| @@ -16,2553 +16,2553 @@ | ||
| 16 | 16 | */ | 
| 17 | 17 | class Transactions_Admin_Page extends EE_Admin_Page | 
| 18 | 18 |  { | 
| 19 | - /** | |
| 20 | - * @var EE_Transaction | |
| 21 | - */ | |
| 22 | - private $_transaction; | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * @var EE_Session | |
| 26 | - */ | |
| 27 | - private $_session; | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * @var array $_txn_status | |
| 31 | - */ | |
| 32 | - private static $_txn_status; | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * @var array $_pay_status | |
| 36 | - */ | |
| 37 | - private static $_pay_status; | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * @var array $_existing_reg_payment_REG_IDs | |
| 41 | - */ | |
| 42 | - protected $_existing_reg_payment_REG_IDs; | |
| 43 | - | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * _init_page_props | |
| 47 | - * | |
| 48 | - * @return void | |
| 49 | - */ | |
| 50 | - protected function _init_page_props() | |
| 51 | -    { | |
| 52 | - $this->page_slug = TXN_PG_SLUG; | |
| 53 | -        $this->page_label       = esc_html__('Transactions', 'event_espresso'); | |
| 54 | - $this->_admin_base_url = TXN_ADMIN_URL; | |
| 55 | - $this->_admin_base_path = TXN_ADMIN; | |
| 56 | - } | |
| 57 | - | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * _ajax_hooks | |
| 61 | - * | |
| 62 | - * @return void | |
| 63 | - */ | |
| 64 | - protected function _ajax_hooks() | |
| 65 | -    { | |
| 66 | - } | |
| 67 | - | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * _define_page_props | |
| 71 | - * | |
| 72 | - * @return void | |
| 73 | - */ | |
| 74 | - protected function _define_page_props() | |
| 75 | -    { | |
| 76 | - $this->_admin_page_title = $this->page_label; | |
| 77 | - $this->_labels = [ | |
| 78 | - 'buttons' => [ | |
| 79 | -                'add'    => esc_html__('Add New Transaction', 'event_espresso'), | |
| 80 | -                'edit'   => esc_html__('Edit Transaction', 'event_espresso'), | |
| 81 | -                'delete' => esc_html__('Delete Transaction', 'event_espresso'), | |
| 82 | - ], | |
| 83 | - ]; | |
| 84 | - } | |
| 85 | - | |
| 86 | - | |
| 87 | - /** | |
| 88 | - * grab url requests and route them | |
| 89 | - * | |
| 90 | - * @access private | |
| 91 | - * @return void | |
| 92 | - * @throws EE_Error | |
| 93 | - * @throws InvalidArgumentException | |
| 94 | - * @throws InvalidDataTypeException | |
| 95 | - * @throws InvalidInterfaceException | |
| 96 | - * @throws ReflectionException | |
| 97 | - */ | |
| 98 | - public function _set_page_routes() | |
| 99 | -    { | |
| 100 | - $this->_set_transaction_status_array(); | |
| 101 | -        $TXN_ID = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 102 | - | |
| 103 | - $this->_page_routes = [ | |
| 104 | - | |
| 105 | - 'default' => [ | |
| 106 | - 'func' => [$this, '_transactions_overview_list_table'], | |
| 107 | - 'capability' => 'ee_read_transactions', | |
| 108 | - ], | |
| 109 | - | |
| 110 | - 'view_transaction' => [ | |
| 111 | - 'func' => [$this, '_transaction_details'], | |
| 112 | - 'capability' => 'ee_read_transaction', | |
| 113 | - 'obj_id' => $TXN_ID, | |
| 114 | - ], | |
| 115 | - | |
| 116 | - 'send_payment_reminder' => [ | |
| 117 | - 'func' => [$this, '_send_payment_reminder'], | |
| 118 | - 'noheader' => true, | |
| 119 | - 'capability' => 'ee_send_message', | |
| 120 | - ], | |
| 121 | - | |
| 122 | - 'espresso_apply_payment' => [ | |
| 123 | - 'func' => [$this, 'apply_payments_or_refunds'], | |
| 124 | - 'noheader' => true, | |
| 125 | - 'capability' => 'ee_edit_payments', | |
| 126 | - ], | |
| 127 | - | |
| 128 | - 'espresso_apply_refund' => [ | |
| 129 | - 'func' => [$this, 'apply_payments_or_refunds'], | |
| 130 | - 'noheader' => true, | |
| 131 | - 'capability' => 'ee_edit_payments', | |
| 132 | - ], | |
| 133 | - | |
| 134 | - 'espresso_delete_payment' => [ | |
| 135 | - 'func' => [$this, 'delete_payment'], | |
| 136 | - 'noheader' => true, | |
| 137 | - 'capability' => 'ee_delete_payments', | |
| 138 | - ], | |
| 139 | - | |
| 140 | - 'espresso_recalculate_line_items' => [ | |
| 141 | - 'func' => [$this, 'recalculateLineItems'], | |
| 142 | - 'noheader' => true, | |
| 143 | - 'capability' => 'ee_edit_payments', | |
| 144 | - ], | |
| 145 | - | |
| 146 | - ]; | |
| 147 | - } | |
| 148 | - | |
| 149 | - | |
| 150 | - protected function _set_page_config() | |
| 151 | -    { | |
| 152 | -        $TXN_ID             = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 153 | - $this->_page_config = [ | |
| 154 | - 'default' => [ | |
| 155 | - 'nav' => [ | |
| 156 | -                    'label' => esc_html__('Overview', 'event_espresso'), | |
| 157 | - 'icon' => 'dashicons-list-view', | |
| 158 | - 'order' => 10, | |
| 159 | - ], | |
| 160 | - 'list_table' => 'EE_Admin_Transactions_List_Table', | |
| 161 | - 'help_tabs' => [ | |
| 162 | - 'transactions_overview_help_tab' => [ | |
| 163 | -                        'title'    => esc_html__('Transactions Overview', 'event_espresso'), | |
| 164 | - 'filename' => 'transactions_overview', | |
| 165 | - ], | |
| 166 | - 'transactions_overview_table_column_headings_help_tab' => [ | |
| 167 | -                        'title'    => esc_html__('Transactions Table Column Headings', 'event_espresso'), | |
| 168 | - 'filename' => 'transactions_overview_table_column_headings', | |
| 169 | - ], | |
| 170 | - 'transactions_overview_views_filters_help_tab' => [ | |
| 171 | -                        'title'    => esc_html__('Transaction Views & Filters & Search', 'event_espresso'), | |
| 172 | - 'filename' => 'transactions_overview_views_filters_search', | |
| 173 | - ], | |
| 174 | - ], | |
| 175 | - 'require_nonce' => false, | |
| 176 | - ], | |
| 177 | - 'view_transaction' => [ | |
| 178 | - 'nav' => [ | |
| 179 | -                    'label'      => esc_html__('View Transaction', 'event_espresso'), | |
| 180 | - 'icon' => 'dashicons-cart', | |
| 181 | - 'order' => 5, | |
| 182 | - 'url' => $TXN_ID | |
| 183 | - ? add_query_arg(['TXN_ID' => $TXN_ID], $this->_current_page_view_url) | |
| 184 | - : $this->_admin_base_url, | |
| 185 | - 'persistent' => false, | |
| 186 | - ], | |
| 187 | - 'help_tabs' => [ | |
| 188 | - 'transactions_view_transaction_help_tab' => [ | |
| 189 | -                        'title'    => esc_html__('View Transaction', 'event_espresso'), | |
| 190 | - 'filename' => 'transactions_view_transaction', | |
| 191 | - ], | |
| 192 | - 'transactions_view_transaction_transaction_details_table_help_tab' => [ | |
| 193 | -                        'title'    => esc_html__('Transaction Details Table', 'event_espresso'), | |
| 194 | - 'filename' => 'transactions_view_transaction_transaction_details_table', | |
| 195 | - ], | |
| 196 | - 'transactions_view_transaction_attendees_registered_help_tab' => [ | |
| 197 | -                        'title'    => esc_html__('Attendees Registered', 'event_espresso'), | |
| 198 | - 'filename' => 'transactions_view_transaction_attendees_registered', | |
| 199 | - ], | |
| 200 | - 'transactions_view_transaction_views_primary_registrant_billing_information_help_tab' => [ | |
| 201 | -                        'title'    => esc_html__('Primary Registrant & Billing Information', 'event_espresso'), | |
| 202 | - 'filename' => 'transactions_view_transaction_primary_registrant_billing_information', | |
| 203 | - ], | |
| 204 | - ], | |
| 205 | - 'qtips' => ['Transaction_Details_Tips'], | |
| 206 | - 'metaboxes' => ['_transaction_details_metaboxes'], | |
| 207 | - | |
| 208 | - 'require_nonce' => false, | |
| 209 | - ], | |
| 210 | - ]; | |
| 211 | - } | |
| 212 | - | |
| 213 | - | |
| 214 | - /** | |
| 215 | - * The below methods aren't used by this class currently | |
| 216 | - */ | |
| 217 | - protected function _add_screen_options() | |
| 218 | -    { | |
| 219 | - // noop | |
| 220 | - } | |
| 221 | - | |
| 222 | - | |
| 223 | - protected function _add_feature_pointers() | |
| 224 | -    { | |
| 225 | - // noop | |
| 226 | - } | |
| 227 | - | |
| 228 | - | |
| 229 | - public function admin_init() | |
| 230 | -    { | |
| 231 | -        $EVT_ID        = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 232 | -        $event_name    = $this->request->getRequestParam('event_name'); | |
| 233 | -        $redirect_from = $this->request->getRequestParam('redirect_from', '', 'url'); | |
| 234 | - // IF a registration was JUST added via the admin... | |
| 235 | -        if ($EVT_ID && $event_name && $redirect_from) { | |
| 236 | - // then set a cookie so that we can block any attempts to use | |
| 237 | - // the back button as a way to enter another registration. | |
| 238 | -            setcookie('ee_registration_added', $EVT_ID, time() + WEEK_IN_SECONDS, '/'); | |
| 239 | - // and update the global | |
| 240 | - $_COOKIE['ee_registration_added'] = $EVT_ID; | |
| 241 | - } | |
| 242 | - EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__( | |
| 243 | - 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', | |
| 244 | - 'event_espresso' | |
| 245 | - ); | |
| 246 | - EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__( | |
| 247 | - 'An error occurred! Please refresh the page and try again.', | |
| 248 | - 'event_espresso' | |
| 249 | - ); | |
| 250 | - EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; | |
| 251 | - EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; | |
| 252 | -        EE_Registry::$i18n_js_strings['payments_total']          = esc_html__('Payments Total', 'event_espresso'); | |
| 253 | - EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__( | |
| 254 | - 'This transaction has been overpaid ! Payments Total', | |
| 255 | - 'event_espresso' | |
| 256 | - ); | |
| 257 | - } | |
| 258 | - | |
| 259 | - | |
| 260 | - public function admin_notices() | |
| 261 | -    { | |
| 262 | - // noop | |
| 263 | - } | |
| 264 | - | |
| 265 | - | |
| 266 | - public function admin_footer_scripts() | |
| 267 | -    { | |
| 268 | - // noop | |
| 269 | - } | |
| 270 | - | |
| 271 | - | |
| 272 | - /** | |
| 273 | - * _set_transaction_status_array | |
| 274 | - * sets list of transaction statuses | |
| 275 | - * | |
| 276 | - * @access private | |
| 277 | - * @return void | |
| 278 | - * @throws EE_Error | |
| 279 | - * @throws InvalidArgumentException | |
| 280 | - * @throws InvalidDataTypeException | |
| 281 | - * @throws InvalidInterfaceException | |
| 282 | - * @throws ReflectionException | |
| 283 | - */ | |
| 284 | - private function _set_transaction_status_array() | |
| 285 | -    { | |
| 286 | - self::$_txn_status = EEM_Transaction::instance()->status_array(true); | |
| 287 | - } | |
| 288 | - | |
| 289 | - | |
| 290 | - /** | |
| 291 | - * get_transaction_status_array | |
| 292 | - * return the transaction status array for wp_list_table | |
| 293 | - * | |
| 294 | - * @access public | |
| 295 | - * @return array | |
| 296 | - */ | |
| 297 | - public function get_transaction_status_array() | |
| 298 | -    { | |
| 299 | - return self::$_txn_status; | |
| 300 | - } | |
| 301 | - | |
| 302 | - | |
| 303 | - /** | |
| 304 | - * get list of payment statuses | |
| 305 | - * | |
| 306 | - * @access private | |
| 307 | - * @return void | |
| 308 | - * @throws EE_Error | |
| 309 | - * @throws InvalidArgumentException | |
| 310 | - * @throws InvalidDataTypeException | |
| 311 | - * @throws InvalidInterfaceException | |
| 312 | - * @throws ReflectionException | |
| 313 | - */ | |
| 314 | - private function _get_payment_status_array() | |
| 315 | -    { | |
| 316 | - self::$_pay_status = EEM_Payment::instance()->status_array(true); | |
| 317 | - $this->_template_args['payment_status'] = self::$_pay_status; | |
| 318 | - } | |
| 319 | - | |
| 320 | - | |
| 321 | - /** | |
| 322 | - * _add_screen_options_default | |
| 323 | - * | |
| 324 | - * @access protected | |
| 325 | - * @return void | |
| 326 | - * @throws InvalidArgumentException | |
| 327 | - * @throws InvalidDataTypeException | |
| 328 | - * @throws InvalidInterfaceException | |
| 329 | - */ | |
| 330 | - protected function _add_screen_options_default() | |
| 331 | -    { | |
| 332 | - $this->_per_page_screen_option(); | |
| 333 | - } | |
| 334 | - | |
| 335 | - | |
| 336 | - /** | |
| 337 | - * load_scripts_styles | |
| 338 | - * | |
| 339 | - * @access public | |
| 340 | - * @return void | |
| 341 | - */ | |
| 342 | - public function load_scripts_styles() | |
| 343 | -    { | |
| 344 | - // enqueue style | |
| 345 | - wp_register_style( | |
| 346 | - 'espresso_txn', | |
| 347 | - TXN_ASSETS_URL . 'espresso_transactions_admin.css', | |
| 348 | - [], | |
| 349 | - EVENT_ESPRESSO_VERSION | |
| 350 | - ); | |
| 351 | -        wp_enqueue_style('espresso_txn'); | |
| 352 | - // scripts | |
| 353 | - wp_register_script( | |
| 354 | - 'espresso_txn', | |
| 355 | - TXN_ASSETS_URL . 'espresso_transactions_admin.js', | |
| 356 | - [ | |
| 357 | - 'ee_admin_js', | |
| 358 | - 'ee-datepicker', | |
| 359 | - 'jquery-ui-datepicker', | |
| 360 | - 'jquery-ui-draggable', | |
| 361 | - 'ee-dialog', | |
| 362 | - 'ee-accounting', | |
| 363 | - 'ee-serialize-full-array', | |
| 364 | - ], | |
| 365 | - EVENT_ESPRESSO_VERSION, | |
| 366 | - true | |
| 367 | - ); | |
| 368 | -        wp_enqueue_script('espresso_txn'); | |
| 369 | - } | |
| 370 | - | |
| 371 | - | |
| 372 | - /** | |
| 373 | - * load_scripts_styles_view_transaction | |
| 374 | - * | |
| 375 | - * @access public | |
| 376 | - * @return void | |
| 377 | - */ | |
| 378 | - public function load_scripts_styles_view_transaction() | |
| 379 | -    { | |
| 380 | - // styles | |
| 381 | -        wp_enqueue_style('espresso-ui-theme'); | |
| 382 | - } | |
| 383 | - | |
| 384 | - | |
| 385 | - /** | |
| 386 | - * load_scripts_styles_default | |
| 387 | - * | |
| 388 | - * @access public | |
| 389 | - * @return void | |
| 390 | - */ | |
| 391 | - public function load_scripts_styles_default() | |
| 392 | -    { | |
| 393 | - // styles | |
| 394 | -        wp_enqueue_style('espresso-ui-theme'); | |
| 395 | - } | |
| 396 | - | |
| 397 | - | |
| 398 | - /** | |
| 399 | - * _set_list_table_views_default | |
| 400 | - * | |
| 401 | - * @access protected | |
| 402 | - * @return void | |
| 403 | - */ | |
| 404 | - protected function _set_list_table_views_default() | |
| 405 | -    { | |
| 406 | - $this->_views = [ | |
| 407 | - 'all' => [ | |
| 408 | - 'slug' => 'all', | |
| 409 | -                'label' => esc_html__('View All Transactions', 'event_espresso'), | |
| 410 | - 'count' => 0, | |
| 411 | - ], | |
| 412 | - 'abandoned' => [ | |
| 413 | - 'slug' => 'abandoned', | |
| 414 | -                'label' => esc_html__('Abandoned Transactions', 'event_espresso'), | |
| 415 | - 'count' => 0, | |
| 416 | - ], | |
| 417 | - 'incomplete' => [ | |
| 418 | - 'slug' => 'incomplete', | |
| 419 | -                'label' => esc_html__('Incomplete Transactions', 'event_espresso'), | |
| 420 | - 'count' => 0, | |
| 421 | - ], | |
| 422 | - ]; | |
| 423 | - if ( | |
| 424 | - /** | |
| 425 | - * Filters whether a link to the "Failed Transactions" list table | |
| 426 | - * appears on the Transactions Admin Page list table. | |
| 427 | - * List display can be turned back on via the following: | |
| 428 | - * add_filter( | |
| 429 | - * 'FHEE__Transactions_Admin_Page___set_list_table_views_default__display_failed_txns_list', | |
| 430 | - * '__return_true' | |
| 431 | - * ); | |
| 432 | - * | |
| 433 | - * @param boolean $display_failed_txns_list | |
| 434 | - * @param Transactions_Admin_Page $this | |
| 435 | - * @since 4.9.70.p | |
| 436 | - */ | |
| 437 | - apply_filters( | |
| 438 | - 'FHEE__Transactions_Admin_Page___set_list_table_views_default__display_failed_txns_list', | |
| 439 | - false, | |
| 440 | - $this | |
| 441 | - ) | |
| 442 | -        ) { | |
| 443 | - $this->_views['failed'] = [ | |
| 444 | - 'slug' => 'failed', | |
| 445 | -                'label' => esc_html__('Failed Transactions', 'event_espresso'), | |
| 446 | - 'count' => 0, | |
| 447 | - ]; | |
| 448 | - } | |
| 449 | - } | |
| 450 | - | |
| 451 | - | |
| 452 | - /** | |
| 453 | - * _set_transaction_object | |
| 454 | - * This sets the _transaction property for the transaction details screen | |
| 455 | - * | |
| 456 | - * @access private | |
| 457 | - * @return void | |
| 458 | - * @throws EE_Error | |
| 459 | - * @throws InvalidArgumentException | |
| 460 | - * @throws RuntimeException | |
| 461 | - * @throws InvalidDataTypeException | |
| 462 | - * @throws InvalidInterfaceException | |
| 463 | - * @throws ReflectionException | |
| 464 | - */ | |
| 465 | - private function _set_transaction_object() | |
| 466 | -    { | |
| 467 | -        if ($this->_transaction instanceof EE_Transaction) { | |
| 468 | - return; | |
| 469 | - } //get out we've already set the object | |
| 470 | - | |
| 471 | -        $TXN_ID = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 472 | - | |
| 473 | - // get transaction object | |
| 474 | - $this->_transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); | |
| 475 | - $this->_session = $this->_transaction instanceof EE_Transaction | |
| 476 | - ? $this->_transaction->session_data() | |
| 477 | - : null; | |
| 478 | -        if ($this->_transaction instanceof EE_Transaction) { | |
| 479 | - $this->_transaction->verify_abandoned_transaction_status(); | |
| 480 | - } | |
| 481 | - | |
| 482 | -        if (! $this->_transaction instanceof EE_Transaction) { | |
| 483 | - $error_msg = sprintf( | |
| 484 | - esc_html__( | |
| 485 | - 'An error occurred and the details for the transaction with the ID # %d could not be retrieved.', | |
| 486 | - 'event_espresso' | |
| 487 | - ), | |
| 488 | - $TXN_ID | |
| 489 | - ); | |
| 490 | - EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); | |
| 491 | - } | |
| 492 | - } | |
| 493 | - | |
| 494 | - | |
| 495 | - /** | |
| 496 | - * _transaction_legend_items | |
| 497 | - * | |
| 498 | - * @access protected | |
| 499 | - * @return array | |
| 500 | - * @throws EE_Error | |
| 501 | - * @throws InvalidArgumentException | |
| 502 | - * @throws ReflectionException | |
| 503 | - * @throws InvalidDataTypeException | |
| 504 | - * @throws InvalidInterfaceException | |
| 505 | - */ | |
| 506 | - protected function _transaction_legend_items() | |
| 507 | -    { | |
| 508 | -        EE_Registry::instance()->load_helper('MSG_Template'); | |
| 509 | - $items = []; | |
| 510 | - | |
| 511 | - if ( | |
| 512 | - $this->capabilities->current_user_can( | |
| 513 | - 'ee_read_global_messages', | |
| 514 | - 'view_filtered_messages' | |
| 515 | - ) | |
| 516 | -        ) { | |
| 517 | -            $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); | |
| 518 | - if ( | |
| 519 | - is_array($related_for_icon) | |
| 520 | - && isset($related_for_icon['css_class'], $related_for_icon['label']) | |
| 521 | -            ) { | |
| 522 | - $items['view_related_messages'] = [ | |
| 523 | - 'class' => $related_for_icon['css_class'], | |
| 524 | - 'desc' => $related_for_icon['label'], | |
| 525 | - ]; | |
| 526 | - } | |
| 527 | - } | |
| 528 | - | |
| 529 | - $items = apply_filters( | |
| 530 | - 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', | |
| 531 | - array_merge( | |
| 532 | - $items, | |
| 533 | - [ | |
| 534 | - 'view_details' => [ | |
| 535 | - 'class' => 'dashicons dashicons-cart', | |
| 536 | -                        'desc'  => esc_html__('View Transaction Details', 'event_espresso'), | |
| 537 | - ], | |
| 538 | - 'view_invoice' => [ | |
| 539 | - 'class' => 'dashicons dashicons-media-spreadsheet', | |
| 540 | -                        'desc'  => esc_html__('View Transaction Invoice', 'event_espresso'), | |
| 541 | - ], | |
| 542 | - 'view_receipt' => [ | |
| 543 | - 'class' => 'dashicons dashicons-text-page', | |
| 544 | -                        'desc'  => esc_html__('View Transaction Receipt', 'event_espresso'), | |
| 545 | - ], | |
| 546 | - 'view_registration' => [ | |
| 547 | - 'class' => 'dashicons dashicons-clipboard', | |
| 548 | -                        'desc'  => esc_html__('View Registration Details', 'event_espresso'), | |
| 549 | - ], | |
| 550 | - 'payment_overview_link' => [ | |
| 551 | - 'class' => 'dashicons dashicons-money', | |
| 552 | -                        'desc'  => esc_html__('Make Payment on Frontend', 'event_espresso'), | |
| 553 | - ], | |
| 554 | - ] | |
| 555 | - ) | |
| 556 | - ); | |
| 557 | - | |
| 558 | - if ( | |
| 559 | -            EEH_MSG_Template::is_mt_active('payment_reminder') | |
| 560 | - && $this->capabilities->current_user_can( | |
| 561 | - 'ee_send_message', | |
| 562 | - 'espresso_transactions_send_payment_reminder' | |
| 563 | - ) | |
| 564 | -        ) { | |
| 565 | - $items['send_payment_reminder'] = [ | |
| 566 | - 'class' => 'dashicons dashicons-email-alt', | |
| 567 | -                'desc'  => esc_html__('Send Payment Reminder', 'event_espresso'), | |
| 568 | - ]; | |
| 569 | -        } else { | |
| 570 | - $items['blank*'] = [ | |
| 571 | - 'class' => '', | |
| 572 | - 'desc' => '', | |
| 573 | - ]; | |
| 574 | - } | |
| 575 | - $more_items = apply_filters( | |
| 576 | - 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', | |
| 577 | - [ | |
| 578 | - 'overpaid' => [ | |
| 579 | - 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::overpaid_status_code, | |
| 580 | - 'desc' => EEH_Template::pretty_status( | |
| 581 | - EEM_Transaction::overpaid_status_code, | |
| 582 | - false, | |
| 583 | - 'sentence' | |
| 584 | - ), | |
| 585 | - ], | |
| 586 | - 'complete' => [ | |
| 587 | - 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::complete_status_code, | |
| 588 | - 'desc' => EEH_Template::pretty_status( | |
| 589 | - EEM_Transaction::complete_status_code, | |
| 590 | - false, | |
| 591 | - 'sentence' | |
| 592 | - ), | |
| 593 | - ], | |
| 594 | - 'incomplete' => [ | |
| 595 | - 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::incomplete_status_code, | |
| 596 | - 'desc' => EEH_Template::pretty_status( | |
| 597 | - EEM_Transaction::incomplete_status_code, | |
| 598 | - false, | |
| 599 | - 'sentence' | |
| 600 | - ), | |
| 601 | - ], | |
| 602 | - 'abandoned' => [ | |
| 603 | - 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::abandoned_status_code, | |
| 604 | - 'desc' => EEH_Template::pretty_status( | |
| 605 | - EEM_Transaction::abandoned_status_code, | |
| 606 | - false, | |
| 607 | - 'sentence' | |
| 608 | - ), | |
| 609 | - ], | |
| 610 | - 'failed' => [ | |
| 611 | - 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::failed_status_code, | |
| 612 | - 'desc' => EEH_Template::pretty_status( | |
| 613 | - EEM_Transaction::failed_status_code, | |
| 614 | - false, | |
| 615 | - 'sentence' | |
| 616 | - ), | |
| 617 | - ], | |
| 618 | - ] | |
| 619 | - ); | |
| 620 | - | |
| 621 | - return array_merge($items, $more_items); | |
| 622 | - } | |
| 623 | - | |
| 624 | - | |
| 625 | - /** | |
| 626 | - * _transactions_overview_list_table | |
| 627 | - * | |
| 628 | - * @access protected | |
| 629 | - * @return void | |
| 630 | - * @throws DomainException | |
| 631 | - * @throws EE_Error | |
| 632 | - * @throws InvalidArgumentException | |
| 633 | - * @throws InvalidDataTypeException | |
| 634 | - * @throws InvalidInterfaceException | |
| 635 | - * @throws ReflectionException | |
| 636 | - */ | |
| 637 | - protected function _transactions_overview_list_table() | |
| 638 | -    { | |
| 639 | -        $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); | |
| 640 | - | |
| 641 | -        $EVT_ID                                    = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 642 | - $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); | |
| 643 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event | |
| 644 | - ? sprintf( | |
| 645 | -                esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), | |
| 646 | - '<h3>', | |
| 647 | - '<a href="' | |
| 648 | - . EE_Admin_Page::add_query_args_and_nonce( | |
| 649 | - ['action' => 'edit', 'post' => $event->ID()], | |
| 650 | - EVENTS_ADMIN_URL | |
| 651 | - ) | |
| 652 | - . '" aria-label="' | |
| 653 | -                . esc_attr__('Click to Edit event', 'event_espresso') | |
| 654 | - . '">' . $event->name() . '</a>', | |
| 655 | - '</h3>' | |
| 656 | - ) | |
| 657 | - : ''; | |
| 658 | - $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); | |
| 659 | - $this->display_admin_list_table_page_with_no_sidebar(); | |
| 660 | - } | |
| 661 | - | |
| 662 | - | |
| 663 | - /** | |
| 664 | - * _transaction_details | |
| 665 | - * generates HTML for the View Transaction Details Admin page | |
| 666 | - * | |
| 667 | - * @access protected | |
| 668 | - * @return void | |
| 669 | - * @throws DomainException | |
| 670 | - * @throws EE_Error | |
| 671 | - * @throws InvalidArgumentException | |
| 672 | - * @throws InvalidDataTypeException | |
| 673 | - * @throws InvalidInterfaceException | |
| 674 | - * @throws RuntimeException | |
| 675 | - * @throws ReflectionException | |
| 676 | - */ | |
| 677 | - protected function _transaction_details() | |
| 678 | -    { | |
| 679 | -        do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); | |
| 680 | - | |
| 681 | - $this->_set_transaction_status_array(); | |
| 682 | - | |
| 683 | - $this->_template_args = []; | |
| 684 | - $this->_template_args['transactions_page'] = $this->_wp_page_slug; | |
| 685 | - | |
| 686 | - $this->_set_transaction_object(); | |
| 687 | - | |
| 688 | -        if (! $this->_transaction instanceof EE_Transaction) { | |
| 689 | - return; | |
| 690 | - } | |
| 691 | - | |
| 692 | - $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); | |
| 693 | -        $this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso'); | |
| 694 | - | |
| 695 | -        $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); | |
| 696 | -        $this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso'); | |
| 697 | - | |
| 698 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->status_ID() ]; | |
| 699 | -        $this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso'); | |
| 700 | - $this->_template_args['txn_status']['class'] = $this->_transaction->status_ID(); | |
| 701 | - | |
| 702 | - $txn_total = $this->_transaction->total(); | |
| 703 | - $total_paid = $this->_transaction->paid(); | |
| 704 | - $amount_due = $txn_total - $total_paid; | |
| 705 | - | |
| 706 | - $this->_template_args['grand_total'] = $txn_total; | |
| 707 | - $this->_template_args['total_paid'] = $total_paid; | |
| 708 | - | |
| 709 | - $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, false, false); | |
| 710 | - $this->_template_args['amount_due_raw'] = $amount_due; | |
| 711 | - | |
| 712 | - $this->_template_args['amount_due_class'] = ''; | |
| 713 | - | |
| 714 | -        if ($txn_total === (float) 0) { | |
| 715 | - // free event | |
| 716 | - $this->_template_args['amount_due'] = false; | |
| 717 | -        } elseif ($amount_due < (float) 0) { | |
| 718 | - // overpaid | |
| 719 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; | |
| 720 | -        } elseif ($amount_due > (float) 0) { | |
| 721 | - // monies owing | |
| 722 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn ee-txn-amount-owing'; | |
| 723 | -        } elseif ($total_paid === (float) 0) { | |
| 724 | - // no payments made yet | |
| 725 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; | |
| 726 | - } | |
| 727 | - | |
| 728 | - $payment_method = $this->_transaction->payment_method(); | |
| 729 | - | |
| 730 | - $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method | |
| 731 | - ? $payment_method->admin_name() | |
| 732 | -            : esc_html__('Unknown', 'event_espresso'); | |
| 733 | - | |
| 734 | - $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; | |
| 735 | - // link back to overview | |
| 736 | - $this->_template_args['txn_overview_url'] = $this->request->getServerParam( | |
| 737 | - 'HTTP_REFERER', | |
| 738 | - TXN_ADMIN_URL | |
| 739 | - ); | |
| 740 | - | |
| 741 | - | |
| 742 | - // next link | |
| 743 | - $next_txn = $this->_transaction->next( | |
| 744 | - null, | |
| 745 | - [['STS_ID' => ['!=', EEM_Transaction::failed_status_code]]], | |
| 746 | - 'TXN_ID' | |
| 747 | - ); | |
| 748 | - $this->_template_args['next_transaction'] = $next_txn | |
| 749 | - ? $this->_next_link( | |
| 750 | - EE_Admin_Page::add_query_args_and_nonce( | |
| 751 | - ['action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']], | |
| 752 | - TXN_ADMIN_URL | |
| 753 | - ), | |
| 754 | - 'dashicons dashicons-arrow-right ee-icon-size-22' | |
| 755 | - ) | |
| 756 | - : ''; | |
| 757 | - // previous link | |
| 758 | - $previous_txn = $this->_transaction->previous( | |
| 759 | - null, | |
| 760 | - [['STS_ID' => ['!=', EEM_Transaction::failed_status_code]]], | |
| 761 | - 'TXN_ID' | |
| 762 | - ); | |
| 763 | - $this->_template_args['previous_transaction'] = $previous_txn | |
| 764 | - ? $this->_previous_link( | |
| 765 | - EE_Admin_Page::add_query_args_and_nonce( | |
| 766 | - ['action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']], | |
| 767 | - TXN_ADMIN_URL | |
| 768 | - ), | |
| 769 | - 'dashicons dashicons-arrow-left ee-icon-size-22' | |
| 770 | - ) | |
| 771 | - : ''; | |
| 772 | - | |
| 773 | -        $EVT_ID        = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 774 | -        $event_name    = $this->request->getRequestParam('event_name'); | |
| 775 | -        $redirect_from = $this->request->getRequestParam('redirect_from', '', 'url'); | |
| 776 | - | |
| 777 | - // were we just redirected here after adding a new registration ??? | |
| 778 | -        if ($EVT_ID && $event_name && $redirect_from) { | |
| 779 | - if ( | |
| 780 | - $this->capabilities->current_user_can( | |
| 781 | - 'ee_edit_registrations', | |
| 782 | - 'espresso_registrations_new_registration', | |
| 783 | - $EVT_ID | |
| 784 | - ) | |
| 785 | -            ) { | |
| 786 | - $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button--primary" href="'; | |
| 787 | - $this->_admin_page_title .= EE_Admin_Page::add_query_args_and_nonce( | |
| 788 | - [ | |
| 789 | - 'page' => 'espresso_registrations', | |
| 790 | - 'action' => 'new_registration', | |
| 791 | - 'return' => 'default', | |
| 792 | - 'TXN_ID' => $this->_transaction->ID(), | |
| 793 | - 'event_id' => $EVT_ID, | |
| 794 | - ], | |
| 795 | - REG_ADMIN_URL | |
| 796 | - ); | |
| 797 | - $this->_admin_page_title .= '">'; | |
| 798 | - | |
| 799 | - $this->_admin_page_title .= sprintf( | |
| 800 | -                    esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'), | |
| 801 | - htmlentities(urldecode($event_name), ENT_QUOTES, 'UTF-8') | |
| 802 | - ); | |
| 803 | - $this->_admin_page_title .= '</a>'; | |
| 804 | - } | |
| 805 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); | |
| 806 | - } | |
| 807 | - // grab messages at the last second | |
| 808 | - $this->_template_args['notices'] = EE_Error::get_notices(); | |
| 809 | - // path to template | |
| 810 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; | |
| 811 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( | |
| 812 | - $template_path, | |
| 813 | - $this->_template_args, | |
| 814 | - true | |
| 815 | - ); | |
| 816 | - | |
| 817 | - // the details template wrapper | |
| 818 | - $this->display_admin_page_with_sidebar(); | |
| 819 | - } | |
| 820 | - | |
| 821 | - | |
| 822 | - /** | |
| 823 | - * _transaction_details_metaboxes | |
| 824 | - * | |
| 825 | - * @access protected | |
| 826 | - * @return void | |
| 827 | - * @throws EE_Error | |
| 828 | - * @throws InvalidArgumentException | |
| 829 | - * @throws InvalidDataTypeException | |
| 830 | - * @throws InvalidInterfaceException | |
| 831 | - * @throws RuntimeException | |
| 832 | - * @throws ReflectionException | |
| 833 | - */ | |
| 834 | - protected function _transaction_details_metaboxes() | |
| 835 | -    { | |
| 836 | - $this->_set_transaction_object(); | |
| 837 | - | |
| 838 | -        if (! $this->_transaction instanceof EE_Transaction) { | |
| 839 | - return; | |
| 840 | - } | |
| 841 | - $this->addMetaBox( | |
| 842 | - 'edit-txn-details-mbox', | |
| 843 | -            '<span>' . esc_html__('Transaction Details', 'event_espresso') | |
| 844 | - . ' <span class="dashicons dashicons-cart" ></span></span>', | |
| 845 | - [$this, 'txn_details_meta_box'], | |
| 846 | - $this->_wp_page_slug | |
| 847 | - ); | |
| 848 | - $this->addMetaBox( | |
| 849 | - 'edit-txn-attendees-mbox', | |
| 850 | -            '<span>' . esc_html__('Attendees Registered in this Transaction', 'event_espresso') | |
| 851 | - . ' <span class="dashicons dashicons-groups" ></span></span>', | |
| 852 | - [$this, 'txn_attendees_meta_box'], | |
| 853 | - $this->_wp_page_slug, | |
| 854 | - 'normal', | |
| 855 | - 'high', | |
| 856 | - ['TXN_ID' => $this->_transaction->ID()] | |
| 857 | - ); | |
| 858 | - $this->addMetaBox( | |
| 859 | - 'edit-txn-registrant-mbox', | |
| 860 | -            esc_html__('Primary Contact', 'event_espresso'), | |
| 861 | - [$this, 'txn_registrant_side_meta_box'], | |
| 862 | - $this->_wp_page_slug, | |
| 863 | - 'side' | |
| 864 | - ); | |
| 865 | - $this->addMetaBox( | |
| 866 | - 'edit-txn-billing-info-mbox', | |
| 867 | -            esc_html__('Billing Information', 'event_espresso'), | |
| 868 | - [$this, 'txn_billing_info_side_meta_box'], | |
| 869 | - $this->_wp_page_slug, | |
| 870 | - 'side' | |
| 871 | - ); | |
| 872 | - } | |
| 873 | - | |
| 874 | - | |
| 875 | - /** | |
| 876 | - * Callback for transaction actions metabox. | |
| 877 | - * | |
| 878 | - * @param EE_Transaction|null $transaction | |
| 879 | - * @return string | |
| 880 | - * @throws DomainException | |
| 881 | - * @throws EE_Error | |
| 882 | - * @throws InvalidArgumentException | |
| 883 | - * @throws InvalidDataTypeException | |
| 884 | - * @throws InvalidInterfaceException | |
| 885 | - * @throws ReflectionException | |
| 886 | - * @throws RuntimeException | |
| 887 | - */ | |
| 888 | - public function getActionButtons(EE_Transaction $transaction = null) | |
| 889 | -    { | |
| 890 | - $content = ''; | |
| 891 | - $actions = []; | |
| 892 | -        if (! $transaction instanceof EE_Transaction) { | |
| 893 | - return $content; | |
| 894 | - } | |
| 895 | - /** @var EE_Registration $primary_registration */ | |
| 896 | - $primary_registration = $transaction->primary_registration(); | |
| 897 | - $attendee = $primary_registration instanceof EE_Registration | |
| 898 | - ? $primary_registration->attendee() | |
| 899 | - : null; | |
| 900 | - | |
| 901 | - if ( | |
| 902 | - $attendee instanceof EE_Attendee | |
| 903 | - && $this->capabilities->current_user_can( | |
| 904 | - 'ee_send_message', | |
| 905 | - 'espresso_transactions_send_payment_reminder' | |
| 906 | - ) | |
| 907 | -        ) { | |
| 908 | - $actions['payment_reminder'] = | |
| 909 | -                EEH_MSG_Template::is_mt_active('payment_reminder') | |
| 910 | - && $this->_transaction->status_ID() !== EEM_Transaction::complete_status_code | |
| 911 | - && $this->_transaction->status_ID() !== EEM_Transaction::overpaid_status_code | |
| 912 | - ? EEH_Template::get_button_or_link( | |
| 913 | - EE_Admin_Page::add_query_args_and_nonce( | |
| 914 | - [ | |
| 915 | - 'action' => 'send_payment_reminder', | |
| 916 | - 'TXN_ID' => $this->_transaction->ID(), | |
| 917 | - 'redirect_to' => 'view_transaction', | |
| 918 | - ], | |
| 919 | - TXN_ADMIN_URL | |
| 920 | - ), | |
| 921 | -                        esc_html__(' Send Payment Reminder', 'event_espresso'), | |
| 922 | - 'button button--secondary', | |
| 923 | - 'dashicons dashicons-email-alt' | |
| 924 | - ) | |
| 925 | - : ''; | |
| 926 | - } | |
| 927 | - | |
| 928 | - if ( | |
| 929 | - $this->capabilities->current_user_can( | |
| 930 | - 'ee_edit_payments', | |
| 931 | - 'espresso_transactions_recalculate_line_items' | |
| 932 | - ) | |
| 933 | -        ) { | |
| 934 | - $actions['recalculate_line_items'] = EEH_Template::get_button_or_link( | |
| 935 | - EE_Admin_Page::add_query_args_and_nonce( | |
| 936 | - [ | |
| 937 | - 'action' => 'espresso_recalculate_line_items', | |
| 938 | - 'TXN_ID' => $this->_transaction->ID(), | |
| 939 | - 'redirect_to' => 'view_transaction', | |
| 940 | - ], | |
| 941 | - TXN_ADMIN_URL | |
| 942 | - ), | |
| 943 | -                esc_html__(' Recalculate Taxes and Total', 'event_espresso'), | |
| 944 | - 'button button--secondary', | |
| 945 | - 'dashicons dashicons-update' | |
| 946 | - ); | |
| 947 | - } | |
| 948 | - | |
| 949 | - if ( | |
| 950 | - $primary_registration instanceof EE_Registration | |
| 951 | -            && EEH_MSG_Template::is_mt_active('receipt') | |
| 952 | -        ) { | |
| 953 | - $actions['receipt'] = EEH_Template::get_button_or_link( | |
| 954 | - $primary_registration->receipt_url(), | |
| 955 | -                esc_html__('View Receipt', 'event_espresso'), | |
| 956 | - 'button button--secondary', | |
| 957 | - 'dashicons dashicons-text-page' | |
| 958 | - ); | |
| 959 | - } | |
| 960 | - | |
| 961 | - if ( | |
| 962 | - $primary_registration instanceof EE_Registration | |
| 963 | -            && EEH_MSG_Template::is_mt_active('invoice') | |
| 964 | -        ) { | |
| 965 | - $actions['invoice'] = EEH_Template::get_button_or_link( | |
| 966 | - $primary_registration->invoice_url(), | |
| 967 | -                esc_html__('View Invoice', 'event_espresso'), | |
| 968 | - 'button button--secondary', | |
| 969 | - 'dashicons dashicons-media-spreadsheet' | |
| 970 | - ); | |
| 971 | - } | |
| 972 | - $actions = array_filter( | |
| 973 | -            apply_filters('FHEE__Transactions_Admin_Page__getActionButtons__actions', $actions, $transaction) | |
| 974 | - ); | |
| 975 | -        if ($actions) { | |
| 976 | -            $content .= implode('', $actions); | |
| 977 | - } | |
| 978 | - return $content; | |
| 979 | - } | |
| 980 | - | |
| 981 | - | |
| 982 | - /** | |
| 983 | - * txn_details_meta_box | |
| 984 | - * generates HTML for the Transaction main meta box | |
| 985 | - * | |
| 986 | - * @return void | |
| 987 | - * @throws DomainException | |
| 988 | - * @throws EE_Error | |
| 989 | - * @throws InvalidArgumentException | |
| 990 | - * @throws InvalidDataTypeException | |
| 991 | - * @throws InvalidInterfaceException | |
| 992 | - * @throws RuntimeException | |
| 993 | - * @throws ReflectionException | |
| 994 | - */ | |
| 995 | - public function txn_details_meta_box() | |
| 996 | -    { | |
| 997 | - $this->_set_transaction_object(); | |
| 998 | - $this->_template_args['TXN_ID'] = $this->_transaction->ID(); | |
| 999 | - $this->_template_args['attendee'] = | |
| 1000 | - $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1001 | - ? $this->_transaction->primary_registration()->attendee() | |
| 1002 | - : null; | |
| 1003 | - $this->_template_args['can_edit_payments'] = $this->capabilities->current_user_can( | |
| 1004 | - 'ee_edit_payments', | |
| 1005 | - 'apply_payment_or_refund_from_registration_details' | |
| 1006 | - ); | |
| 1007 | - $this->_template_args['can_delete_payments'] = $this->capabilities->current_user_can( | |
| 1008 | - 'ee_delete_payments', | |
| 1009 | - 'delete_payment_from_registration_details' | |
| 1010 | - ); | |
| 1011 | - | |
| 1012 | - // get line table | |
| 1013 | - EEH_Autoloader::register_line_item_display_autoloaders(); | |
| 1014 | - $Line_Item_Display = new EE_Line_Item_Display( | |
| 1015 | - 'admin_table', | |
| 1016 | - 'EE_Admin_Table_Line_Item_Display_Strategy' | |
| 1017 | - ); | |
| 1018 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( | |
| 1019 | - $this->_transaction->total_line_item() | |
| 1020 | - ); | |
| 1021 | - $this->_template_args['REG_code'] = | |
| 1022 | - $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1023 | - ? $this->_transaction->primary_registration()->reg_code() | |
| 1024 | - : null; | |
| 1025 | - // process taxes | |
| 1026 | - $taxes = $this->_transaction->line_items([['LIN_type' => EEM_Line_Item::type_tax]]); | |
| 1027 | - $this->_template_args['taxes'] = ! empty($taxes) | |
| 1028 | - ? $taxes | |
| 1029 | - : false; | |
| 1030 | - | |
| 1031 | - $this->_template_args['grand_total'] = EEH_Template::format_currency( | |
| 1032 | - $this->_transaction->total(), | |
| 1033 | - false, | |
| 1034 | - false | |
| 1035 | - ); | |
| 1036 | - $this->_template_args['grand_raw_total'] = $this->_transaction->total(); | |
| 1037 | - $this->_template_args['TXN_status'] = $this->_transaction->status_ID(); | |
| 1038 | - | |
| 1039 | - // process payment details | |
| 1040 | - $payments = $this->_transaction->payments(); | |
| 1041 | -        if (! empty($payments)) { | |
| 1042 | - $this->_template_args['payments'] = $payments; | |
| 1043 | - $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); | |
| 1044 | -        } else { | |
| 1045 | - $this->_template_args['payments'] = false; | |
| 1046 | - $this->_template_args['existing_reg_payments'] = []; | |
| 1047 | - } | |
| 1048 | - | |
| 1049 | - $this->_template_args['edit_payment_url'] = add_query_arg(['action' => 'edit_payment'], TXN_ADMIN_URL); | |
| 1050 | - $this->_template_args['delete_payment_url'] = add_query_arg( | |
| 1051 | - ['action' => 'espresso_delete_payment'], | |
| 1052 | - TXN_ADMIN_URL | |
| 1053 | - ); | |
| 1054 | - | |
| 1055 | -        if (isset($txn_details['invoice_number'])) { | |
| 1056 | - $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; | |
| 1057 | - $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( | |
| 1058 | - 'Invoice Number', | |
| 1059 | - 'event_espresso' | |
| 1060 | - ); | |
| 1061 | - } | |
| 1062 | - | |
| 1063 | - $this->_template_args['txn_details']['registration_session']['value'] = | |
| 1064 | - $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1065 | - ? $this->_transaction->primary_registration()->session_ID() | |
| 1066 | - : null; | |
| 1067 | - $this->_template_args['txn_details']['registration_session']['label'] = esc_html__( | |
| 1068 | - 'Registration Session', | |
| 1069 | - 'event_espresso' | |
| 1070 | - ); | |
| 1071 | - | |
| 1072 | - $this->_template_args['txn_details']['ip_address']['value'] = $this->_session['ip_address'] ?? ''; | |
| 1073 | - $this->_template_args['txn_details']['ip_address']['label'] = esc_html__( | |
| 1074 | - 'Transaction placed from IP', | |
| 1075 | - 'event_espresso' | |
| 1076 | - ); | |
| 1077 | - | |
| 1078 | - $this->_template_args['txn_details']['user_agent']['value'] = $this->_session['user_agent'] ?? ''; | |
| 1079 | - $this->_template_args['txn_details']['user_agent']['label'] = esc_html__( | |
| 1080 | - 'Registrant User Agent', | |
| 1081 | - 'event_espresso' | |
| 1082 | - ); | |
| 1083 | - | |
| 1084 | - $reg_steps = '<div class="ee-txn-reg-step-status-steps ee-layout-row">'; | |
| 1085 | -        foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { | |
| 1086 | -            if ($reg_step_status === true) { | |
| 1087 | - $reg_steps .= '<div class="ee-status-pill ee-status-bg--success">' | |
| 1088 | - . sprintf( | |
| 1089 | -                                  esc_html__('%1$s : Completed', 'event_espresso'), | |
| 1090 | -                                  ucwords(str_replace('_', ' ', $reg_step)) | |
| 1091 | - ) | |
| 1092 | - . '</div>'; | |
| 1093 | -            } elseif ($reg_step_status !== false && is_numeric($reg_step_status)) { | |
| 1094 | - $reg_steps .= '<div class="ee-status-pill ee-status-bg--attention">' | |
| 1095 | - . sprintf( | |
| 1096 | -                                  esc_html__('%1$s : Initiated %2$s', 'event_espresso'), | |
| 1097 | -                                  ucwords(str_replace('_', ' ', $reg_step)), | |
| 1098 | - date( | |
| 1099 | -                                      get_option('date_format') . ' ' . get_option('time_format'), | |
| 1100 | -                                      $reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS) | |
| 1101 | - ) | |
| 1102 | - ) | |
| 1103 | - . '</div>'; | |
| 1104 | -            } else { | |
| 1105 | - $reg_steps .= '<div class="ee-status-pill ee-status-bg--error">' | |
| 1106 | - . sprintf( | |
| 1107 | -                                  esc_html__('%1$s : Never Initiated', 'event_espresso'), | |
| 1108 | -                                  ucwords(str_replace('_', ' ', $reg_step)) | |
| 1109 | - ) | |
| 1110 | - . '</div>'; | |
| 1111 | - } | |
| 1112 | - } | |
| 1113 | - $reg_steps .= '</ul>'; | |
| 1114 | - $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; | |
| 1115 | - $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( | |
| 1116 | - 'Registration Step Progress', | |
| 1117 | - 'event_espresso' | |
| 1118 | - ); | |
| 1119 | - | |
| 1120 | - | |
| 1121 | - $this->_get_registrations_to_apply_payment_to(); | |
| 1122 | - $this->_get_payment_methods($payments); | |
| 1123 | - $this->_get_payment_status_array(); | |
| 1124 | - $this->_get_reg_status_selection(); // sets up the template args for the reg status array for the transaction. | |
| 1125 | - | |
| 1126 | - $this->_template_args['transaction_form_url'] = add_query_arg( | |
| 1127 | - [ | |
| 1128 | - 'action' => 'edit_transaction', | |
| 1129 | - 'process' => 'transaction', | |
| 1130 | - ], | |
| 1131 | - TXN_ADMIN_URL | |
| 1132 | - ); | |
| 1133 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( | |
| 1134 | - [ | |
| 1135 | - 'page' => 'espresso_transactions', | |
| 1136 | - 'action' => 'espresso_apply_payment', | |
| 1137 | - ], | |
| 1138 | - TXN_ADMIN_URL | |
| 1139 | - ); | |
| 1140 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( | |
| 1141 | - [ | |
| 1142 | - 'page' => 'espresso_transactions', | |
| 1143 | - 'action' => 'espresso_delete_payment', | |
| 1144 | - ], | |
| 1145 | - TXN_ADMIN_URL | |
| 1146 | - ); | |
| 1147 | - | |
| 1148 | - $this->_template_args['action_buttons'] = $this->getActionButtons($this->_transaction); | |
| 1149 | - | |
| 1150 | - // 'espresso_delete_payment_nonce' | |
| 1151 | - | |
| 1152 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; | |
| 1153 | - echo EEH_Template::display_template($template_path, $this->_template_args, true); | |
| 1154 | - } | |
| 1155 | - | |
| 1156 | - | |
| 1157 | - /** | |
| 1158 | - * _get_registration_payment_IDs | |
| 1159 | - * generates an array of Payment IDs and their corresponding Registration IDs | |
| 1160 | - * | |
| 1161 | - * @access protected | |
| 1162 | - * @param EE_Payment[] $payments | |
| 1163 | - * @return array | |
| 1164 | - * @throws EE_Error | |
| 1165 | - * @throws InvalidArgumentException | |
| 1166 | - * @throws InvalidDataTypeException | |
| 1167 | - * @throws InvalidInterfaceException | |
| 1168 | - * @throws ReflectionException | |
| 1169 | - */ | |
| 1170 | - protected function _get_registration_payment_IDs($payments = []) | |
| 1171 | -    { | |
| 1172 | - $existing_reg_payments = []; | |
| 1173 | - // get all reg payments for these payments | |
| 1174 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( | |
| 1175 | - [ | |
| 1176 | - [ | |
| 1177 | - 'PAY_ID' => [ | |
| 1178 | - 'IN', | |
| 1179 | - array_keys($payments), | |
| 1180 | - ], | |
| 1181 | - ], | |
| 1182 | - ] | |
| 1183 | - ); | |
| 1184 | -        if (! empty($reg_payments)) { | |
| 1185 | -            foreach ($payments as $payment) { | |
| 1186 | -                if (! $payment instanceof EE_Payment) { | |
| 1187 | - continue; | |
| 1188 | -                } elseif (! isset($existing_reg_payments[ $payment->ID() ])) { | |
| 1189 | - $existing_reg_payments[ $payment->ID() ] = []; | |
| 1190 | - } | |
| 1191 | -                foreach ($reg_payments as $reg_payment) { | |
| 1192 | - if ( | |
| 1193 | - $reg_payment instanceof EE_Registration_Payment | |
| 1194 | - && $reg_payment->payment_ID() === $payment->ID() | |
| 1195 | -                    ) { | |
| 1196 | - $existing_reg_payments[ $payment->ID() ][] = $reg_payment->registration_ID(); | |
| 1197 | - } | |
| 1198 | - } | |
| 1199 | - } | |
| 1200 | - } | |
| 1201 | - | |
| 1202 | - return $existing_reg_payments; | |
| 1203 | - } | |
| 1204 | - | |
| 1205 | - | |
| 1206 | - /** | |
| 1207 | - * _get_registrations_to_apply_payment_to | |
| 1208 | - * generates HTML for displaying a series of checkboxes in the admin payment modal window | |
| 1209 | - * which allows the admin to only apply the payment to the specific registrations | |
| 1210 | - * | |
| 1211 | - * @access protected | |
| 1212 | - * @return void | |
| 1213 | - * @throws EE_Error | |
| 1214 | - * @throws InvalidArgumentException | |
| 1215 | - * @throws InvalidDataTypeException | |
| 1216 | - * @throws InvalidInterfaceException | |
| 1217 | - * @throws ReflectionException | |
| 1218 | - */ | |
| 1219 | - protected function _get_registrations_to_apply_payment_to() | |
| 1220 | -    { | |
| 1221 | - // we want any registration with an active status (ie: not deleted or cancelled) | |
| 1222 | - $query_params = [ | |
| 1223 | - [ | |
| 1224 | - 'STS_ID' => [ | |
| 1225 | - 'IN', | |
| 1226 | - [ | |
| 1227 | - RegStatus::APPROVED, | |
| 1228 | - RegStatus::PENDING_PAYMENT, | |
| 1229 | - RegStatus::AWAITING_REVIEW, | |
| 1230 | - ], | |
| 1231 | - ], | |
| 1232 | - ], | |
| 1233 | - ]; | |
| 1234 | - $registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div( | |
| 1235 | - '', | |
| 1236 | - 'txn-admin-apply-payment-to-registrations-dv', | |
| 1237 | - '', | |
| 1238 | - 'clear: both; margin: 1.5em 0 0; display: none;' | |
| 1239 | - ); | |
| 1240 | -        $registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap'); | |
| 1241 | -        $registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl striped'); | |
| 1242 | - $registrations_to_apply_payment_to .= EEH_HTML::thead( | |
| 1243 | - EEH_HTML::tr( | |
| 1244 | -                EEH_HTML::th(esc_html__('ID', 'event_espresso')) . | |
| 1245 | -                EEH_HTML::th(esc_html__('Registrant', 'event_espresso')) . | |
| 1246 | -                EEH_HTML::th(esc_html__('Ticket', 'event_espresso')) . | |
| 1247 | -                EEH_HTML::th(esc_html__('Event', 'event_espresso')) . | |
| 1248 | -                EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr') . | |
| 1249 | -                EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr') . | |
| 1250 | -                EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr') | |
| 1251 | - ) | |
| 1252 | - ); | |
| 1253 | - $registrations_to_apply_payment_to .= EEH_HTML::tbody(); | |
| 1254 | - // get registrations for TXN | |
| 1255 | - $registrations = $this->_transaction->registrations($query_params); | |
| 1256 | - $existing_reg_payments = $this->_template_args['existing_reg_payments']; | |
| 1257 | -        foreach ($registrations as $registration) { | |
| 1258 | -            if ($registration instanceof EE_Registration) { | |
| 1259 | - $attendee_name = $registration->attendee() instanceof EE_Attendee | |
| 1260 | - ? $registration->attendee()->full_name() | |
| 1261 | -                    : esc_html__('Unknown Attendee', 'event_espresso'); | |
| 1262 | - $owing = $registration->final_price() - $registration->paid(); | |
| 1263 | - $taxable = $registration->ticket()->taxable() | |
| 1264 | -                    ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__('+ tax', 'event_espresso') . '</span>' | |
| 1265 | - : ''; | |
| 1266 | - $checked = empty($existing_reg_payments) | |
| 1267 | - || in_array($registration->ID(), $existing_reg_payments, true) | |
| 1268 | - ? ' checked' | |
| 1269 | - : ''; | |
| 1270 | - $disabled = $registration->final_price() > 0 | |
| 1271 | - ? '' | |
| 1272 | - : ' disabled'; | |
| 1273 | - $registrations_to_apply_payment_to .= EEH_HTML::tr( | |
| 1274 | - EEH_HTML::td($registration->ID()) . | |
| 1275 | - EEH_HTML::td($attendee_name) . | |
| 1276 | - EEH_HTML::td( | |
| 1277 | - $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable | |
| 1278 | - ) . | |
| 1279 | - EEH_HTML::td($registration->event_name()) . | |
| 1280 | - EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr') . | |
| 1281 | - EEH_HTML::td( | |
| 1282 | - EEH_Template::format_currency($owing), | |
| 1283 | - '', | |
| 1284 | - 'txn-admin-payment-owing-td jst-cntr' | |
| 1285 | - ) . | |
| 1286 | - EEH_HTML::td( | |
| 1287 | - '<input type="checkbox" value="' . $registration->ID() | |
| 1288 | - . '" name="txn_admin_payment[registrations]"' | |
| 1289 | - . $checked . $disabled . '>', | |
| 1290 | - '', | |
| 1291 | - 'jst-cntr' | |
| 1292 | - ), | |
| 1293 | - 'apply-payment-registration-row-' . $registration->ID() | |
| 1294 | - ); | |
| 1295 | - } | |
| 1296 | - } | |
| 1297 | - $registrations_to_apply_payment_to .= EEH_HTML::tbodyx(); | |
| 1298 | - $registrations_to_apply_payment_to .= EEH_HTML::tablex(); | |
| 1299 | - $registrations_to_apply_payment_to .= EEH_HTML::divx(); | |
| 1300 | - $registrations_to_apply_payment_to .= EEH_HTML::p( | |
| 1301 | - esc_html__( | |
| 1302 | - 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', | |
| 1303 | - 'event_espresso' | |
| 1304 | - ), | |
| 1305 | - '', | |
| 1306 | - 'clear description' | |
| 1307 | - ); | |
| 1308 | - $registrations_to_apply_payment_to .= EEH_HTML::divx(); | |
| 1309 | - $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; | |
| 1310 | - } | |
| 1311 | - | |
| 1312 | - | |
| 1313 | - /** | |
| 1314 | - * _get_reg_status_selection | |
| 1315 | - * | |
| 1316 | - * @return void | |
| 1317 | - * @throws EE_Error | |
| 1318 | - * @todo this will need to be adjusted either once MER comes along OR we move default reg status to tickets | |
| 1319 | - * instead of events. | |
| 1320 | - * @access protected | |
| 1321 | - */ | |
| 1322 | - protected function _get_reg_status_selection() | |
| 1323 | -    { | |
| 1324 | - // first get all possible statuses | |
| 1325 | - $statuses = EEM_Registration::reg_status_array([], true); | |
| 1326 | - // let's add a "don't change" option. | |
| 1327 | -        $status_array['NAN']                                 = esc_html__('Leave the Same', 'event_espresso'); | |
| 1328 | - $status_array = array_merge($status_array, $statuses); | |
| 1329 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( | |
| 1330 | - 'txn_reg_status_change[reg_status]', | |
| 1331 | - $status_array, | |
| 1332 | - 'NAN', | |
| 1333 | - 'id="txn-admin-payment-reg-status-inp"', | |
| 1334 | - 'txn-reg-status-change-reg-status' | |
| 1335 | - ); | |
| 1336 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( | |
| 1337 | - 'delete_txn_reg_status_change[reg_status]', | |
| 1338 | - $status_array, | |
| 1339 | - 'NAN', | |
| 1340 | - 'delete-txn-admin-payment-reg-status-inp', | |
| 1341 | - 'delete-txn-reg-status-change-reg-status' | |
| 1342 | - ); | |
| 1343 | - } | |
| 1344 | - | |
| 1345 | - | |
| 1346 | - /** | |
| 1347 | - * _get_payment_methods | |
| 1348 | - * Gets all the payment methods available generally, or the ones that are already | |
| 1349 | - * selected on these payments (in case their payment methods are no longer active). | |
| 1350 | - * Has the side-effect of updating the template args' payment_methods item | |
| 1351 | - * | |
| 1352 | - * @access private | |
| 1353 | - * @param EE_Payment[] to show on this page | |
| 1354 | - * @return void | |
| 1355 | - * @throws EE_Error | |
| 1356 | - * @throws InvalidArgumentException | |
| 1357 | - * @throws InvalidDataTypeException | |
| 1358 | - * @throws InvalidInterfaceException | |
| 1359 | - * @throws ReflectionException | |
| 1360 | - */ | |
| 1361 | - private function _get_payment_methods($payments = []) | |
| 1362 | -    { | |
| 1363 | - $payment_methods_of_payments = []; | |
| 1364 | -        foreach ($payments as $payment) { | |
| 1365 | -            if ($payment instanceof EE_Payment) { | |
| 1366 | - $payment_methods_of_payments[] = $payment->ID(); | |
| 1367 | - } | |
| 1368 | - } | |
| 1369 | -        if ($payment_methods_of_payments) { | |
| 1370 | - $query_args = [ | |
| 1371 | - [ | |
| 1372 | - 'OR*payment_method_for_payment' => [ | |
| 1373 | - 'PMD_ID' => ['IN', $payment_methods_of_payments], | |
| 1374 | - 'PMD_scope' => ['LIKE', '%' . EEM_Payment_Method::scope_admin . '%'], | |
| 1375 | - ], | |
| 1376 | - ], | |
| 1377 | - ]; | |
| 1378 | -        } else { | |
| 1379 | - $query_args = [['PMD_scope' => ['LIKE', '%' . EEM_Payment_Method::scope_admin . '%']]]; | |
| 1380 | - } | |
| 1381 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); | |
| 1382 | - } | |
| 1383 | - | |
| 1384 | - | |
| 1385 | - /** | |
| 1386 | - * txn_attendees_meta_box | |
| 1387 | - * generates HTML for the Attendees Transaction main meta box | |
| 1388 | - * | |
| 1389 | - * @access public | |
| 1390 | - * @param WP_Post $post | |
| 1391 | - * @param array $metabox | |
| 1392 | - * @return void | |
| 1393 | - * @throws DomainException | |
| 1394 | - * @throws EE_Error | |
| 1395 | - * @throws InvalidArgumentException | |
| 1396 | - * @throws InvalidDataTypeException | |
| 1397 | - * @throws InvalidInterfaceException | |
| 1398 | - * @throws ReflectionException | |
| 1399 | - */ | |
| 1400 | - public function txn_attendees_meta_box($post, $metabox = ['args' => []]) | |
| 1401 | -    { | |
| 1402 | - /** @noinspection NonSecureExtractUsageInspection */ | |
| 1403 | - extract($metabox['args']); | |
| 1404 | - $this->_template_args['post'] = $post; | |
| 1405 | - $this->_template_args['event_attendees'] = []; | |
| 1406 | - // process items in cart | |
| 1407 | - $line_items = $this->_transaction->get_many_related( | |
| 1408 | - 'Line_Item', | |
| 1409 | - [['LIN_type' => 'line-item']] | |
| 1410 | - ); | |
| 1411 | -        if (! empty($line_items)) { | |
| 1412 | -            foreach ($line_items as $item) { | |
| 1413 | -                if ($item instanceof EE_Line_Item) { | |
| 1414 | -                    switch ($item->OBJ_type()) { | |
| 1415 | - case 'Event': | |
| 1416 | - break; | |
| 1417 | - case 'Ticket': | |
| 1418 | - $ticket = $item->ticket(); | |
| 1419 | - // right now we're only handling tickets here. | |
| 1420 | - // Cause its expected that only tickets will have attendees right? | |
| 1421 | -                            if (! $ticket instanceof EE_Ticket) { | |
| 1422 | - break; | |
| 1423 | - } | |
| 1424 | -                            try { | |
| 1425 | - $event_name = $ticket->get_event_name(); | |
| 1426 | -                            } catch (Exception $e) { | |
| 1427 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 1428 | -                                $event_name = esc_html__('Unknown Event', 'event_espresso'); | |
| 1429 | - } | |
| 1430 | - $event_name .= ' - ' . $item->name(); | |
| 1431 | - $ticket_price = EEH_Template::format_currency($item->unit_price()); | |
| 1432 | - // now get all of the registrations for this transaction that use this ticket | |
| 1433 | - $registrations = $ticket->registrations( | |
| 1434 | - [['TXN_ID' => $this->_transaction->ID()]] | |
| 1435 | - ); | |
| 1436 | -                            foreach ($registrations as $registration) { | |
| 1437 | -                                if (! $registration instanceof EE_Registration) { | |
| 1438 | - break; | |
| 1439 | - } | |
| 1440 | - $this->_template_args['event_attendees'][ $registration->ID() ]['STS_ID'] | |
| 1441 | - = $registration->status_ID(); | |
| 1442 | - $this->_template_args['event_attendees'][ $registration->ID() ]['att_num'] | |
| 1443 | - = $registration->count(); | |
| 1444 | - $this->_template_args['event_attendees'][ $registration->ID() ]['event_ticket_name'] | |
| 1445 | - = $event_name; | |
| 1446 | - $this->_template_args['event_attendees'][ $registration->ID() ]['ticket_price'] | |
| 1447 | - = $ticket_price; | |
| 1448 | - // attendee info | |
| 1449 | -                                $attendee = $registration->get_first_related('Attendee'); | |
| 1450 | -                                if ($attendee instanceof EE_Attendee) { | |
| 1451 | - $this->_template_args['event_attendees'][ $registration->ID() ]['att_id'] | |
| 1452 | - = $attendee->ID(); | |
| 1453 | - $this->_template_args['event_attendees'][ $registration->ID() ]['attendee'] | |
| 1454 | - = $attendee->full_name(); | |
| 1455 | - $this->_template_args['event_attendees'][ $registration->ID() ]['email'] | |
| 1456 | - = '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name | |
| 1457 | - . esc_html__( | |
| 1458 | - ' Event', | |
| 1459 | - 'event_espresso' | |
| 1460 | - ) | |
| 1461 | - . '">' . $attendee->email() . '</a>'; | |
| 1462 | - $this->_template_args['event_attendees'][ $registration->ID() ]['address'] | |
| 1463 | - = EEH_Address::format($attendee, 'inline', false, false); | |
| 1464 | -                                } else { | |
| 1465 | - $this->_template_args['event_attendees'][ $registration->ID() ]['att_id'] = ''; | |
| 1466 | - $this->_template_args['event_attendees'][ $registration->ID() ]['attendee'] = ''; | |
| 1467 | - $this->_template_args['event_attendees'][ $registration->ID() ]['email'] = ''; | |
| 1468 | - $this->_template_args['event_attendees'][ $registration->ID() ]['address'] = ''; | |
| 1469 | - } | |
| 1470 | - } | |
| 1471 | - break; | |
| 1472 | - } | |
| 1473 | - } | |
| 1474 | - } | |
| 1475 | - | |
| 1476 | - $this->_template_args['transaction_form_url'] = add_query_arg( | |
| 1477 | - [ | |
| 1478 | - 'action' => 'edit_transaction', | |
| 1479 | - 'process' => 'attendees', | |
| 1480 | - ], | |
| 1481 | - TXN_ADMIN_URL | |
| 1482 | - ); | |
| 1483 | - echo EEH_Template::display_template( | |
| 1484 | - TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', | |
| 1485 | - $this->_template_args, | |
| 1486 | - true | |
| 1487 | - ); | |
| 1488 | -        } else { | |
| 1489 | - printf( | |
| 1490 | - esc_html__( | |
| 1491 | - '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', | |
| 1492 | - 'event_espresso' | |
| 1493 | - ), | |
| 1494 | - '<p class="important-notice">', | |
| 1495 | - '</p>' | |
| 1496 | - ); | |
| 1497 | - } | |
| 1498 | - } | |
| 1499 | - | |
| 1500 | - | |
| 1501 | - /** | |
| 1502 | - * txn_registrant_side_meta_box | |
| 1503 | - * generates HTML for the Edit Transaction side meta box | |
| 1504 | - * | |
| 1505 | - * @access public | |
| 1506 | - * @return void | |
| 1507 | - * @throws DomainException | |
| 1508 | - * @throws EE_Error | |
| 1509 | - * @throws InvalidArgumentException | |
| 1510 | - * @throws InvalidDataTypeException | |
| 1511 | - * @throws InvalidInterfaceException | |
| 1512 | - * @throws ReflectionException | |
| 1513 | - */ | |
| 1514 | - public function txn_registrant_side_meta_box() | |
| 1515 | -    { | |
| 1516 | - $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1517 | -            ? $this->_transaction->primary_registration()->get_first_related('Attendee') | |
| 1518 | - : null; | |
| 1519 | -        if (! $primary_att instanceof EE_Attendee) { | |
| 1520 | - $this->_template_args['no_attendee_message'] = esc_html__( | |
| 1521 | - 'There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', | |
| 1522 | - 'event_espresso' | |
| 1523 | - ); | |
| 1524 | - $primary_att = EEM_Attendee::instance()->create_default_object(); | |
| 1525 | - } | |
| 1526 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); | |
| 1527 | - $this->_template_args['prime_reg_fname'] = $primary_att->fname(); | |
| 1528 | - $this->_template_args['prime_reg_lname'] = $primary_att->lname(); | |
| 1529 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); | |
| 1530 | - $this->_template_args['prime_reg_phone'] = $primary_att->phone(); | |
| 1531 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( | |
| 1532 | - [ | |
| 1533 | - 'action' => 'edit_attendee', | |
| 1534 | - 'post' => $primary_att->ID(), | |
| 1535 | - ], | |
| 1536 | - REG_ADMIN_URL | |
| 1537 | - ); | |
| 1538 | - // get formatted address for registrant | |
| 1539 | - $formatted_address = EEH_Address::format($primary_att); | |
| 1540 | - $formatted_address = | |
| 1541 | - $formatted_address !== '<div class="espresso-address-dv"><div></div></div>' | |
| 1542 | - ? $formatted_address | |
| 1543 | - : ''; | |
| 1544 | - $this->_template_args['formatted_address'] = $formatted_address; | |
| 1545 | - echo EEH_Template::display_template( | |
| 1546 | - TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', | |
| 1547 | - $this->_template_args, | |
| 1548 | - true | |
| 1549 | - ); | |
| 1550 | - } | |
| 1551 | - | |
| 1552 | - | |
| 1553 | - /** | |
| 1554 | - * txn_billing_info_side_meta_box | |
| 1555 | - * generates HTML for the Edit Transaction side meta box | |
| 1556 | - * | |
| 1557 | - * @access public | |
| 1558 | - * @return void | |
| 1559 | - * @throws DomainException | |
| 1560 | - */ | |
| 1561 | - public function txn_billing_info_side_meta_box() | |
| 1562 | -    { | |
| 1563 | -        try { | |
| 1564 | - $this->_template_args['billing_form'] = $this->_transaction->billing_info(); | |
| 1565 | - $this->_template_args['billing_form_url'] = add_query_arg( | |
| 1566 | - ['action' => 'edit_transaction', 'process' => 'billing'], | |
| 1567 | - TXN_ADMIN_URL | |
| 1568 | - ); | |
| 1569 | -        } catch (Exception $e) { | |
| 1570 | - $this->_template_args['billing_form'] = []; | |
| 1571 | - $this->_template_args['billing_form_url'] = ''; | |
| 1572 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 1573 | - } | |
| 1574 | - | |
| 1575 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; | |
| 1576 | - echo EEH_Template::display_template($template_path, $this->_template_args, true); | |
| 1577 | - } | |
| 1578 | - | |
| 1579 | - | |
| 1580 | - /** | |
| 1581 | - * apply_payments_or_refunds | |
| 1582 | - * registers a payment or refund made towards a transaction | |
| 1583 | - * | |
| 1584 | - * @access public | |
| 1585 | - * @return void | |
| 1586 | - * @throws EE_Error | |
| 1587 | - * @throws InvalidArgumentException | |
| 1588 | - * @throws ReflectionException | |
| 1589 | - * @throws RuntimeException | |
| 1590 | - * @throws InvalidDataTypeException | |
| 1591 | - * @throws InvalidInterfaceException | |
| 1592 | - */ | |
| 1593 | - public function apply_payments_or_refunds() | |
| 1594 | -    { | |
| 1595 | - $valid_data = $this->_validate_payment_request_data(); | |
| 1596 | - $has_access = $this->capabilities->current_user_can( | |
| 1597 | - 'ee_edit_payments', | |
| 1598 | - 'apply_payment_or_refund_from_registration_details' | |
| 1599 | - ); | |
| 1600 | -        $TXD_ID     = $this->request->getRequestParam('txn_admin_payment[TXN_ID]', 0, 'int'); | |
| 1601 | - $amount = 0; | |
| 1602 | -        if (! empty($valid_data) && $has_access) { | |
| 1603 | - $PAY_ID = $valid_data['PAY_ID']; | |
| 1604 | - // save the new payment | |
| 1605 | - $payment = $this->_create_payment_from_request_data($valid_data); | |
| 1606 | - $amount = $payment->amount(); | |
| 1607 | - // get the TXN for this payment | |
| 1608 | - $transaction = $payment->transaction(); | |
| 1609 | - // verify transaction | |
| 1610 | -            if ($transaction instanceof EE_Transaction) { | |
| 1611 | - // calculate_total_payments_and_update_status | |
| 1612 | - $this->_process_transaction_payments($transaction); | |
| 1613 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); | |
| 1614 | - $this->_remove_existing_registration_payments($payment, $PAY_ID); | |
| 1615 | - // apply payment to registrations (if applicable) | |
| 1616 | -                if (! empty($REG_IDs)) { | |
| 1617 | - $this->_update_registration_payments($transaction, $payment, $REG_IDs); | |
| 1618 | - $this->_maybe_send_notifications(); | |
| 1619 | - // now process status changes for the same registrations | |
| 1620 | - $this->_process_registration_status_change($transaction, $REG_IDs); | |
| 1621 | - } | |
| 1622 | - $this->_maybe_send_notifications($payment); | |
| 1623 | - // prepare to render page | |
| 1624 | - do_action( | |
| 1625 | - 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', | |
| 1626 | - $transaction, | |
| 1627 | - $payment | |
| 1628 | - ); | |
| 1629 | -            } else { | |
| 1630 | - EE_Error::add_error( | |
| 1631 | - esc_html__( | |
| 1632 | - 'A valid Transaction for this payment could not be retrieved.', | |
| 1633 | - 'event_espresso' | |
| 1634 | - ), | |
| 1635 | - __FILE__, | |
| 1636 | - __FUNCTION__, | |
| 1637 | - __LINE__ | |
| 1638 | - ); | |
| 1639 | - } | |
| 1640 | -        } elseif ($has_access) { | |
| 1641 | - EE_Error::add_error( | |
| 1642 | - esc_html__( | |
| 1643 | - 'The payment form data could not be processed. Please try again.', | |
| 1644 | - 'event_espresso' | |
| 1645 | - ), | |
| 1646 | - __FILE__, | |
| 1647 | - __FUNCTION__, | |
| 1648 | - __LINE__ | |
| 1649 | - ); | |
| 1650 | -        } else { | |
| 1651 | - EE_Error::add_error( | |
| 1652 | - esc_html__( | |
| 1653 | - 'You do not have access to apply payments or refunds to a registration.', | |
| 1654 | - 'event_espresso' | |
| 1655 | - ), | |
| 1656 | - __FILE__, | |
| 1657 | - __FUNCTION__, | |
| 1658 | - __LINE__ | |
| 1659 | - ); | |
| 1660 | - } | |
| 1661 | - $query_args = [ | |
| 1662 | - 'page' => 'espresso_transactions', | |
| 1663 | - 'action' => 'view_transaction', | |
| 1664 | - 'TXN_ID' => $TXD_ID, | |
| 1665 | - ]; | |
| 1666 | - | |
| 1667 | - $this->_redirect_after_action( | |
| 1668 | - ! EE_Error::has_error(), | |
| 1669 | - $amount > 0 | |
| 1670 | -                ? esc_html__('payment', 'event_espresso') | |
| 1671 | -                : esc_html__('refund', 'event_espresso'), | |
| 1672 | -            esc_html__('processed', 'event_espresso'), | |
| 1673 | - $query_args | |
| 1674 | - ); | |
| 1675 | - } | |
| 1676 | - | |
| 1677 | - | |
| 1678 | - /** | |
| 1679 | - * _validate_payment_request_data | |
| 1680 | - * | |
| 1681 | - * @return array | |
| 1682 | - * @throws EE_Error | |
| 1683 | - * @throws InvalidArgumentException | |
| 1684 | - * @throws InvalidDataTypeException | |
| 1685 | - * @throws InvalidInterfaceException | |
| 1686 | - */ | |
| 1687 | - protected function _validate_payment_request_data() | |
| 1688 | -    { | |
| 1689 | -        if (! $this->request->requestParamIsSet('txn_admin_payment')) { | |
| 1690 | - return []; | |
| 1691 | - } | |
| 1692 | - $payment_form = $this->_generate_payment_form_section(); | |
| 1693 | -        try { | |
| 1694 | -            if ($payment_form->was_submitted()) { | |
| 1695 | - $payment_form->receive_form_submission(); | |
| 1696 | -                if (! $payment_form->is_valid()) { | |
| 1697 | - $submission_error_messages = []; | |
| 1698 | -                    foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { | |
| 1699 | -                        if ($validation_error instanceof EE_Validation_Error) { | |
| 1700 | - $form_input = $validation_error->get_form_section(); | |
| 1701 | - $submission_error_messages[] = sprintf( | |
| 1702 | -                                _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), | |
| 1703 | - $form_input instanceof EE_Form_Input_Base | |
| 1704 | - ? $form_input->html_label_text() | |
| 1705 | - : '', | |
| 1706 | - $validation_error->getMessage() | |
| 1707 | - ); | |
| 1708 | - } | |
| 1709 | - } | |
| 1710 | - EE_Error::add_error( | |
| 1711 | -                        implode('<br />', $submission_error_messages), | |
| 1712 | - __FILE__, | |
| 1713 | - __FUNCTION__, | |
| 1714 | - __LINE__ | |
| 1715 | - ); | |
| 1716 | - return []; | |
| 1717 | - } | |
| 1718 | - } | |
| 1719 | -        } catch (EE_Error $e) { | |
| 1720 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 1721 | - return []; | |
| 1722 | - } | |
| 1723 | - | |
| 1724 | - return $payment_form->valid_data(); | |
| 1725 | - } | |
| 1726 | - | |
| 1727 | - | |
| 1728 | - /** | |
| 1729 | - * _generate_payment_form_section | |
| 1730 | - * | |
| 1731 | - * @return EE_Form_Section_Proper | |
| 1732 | - * @throws EE_Error | |
| 1733 | - */ | |
| 1734 | - protected function _generate_payment_form_section() | |
| 1735 | -    { | |
| 1736 | - return new EE_Form_Section_Proper( | |
| 1737 | - [ | |
| 1738 | - 'name' => 'txn_admin_payment', | |
| 1739 | - 'subsections' => [ | |
| 1740 | - 'PAY_ID' => new EE_Text_Input( | |
| 1741 | - [ | |
| 1742 | - 'default' => 0, | |
| 1743 | - 'required' => false, | |
| 1744 | -                            'html_label_text'       => esc_html__('Payment ID', 'event_espresso'), | |
| 1745 | - 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1746 | - ] | |
| 1747 | - ), | |
| 1748 | - 'TXN_ID' => new EE_Text_Input( | |
| 1749 | - [ | |
| 1750 | - 'default' => 0, | |
| 1751 | - 'required' => true, | |
| 1752 | -                            'html_label_text'       => esc_html__('Transaction ID', 'event_espresso'), | |
| 1753 | - 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1754 | - ] | |
| 1755 | - ), | |
| 1756 | - 'type' => new EE_Text_Input( | |
| 1757 | - [ | |
| 1758 | - 'default' => 1, | |
| 1759 | - 'required' => true, | |
| 1760 | -                            'html_label_text'       => esc_html__('Payment or Refund', 'event_espresso'), | |
| 1761 | - 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1762 | - ] | |
| 1763 | - ), | |
| 1764 | - 'amount' => new EE_Text_Input( | |
| 1765 | - [ | |
| 1766 | - 'default' => 0, | |
| 1767 | - 'required' => true, | |
| 1768 | -                            'html_label_text'       => esc_html__('Payment amount', 'event_espresso'), | |
| 1769 | - 'validation_strategies' => [new EE_Float_Normalization()], | |
| 1770 | - ] | |
| 1771 | - ), | |
| 1772 | - 'status' => new EE_Text_Input( | |
| 1773 | - [ | |
| 1774 | - 'default' => EEM_Payment::status_id_approved, | |
| 1775 | - 'required' => true, | |
| 1776 | -                            'html_label_text' => esc_html__('Payment status', 'event_espresso'), | |
| 1777 | - ] | |
| 1778 | - ), | |
| 1779 | - 'PMD_ID' => new EE_Text_Input( | |
| 1780 | - [ | |
| 1781 | - 'default' => 2, | |
| 1782 | - 'required' => true, | |
| 1783 | -                            'html_label_text'       => esc_html__('Payment Method', 'event_espresso'), | |
| 1784 | - 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1785 | - ] | |
| 1786 | - ), | |
| 1787 | - 'date' => new EE_Text_Input( | |
| 1788 | - [ | |
| 1789 | - 'default' => time(), | |
| 1790 | - 'required' => true, | |
| 1791 | -                            'html_label_text' => esc_html__('Payment date', 'event_espresso'), | |
| 1792 | - ] | |
| 1793 | - ), | |
| 1794 | - 'txn_id_chq_nmbr' => new EE_Text_Input( | |
| 1795 | - [ | |
| 1796 | - 'default' => '', | |
| 1797 | - 'required' => false, | |
| 1798 | -                            'html_label_text'       => esc_html__('Transaction or Cheque Number', 'event_espresso'), | |
| 1799 | - 'validation_strategies' => [ | |
| 1800 | - new EE_Max_Length_Validation_Strategy( | |
| 1801 | -                                    esc_html__('Input too long', 'event_espresso'), | |
| 1802 | - 100 | |
| 1803 | - ), | |
| 1804 | - ], | |
| 1805 | - ] | |
| 1806 | - ), | |
| 1807 | - 'po_number' => new EE_Text_Input( | |
| 1808 | - [ | |
| 1809 | - 'default' => '', | |
| 1810 | - 'required' => false, | |
| 1811 | -                            'html_label_text'       => esc_html__('Purchase Order Number', 'event_espresso'), | |
| 1812 | - 'validation_strategies' => [ | |
| 1813 | - new EE_Max_Length_Validation_Strategy( | |
| 1814 | -                                    esc_html__('Input too long', 'event_espresso'), | |
| 1815 | - 100 | |
| 1816 | - ), | |
| 1817 | - ], | |
| 1818 | - ] | |
| 1819 | - ), | |
| 1820 | - 'accounting' => new EE_Text_Input( | |
| 1821 | - [ | |
| 1822 | - 'default' => '', | |
| 1823 | - 'required' => false, | |
| 1824 | -                            'html_label_text'       => esc_html__('Extra Field for Accounting', 'event_espresso'), | |
| 1825 | - 'validation_strategies' => [ | |
| 1826 | - new EE_Max_Length_Validation_Strategy( | |
| 1827 | -                                    esc_html__('Input too long', 'event_espresso'), | |
| 1828 | - 100 | |
| 1829 | - ), | |
| 1830 | - ], | |
| 1831 | - ] | |
| 1832 | - ), | |
| 1833 | - ], | |
| 1834 | - ] | |
| 1835 | - ); | |
| 1836 | - } | |
| 1837 | - | |
| 1838 | - | |
| 1839 | - /** | |
| 1840 | - * _create_payment_from_request_data | |
| 1841 | - * | |
| 1842 | - * @param array $valid_data | |
| 1843 | - * @return EE_Payment | |
| 1844 | - * @throws EE_Error | |
| 1845 | - * @throws InvalidArgumentException | |
| 1846 | - * @throws InvalidDataTypeException | |
| 1847 | - * @throws InvalidInterfaceException | |
| 1848 | - * @throws ReflectionException | |
| 1849 | - */ | |
| 1850 | - protected function _create_payment_from_request_data($valid_data) | |
| 1851 | -    { | |
| 1852 | - $PAY_ID = $valid_data['PAY_ID']; | |
| 1853 | - // get payment amount | |
| 1854 | - $amount = $valid_data['amount'] | |
| 1855 | - ? EEH_Money::strip_localized_money_formatting($valid_data['amount']) | |
| 1856 | - : 0; | |
| 1857 | - // payments have a type value of 1 and refunds have a type value of -1 | |
| 1858 | - // so multiplying amount by type will give a positive value for payments, and negative values for refunds | |
| 1859 | - $amount = $valid_data['type'] < 0 | |
| 1860 | - ? $amount * -1 | |
| 1861 | - : $amount; | |
| 1862 | - // for some reason the date string coming in has extra spaces between the date and time. This fixes that. | |
| 1863 | - $date = $valid_data['date'] | |
| 1864 | -            ? preg_replace('/\s+/', ' ', $valid_data['date']) | |
| 1865 | -            : date('Y-m-d g:i a', current_time('timestamp')); | |
| 1866 | - $payment = EE_Payment::new_instance( | |
| 1867 | - [ | |
| 1868 | - 'TXN_ID' => $valid_data['TXN_ID'], | |
| 1869 | - 'STS_ID' => $valid_data['status'], | |
| 1870 | - 'PAY_timestamp' => $date, | |
| 1871 | - 'PAY_source' => EEM_Payment_Method::scope_admin, | |
| 1872 | - 'PMD_ID' => $valid_data['PMD_ID'], | |
| 1873 | - 'PAY_amount' => $amount, | |
| 1874 | - 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], | |
| 1875 | - 'PAY_po_number' => $valid_data['po_number'], | |
| 1876 | - 'PAY_extra_accntng' => $valid_data['accounting'], | |
| 1877 | - 'PAY_details' => $valid_data, | |
| 1878 | - 'PAY_ID' => $PAY_ID, | |
| 1879 | - ], | |
| 1880 | - '', | |
| 1881 | - ['Y-m-d', 'g:i a'] | |
| 1882 | - ); | |
| 1883 | - | |
| 1884 | -        if (! $payment->save()) { | |
| 1885 | - EE_Error::add_error( | |
| 1886 | - sprintf( | |
| 1887 | -                    esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), | |
| 1888 | - $payment->ID() | |
| 1889 | - ), | |
| 1890 | - __FILE__, | |
| 1891 | - __FUNCTION__, | |
| 1892 | - __LINE__ | |
| 1893 | - ); | |
| 1894 | - } | |
| 1895 | - | |
| 1896 | - return $payment; | |
| 1897 | - } | |
| 1898 | - | |
| 1899 | - | |
| 1900 | - /** | |
| 1901 | - * _process_transaction_payments | |
| 1902 | - * | |
| 1903 | - * @param EE_Transaction $transaction | |
| 1904 | - * @return void | |
| 1905 | - * @throws EE_Error | |
| 1906 | - * @throws InvalidArgumentException | |
| 1907 | - * @throws ReflectionException | |
| 1908 | - * @throws InvalidDataTypeException | |
| 1909 | - * @throws InvalidInterfaceException | |
| 1910 | - */ | |
| 1911 | - protected function _process_transaction_payments(EE_Transaction $transaction) | |
| 1912 | -    { | |
| 1913 | - /** @type EE_Transaction_Payments $transaction_payments */ | |
| 1914 | -        $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | |
| 1915 | - // update the transaction with this payment | |
| 1916 | -        if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { | |
| 1917 | - EE_Error::add_success( | |
| 1918 | - esc_html__( | |
| 1919 | - 'The payment has been processed successfully.', | |
| 1920 | - 'event_espresso' | |
| 1921 | - ), | |
| 1922 | - __FILE__, | |
| 1923 | - __FUNCTION__, | |
| 1924 | - __LINE__ | |
| 1925 | - ); | |
| 1926 | -        } else { | |
| 1927 | - EE_Error::add_error( | |
| 1928 | - esc_html__( | |
| 1929 | - 'The payment was processed successfully but the amount paid for the transaction was not updated.', | |
| 1930 | - 'event_espresso' | |
| 1931 | - ), | |
| 1932 | - __FILE__, | |
| 1933 | - __FUNCTION__, | |
| 1934 | - __LINE__ | |
| 1935 | - ); | |
| 1936 | - } | |
| 1937 | - } | |
| 1938 | - | |
| 1939 | - | |
| 1940 | - /** | |
| 1941 | - * _get_REG_IDs_to_apply_payment_to | |
| 1942 | - * returns a list of registration IDs that the payment will apply to | |
| 1943 | - * | |
| 1944 | - * @param EE_Payment $payment | |
| 1945 | - * @return array | |
| 1946 | - * @throws EE_Error | |
| 1947 | - * @throws InvalidArgumentException | |
| 1948 | - * @throws InvalidDataTypeException | |
| 1949 | - * @throws InvalidInterfaceException | |
| 1950 | - * @throws ReflectionException | |
| 1951 | - */ | |
| 1952 | - protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) | |
| 1953 | -    { | |
| 1954 | - // grab array of IDs for specific registrations to apply changes to | |
| 1955 | - $apply_to_all = $this->request->getRequestParam( | |
| 1956 | - 'txn_admin_payment[apply_to_all_registrations]', | |
| 1957 | - false, | |
| 1958 | - DataType::BOOL | |
| 1959 | - ); | |
| 1960 | - $REG_IDs = ! $apply_to_all | |
| 1961 | - ? $this->request->getRequestParam( | |
| 1962 | - 'txn_admin_payment[registrations]', | |
| 1963 | - [], | |
| 1964 | - DataType::INT, | |
| 1965 | - true | |
| 1966 | - ) | |
| 1967 | - : []; | |
| 1968 | - // nothing specified ? then get all reg IDs | |
| 1969 | -        if ($apply_to_all || empty($REG_IDs)) { | |
| 1970 | - $registrations = $payment->transaction()->registrations( | |
| 1971 | - [ | |
| 1972 | - [ | |
| 1973 | - 'STS_ID' => [ | |
| 1974 | - 'NOT_IN', [ RegStatus::CANCELLED ] | |
| 1975 | - ] | |
| 1976 | - ] | |
| 1977 | - ] | |
| 1978 | - ); | |
| 1979 | - $REG_IDs = ! empty($registrations) | |
| 1980 | - ? array_keys($registrations) | |
| 1981 | - : $this->_get_existing_reg_payment_REG_IDs($payment); | |
| 1982 | - } | |
| 1983 | - // ensure that REG_IDs are integers and NOT strings | |
| 1984 | -        return array_map('absint', $REG_IDs); | |
| 1985 | - } | |
| 1986 | - | |
| 1987 | - | |
| 1988 | - /** | |
| 1989 | - * @return array | |
| 1990 | - */ | |
| 1991 | - public function existing_reg_payment_REG_IDs() | |
| 1992 | -    { | |
| 1993 | - return $this->_existing_reg_payment_REG_IDs; | |
| 1994 | - } | |
| 1995 | - | |
| 1996 | - | |
| 1997 | - /** | |
| 1998 | - * @param array $existing_reg_payment_REG_IDs | |
| 1999 | - */ | |
| 2000 | - public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) | |
| 2001 | -    { | |
| 2002 | - $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; | |
| 2003 | - } | |
| 2004 | - | |
| 2005 | - | |
| 2006 | - /** | |
| 2007 | - * _get_existing_reg_payment_REG_IDs | |
| 2008 | - * returns a list of registration IDs that the payment is currently related to | |
| 2009 | - * as recorded in the database | |
| 2010 | - * | |
| 2011 | - * @param EE_Payment $payment | |
| 2012 | - * @return array | |
| 2013 | - * @throws EE_Error | |
| 2014 | - * @throws InvalidArgumentException | |
| 2015 | - * @throws InvalidDataTypeException | |
| 2016 | - * @throws InvalidInterfaceException | |
| 2017 | - * @throws ReflectionException | |
| 2018 | - */ | |
| 2019 | - protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) | |
| 2020 | -    { | |
| 2021 | -        if ($this->existing_reg_payment_REG_IDs() === null) { | |
| 2022 | - // let's get any existing reg payment records for this payment | |
| 2023 | -            $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); | |
| 2024 | - // but we only want the REG IDs, so grab the array keys | |
| 2025 | - $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) | |
| 2026 | - ? array_keys($existing_reg_payment_REG_IDs) | |
| 2027 | - : []; | |
| 2028 | - $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); | |
| 2029 | - } | |
| 2030 | - | |
| 2031 | - return $this->existing_reg_payment_REG_IDs(); | |
| 2032 | - } | |
| 2033 | - | |
| 2034 | - | |
| 2035 | - /** | |
| 2036 | - * _remove_existing_registration_payments | |
| 2037 | - * this calculates the difference between existing relations | |
| 2038 | - * to the supplied payment and the new list registration IDs, | |
| 2039 | - * removes any related registrations that no longer apply, | |
| 2040 | - * and then updates the registration paid fields | |
| 2041 | - * | |
| 2042 | - * @param EE_Payment $payment | |
| 2043 | - * @param int $PAY_ID | |
| 2044 | - * @return bool; | |
| 2045 | - * @throws EE_Error | |
| 2046 | - * @throws InvalidArgumentException | |
| 2047 | - * @throws ReflectionException | |
| 2048 | - * @throws InvalidDataTypeException | |
| 2049 | - * @throws InvalidInterfaceException | |
| 2050 | - */ | |
| 2051 | - protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) | |
| 2052 | -    { | |
| 2053 | - // newly created payments will have nothing recorded for $PAY_ID | |
| 2054 | -        if (absint($PAY_ID) === 0) { | |
| 2055 | - return false; | |
| 2056 | - } | |
| 2057 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); | |
| 2058 | -        if (empty($existing_reg_payment_REG_IDs)) { | |
| 2059 | - return false; | |
| 2060 | - } | |
| 2061 | - /** @type EE_Transaction_Payments $transaction_payments */ | |
| 2062 | -        $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | |
| 2063 | - | |
| 2064 | - return $transaction_payments->delete_registration_payments_and_update_registrations( | |
| 2065 | - $payment, | |
| 2066 | - [ | |
| 2067 | - [ | |
| 2068 | - 'PAY_ID' => $payment->ID(), | |
| 2069 | - 'REG_ID' => ['IN', $existing_reg_payment_REG_IDs], | |
| 2070 | - ], | |
| 2071 | - ] | |
| 2072 | - ); | |
| 2073 | - } | |
| 2074 | - | |
| 2075 | - | |
| 2076 | - /** | |
| 2077 | - * _update_registration_payments | |
| 2078 | - * this applies the payments to the selected registrations | |
| 2079 | - * but only if they have not already been paid for | |
| 2080 | - * | |
| 2081 | - * @param EE_Transaction $transaction | |
| 2082 | - * @param EE_Payment $payment | |
| 2083 | - * @param array $REG_IDs | |
| 2084 | - * @return void | |
| 2085 | - * @throws EE_Error | |
| 2086 | - * @throws InvalidArgumentException | |
| 2087 | - * @throws ReflectionException | |
| 2088 | - * @throws RuntimeException | |
| 2089 | - * @throws InvalidDataTypeException | |
| 2090 | - * @throws InvalidInterfaceException | |
| 2091 | - */ | |
| 2092 | - protected function _update_registration_payments( | |
| 2093 | - EE_Transaction $transaction, | |
| 2094 | - EE_Payment $payment, | |
| 2095 | - $REG_IDs = [] | |
| 2096 | -    ) { | |
| 2097 | - // we can pass our own custom set of registrations to RegistrationPayments::processRegistrationPayments() | |
| 2098 | - // so let's do that using our set of REG_IDs from the form | |
| 2099 | - $registration_query_where_params = [ | |
| 2100 | - 'REG_ID' => ['IN', $REG_IDs], | |
| 2101 | - ]; | |
| 2102 | - // but add in some conditions regarding payment, | |
| 2103 | - // so that we don't apply payments to registrations that are free or have already been paid for | |
| 2104 | - // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) | |
| 2105 | -        if (! $payment->is_a_refund()) { | |
| 2106 | - $registration_query_where_params['REG_final_price'] = ['!=', 0]; | |
| 2107 | - $registration_query_where_params['REG_final_price*'] = ['!=', 'REG_paid', true]; | |
| 2108 | - } | |
| 2109 | - $registrations = $transaction->registrations([$registration_query_where_params]); | |
| 2110 | -        if (! empty($registrations)) { | |
| 2111 | - /** @var RegistrationPayments $payment_processor */ | |
| 2112 | - $payment_processor = LoaderFactory::getShared(RegistrationPayments::class); | |
| 2113 | - $payment_processor->processRegistrationPayments($transaction, $payment, $registrations); | |
| 2114 | - } | |
| 2115 | - } | |
| 2116 | - | |
| 2117 | - | |
| 2118 | - /** | |
| 2119 | - * _process_registration_status_change | |
| 2120 | - * This processes requested registration status changes for all the registrations | |
| 2121 | - * on a given transaction and (optionally) sends out notifications for the changes. | |
| 2122 | - * | |
| 2123 | - * @param EE_Transaction $transaction | |
| 2124 | - * @param array $REG_IDs | |
| 2125 | - * @return bool | |
| 2126 | - * @throws EE_Error | |
| 2127 | - * @throws InvalidArgumentException | |
| 2128 | - * @throws ReflectionException | |
| 2129 | - * @throws InvalidDataTypeException | |
| 2130 | - * @throws InvalidInterfaceException | |
| 2131 | - */ | |
| 2132 | - protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = [], $reg_status = '') | |
| 2133 | -    { | |
| 2134 | - // first if there is no change in status then we get out. | |
| 2135 | - $reg_status = $reg_status | |
| 2136 | -            ?: $this->request->getRequestParam('txn_reg_status_change[reg_status]', 'NAN'); | |
| 2137 | -        if ($reg_status === 'NAN') { | |
| 2138 | - // no error message, no change requested, just nothing to do man. | |
| 2139 | - return false; | |
| 2140 | - } | |
| 2141 | - /** @type EE_Transaction_Processor $transaction_processor */ | |
| 2142 | -        $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); | |
| 2143 | - | |
| 2144 | - // made it here dude? Oh WOW. K, let's take care of changing the statuses | |
| 2145 | - return $transaction_processor->manually_update_registration_statuses( | |
| 2146 | - $transaction, | |
| 2147 | - $reg_status, | |
| 2148 | - [['REG_ID' => ['IN', $REG_IDs]]] | |
| 2149 | - ); | |
| 2150 | - } | |
| 2151 | - | |
| 2152 | - | |
| 2153 | - /** | |
| 2154 | - * _build_payment_json_response | |
| 2155 | - * | |
| 2156 | - * @access public | |
| 2157 | - * @param EE_Payment $payment | |
| 2158 | - * @param array $REG_IDs | |
| 2159 | - * @param bool | null $delete_txn_reg_status_change | |
| 2160 | - * @return array | |
| 2161 | - * @throws EE_Error | |
| 2162 | - * @throws InvalidArgumentException | |
| 2163 | - * @throws InvalidDataTypeException | |
| 2164 | - * @throws InvalidInterfaceException | |
| 2165 | - * @throws ReflectionException | |
| 2166 | - */ | |
| 2167 | - protected function _build_payment_json_response( | |
| 2168 | - EE_Payment $payment, | |
| 2169 | - $REG_IDs = [], | |
| 2170 | - $delete_txn_reg_status_change = null | |
| 2171 | -    ) { | |
| 2172 | - // was the payment deleted ? | |
| 2173 | -        if (is_bool($delete_txn_reg_status_change)) { | |
| 2174 | - return [ | |
| 2175 | - 'PAY_ID' => $payment->ID(), | |
| 2176 | - 'amount' => $payment->amount(), | |
| 2177 | - 'total_paid' => $payment->transaction()->paid(), | |
| 2178 | - 'txn_status' => $payment->transaction()->status_ID(), | |
| 2179 | - 'pay_status' => $payment->STS_ID(), | |
| 2180 | - 'registrations' => $this->_registration_payment_data_array($REG_IDs), | |
| 2181 | - 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, | |
| 2182 | - ]; | |
| 2183 | - } | |
| 2184 | - | |
| 2185 | - $this->_get_payment_status_array(); | |
| 2186 | - $payment_method = $payment->payment_method(); | |
| 2187 | - return [ | |
| 2188 | - 'amount' => $payment->amount(), | |
| 2189 | - 'total_paid' => $payment->transaction()->paid(), | |
| 2190 | - 'txn_status' => $payment->transaction()->status_ID(), | |
| 2191 | - 'pay_status' => $payment->STS_ID(), | |
| 2192 | - 'PAY_ID' => $payment->ID(), | |
| 2193 | - 'STS_ID' => $payment->STS_ID(), | |
| 2194 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], | |
| 2195 | -            'date'             => $payment->timestamp('Y-m-d', 'h:i a'), | |
| 2196 | - 'method' => strtoupper($payment->source()), | |
| 2197 | - 'PM_ID' => $payment_method instanceof EE_Payment_Method | |
| 2198 | - ? $payment_method->ID() | |
| 2199 | - : 1, | |
| 2200 | - 'gateway' => $payment_method instanceof EE_Payment_Method | |
| 2201 | - ? $payment_method->admin_name() | |
| 2202 | -                : esc_html__('Unknown', 'event_espresso'), | |
| 2203 | - 'gateway_response' => $payment->gateway_response(), | |
| 2204 | - 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), | |
| 2205 | - 'po_number' => $payment->po_number(), | |
| 2206 | - 'extra_accntng' => $payment->extra_accntng(), | |
| 2207 | - 'registrations' => $this->_registration_payment_data_array($REG_IDs), | |
| 2208 | - ]; | |
| 2209 | - } | |
| 2210 | - | |
| 2211 | - | |
| 2212 | - /** | |
| 2213 | - * delete_payment | |
| 2214 | - * delete a payment or refund made towards a transaction | |
| 2215 | - * | |
| 2216 | - * @access public | |
| 2217 | - * @return void | |
| 2218 | - * @throws EE_Error | |
| 2219 | - * @throws InvalidArgumentException | |
| 2220 | - * @throws ReflectionException | |
| 2221 | - * @throws InvalidDataTypeException | |
| 2222 | - * @throws InvalidInterfaceException | |
| 2223 | - */ | |
| 2224 | - public function delete_payment() | |
| 2225 | -    { | |
| 2226 | -        $TXD_ID = $this->request->getRequestParam('delete_txn_admin_payment[TXN_ID]', 0, 'int'); | |
| 2227 | - // $json_response_data = ['return_data' => false]; | |
| 2228 | -        $PAY_ID     = $this->request->getRequestParam('delete_txn_admin_payment[PAY_ID]', 0, 'int'); | |
| 2229 | - $amount = 0; | |
| 2230 | - $can_delete = $this->capabilities->current_user_can( | |
| 2231 | - 'ee_delete_payments', | |
| 2232 | - 'delete_payment_from_registration_details' | |
| 2233 | - ); | |
| 2234 | -        if ($PAY_ID && $can_delete) { | |
| 2235 | -            $delete_txn_reg_status_change = $this->request->getRequestParam('delete_txn_reg_status_change[reg_status]'); | |
| 2236 | - $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); | |
| 2237 | -            if ($payment instanceof EE_Payment) { | |
| 2238 | - $amount = $payment->amount(); | |
| 2239 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); | |
| 2240 | - /** @type EE_Transaction_Payments $transaction_payments */ | |
| 2241 | -                $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | |
| 2242 | -                if ($transaction_payments->delete_payment_and_update_transaction($payment)) { | |
| 2243 | -                    if ($delete_txn_reg_status_change) { | |
| 2244 | - $this->_maybe_send_notifications(); | |
| 2245 | - $this->_process_registration_status_change( | |
| 2246 | - $payment->transaction(), | |
| 2247 | - $REG_IDs, | |
| 2248 | - $delete_txn_reg_status_change | |
| 2249 | - ); | |
| 2250 | - } | |
| 2251 | - } | |
| 2252 | -            } else { | |
| 2253 | - EE_Error::add_error( | |
| 2254 | -                    esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), | |
| 2255 | - __FILE__, | |
| 2256 | - __FUNCTION__, | |
| 2257 | - __LINE__ | |
| 2258 | - ); | |
| 2259 | - } | |
| 2260 | -        } elseif ($can_delete) { | |
| 2261 | - EE_Error::add_error( | |
| 2262 | - esc_html__( | |
| 2263 | - 'A valid Payment ID was not received, therefore payment form data could not be loaded.', | |
| 2264 | - 'event_espresso' | |
| 2265 | - ), | |
| 2266 | - __FILE__, | |
| 2267 | - __FUNCTION__, | |
| 2268 | - __LINE__ | |
| 2269 | - ); | |
| 2270 | -        } else { | |
| 2271 | - EE_Error::add_error( | |
| 2272 | - esc_html__( | |
| 2273 | - 'You do not have access to delete a payment.', | |
| 2274 | - 'event_espresso' | |
| 2275 | - ), | |
| 2276 | - __FILE__, | |
| 2277 | - __FUNCTION__, | |
| 2278 | - __LINE__ | |
| 2279 | - ); | |
| 2280 | - } | |
| 2281 | - $query_args = [ | |
| 2282 | - 'page' => 'espresso_transactions', | |
| 2283 | - 'action' => 'view_transaction', | |
| 2284 | - 'TXN_ID' => $TXD_ID, | |
| 2285 | - ]; | |
| 2286 | - $this->_redirect_after_action( | |
| 2287 | - ! EE_Error::has_error(), | |
| 2288 | - $amount > 0 | |
| 2289 | -                ? esc_html__('payment', 'event_espresso') | |
| 2290 | -                : esc_html__('refund', 'event_espresso'), | |
| 2291 | -            esc_html__('deleted', 'event_espresso'), | |
| 2292 | - $query_args | |
| 2293 | - ); | |
| 2294 | - } | |
| 2295 | - | |
| 2296 | - | |
| 2297 | - /** | |
| 2298 | - * _registration_payment_data_array | |
| 2299 | - * adds info for 'owing' and 'paid' for each registration to the json response | |
| 2300 | - * | |
| 2301 | - * @access protected | |
| 2302 | - * @param array $REG_IDs | |
| 2303 | - * @return array | |
| 2304 | - * @throws EE_Error | |
| 2305 | - * @throws InvalidArgumentException | |
| 2306 | - * @throws InvalidDataTypeException | |
| 2307 | - * @throws InvalidInterfaceException | |
| 2308 | - * @throws ReflectionException | |
| 2309 | - */ | |
| 2310 | - protected function _registration_payment_data_array($REG_IDs) | |
| 2311 | -    { | |
| 2312 | - $registration_payment_data = []; | |
| 2313 | - // if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. | |
| 2314 | -        if (! empty($REG_IDs)) { | |
| 2315 | - $registrations = EEM_Registration::instance()->get_all([['REG_ID' => ['IN', $REG_IDs]]]); | |
| 2316 | -            foreach ($registrations as $registration) { | |
| 2317 | -                if ($registration instanceof EE_Registration) { | |
| 2318 | - $registration_payment_data[ $registration->ID() ] = [ | |
| 2319 | - 'paid' => $registration->pretty_paid(), | |
| 2320 | - 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), | |
| 2321 | - ]; | |
| 2322 | - } | |
| 2323 | - } | |
| 2324 | - } | |
| 2325 | - | |
| 2326 | - return $registration_payment_data; | |
| 2327 | - } | |
| 2328 | - | |
| 2329 | - | |
| 2330 | - /** | |
| 2331 | - * _maybe_send_notifications | |
| 2332 | - * determines whether or not the admin has indicated that notifications should be sent. | |
| 2333 | - * If so, will toggle a filter switch for delivering registration notices. | |
| 2334 | - * If passed an EE_Payment object, then it will trigger payment notifications instead. | |
| 2335 | - * | |
| 2336 | - * @access protected | |
| 2337 | - * @param EE_Payment | null $payment | |
| 2338 | - */ | |
| 2339 | - protected function _maybe_send_notifications($payment = null) | |
| 2340 | -    { | |
| 2341 | -        switch ($payment instanceof EE_Payment) { | |
| 2342 | - // payment notifications | |
| 2343 | - case true: | |
| 2344 | -                if ($this->request->getRequestParam('txn_payments[send_notifications]', false, 'bool')) { | |
| 2345 | - $this->_process_payment_notification($payment); | |
| 2346 | - } | |
| 2347 | - break; | |
| 2348 | - // registration notifications | |
| 2349 | - case false: | |
| 2350 | -                if ($this->request->getRequestParam('txn_reg_status_change[send_notifications]', false, 'bool')) { | |
| 2351 | -                    add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); | |
| 2352 | - } | |
| 2353 | - break; | |
| 2354 | - } | |
| 2355 | - } | |
| 2356 | - | |
| 2357 | - | |
| 2358 | - /** | |
| 2359 | - * _send_payment_reminder | |
| 2360 | - * generates HTML for the View Transaction Details Admin page | |
| 2361 | - * | |
| 2362 | - * @access protected | |
| 2363 | - * @return void | |
| 2364 | - * @throws EE_Error | |
| 2365 | - * @throws InvalidArgumentException | |
| 2366 | - * @throws InvalidDataTypeException | |
| 2367 | - * @throws InvalidInterfaceException | |
| 2368 | - */ | |
| 2369 | - protected function _send_payment_reminder() | |
| 2370 | -    { | |
| 2371 | -        $TXN_ID      = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 2372 | - $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); | |
| 2373 | -        $redirect_to = $this->request->getRequestParam('redirect_to'); | |
| 2374 | - $query_args = $redirect_to | |
| 2375 | - ? ['action' => $redirect_to, 'TXN_ID' => $TXN_ID,] | |
| 2376 | - : []; | |
| 2377 | - do_action( | |
| 2378 | - 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', | |
| 2379 | - $transaction | |
| 2380 | - ); | |
| 2381 | - $this->_redirect_after_action( | |
| 2382 | - false, | |
| 2383 | -            esc_html__('payment reminder', 'event_espresso'), | |
| 2384 | -            esc_html__('sent', 'event_espresso'), | |
| 2385 | - $query_args, | |
| 2386 | - true | |
| 2387 | - ); | |
| 2388 | - } | |
| 2389 | - | |
| 2390 | - | |
| 2391 | - /** | |
| 2392 | - * get_transactions | |
| 2393 | - * get transactions for given parameters (used by list table) | |
| 2394 | - * | |
| 2395 | - * @param int $per_page how many transactions displayed per page | |
| 2396 | - * @param boolean $count return the count or objects | |
| 2397 | - * @param string $view | |
| 2398 | - * @return EE_Transaction[]|int int = count || array of transaction objects | |
| 2399 | - * @throws EE_Error | |
| 2400 | - * @throws InvalidArgumentException | |
| 2401 | - * @throws InvalidDataTypeException | |
| 2402 | - * @throws InvalidInterfaceException | |
| 2403 | - * @throws ReflectionException | |
| 2404 | - */ | |
| 2405 | - public function get_transactions($per_page, $count = false, $view = '') | |
| 2406 | -    { | |
| 2407 | - $start_date = wp_strip_all_tags( | |
| 2408 | -            $this->request->getRequestParam('txn-filter-start-date', date('m/d/Y', strtotime('-10 year'))) | |
| 2409 | - ); | |
| 2410 | - $end_date = wp_strip_all_tags( | |
| 2411 | -            $this->request->getRequestParam('txn-filter-end-date', date('m/d/Y')) | |
| 2412 | - ); | |
| 2413 | - | |
| 2414 | - // make sure our timestamps start and end right at the boundaries for each day | |
| 2415 | -        $start_date = date('Y-m-d', strtotime($start_date)) . ' 00:00:00'; | |
| 2416 | -        $end_date   = date('Y-m-d', strtotime($end_date)) . ' 23:59:59'; | |
| 2417 | - | |
| 2418 | - | |
| 2419 | - // convert to timestamps | |
| 2420 | - $start_date = strtotime($start_date); | |
| 2421 | - $end_date = strtotime($end_date); | |
| 2422 | - | |
| 2423 | - // makes sure start date is the lowest value and vice versa | |
| 2424 | - $start_date = min($start_date, $end_date); | |
| 2425 | - $end_date = max($start_date, $end_date); | |
| 2426 | - | |
| 2427 | - // convert to correct format for query | |
| 2428 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( | |
| 2429 | - 'TXN_timestamp', | |
| 2430 | -            date('Y-m-d H:i:s', $start_date), | |
| 2431 | - 'Y-m-d H:i:s' | |
| 2432 | - ); | |
| 2433 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( | |
| 2434 | - 'TXN_timestamp', | |
| 2435 | -            date('Y-m-d H:i:s', $end_date), | |
| 2436 | - 'Y-m-d H:i:s' | |
| 2437 | - ); | |
| 2438 | - | |
| 2439 | - | |
| 2440 | - // set orderby | |
| 2441 | -        $orderby = $this->request->getRequestParam('orderby'); | |
| 2442 | - | |
| 2443 | -        switch ($orderby) { | |
| 2444 | - case 'TXN_ID': | |
| 2445 | - break; | |
| 2446 | - case 'ATT_fname': | |
| 2447 | - $orderby = 'Registration.Attendee.ATT_fname'; | |
| 2448 | - break; | |
| 2449 | - case 'event_name': | |
| 2450 | - $orderby = 'Registration.Event.EVT_name'; | |
| 2451 | - break; | |
| 2452 | - default: // 'TXN_timestamp' | |
| 2453 | - $orderby = 'TXN_timestamp'; | |
| 2454 | - } | |
| 2455 | - | |
| 2456 | -        $sort         = $this->request->getRequestParam('order', 'DESC'); | |
| 2457 | -        $current_page = $this->request->getRequestParam('paged', 1, 'int'); | |
| 2458 | - | |
| 2459 | - $per_page = absint($per_page) | |
| 2460 | - ? $per_page | |
| 2461 | - : 10; | |
| 2462 | -        $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); | |
| 2463 | - | |
| 2464 | - $offset = ($current_page - 1) * $per_page; | |
| 2465 | - $limit = [$offset, $per_page]; | |
| 2466 | - | |
| 2467 | - $_where = [ | |
| 2468 | - 'TXN_timestamp' => ['BETWEEN', [$start_date, $end_date]], | |
| 2469 | - 'Registration.REG_count' => 1, | |
| 2470 | - ]; | |
| 2471 | - | |
| 2472 | -        $EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 2473 | -        if ($EVT_ID) { | |
| 2474 | - $_where['Registration.EVT_ID'] = $EVT_ID; | |
| 2475 | - } | |
| 2476 | - | |
| 2477 | -        $search_term = $this->request->getRequestParam('s'); | |
| 2478 | -        if ($search_term) { | |
| 2479 | - $search_term = '%' . $search_term . '%'; | |
| 2480 | - $_where['OR'] = [ | |
| 2481 | - 'Registration.Event.EVT_name' => ['LIKE', $search_term], | |
| 2482 | - 'Registration.Event.EVT_desc' => ['LIKE', $search_term], | |
| 2483 | - 'Registration.Event.EVT_short_desc' => ['LIKE', $search_term], | |
| 2484 | - 'Registration.Attendee.ATT_full_name' => ['LIKE', $search_term], | |
| 2485 | - 'Registration.Attendee.ATT_fname' => ['LIKE', $search_term], | |
| 2486 | - 'Registration.Attendee.ATT_lname' => ['LIKE', $search_term], | |
| 2487 | - 'Registration.Attendee.ATT_short_bio' => ['LIKE', $search_term], | |
| 2488 | - 'Registration.Attendee.ATT_email' => ['LIKE', $search_term], | |
| 2489 | - 'Registration.Attendee.ATT_address' => ['LIKE', $search_term], | |
| 2490 | - 'Registration.Attendee.ATT_address2' => ['LIKE', $search_term], | |
| 2491 | - 'Registration.Attendee.ATT_city' => ['LIKE', $search_term], | |
| 2492 | - 'Registration.REG_final_price' => ['LIKE', $search_term], | |
| 2493 | - 'Registration.REG_code' => ['LIKE', $search_term], | |
| 2494 | - 'Registration.REG_count' => ['LIKE', $search_term], | |
| 2495 | - 'Registration.REG_group_size' => ['LIKE', $search_term], | |
| 2496 | - 'Registration.Ticket.TKT_name' => ['LIKE', $search_term], | |
| 2497 | - 'Registration.Ticket.TKT_description' => ['LIKE', $search_term], | |
| 2498 | - 'Payment.PAY_source' => ['LIKE', $search_term], | |
| 2499 | - 'Payment.Payment_Method.PMD_name' => ['LIKE', $search_term], | |
| 2500 | - 'TXN_session_data' => ['LIKE', $search_term], | |
| 2501 | - 'Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_term], | |
| 2502 | - ]; | |
| 2503 | - } | |
| 2504 | - | |
| 2505 | -        $status = $this->request->getRequestParam('status'); | |
| 2506 | - // failed transactions | |
| 2507 | - $failed = (! empty($status) && $status === 'failed' && ! $count) || ($count && $view === 'failed'); | |
| 2508 | - $abandoned = (! empty($status) && $status === 'abandoned' && ! $count) || ($count && $view === 'abandoned'); | |
| 2509 | - $incomplete = (! empty($status) && $status === 'incomplete' && ! $count) || ($count && $view === 'incomplete'); | |
| 2510 | - | |
| 2511 | -        if ($failed) { | |
| 2512 | - $_where['STS_ID'] = EEM_Transaction::failed_status_code; | |
| 2513 | -        } elseif ($abandoned) { | |
| 2514 | - $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; | |
| 2515 | -        } elseif ($incomplete) { | |
| 2516 | - $_where['STS_ID'] = EEM_Transaction::incomplete_status_code; | |
| 2517 | -        } else { | |
| 2518 | - $_where['STS_ID'] = ['!=', EEM_Transaction::failed_status_code]; | |
| 2519 | - $_where['STS_ID*'] = ['!=', EEM_Transaction::abandoned_status_code]; | |
| 2520 | - } | |
| 2521 | - | |
| 2522 | - $query_params = apply_filters( | |
| 2523 | - 'FHEE__Transactions_Admin_Page___get_transactions_query_params', | |
| 2524 | - [ | |
| 2525 | - $_where, | |
| 2526 | - 'order_by' => [$orderby => $sort], | |
| 2527 | - 'limit' => $limit, | |
| 2528 | - 'default_where_conditions' => EE_Default_Where_Conditions::THIS_MODEL_ONLY, | |
| 2529 | - ], | |
| 2530 | - $this->request->requestParams(), | |
| 2531 | - $view, | |
| 2532 | - $count | |
| 2533 | - ); | |
| 2534 | - | |
| 2535 | - return $count | |
| 2536 | - ? EEM_Transaction::instance()->count([$query_params[0]], 'TXN_ID', true) | |
| 2537 | - : EEM_Transaction::instance()->get_all($query_params); | |
| 2538 | - } | |
| 2539 | - | |
| 2540 | - | |
| 2541 | - /** | |
| 2542 | - * @throws EE_Error | |
| 2543 | - * @throws InvalidArgumentException | |
| 2544 | - * @throws InvalidDataTypeException | |
| 2545 | - * @throws InvalidInterfaceException | |
| 2546 | - * @throws ReflectionException | |
| 2547 | - * @throws RuntimeException | |
| 2548 | - * @since 4.9.79.p | |
| 2549 | - */ | |
| 2550 | - public function recalculateLineItems() | |
| 2551 | -    { | |
| 2552 | -        $TXN_ID = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 2553 | - /** @var EE_Transaction $transaction */ | |
| 2554 | - $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); | |
| 2555 | - $success = $transaction->recalculateLineItems(); | |
| 2556 | -        $redirect_to = $this->request->getRequestParam('redirect_to'); | |
| 2557 | - $query_args = $redirect_to | |
| 2558 | - ? ['action' => $redirect_to, 'TXN_ID' => $TXN_ID,] | |
| 2559 | - : []; | |
| 2560 | - $this->_redirect_after_action( | |
| 2561 | - $success, | |
| 2562 | -            esc_html__('Transaction taxes and totals', 'event_espresso'), | |
| 2563 | -            esc_html__('recalculated', 'event_espresso'), | |
| 2564 | - $query_args, | |
| 2565 | - true | |
| 2566 | - ); | |
| 2567 | - } | |
| 19 | + /** | |
| 20 | + * @var EE_Transaction | |
| 21 | + */ | |
| 22 | + private $_transaction; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * @var EE_Session | |
| 26 | + */ | |
| 27 | + private $_session; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * @var array $_txn_status | |
| 31 | + */ | |
| 32 | + private static $_txn_status; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * @var array $_pay_status | |
| 36 | + */ | |
| 37 | + private static $_pay_status; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @var array $_existing_reg_payment_REG_IDs | |
| 41 | + */ | |
| 42 | + protected $_existing_reg_payment_REG_IDs; | |
| 43 | + | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * _init_page_props | |
| 47 | + * | |
| 48 | + * @return void | |
| 49 | + */ | |
| 50 | + protected function _init_page_props() | |
| 51 | +	{ | |
| 52 | + $this->page_slug = TXN_PG_SLUG; | |
| 53 | +		$this->page_label       = esc_html__('Transactions', 'event_espresso'); | |
| 54 | + $this->_admin_base_url = TXN_ADMIN_URL; | |
| 55 | + $this->_admin_base_path = TXN_ADMIN; | |
| 56 | + } | |
| 57 | + | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * _ajax_hooks | |
| 61 | + * | |
| 62 | + * @return void | |
| 63 | + */ | |
| 64 | + protected function _ajax_hooks() | |
| 65 | +	{ | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * _define_page_props | |
| 71 | + * | |
| 72 | + * @return void | |
| 73 | + */ | |
| 74 | + protected function _define_page_props() | |
| 75 | +	{ | |
| 76 | + $this->_admin_page_title = $this->page_label; | |
| 77 | + $this->_labels = [ | |
| 78 | + 'buttons' => [ | |
| 79 | +				'add'    => esc_html__('Add New Transaction', 'event_espresso'), | |
| 80 | +				'edit'   => esc_html__('Edit Transaction', 'event_espresso'), | |
| 81 | +				'delete' => esc_html__('Delete Transaction', 'event_espresso'), | |
| 82 | + ], | |
| 83 | + ]; | |
| 84 | + } | |
| 85 | + | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * grab url requests and route them | |
| 89 | + * | |
| 90 | + * @access private | |
| 91 | + * @return void | |
| 92 | + * @throws EE_Error | |
| 93 | + * @throws InvalidArgumentException | |
| 94 | + * @throws InvalidDataTypeException | |
| 95 | + * @throws InvalidInterfaceException | |
| 96 | + * @throws ReflectionException | |
| 97 | + */ | |
| 98 | + public function _set_page_routes() | |
| 99 | +	{ | |
| 100 | + $this->_set_transaction_status_array(); | |
| 101 | +		$TXN_ID = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 102 | + | |
| 103 | + $this->_page_routes = [ | |
| 104 | + | |
| 105 | + 'default' => [ | |
| 106 | + 'func' => [$this, '_transactions_overview_list_table'], | |
| 107 | + 'capability' => 'ee_read_transactions', | |
| 108 | + ], | |
| 109 | + | |
| 110 | + 'view_transaction' => [ | |
| 111 | + 'func' => [$this, '_transaction_details'], | |
| 112 | + 'capability' => 'ee_read_transaction', | |
| 113 | + 'obj_id' => $TXN_ID, | |
| 114 | + ], | |
| 115 | + | |
| 116 | + 'send_payment_reminder' => [ | |
| 117 | + 'func' => [$this, '_send_payment_reminder'], | |
| 118 | + 'noheader' => true, | |
| 119 | + 'capability' => 'ee_send_message', | |
| 120 | + ], | |
| 121 | + | |
| 122 | + 'espresso_apply_payment' => [ | |
| 123 | + 'func' => [$this, 'apply_payments_or_refunds'], | |
| 124 | + 'noheader' => true, | |
| 125 | + 'capability' => 'ee_edit_payments', | |
| 126 | + ], | |
| 127 | + | |
| 128 | + 'espresso_apply_refund' => [ | |
| 129 | + 'func' => [$this, 'apply_payments_or_refunds'], | |
| 130 | + 'noheader' => true, | |
| 131 | + 'capability' => 'ee_edit_payments', | |
| 132 | + ], | |
| 133 | + | |
| 134 | + 'espresso_delete_payment' => [ | |
| 135 | + 'func' => [$this, 'delete_payment'], | |
| 136 | + 'noheader' => true, | |
| 137 | + 'capability' => 'ee_delete_payments', | |
| 138 | + ], | |
| 139 | + | |
| 140 | + 'espresso_recalculate_line_items' => [ | |
| 141 | + 'func' => [$this, 'recalculateLineItems'], | |
| 142 | + 'noheader' => true, | |
| 143 | + 'capability' => 'ee_edit_payments', | |
| 144 | + ], | |
| 145 | + | |
| 146 | + ]; | |
| 147 | + } | |
| 148 | + | |
| 149 | + | |
| 150 | + protected function _set_page_config() | |
| 151 | +	{ | |
| 152 | +		$TXN_ID             = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 153 | + $this->_page_config = [ | |
| 154 | + 'default' => [ | |
| 155 | + 'nav' => [ | |
| 156 | +					'label' => esc_html__('Overview', 'event_espresso'), | |
| 157 | + 'icon' => 'dashicons-list-view', | |
| 158 | + 'order' => 10, | |
| 159 | + ], | |
| 160 | + 'list_table' => 'EE_Admin_Transactions_List_Table', | |
| 161 | + 'help_tabs' => [ | |
| 162 | + 'transactions_overview_help_tab' => [ | |
| 163 | +						'title'    => esc_html__('Transactions Overview', 'event_espresso'), | |
| 164 | + 'filename' => 'transactions_overview', | |
| 165 | + ], | |
| 166 | + 'transactions_overview_table_column_headings_help_tab' => [ | |
| 167 | +						'title'    => esc_html__('Transactions Table Column Headings', 'event_espresso'), | |
| 168 | + 'filename' => 'transactions_overview_table_column_headings', | |
| 169 | + ], | |
| 170 | + 'transactions_overview_views_filters_help_tab' => [ | |
| 171 | +						'title'    => esc_html__('Transaction Views & Filters & Search', 'event_espresso'), | |
| 172 | + 'filename' => 'transactions_overview_views_filters_search', | |
| 173 | + ], | |
| 174 | + ], | |
| 175 | + 'require_nonce' => false, | |
| 176 | + ], | |
| 177 | + 'view_transaction' => [ | |
| 178 | + 'nav' => [ | |
| 179 | +					'label'      => esc_html__('View Transaction', 'event_espresso'), | |
| 180 | + 'icon' => 'dashicons-cart', | |
| 181 | + 'order' => 5, | |
| 182 | + 'url' => $TXN_ID | |
| 183 | + ? add_query_arg(['TXN_ID' => $TXN_ID], $this->_current_page_view_url) | |
| 184 | + : $this->_admin_base_url, | |
| 185 | + 'persistent' => false, | |
| 186 | + ], | |
| 187 | + 'help_tabs' => [ | |
| 188 | + 'transactions_view_transaction_help_tab' => [ | |
| 189 | +						'title'    => esc_html__('View Transaction', 'event_espresso'), | |
| 190 | + 'filename' => 'transactions_view_transaction', | |
| 191 | + ], | |
| 192 | + 'transactions_view_transaction_transaction_details_table_help_tab' => [ | |
| 193 | +						'title'    => esc_html__('Transaction Details Table', 'event_espresso'), | |
| 194 | + 'filename' => 'transactions_view_transaction_transaction_details_table', | |
| 195 | + ], | |
| 196 | + 'transactions_view_transaction_attendees_registered_help_tab' => [ | |
| 197 | +						'title'    => esc_html__('Attendees Registered', 'event_espresso'), | |
| 198 | + 'filename' => 'transactions_view_transaction_attendees_registered', | |
| 199 | + ], | |
| 200 | + 'transactions_view_transaction_views_primary_registrant_billing_information_help_tab' => [ | |
| 201 | +						'title'    => esc_html__('Primary Registrant & Billing Information', 'event_espresso'), | |
| 202 | + 'filename' => 'transactions_view_transaction_primary_registrant_billing_information', | |
| 203 | + ], | |
| 204 | + ], | |
| 205 | + 'qtips' => ['Transaction_Details_Tips'], | |
| 206 | + 'metaboxes' => ['_transaction_details_metaboxes'], | |
| 207 | + | |
| 208 | + 'require_nonce' => false, | |
| 209 | + ], | |
| 210 | + ]; | |
| 211 | + } | |
| 212 | + | |
| 213 | + | |
| 214 | + /** | |
| 215 | + * The below methods aren't used by this class currently | |
| 216 | + */ | |
| 217 | + protected function _add_screen_options() | |
| 218 | +	{ | |
| 219 | + // noop | |
| 220 | + } | |
| 221 | + | |
| 222 | + | |
| 223 | + protected function _add_feature_pointers() | |
| 224 | +	{ | |
| 225 | + // noop | |
| 226 | + } | |
| 227 | + | |
| 228 | + | |
| 229 | + public function admin_init() | |
| 230 | +	{ | |
| 231 | +		$EVT_ID        = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 232 | +		$event_name    = $this->request->getRequestParam('event_name'); | |
| 233 | +		$redirect_from = $this->request->getRequestParam('redirect_from', '', 'url'); | |
| 234 | + // IF a registration was JUST added via the admin... | |
| 235 | +		if ($EVT_ID && $event_name && $redirect_from) { | |
| 236 | + // then set a cookie so that we can block any attempts to use | |
| 237 | + // the back button as a way to enter another registration. | |
| 238 | +			setcookie('ee_registration_added', $EVT_ID, time() + WEEK_IN_SECONDS, '/'); | |
| 239 | + // and update the global | |
| 240 | + $_COOKIE['ee_registration_added'] = $EVT_ID; | |
| 241 | + } | |
| 242 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__( | |
| 243 | + 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', | |
| 244 | + 'event_espresso' | |
| 245 | + ); | |
| 246 | + EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__( | |
| 247 | + 'An error occurred! Please refresh the page and try again.', | |
| 248 | + 'event_espresso' | |
| 249 | + ); | |
| 250 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; | |
| 251 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; | |
| 252 | +		EE_Registry::$i18n_js_strings['payments_total']          = esc_html__('Payments Total', 'event_espresso'); | |
| 253 | + EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__( | |
| 254 | + 'This transaction has been overpaid ! Payments Total', | |
| 255 | + 'event_espresso' | |
| 256 | + ); | |
| 257 | + } | |
| 258 | + | |
| 259 | + | |
| 260 | + public function admin_notices() | |
| 261 | +	{ | |
| 262 | + // noop | |
| 263 | + } | |
| 264 | + | |
| 265 | + | |
| 266 | + public function admin_footer_scripts() | |
| 267 | +	{ | |
| 268 | + // noop | |
| 269 | + } | |
| 270 | + | |
| 271 | + | |
| 272 | + /** | |
| 273 | + * _set_transaction_status_array | |
| 274 | + * sets list of transaction statuses | |
| 275 | + * | |
| 276 | + * @access private | |
| 277 | + * @return void | |
| 278 | + * @throws EE_Error | |
| 279 | + * @throws InvalidArgumentException | |
| 280 | + * @throws InvalidDataTypeException | |
| 281 | + * @throws InvalidInterfaceException | |
| 282 | + * @throws ReflectionException | |
| 283 | + */ | |
| 284 | + private function _set_transaction_status_array() | |
| 285 | +	{ | |
| 286 | + self::$_txn_status = EEM_Transaction::instance()->status_array(true); | |
| 287 | + } | |
| 288 | + | |
| 289 | + | |
| 290 | + /** | |
| 291 | + * get_transaction_status_array | |
| 292 | + * return the transaction status array for wp_list_table | |
| 293 | + * | |
| 294 | + * @access public | |
| 295 | + * @return array | |
| 296 | + */ | |
| 297 | + public function get_transaction_status_array() | |
| 298 | +	{ | |
| 299 | + return self::$_txn_status; | |
| 300 | + } | |
| 301 | + | |
| 302 | + | |
| 303 | + /** | |
| 304 | + * get list of payment statuses | |
| 305 | + * | |
| 306 | + * @access private | |
| 307 | + * @return void | |
| 308 | + * @throws EE_Error | |
| 309 | + * @throws InvalidArgumentException | |
| 310 | + * @throws InvalidDataTypeException | |
| 311 | + * @throws InvalidInterfaceException | |
| 312 | + * @throws ReflectionException | |
| 313 | + */ | |
| 314 | + private function _get_payment_status_array() | |
| 315 | +	{ | |
| 316 | + self::$_pay_status = EEM_Payment::instance()->status_array(true); | |
| 317 | + $this->_template_args['payment_status'] = self::$_pay_status; | |
| 318 | + } | |
| 319 | + | |
| 320 | + | |
| 321 | + /** | |
| 322 | + * _add_screen_options_default | |
| 323 | + * | |
| 324 | + * @access protected | |
| 325 | + * @return void | |
| 326 | + * @throws InvalidArgumentException | |
| 327 | + * @throws InvalidDataTypeException | |
| 328 | + * @throws InvalidInterfaceException | |
| 329 | + */ | |
| 330 | + protected function _add_screen_options_default() | |
| 331 | +	{ | |
| 332 | + $this->_per_page_screen_option(); | |
| 333 | + } | |
| 334 | + | |
| 335 | + | |
| 336 | + /** | |
| 337 | + * load_scripts_styles | |
| 338 | + * | |
| 339 | + * @access public | |
| 340 | + * @return void | |
| 341 | + */ | |
| 342 | + public function load_scripts_styles() | |
| 343 | +	{ | |
| 344 | + // enqueue style | |
| 345 | + wp_register_style( | |
| 346 | + 'espresso_txn', | |
| 347 | + TXN_ASSETS_URL . 'espresso_transactions_admin.css', | |
| 348 | + [], | |
| 349 | + EVENT_ESPRESSO_VERSION | |
| 350 | + ); | |
| 351 | +		wp_enqueue_style('espresso_txn'); | |
| 352 | + // scripts | |
| 353 | + wp_register_script( | |
| 354 | + 'espresso_txn', | |
| 355 | + TXN_ASSETS_URL . 'espresso_transactions_admin.js', | |
| 356 | + [ | |
| 357 | + 'ee_admin_js', | |
| 358 | + 'ee-datepicker', | |
| 359 | + 'jquery-ui-datepicker', | |
| 360 | + 'jquery-ui-draggable', | |
| 361 | + 'ee-dialog', | |
| 362 | + 'ee-accounting', | |
| 363 | + 'ee-serialize-full-array', | |
| 364 | + ], | |
| 365 | + EVENT_ESPRESSO_VERSION, | |
| 366 | + true | |
| 367 | + ); | |
| 368 | +		wp_enqueue_script('espresso_txn'); | |
| 369 | + } | |
| 370 | + | |
| 371 | + | |
| 372 | + /** | |
| 373 | + * load_scripts_styles_view_transaction | |
| 374 | + * | |
| 375 | + * @access public | |
| 376 | + * @return void | |
| 377 | + */ | |
| 378 | + public function load_scripts_styles_view_transaction() | |
| 379 | +	{ | |
| 380 | + // styles | |
| 381 | +		wp_enqueue_style('espresso-ui-theme'); | |
| 382 | + } | |
| 383 | + | |
| 384 | + | |
| 385 | + /** | |
| 386 | + * load_scripts_styles_default | |
| 387 | + * | |
| 388 | + * @access public | |
| 389 | + * @return void | |
| 390 | + */ | |
| 391 | + public function load_scripts_styles_default() | |
| 392 | +	{ | |
| 393 | + // styles | |
| 394 | +		wp_enqueue_style('espresso-ui-theme'); | |
| 395 | + } | |
| 396 | + | |
| 397 | + | |
| 398 | + /** | |
| 399 | + * _set_list_table_views_default | |
| 400 | + * | |
| 401 | + * @access protected | |
| 402 | + * @return void | |
| 403 | + */ | |
| 404 | + protected function _set_list_table_views_default() | |
| 405 | +	{ | |
| 406 | + $this->_views = [ | |
| 407 | + 'all' => [ | |
| 408 | + 'slug' => 'all', | |
| 409 | +				'label' => esc_html__('View All Transactions', 'event_espresso'), | |
| 410 | + 'count' => 0, | |
| 411 | + ], | |
| 412 | + 'abandoned' => [ | |
| 413 | + 'slug' => 'abandoned', | |
| 414 | +				'label' => esc_html__('Abandoned Transactions', 'event_espresso'), | |
| 415 | + 'count' => 0, | |
| 416 | + ], | |
| 417 | + 'incomplete' => [ | |
| 418 | + 'slug' => 'incomplete', | |
| 419 | +				'label' => esc_html__('Incomplete Transactions', 'event_espresso'), | |
| 420 | + 'count' => 0, | |
| 421 | + ], | |
| 422 | + ]; | |
| 423 | + if ( | |
| 424 | + /** | |
| 425 | + * Filters whether a link to the "Failed Transactions" list table | |
| 426 | + * appears on the Transactions Admin Page list table. | |
| 427 | + * List display can be turned back on via the following: | |
| 428 | + * add_filter( | |
| 429 | + * 'FHEE__Transactions_Admin_Page___set_list_table_views_default__display_failed_txns_list', | |
| 430 | + * '__return_true' | |
| 431 | + * ); | |
| 432 | + * | |
| 433 | + * @param boolean $display_failed_txns_list | |
| 434 | + * @param Transactions_Admin_Page $this | |
| 435 | + * @since 4.9.70.p | |
| 436 | + */ | |
| 437 | + apply_filters( | |
| 438 | + 'FHEE__Transactions_Admin_Page___set_list_table_views_default__display_failed_txns_list', | |
| 439 | + false, | |
| 440 | + $this | |
| 441 | + ) | |
| 442 | +		) { | |
| 443 | + $this->_views['failed'] = [ | |
| 444 | + 'slug' => 'failed', | |
| 445 | +				'label' => esc_html__('Failed Transactions', 'event_espresso'), | |
| 446 | + 'count' => 0, | |
| 447 | + ]; | |
| 448 | + } | |
| 449 | + } | |
| 450 | + | |
| 451 | + | |
| 452 | + /** | |
| 453 | + * _set_transaction_object | |
| 454 | + * This sets the _transaction property for the transaction details screen | |
| 455 | + * | |
| 456 | + * @access private | |
| 457 | + * @return void | |
| 458 | + * @throws EE_Error | |
| 459 | + * @throws InvalidArgumentException | |
| 460 | + * @throws RuntimeException | |
| 461 | + * @throws InvalidDataTypeException | |
| 462 | + * @throws InvalidInterfaceException | |
| 463 | + * @throws ReflectionException | |
| 464 | + */ | |
| 465 | + private function _set_transaction_object() | |
| 466 | +	{ | |
| 467 | +		if ($this->_transaction instanceof EE_Transaction) { | |
| 468 | + return; | |
| 469 | + } //get out we've already set the object | |
| 470 | + | |
| 471 | +		$TXN_ID = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 472 | + | |
| 473 | + // get transaction object | |
| 474 | + $this->_transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); | |
| 475 | + $this->_session = $this->_transaction instanceof EE_Transaction | |
| 476 | + ? $this->_transaction->session_data() | |
| 477 | + : null; | |
| 478 | +		if ($this->_transaction instanceof EE_Transaction) { | |
| 479 | + $this->_transaction->verify_abandoned_transaction_status(); | |
| 480 | + } | |
| 481 | + | |
| 482 | +		if (! $this->_transaction instanceof EE_Transaction) { | |
| 483 | + $error_msg = sprintf( | |
| 484 | + esc_html__( | |
| 485 | + 'An error occurred and the details for the transaction with the ID # %d could not be retrieved.', | |
| 486 | + 'event_espresso' | |
| 487 | + ), | |
| 488 | + $TXN_ID | |
| 489 | + ); | |
| 490 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); | |
| 491 | + } | |
| 492 | + } | |
| 493 | + | |
| 494 | + | |
| 495 | + /** | |
| 496 | + * _transaction_legend_items | |
| 497 | + * | |
| 498 | + * @access protected | |
| 499 | + * @return array | |
| 500 | + * @throws EE_Error | |
| 501 | + * @throws InvalidArgumentException | |
| 502 | + * @throws ReflectionException | |
| 503 | + * @throws InvalidDataTypeException | |
| 504 | + * @throws InvalidInterfaceException | |
| 505 | + */ | |
| 506 | + protected function _transaction_legend_items() | |
| 507 | +	{ | |
| 508 | +		EE_Registry::instance()->load_helper('MSG_Template'); | |
| 509 | + $items = []; | |
| 510 | + | |
| 511 | + if ( | |
| 512 | + $this->capabilities->current_user_can( | |
| 513 | + 'ee_read_global_messages', | |
| 514 | + 'view_filtered_messages' | |
| 515 | + ) | |
| 516 | +		) { | |
| 517 | +			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); | |
| 518 | + if ( | |
| 519 | + is_array($related_for_icon) | |
| 520 | + && isset($related_for_icon['css_class'], $related_for_icon['label']) | |
| 521 | +			) { | |
| 522 | + $items['view_related_messages'] = [ | |
| 523 | + 'class' => $related_for_icon['css_class'], | |
| 524 | + 'desc' => $related_for_icon['label'], | |
| 525 | + ]; | |
| 526 | + } | |
| 527 | + } | |
| 528 | + | |
| 529 | + $items = apply_filters( | |
| 530 | + 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', | |
| 531 | + array_merge( | |
| 532 | + $items, | |
| 533 | + [ | |
| 534 | + 'view_details' => [ | |
| 535 | + 'class' => 'dashicons dashicons-cart', | |
| 536 | +						'desc'  => esc_html__('View Transaction Details', 'event_espresso'), | |
| 537 | + ], | |
| 538 | + 'view_invoice' => [ | |
| 539 | + 'class' => 'dashicons dashicons-media-spreadsheet', | |
| 540 | +						'desc'  => esc_html__('View Transaction Invoice', 'event_espresso'), | |
| 541 | + ], | |
| 542 | + 'view_receipt' => [ | |
| 543 | + 'class' => 'dashicons dashicons-text-page', | |
| 544 | +						'desc'  => esc_html__('View Transaction Receipt', 'event_espresso'), | |
| 545 | + ], | |
| 546 | + 'view_registration' => [ | |
| 547 | + 'class' => 'dashicons dashicons-clipboard', | |
| 548 | +						'desc'  => esc_html__('View Registration Details', 'event_espresso'), | |
| 549 | + ], | |
| 550 | + 'payment_overview_link' => [ | |
| 551 | + 'class' => 'dashicons dashicons-money', | |
| 552 | +						'desc'  => esc_html__('Make Payment on Frontend', 'event_espresso'), | |
| 553 | + ], | |
| 554 | + ] | |
| 555 | + ) | |
| 556 | + ); | |
| 557 | + | |
| 558 | + if ( | |
| 559 | +			EEH_MSG_Template::is_mt_active('payment_reminder') | |
| 560 | + && $this->capabilities->current_user_can( | |
| 561 | + 'ee_send_message', | |
| 562 | + 'espresso_transactions_send_payment_reminder' | |
| 563 | + ) | |
| 564 | +		) { | |
| 565 | + $items['send_payment_reminder'] = [ | |
| 566 | + 'class' => 'dashicons dashicons-email-alt', | |
| 567 | +				'desc'  => esc_html__('Send Payment Reminder', 'event_espresso'), | |
| 568 | + ]; | |
| 569 | +		} else { | |
| 570 | + $items['blank*'] = [ | |
| 571 | + 'class' => '', | |
| 572 | + 'desc' => '', | |
| 573 | + ]; | |
| 574 | + } | |
| 575 | + $more_items = apply_filters( | |
| 576 | + 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', | |
| 577 | + [ | |
| 578 | + 'overpaid' => [ | |
| 579 | + 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::overpaid_status_code, | |
| 580 | + 'desc' => EEH_Template::pretty_status( | |
| 581 | + EEM_Transaction::overpaid_status_code, | |
| 582 | + false, | |
| 583 | + 'sentence' | |
| 584 | + ), | |
| 585 | + ], | |
| 586 | + 'complete' => [ | |
| 587 | + 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::complete_status_code, | |
| 588 | + 'desc' => EEH_Template::pretty_status( | |
| 589 | + EEM_Transaction::complete_status_code, | |
| 590 | + false, | |
| 591 | + 'sentence' | |
| 592 | + ), | |
| 593 | + ], | |
| 594 | + 'incomplete' => [ | |
| 595 | + 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::incomplete_status_code, | |
| 596 | + 'desc' => EEH_Template::pretty_status( | |
| 597 | + EEM_Transaction::incomplete_status_code, | |
| 598 | + false, | |
| 599 | + 'sentence' | |
| 600 | + ), | |
| 601 | + ], | |
| 602 | + 'abandoned' => [ | |
| 603 | + 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::abandoned_status_code, | |
| 604 | + 'desc' => EEH_Template::pretty_status( | |
| 605 | + EEM_Transaction::abandoned_status_code, | |
| 606 | + false, | |
| 607 | + 'sentence' | |
| 608 | + ), | |
| 609 | + ], | |
| 610 | + 'failed' => [ | |
| 611 | + 'class' => 'ee-status-legend ee-status-bg--' . EEM_Transaction::failed_status_code, | |
| 612 | + 'desc' => EEH_Template::pretty_status( | |
| 613 | + EEM_Transaction::failed_status_code, | |
| 614 | + false, | |
| 615 | + 'sentence' | |
| 616 | + ), | |
| 617 | + ], | |
| 618 | + ] | |
| 619 | + ); | |
| 620 | + | |
| 621 | + return array_merge($items, $more_items); | |
| 622 | + } | |
| 623 | + | |
| 624 | + | |
| 625 | + /** | |
| 626 | + * _transactions_overview_list_table | |
| 627 | + * | |
| 628 | + * @access protected | |
| 629 | + * @return void | |
| 630 | + * @throws DomainException | |
| 631 | + * @throws EE_Error | |
| 632 | + * @throws InvalidArgumentException | |
| 633 | + * @throws InvalidDataTypeException | |
| 634 | + * @throws InvalidInterfaceException | |
| 635 | + * @throws ReflectionException | |
| 636 | + */ | |
| 637 | + protected function _transactions_overview_list_table() | |
| 638 | +	{ | |
| 639 | +		$this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); | |
| 640 | + | |
| 641 | +		$EVT_ID                                    = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 642 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); | |
| 643 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event | |
| 644 | + ? sprintf( | |
| 645 | +				esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), | |
| 646 | + '<h3>', | |
| 647 | + '<a href="' | |
| 648 | + . EE_Admin_Page::add_query_args_and_nonce( | |
| 649 | + ['action' => 'edit', 'post' => $event->ID()], | |
| 650 | + EVENTS_ADMIN_URL | |
| 651 | + ) | |
| 652 | + . '" aria-label="' | |
| 653 | +				. esc_attr__('Click to Edit event', 'event_espresso') | |
| 654 | + . '">' . $event->name() . '</a>', | |
| 655 | + '</h3>' | |
| 656 | + ) | |
| 657 | + : ''; | |
| 658 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); | |
| 659 | + $this->display_admin_list_table_page_with_no_sidebar(); | |
| 660 | + } | |
| 661 | + | |
| 662 | + | |
| 663 | + /** | |
| 664 | + * _transaction_details | |
| 665 | + * generates HTML for the View Transaction Details Admin page | |
| 666 | + * | |
| 667 | + * @access protected | |
| 668 | + * @return void | |
| 669 | + * @throws DomainException | |
| 670 | + * @throws EE_Error | |
| 671 | + * @throws InvalidArgumentException | |
| 672 | + * @throws InvalidDataTypeException | |
| 673 | + * @throws InvalidInterfaceException | |
| 674 | + * @throws RuntimeException | |
| 675 | + * @throws ReflectionException | |
| 676 | + */ | |
| 677 | + protected function _transaction_details() | |
| 678 | +	{ | |
| 679 | +		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); | |
| 680 | + | |
| 681 | + $this->_set_transaction_status_array(); | |
| 682 | + | |
| 683 | + $this->_template_args = []; | |
| 684 | + $this->_template_args['transactions_page'] = $this->_wp_page_slug; | |
| 685 | + | |
| 686 | + $this->_set_transaction_object(); | |
| 687 | + | |
| 688 | +		if (! $this->_transaction instanceof EE_Transaction) { | |
| 689 | + return; | |
| 690 | + } | |
| 691 | + | |
| 692 | + $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); | |
| 693 | +		$this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso'); | |
| 694 | + | |
| 695 | +		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); | |
| 696 | +		$this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso'); | |
| 697 | + | |
| 698 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->status_ID() ]; | |
| 699 | +		$this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso'); | |
| 700 | + $this->_template_args['txn_status']['class'] = $this->_transaction->status_ID(); | |
| 701 | + | |
| 702 | + $txn_total = $this->_transaction->total(); | |
| 703 | + $total_paid = $this->_transaction->paid(); | |
| 704 | + $amount_due = $txn_total - $total_paid; | |
| 705 | + | |
| 706 | + $this->_template_args['grand_total'] = $txn_total; | |
| 707 | + $this->_template_args['total_paid'] = $total_paid; | |
| 708 | + | |
| 709 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, false, false); | |
| 710 | + $this->_template_args['amount_due_raw'] = $amount_due; | |
| 711 | + | |
| 712 | + $this->_template_args['amount_due_class'] = ''; | |
| 713 | + | |
| 714 | +		if ($txn_total === (float) 0) { | |
| 715 | + // free event | |
| 716 | + $this->_template_args['amount_due'] = false; | |
| 717 | +		} elseif ($amount_due < (float) 0) { | |
| 718 | + // overpaid | |
| 719 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; | |
| 720 | +		} elseif ($amount_due > (float) 0) { | |
| 721 | + // monies owing | |
| 722 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn ee-txn-amount-owing'; | |
| 723 | +		} elseif ($total_paid === (float) 0) { | |
| 724 | + // no payments made yet | |
| 725 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; | |
| 726 | + } | |
| 727 | + | |
| 728 | + $payment_method = $this->_transaction->payment_method(); | |
| 729 | + | |
| 730 | + $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method | |
| 731 | + ? $payment_method->admin_name() | |
| 732 | +			: esc_html__('Unknown', 'event_espresso'); | |
| 733 | + | |
| 734 | + $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; | |
| 735 | + // link back to overview | |
| 736 | + $this->_template_args['txn_overview_url'] = $this->request->getServerParam( | |
| 737 | + 'HTTP_REFERER', | |
| 738 | + TXN_ADMIN_URL | |
| 739 | + ); | |
| 740 | + | |
| 741 | + | |
| 742 | + // next link | |
| 743 | + $next_txn = $this->_transaction->next( | |
| 744 | + null, | |
| 745 | + [['STS_ID' => ['!=', EEM_Transaction::failed_status_code]]], | |
| 746 | + 'TXN_ID' | |
| 747 | + ); | |
| 748 | + $this->_template_args['next_transaction'] = $next_txn | |
| 749 | + ? $this->_next_link( | |
| 750 | + EE_Admin_Page::add_query_args_and_nonce( | |
| 751 | + ['action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']], | |
| 752 | + TXN_ADMIN_URL | |
| 753 | + ), | |
| 754 | + 'dashicons dashicons-arrow-right ee-icon-size-22' | |
| 755 | + ) | |
| 756 | + : ''; | |
| 757 | + // previous link | |
| 758 | + $previous_txn = $this->_transaction->previous( | |
| 759 | + null, | |
| 760 | + [['STS_ID' => ['!=', EEM_Transaction::failed_status_code]]], | |
| 761 | + 'TXN_ID' | |
| 762 | + ); | |
| 763 | + $this->_template_args['previous_transaction'] = $previous_txn | |
| 764 | + ? $this->_previous_link( | |
| 765 | + EE_Admin_Page::add_query_args_and_nonce( | |
| 766 | + ['action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']], | |
| 767 | + TXN_ADMIN_URL | |
| 768 | + ), | |
| 769 | + 'dashicons dashicons-arrow-left ee-icon-size-22' | |
| 770 | + ) | |
| 771 | + : ''; | |
| 772 | + | |
| 773 | +		$EVT_ID        = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 774 | +		$event_name    = $this->request->getRequestParam('event_name'); | |
| 775 | +		$redirect_from = $this->request->getRequestParam('redirect_from', '', 'url'); | |
| 776 | + | |
| 777 | + // were we just redirected here after adding a new registration ??? | |
| 778 | +		if ($EVT_ID && $event_name && $redirect_from) { | |
| 779 | + if ( | |
| 780 | + $this->capabilities->current_user_can( | |
| 781 | + 'ee_edit_registrations', | |
| 782 | + 'espresso_registrations_new_registration', | |
| 783 | + $EVT_ID | |
| 784 | + ) | |
| 785 | +			) { | |
| 786 | + $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button--primary" href="'; | |
| 787 | + $this->_admin_page_title .= EE_Admin_Page::add_query_args_and_nonce( | |
| 788 | + [ | |
| 789 | + 'page' => 'espresso_registrations', | |
| 790 | + 'action' => 'new_registration', | |
| 791 | + 'return' => 'default', | |
| 792 | + 'TXN_ID' => $this->_transaction->ID(), | |
| 793 | + 'event_id' => $EVT_ID, | |
| 794 | + ], | |
| 795 | + REG_ADMIN_URL | |
| 796 | + ); | |
| 797 | + $this->_admin_page_title .= '">'; | |
| 798 | + | |
| 799 | + $this->_admin_page_title .= sprintf( | |
| 800 | +					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'), | |
| 801 | + htmlentities(urldecode($event_name), ENT_QUOTES, 'UTF-8') | |
| 802 | + ); | |
| 803 | + $this->_admin_page_title .= '</a>'; | |
| 804 | + } | |
| 805 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); | |
| 806 | + } | |
| 807 | + // grab messages at the last second | |
| 808 | + $this->_template_args['notices'] = EE_Error::get_notices(); | |
| 809 | + // path to template | |
| 810 | + $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; | |
| 811 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template( | |
| 812 | + $template_path, | |
| 813 | + $this->_template_args, | |
| 814 | + true | |
| 815 | + ); | |
| 816 | + | |
| 817 | + // the details template wrapper | |
| 818 | + $this->display_admin_page_with_sidebar(); | |
| 819 | + } | |
| 820 | + | |
| 821 | + | |
| 822 | + /** | |
| 823 | + * _transaction_details_metaboxes | |
| 824 | + * | |
| 825 | + * @access protected | |
| 826 | + * @return void | |
| 827 | + * @throws EE_Error | |
| 828 | + * @throws InvalidArgumentException | |
| 829 | + * @throws InvalidDataTypeException | |
| 830 | + * @throws InvalidInterfaceException | |
| 831 | + * @throws RuntimeException | |
| 832 | + * @throws ReflectionException | |
| 833 | + */ | |
| 834 | + protected function _transaction_details_metaboxes() | |
| 835 | +	{ | |
| 836 | + $this->_set_transaction_object(); | |
| 837 | + | |
| 838 | +		if (! $this->_transaction instanceof EE_Transaction) { | |
| 839 | + return; | |
| 840 | + } | |
| 841 | + $this->addMetaBox( | |
| 842 | + 'edit-txn-details-mbox', | |
| 843 | +			'<span>' . esc_html__('Transaction Details', 'event_espresso') | |
| 844 | + . ' <span class="dashicons dashicons-cart" ></span></span>', | |
| 845 | + [$this, 'txn_details_meta_box'], | |
| 846 | + $this->_wp_page_slug | |
| 847 | + ); | |
| 848 | + $this->addMetaBox( | |
| 849 | + 'edit-txn-attendees-mbox', | |
| 850 | +			'<span>' . esc_html__('Attendees Registered in this Transaction', 'event_espresso') | |
| 851 | + . ' <span class="dashicons dashicons-groups" ></span></span>', | |
| 852 | + [$this, 'txn_attendees_meta_box'], | |
| 853 | + $this->_wp_page_slug, | |
| 854 | + 'normal', | |
| 855 | + 'high', | |
| 856 | + ['TXN_ID' => $this->_transaction->ID()] | |
| 857 | + ); | |
| 858 | + $this->addMetaBox( | |
| 859 | + 'edit-txn-registrant-mbox', | |
| 860 | +			esc_html__('Primary Contact', 'event_espresso'), | |
| 861 | + [$this, 'txn_registrant_side_meta_box'], | |
| 862 | + $this->_wp_page_slug, | |
| 863 | + 'side' | |
| 864 | + ); | |
| 865 | + $this->addMetaBox( | |
| 866 | + 'edit-txn-billing-info-mbox', | |
| 867 | +			esc_html__('Billing Information', 'event_espresso'), | |
| 868 | + [$this, 'txn_billing_info_side_meta_box'], | |
| 869 | + $this->_wp_page_slug, | |
| 870 | + 'side' | |
| 871 | + ); | |
| 872 | + } | |
| 873 | + | |
| 874 | + | |
| 875 | + /** | |
| 876 | + * Callback for transaction actions metabox. | |
| 877 | + * | |
| 878 | + * @param EE_Transaction|null $transaction | |
| 879 | + * @return string | |
| 880 | + * @throws DomainException | |
| 881 | + * @throws EE_Error | |
| 882 | + * @throws InvalidArgumentException | |
| 883 | + * @throws InvalidDataTypeException | |
| 884 | + * @throws InvalidInterfaceException | |
| 885 | + * @throws ReflectionException | |
| 886 | + * @throws RuntimeException | |
| 887 | + */ | |
| 888 | + public function getActionButtons(EE_Transaction $transaction = null) | |
| 889 | +	{ | |
| 890 | + $content = ''; | |
| 891 | + $actions = []; | |
| 892 | +		if (! $transaction instanceof EE_Transaction) { | |
| 893 | + return $content; | |
| 894 | + } | |
| 895 | + /** @var EE_Registration $primary_registration */ | |
| 896 | + $primary_registration = $transaction->primary_registration(); | |
| 897 | + $attendee = $primary_registration instanceof EE_Registration | |
| 898 | + ? $primary_registration->attendee() | |
| 899 | + : null; | |
| 900 | + | |
| 901 | + if ( | |
| 902 | + $attendee instanceof EE_Attendee | |
| 903 | + && $this->capabilities->current_user_can( | |
| 904 | + 'ee_send_message', | |
| 905 | + 'espresso_transactions_send_payment_reminder' | |
| 906 | + ) | |
| 907 | +		) { | |
| 908 | + $actions['payment_reminder'] = | |
| 909 | +				EEH_MSG_Template::is_mt_active('payment_reminder') | |
| 910 | + && $this->_transaction->status_ID() !== EEM_Transaction::complete_status_code | |
| 911 | + && $this->_transaction->status_ID() !== EEM_Transaction::overpaid_status_code | |
| 912 | + ? EEH_Template::get_button_or_link( | |
| 913 | + EE_Admin_Page::add_query_args_and_nonce( | |
| 914 | + [ | |
| 915 | + 'action' => 'send_payment_reminder', | |
| 916 | + 'TXN_ID' => $this->_transaction->ID(), | |
| 917 | + 'redirect_to' => 'view_transaction', | |
| 918 | + ], | |
| 919 | + TXN_ADMIN_URL | |
| 920 | + ), | |
| 921 | +						esc_html__(' Send Payment Reminder', 'event_espresso'), | |
| 922 | + 'button button--secondary', | |
| 923 | + 'dashicons dashicons-email-alt' | |
| 924 | + ) | |
| 925 | + : ''; | |
| 926 | + } | |
| 927 | + | |
| 928 | + if ( | |
| 929 | + $this->capabilities->current_user_can( | |
| 930 | + 'ee_edit_payments', | |
| 931 | + 'espresso_transactions_recalculate_line_items' | |
| 932 | + ) | |
| 933 | +		) { | |
| 934 | + $actions['recalculate_line_items'] = EEH_Template::get_button_or_link( | |
| 935 | + EE_Admin_Page::add_query_args_and_nonce( | |
| 936 | + [ | |
| 937 | + 'action' => 'espresso_recalculate_line_items', | |
| 938 | + 'TXN_ID' => $this->_transaction->ID(), | |
| 939 | + 'redirect_to' => 'view_transaction', | |
| 940 | + ], | |
| 941 | + TXN_ADMIN_URL | |
| 942 | + ), | |
| 943 | +				esc_html__(' Recalculate Taxes and Total', 'event_espresso'), | |
| 944 | + 'button button--secondary', | |
| 945 | + 'dashicons dashicons-update' | |
| 946 | + ); | |
| 947 | + } | |
| 948 | + | |
| 949 | + if ( | |
| 950 | + $primary_registration instanceof EE_Registration | |
| 951 | +			&& EEH_MSG_Template::is_mt_active('receipt') | |
| 952 | +		) { | |
| 953 | + $actions['receipt'] = EEH_Template::get_button_or_link( | |
| 954 | + $primary_registration->receipt_url(), | |
| 955 | +				esc_html__('View Receipt', 'event_espresso'), | |
| 956 | + 'button button--secondary', | |
| 957 | + 'dashicons dashicons-text-page' | |
| 958 | + ); | |
| 959 | + } | |
| 960 | + | |
| 961 | + if ( | |
| 962 | + $primary_registration instanceof EE_Registration | |
| 963 | +			&& EEH_MSG_Template::is_mt_active('invoice') | |
| 964 | +		) { | |
| 965 | + $actions['invoice'] = EEH_Template::get_button_or_link( | |
| 966 | + $primary_registration->invoice_url(), | |
| 967 | +				esc_html__('View Invoice', 'event_espresso'), | |
| 968 | + 'button button--secondary', | |
| 969 | + 'dashicons dashicons-media-spreadsheet' | |
| 970 | + ); | |
| 971 | + } | |
| 972 | + $actions = array_filter( | |
| 973 | +			apply_filters('FHEE__Transactions_Admin_Page__getActionButtons__actions', $actions, $transaction) | |
| 974 | + ); | |
| 975 | +		if ($actions) { | |
| 976 | +			$content .= implode('', $actions); | |
| 977 | + } | |
| 978 | + return $content; | |
| 979 | + } | |
| 980 | + | |
| 981 | + | |
| 982 | + /** | |
| 983 | + * txn_details_meta_box | |
| 984 | + * generates HTML for the Transaction main meta box | |
| 985 | + * | |
| 986 | + * @return void | |
| 987 | + * @throws DomainException | |
| 988 | + * @throws EE_Error | |
| 989 | + * @throws InvalidArgumentException | |
| 990 | + * @throws InvalidDataTypeException | |
| 991 | + * @throws InvalidInterfaceException | |
| 992 | + * @throws RuntimeException | |
| 993 | + * @throws ReflectionException | |
| 994 | + */ | |
| 995 | + public function txn_details_meta_box() | |
| 996 | +	{ | |
| 997 | + $this->_set_transaction_object(); | |
| 998 | + $this->_template_args['TXN_ID'] = $this->_transaction->ID(); | |
| 999 | + $this->_template_args['attendee'] = | |
| 1000 | + $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1001 | + ? $this->_transaction->primary_registration()->attendee() | |
| 1002 | + : null; | |
| 1003 | + $this->_template_args['can_edit_payments'] = $this->capabilities->current_user_can( | |
| 1004 | + 'ee_edit_payments', | |
| 1005 | + 'apply_payment_or_refund_from_registration_details' | |
| 1006 | + ); | |
| 1007 | + $this->_template_args['can_delete_payments'] = $this->capabilities->current_user_can( | |
| 1008 | + 'ee_delete_payments', | |
| 1009 | + 'delete_payment_from_registration_details' | |
| 1010 | + ); | |
| 1011 | + | |
| 1012 | + // get line table | |
| 1013 | + EEH_Autoloader::register_line_item_display_autoloaders(); | |
| 1014 | + $Line_Item_Display = new EE_Line_Item_Display( | |
| 1015 | + 'admin_table', | |
| 1016 | + 'EE_Admin_Table_Line_Item_Display_Strategy' | |
| 1017 | + ); | |
| 1018 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( | |
| 1019 | + $this->_transaction->total_line_item() | |
| 1020 | + ); | |
| 1021 | + $this->_template_args['REG_code'] = | |
| 1022 | + $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1023 | + ? $this->_transaction->primary_registration()->reg_code() | |
| 1024 | + : null; | |
| 1025 | + // process taxes | |
| 1026 | + $taxes = $this->_transaction->line_items([['LIN_type' => EEM_Line_Item::type_tax]]); | |
| 1027 | + $this->_template_args['taxes'] = ! empty($taxes) | |
| 1028 | + ? $taxes | |
| 1029 | + : false; | |
| 1030 | + | |
| 1031 | + $this->_template_args['grand_total'] = EEH_Template::format_currency( | |
| 1032 | + $this->_transaction->total(), | |
| 1033 | + false, | |
| 1034 | + false | |
| 1035 | + ); | |
| 1036 | + $this->_template_args['grand_raw_total'] = $this->_transaction->total(); | |
| 1037 | + $this->_template_args['TXN_status'] = $this->_transaction->status_ID(); | |
| 1038 | + | |
| 1039 | + // process payment details | |
| 1040 | + $payments = $this->_transaction->payments(); | |
| 1041 | +		if (! empty($payments)) { | |
| 1042 | + $this->_template_args['payments'] = $payments; | |
| 1043 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); | |
| 1044 | +		} else { | |
| 1045 | + $this->_template_args['payments'] = false; | |
| 1046 | + $this->_template_args['existing_reg_payments'] = []; | |
| 1047 | + } | |
| 1048 | + | |
| 1049 | + $this->_template_args['edit_payment_url'] = add_query_arg(['action' => 'edit_payment'], TXN_ADMIN_URL); | |
| 1050 | + $this->_template_args['delete_payment_url'] = add_query_arg( | |
| 1051 | + ['action' => 'espresso_delete_payment'], | |
| 1052 | + TXN_ADMIN_URL | |
| 1053 | + ); | |
| 1054 | + | |
| 1055 | +		if (isset($txn_details['invoice_number'])) { | |
| 1056 | + $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; | |
| 1057 | + $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( | |
| 1058 | + 'Invoice Number', | |
| 1059 | + 'event_espresso' | |
| 1060 | + ); | |
| 1061 | + } | |
| 1062 | + | |
| 1063 | + $this->_template_args['txn_details']['registration_session']['value'] = | |
| 1064 | + $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1065 | + ? $this->_transaction->primary_registration()->session_ID() | |
| 1066 | + : null; | |
| 1067 | + $this->_template_args['txn_details']['registration_session']['label'] = esc_html__( | |
| 1068 | + 'Registration Session', | |
| 1069 | + 'event_espresso' | |
| 1070 | + ); | |
| 1071 | + | |
| 1072 | + $this->_template_args['txn_details']['ip_address']['value'] = $this->_session['ip_address'] ?? ''; | |
| 1073 | + $this->_template_args['txn_details']['ip_address']['label'] = esc_html__( | |
| 1074 | + 'Transaction placed from IP', | |
| 1075 | + 'event_espresso' | |
| 1076 | + ); | |
| 1077 | + | |
| 1078 | + $this->_template_args['txn_details']['user_agent']['value'] = $this->_session['user_agent'] ?? ''; | |
| 1079 | + $this->_template_args['txn_details']['user_agent']['label'] = esc_html__( | |
| 1080 | + 'Registrant User Agent', | |
| 1081 | + 'event_espresso' | |
| 1082 | + ); | |
| 1083 | + | |
| 1084 | + $reg_steps = '<div class="ee-txn-reg-step-status-steps ee-layout-row">'; | |
| 1085 | +		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { | |
| 1086 | +			if ($reg_step_status === true) { | |
| 1087 | + $reg_steps .= '<div class="ee-status-pill ee-status-bg--success">' | |
| 1088 | + . sprintf( | |
| 1089 | +								  esc_html__('%1$s : Completed', 'event_espresso'), | |
| 1090 | +								  ucwords(str_replace('_', ' ', $reg_step)) | |
| 1091 | + ) | |
| 1092 | + . '</div>'; | |
| 1093 | +			} elseif ($reg_step_status !== false && is_numeric($reg_step_status)) { | |
| 1094 | + $reg_steps .= '<div class="ee-status-pill ee-status-bg--attention">' | |
| 1095 | + . sprintf( | |
| 1096 | +								  esc_html__('%1$s : Initiated %2$s', 'event_espresso'), | |
| 1097 | +								  ucwords(str_replace('_', ' ', $reg_step)), | |
| 1098 | + date( | |
| 1099 | +									  get_option('date_format') . ' ' . get_option('time_format'), | |
| 1100 | +									  $reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS) | |
| 1101 | + ) | |
| 1102 | + ) | |
| 1103 | + . '</div>'; | |
| 1104 | +			} else { | |
| 1105 | + $reg_steps .= '<div class="ee-status-pill ee-status-bg--error">' | |
| 1106 | + . sprintf( | |
| 1107 | +								  esc_html__('%1$s : Never Initiated', 'event_espresso'), | |
| 1108 | +								  ucwords(str_replace('_', ' ', $reg_step)) | |
| 1109 | + ) | |
| 1110 | + . '</div>'; | |
| 1111 | + } | |
| 1112 | + } | |
| 1113 | + $reg_steps .= '</ul>'; | |
| 1114 | + $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; | |
| 1115 | + $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( | |
| 1116 | + 'Registration Step Progress', | |
| 1117 | + 'event_espresso' | |
| 1118 | + ); | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + $this->_get_registrations_to_apply_payment_to(); | |
| 1122 | + $this->_get_payment_methods($payments); | |
| 1123 | + $this->_get_payment_status_array(); | |
| 1124 | + $this->_get_reg_status_selection(); // sets up the template args for the reg status array for the transaction. | |
| 1125 | + | |
| 1126 | + $this->_template_args['transaction_form_url'] = add_query_arg( | |
| 1127 | + [ | |
| 1128 | + 'action' => 'edit_transaction', | |
| 1129 | + 'process' => 'transaction', | |
| 1130 | + ], | |
| 1131 | + TXN_ADMIN_URL | |
| 1132 | + ); | |
| 1133 | + $this->_template_args['apply_payment_form_url'] = add_query_arg( | |
| 1134 | + [ | |
| 1135 | + 'page' => 'espresso_transactions', | |
| 1136 | + 'action' => 'espresso_apply_payment', | |
| 1137 | + ], | |
| 1138 | + TXN_ADMIN_URL | |
| 1139 | + ); | |
| 1140 | + $this->_template_args['delete_payment_form_url'] = add_query_arg( | |
| 1141 | + [ | |
| 1142 | + 'page' => 'espresso_transactions', | |
| 1143 | + 'action' => 'espresso_delete_payment', | |
| 1144 | + ], | |
| 1145 | + TXN_ADMIN_URL | |
| 1146 | + ); | |
| 1147 | + | |
| 1148 | + $this->_template_args['action_buttons'] = $this->getActionButtons($this->_transaction); | |
| 1149 | + | |
| 1150 | + // 'espresso_delete_payment_nonce' | |
| 1151 | + | |
| 1152 | + $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; | |
| 1153 | + echo EEH_Template::display_template($template_path, $this->_template_args, true); | |
| 1154 | + } | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + /** | |
| 1158 | + * _get_registration_payment_IDs | |
| 1159 | + * generates an array of Payment IDs and their corresponding Registration IDs | |
| 1160 | + * | |
| 1161 | + * @access protected | |
| 1162 | + * @param EE_Payment[] $payments | |
| 1163 | + * @return array | |
| 1164 | + * @throws EE_Error | |
| 1165 | + * @throws InvalidArgumentException | |
| 1166 | + * @throws InvalidDataTypeException | |
| 1167 | + * @throws InvalidInterfaceException | |
| 1168 | + * @throws ReflectionException | |
| 1169 | + */ | |
| 1170 | + protected function _get_registration_payment_IDs($payments = []) | |
| 1171 | +	{ | |
| 1172 | + $existing_reg_payments = []; | |
| 1173 | + // get all reg payments for these payments | |
| 1174 | + $reg_payments = EEM_Registration_Payment::instance()->get_all( | |
| 1175 | + [ | |
| 1176 | + [ | |
| 1177 | + 'PAY_ID' => [ | |
| 1178 | + 'IN', | |
| 1179 | + array_keys($payments), | |
| 1180 | + ], | |
| 1181 | + ], | |
| 1182 | + ] | |
| 1183 | + ); | |
| 1184 | +		if (! empty($reg_payments)) { | |
| 1185 | +			foreach ($payments as $payment) { | |
| 1186 | +				if (! $payment instanceof EE_Payment) { | |
| 1187 | + continue; | |
| 1188 | +				} elseif (! isset($existing_reg_payments[ $payment->ID() ])) { | |
| 1189 | + $existing_reg_payments[ $payment->ID() ] = []; | |
| 1190 | + } | |
| 1191 | +				foreach ($reg_payments as $reg_payment) { | |
| 1192 | + if ( | |
| 1193 | + $reg_payment instanceof EE_Registration_Payment | |
| 1194 | + && $reg_payment->payment_ID() === $payment->ID() | |
| 1195 | +					) { | |
| 1196 | + $existing_reg_payments[ $payment->ID() ][] = $reg_payment->registration_ID(); | |
| 1197 | + } | |
| 1198 | + } | |
| 1199 | + } | |
| 1200 | + } | |
| 1201 | + | |
| 1202 | + return $existing_reg_payments; | |
| 1203 | + } | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + /** | |
| 1207 | + * _get_registrations_to_apply_payment_to | |
| 1208 | + * generates HTML for displaying a series of checkboxes in the admin payment modal window | |
| 1209 | + * which allows the admin to only apply the payment to the specific registrations | |
| 1210 | + * | |
| 1211 | + * @access protected | |
| 1212 | + * @return void | |
| 1213 | + * @throws EE_Error | |
| 1214 | + * @throws InvalidArgumentException | |
| 1215 | + * @throws InvalidDataTypeException | |
| 1216 | + * @throws InvalidInterfaceException | |
| 1217 | + * @throws ReflectionException | |
| 1218 | + */ | |
| 1219 | + protected function _get_registrations_to_apply_payment_to() | |
| 1220 | +	{ | |
| 1221 | + // we want any registration with an active status (ie: not deleted or cancelled) | |
| 1222 | + $query_params = [ | |
| 1223 | + [ | |
| 1224 | + 'STS_ID' => [ | |
| 1225 | + 'IN', | |
| 1226 | + [ | |
| 1227 | + RegStatus::APPROVED, | |
| 1228 | + RegStatus::PENDING_PAYMENT, | |
| 1229 | + RegStatus::AWAITING_REVIEW, | |
| 1230 | + ], | |
| 1231 | + ], | |
| 1232 | + ], | |
| 1233 | + ]; | |
| 1234 | + $registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div( | |
| 1235 | + '', | |
| 1236 | + 'txn-admin-apply-payment-to-registrations-dv', | |
| 1237 | + '', | |
| 1238 | + 'clear: both; margin: 1.5em 0 0; display: none;' | |
| 1239 | + ); | |
| 1240 | +		$registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap'); | |
| 1241 | +		$registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl striped'); | |
| 1242 | + $registrations_to_apply_payment_to .= EEH_HTML::thead( | |
| 1243 | + EEH_HTML::tr( | |
| 1244 | +				EEH_HTML::th(esc_html__('ID', 'event_espresso')) . | |
| 1245 | +				EEH_HTML::th(esc_html__('Registrant', 'event_espresso')) . | |
| 1246 | +				EEH_HTML::th(esc_html__('Ticket', 'event_espresso')) . | |
| 1247 | +				EEH_HTML::th(esc_html__('Event', 'event_espresso')) . | |
| 1248 | +				EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr') . | |
| 1249 | +				EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr') . | |
| 1250 | +				EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr') | |
| 1251 | + ) | |
| 1252 | + ); | |
| 1253 | + $registrations_to_apply_payment_to .= EEH_HTML::tbody(); | |
| 1254 | + // get registrations for TXN | |
| 1255 | + $registrations = $this->_transaction->registrations($query_params); | |
| 1256 | + $existing_reg_payments = $this->_template_args['existing_reg_payments']; | |
| 1257 | +		foreach ($registrations as $registration) { | |
| 1258 | +			if ($registration instanceof EE_Registration) { | |
| 1259 | + $attendee_name = $registration->attendee() instanceof EE_Attendee | |
| 1260 | + ? $registration->attendee()->full_name() | |
| 1261 | +					: esc_html__('Unknown Attendee', 'event_espresso'); | |
| 1262 | + $owing = $registration->final_price() - $registration->paid(); | |
| 1263 | + $taxable = $registration->ticket()->taxable() | |
| 1264 | +					? ' <span class="smaller-text lt-grey-text"> ' . esc_html__('+ tax', 'event_espresso') . '</span>' | |
| 1265 | + : ''; | |
| 1266 | + $checked = empty($existing_reg_payments) | |
| 1267 | + || in_array($registration->ID(), $existing_reg_payments, true) | |
| 1268 | + ? ' checked' | |
| 1269 | + : ''; | |
| 1270 | + $disabled = $registration->final_price() > 0 | |
| 1271 | + ? '' | |
| 1272 | + : ' disabled'; | |
| 1273 | + $registrations_to_apply_payment_to .= EEH_HTML::tr( | |
| 1274 | + EEH_HTML::td($registration->ID()) . | |
| 1275 | + EEH_HTML::td($attendee_name) . | |
| 1276 | + EEH_HTML::td( | |
| 1277 | + $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable | |
| 1278 | + ) . | |
| 1279 | + EEH_HTML::td($registration->event_name()) . | |
| 1280 | + EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr') . | |
| 1281 | + EEH_HTML::td( | |
| 1282 | + EEH_Template::format_currency($owing), | |
| 1283 | + '', | |
| 1284 | + 'txn-admin-payment-owing-td jst-cntr' | |
| 1285 | + ) . | |
| 1286 | + EEH_HTML::td( | |
| 1287 | + '<input type="checkbox" value="' . $registration->ID() | |
| 1288 | + . '" name="txn_admin_payment[registrations]"' | |
| 1289 | + . $checked . $disabled . '>', | |
| 1290 | + '', | |
| 1291 | + 'jst-cntr' | |
| 1292 | + ), | |
| 1293 | + 'apply-payment-registration-row-' . $registration->ID() | |
| 1294 | + ); | |
| 1295 | + } | |
| 1296 | + } | |
| 1297 | + $registrations_to_apply_payment_to .= EEH_HTML::tbodyx(); | |
| 1298 | + $registrations_to_apply_payment_to .= EEH_HTML::tablex(); | |
| 1299 | + $registrations_to_apply_payment_to .= EEH_HTML::divx(); | |
| 1300 | + $registrations_to_apply_payment_to .= EEH_HTML::p( | |
| 1301 | + esc_html__( | |
| 1302 | + 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', | |
| 1303 | + 'event_espresso' | |
| 1304 | + ), | |
| 1305 | + '', | |
| 1306 | + 'clear description' | |
| 1307 | + ); | |
| 1308 | + $registrations_to_apply_payment_to .= EEH_HTML::divx(); | |
| 1309 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; | |
| 1310 | + } | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + /** | |
| 1314 | + * _get_reg_status_selection | |
| 1315 | + * | |
| 1316 | + * @return void | |
| 1317 | + * @throws EE_Error | |
| 1318 | + * @todo this will need to be adjusted either once MER comes along OR we move default reg status to tickets | |
| 1319 | + * instead of events. | |
| 1320 | + * @access protected | |
| 1321 | + */ | |
| 1322 | + protected function _get_reg_status_selection() | |
| 1323 | +	{ | |
| 1324 | + // first get all possible statuses | |
| 1325 | + $statuses = EEM_Registration::reg_status_array([], true); | |
| 1326 | + // let's add a "don't change" option. | |
| 1327 | +		$status_array['NAN']                                 = esc_html__('Leave the Same', 'event_espresso'); | |
| 1328 | + $status_array = array_merge($status_array, $statuses); | |
| 1329 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( | |
| 1330 | + 'txn_reg_status_change[reg_status]', | |
| 1331 | + $status_array, | |
| 1332 | + 'NAN', | |
| 1333 | + 'id="txn-admin-payment-reg-status-inp"', | |
| 1334 | + 'txn-reg-status-change-reg-status' | |
| 1335 | + ); | |
| 1336 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( | |
| 1337 | + 'delete_txn_reg_status_change[reg_status]', | |
| 1338 | + $status_array, | |
| 1339 | + 'NAN', | |
| 1340 | + 'delete-txn-admin-payment-reg-status-inp', | |
| 1341 | + 'delete-txn-reg-status-change-reg-status' | |
| 1342 | + ); | |
| 1343 | + } | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + /** | |
| 1347 | + * _get_payment_methods | |
| 1348 | + * Gets all the payment methods available generally, or the ones that are already | |
| 1349 | + * selected on these payments (in case their payment methods are no longer active). | |
| 1350 | + * Has the side-effect of updating the template args' payment_methods item | |
| 1351 | + * | |
| 1352 | + * @access private | |
| 1353 | + * @param EE_Payment[] to show on this page | |
| 1354 | + * @return void | |
| 1355 | + * @throws EE_Error | |
| 1356 | + * @throws InvalidArgumentException | |
| 1357 | + * @throws InvalidDataTypeException | |
| 1358 | + * @throws InvalidInterfaceException | |
| 1359 | + * @throws ReflectionException | |
| 1360 | + */ | |
| 1361 | + private function _get_payment_methods($payments = []) | |
| 1362 | +	{ | |
| 1363 | + $payment_methods_of_payments = []; | |
| 1364 | +		foreach ($payments as $payment) { | |
| 1365 | +			if ($payment instanceof EE_Payment) { | |
| 1366 | + $payment_methods_of_payments[] = $payment->ID(); | |
| 1367 | + } | |
| 1368 | + } | |
| 1369 | +		if ($payment_methods_of_payments) { | |
| 1370 | + $query_args = [ | |
| 1371 | + [ | |
| 1372 | + 'OR*payment_method_for_payment' => [ | |
| 1373 | + 'PMD_ID' => ['IN', $payment_methods_of_payments], | |
| 1374 | + 'PMD_scope' => ['LIKE', '%' . EEM_Payment_Method::scope_admin . '%'], | |
| 1375 | + ], | |
| 1376 | + ], | |
| 1377 | + ]; | |
| 1378 | +		} else { | |
| 1379 | + $query_args = [['PMD_scope' => ['LIKE', '%' . EEM_Payment_Method::scope_admin . '%']]]; | |
| 1380 | + } | |
| 1381 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); | |
| 1382 | + } | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + /** | |
| 1386 | + * txn_attendees_meta_box | |
| 1387 | + * generates HTML for the Attendees Transaction main meta box | |
| 1388 | + * | |
| 1389 | + * @access public | |
| 1390 | + * @param WP_Post $post | |
| 1391 | + * @param array $metabox | |
| 1392 | + * @return void | |
| 1393 | + * @throws DomainException | |
| 1394 | + * @throws EE_Error | |
| 1395 | + * @throws InvalidArgumentException | |
| 1396 | + * @throws InvalidDataTypeException | |
| 1397 | + * @throws InvalidInterfaceException | |
| 1398 | + * @throws ReflectionException | |
| 1399 | + */ | |
| 1400 | + public function txn_attendees_meta_box($post, $metabox = ['args' => []]) | |
| 1401 | +	{ | |
| 1402 | + /** @noinspection NonSecureExtractUsageInspection */ | |
| 1403 | + extract($metabox['args']); | |
| 1404 | + $this->_template_args['post'] = $post; | |
| 1405 | + $this->_template_args['event_attendees'] = []; | |
| 1406 | + // process items in cart | |
| 1407 | + $line_items = $this->_transaction->get_many_related( | |
| 1408 | + 'Line_Item', | |
| 1409 | + [['LIN_type' => 'line-item']] | |
| 1410 | + ); | |
| 1411 | +		if (! empty($line_items)) { | |
| 1412 | +			foreach ($line_items as $item) { | |
| 1413 | +				if ($item instanceof EE_Line_Item) { | |
| 1414 | +					switch ($item->OBJ_type()) { | |
| 1415 | + case 'Event': | |
| 1416 | + break; | |
| 1417 | + case 'Ticket': | |
| 1418 | + $ticket = $item->ticket(); | |
| 1419 | + // right now we're only handling tickets here. | |
| 1420 | + // Cause its expected that only tickets will have attendees right? | |
| 1421 | +							if (! $ticket instanceof EE_Ticket) { | |
| 1422 | + break; | |
| 1423 | + } | |
| 1424 | +							try { | |
| 1425 | + $event_name = $ticket->get_event_name(); | |
| 1426 | +							} catch (Exception $e) { | |
| 1427 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 1428 | +								$event_name = esc_html__('Unknown Event', 'event_espresso'); | |
| 1429 | + } | |
| 1430 | + $event_name .= ' - ' . $item->name(); | |
| 1431 | + $ticket_price = EEH_Template::format_currency($item->unit_price()); | |
| 1432 | + // now get all of the registrations for this transaction that use this ticket | |
| 1433 | + $registrations = $ticket->registrations( | |
| 1434 | + [['TXN_ID' => $this->_transaction->ID()]] | |
| 1435 | + ); | |
| 1436 | +							foreach ($registrations as $registration) { | |
| 1437 | +								if (! $registration instanceof EE_Registration) { | |
| 1438 | + break; | |
| 1439 | + } | |
| 1440 | + $this->_template_args['event_attendees'][ $registration->ID() ]['STS_ID'] | |
| 1441 | + = $registration->status_ID(); | |
| 1442 | + $this->_template_args['event_attendees'][ $registration->ID() ]['att_num'] | |
| 1443 | + = $registration->count(); | |
| 1444 | + $this->_template_args['event_attendees'][ $registration->ID() ]['event_ticket_name'] | |
| 1445 | + = $event_name; | |
| 1446 | + $this->_template_args['event_attendees'][ $registration->ID() ]['ticket_price'] | |
| 1447 | + = $ticket_price; | |
| 1448 | + // attendee info | |
| 1449 | +								$attendee = $registration->get_first_related('Attendee'); | |
| 1450 | +								if ($attendee instanceof EE_Attendee) { | |
| 1451 | + $this->_template_args['event_attendees'][ $registration->ID() ]['att_id'] | |
| 1452 | + = $attendee->ID(); | |
| 1453 | + $this->_template_args['event_attendees'][ $registration->ID() ]['attendee'] | |
| 1454 | + = $attendee->full_name(); | |
| 1455 | + $this->_template_args['event_attendees'][ $registration->ID() ]['email'] | |
| 1456 | + = '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name | |
| 1457 | + . esc_html__( | |
| 1458 | + ' Event', | |
| 1459 | + 'event_espresso' | |
| 1460 | + ) | |
| 1461 | + . '">' . $attendee->email() . '</a>'; | |
| 1462 | + $this->_template_args['event_attendees'][ $registration->ID() ]['address'] | |
| 1463 | + = EEH_Address::format($attendee, 'inline', false, false); | |
| 1464 | +								} else { | |
| 1465 | + $this->_template_args['event_attendees'][ $registration->ID() ]['att_id'] = ''; | |
| 1466 | + $this->_template_args['event_attendees'][ $registration->ID() ]['attendee'] = ''; | |
| 1467 | + $this->_template_args['event_attendees'][ $registration->ID() ]['email'] = ''; | |
| 1468 | + $this->_template_args['event_attendees'][ $registration->ID() ]['address'] = ''; | |
| 1469 | + } | |
| 1470 | + } | |
| 1471 | + break; | |
| 1472 | + } | |
| 1473 | + } | |
| 1474 | + } | |
| 1475 | + | |
| 1476 | + $this->_template_args['transaction_form_url'] = add_query_arg( | |
| 1477 | + [ | |
| 1478 | + 'action' => 'edit_transaction', | |
| 1479 | + 'process' => 'attendees', | |
| 1480 | + ], | |
| 1481 | + TXN_ADMIN_URL | |
| 1482 | + ); | |
| 1483 | + echo EEH_Template::display_template( | |
| 1484 | + TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', | |
| 1485 | + $this->_template_args, | |
| 1486 | + true | |
| 1487 | + ); | |
| 1488 | +		} else { | |
| 1489 | + printf( | |
| 1490 | + esc_html__( | |
| 1491 | + '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', | |
| 1492 | + 'event_espresso' | |
| 1493 | + ), | |
| 1494 | + '<p class="important-notice">', | |
| 1495 | + '</p>' | |
| 1496 | + ); | |
| 1497 | + } | |
| 1498 | + } | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + /** | |
| 1502 | + * txn_registrant_side_meta_box | |
| 1503 | + * generates HTML for the Edit Transaction side meta box | |
| 1504 | + * | |
| 1505 | + * @access public | |
| 1506 | + * @return void | |
| 1507 | + * @throws DomainException | |
| 1508 | + * @throws EE_Error | |
| 1509 | + * @throws InvalidArgumentException | |
| 1510 | + * @throws InvalidDataTypeException | |
| 1511 | + * @throws InvalidInterfaceException | |
| 1512 | + * @throws ReflectionException | |
| 1513 | + */ | |
| 1514 | + public function txn_registrant_side_meta_box() | |
| 1515 | +	{ | |
| 1516 | + $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration | |
| 1517 | +			? $this->_transaction->primary_registration()->get_first_related('Attendee') | |
| 1518 | + : null; | |
| 1519 | +		if (! $primary_att instanceof EE_Attendee) { | |
| 1520 | + $this->_template_args['no_attendee_message'] = esc_html__( | |
| 1521 | + 'There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', | |
| 1522 | + 'event_espresso' | |
| 1523 | + ); | |
| 1524 | + $primary_att = EEM_Attendee::instance()->create_default_object(); | |
| 1525 | + } | |
| 1526 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); | |
| 1527 | + $this->_template_args['prime_reg_fname'] = $primary_att->fname(); | |
| 1528 | + $this->_template_args['prime_reg_lname'] = $primary_att->lname(); | |
| 1529 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); | |
| 1530 | + $this->_template_args['prime_reg_phone'] = $primary_att->phone(); | |
| 1531 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( | |
| 1532 | + [ | |
| 1533 | + 'action' => 'edit_attendee', | |
| 1534 | + 'post' => $primary_att->ID(), | |
| 1535 | + ], | |
| 1536 | + REG_ADMIN_URL | |
| 1537 | + ); | |
| 1538 | + // get formatted address for registrant | |
| 1539 | + $formatted_address = EEH_Address::format($primary_att); | |
| 1540 | + $formatted_address = | |
| 1541 | + $formatted_address !== '<div class="espresso-address-dv"><div></div></div>' | |
| 1542 | + ? $formatted_address | |
| 1543 | + : ''; | |
| 1544 | + $this->_template_args['formatted_address'] = $formatted_address; | |
| 1545 | + echo EEH_Template::display_template( | |
| 1546 | + TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', | |
| 1547 | + $this->_template_args, | |
| 1548 | + true | |
| 1549 | + ); | |
| 1550 | + } | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + /** | |
| 1554 | + * txn_billing_info_side_meta_box | |
| 1555 | + * generates HTML for the Edit Transaction side meta box | |
| 1556 | + * | |
| 1557 | + * @access public | |
| 1558 | + * @return void | |
| 1559 | + * @throws DomainException | |
| 1560 | + */ | |
| 1561 | + public function txn_billing_info_side_meta_box() | |
| 1562 | +	{ | |
| 1563 | +		try { | |
| 1564 | + $this->_template_args['billing_form'] = $this->_transaction->billing_info(); | |
| 1565 | + $this->_template_args['billing_form_url'] = add_query_arg( | |
| 1566 | + ['action' => 'edit_transaction', 'process' => 'billing'], | |
| 1567 | + TXN_ADMIN_URL | |
| 1568 | + ); | |
| 1569 | +		} catch (Exception $e) { | |
| 1570 | + $this->_template_args['billing_form'] = []; | |
| 1571 | + $this->_template_args['billing_form_url'] = ''; | |
| 1572 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 1573 | + } | |
| 1574 | + | |
| 1575 | + $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; | |
| 1576 | + echo EEH_Template::display_template($template_path, $this->_template_args, true); | |
| 1577 | + } | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + /** | |
| 1581 | + * apply_payments_or_refunds | |
| 1582 | + * registers a payment or refund made towards a transaction | |
| 1583 | + * | |
| 1584 | + * @access public | |
| 1585 | + * @return void | |
| 1586 | + * @throws EE_Error | |
| 1587 | + * @throws InvalidArgumentException | |
| 1588 | + * @throws ReflectionException | |
| 1589 | + * @throws RuntimeException | |
| 1590 | + * @throws InvalidDataTypeException | |
| 1591 | + * @throws InvalidInterfaceException | |
| 1592 | + */ | |
| 1593 | + public function apply_payments_or_refunds() | |
| 1594 | +	{ | |
| 1595 | + $valid_data = $this->_validate_payment_request_data(); | |
| 1596 | + $has_access = $this->capabilities->current_user_can( | |
| 1597 | + 'ee_edit_payments', | |
| 1598 | + 'apply_payment_or_refund_from_registration_details' | |
| 1599 | + ); | |
| 1600 | +		$TXD_ID     = $this->request->getRequestParam('txn_admin_payment[TXN_ID]', 0, 'int'); | |
| 1601 | + $amount = 0; | |
| 1602 | +		if (! empty($valid_data) && $has_access) { | |
| 1603 | + $PAY_ID = $valid_data['PAY_ID']; | |
| 1604 | + // save the new payment | |
| 1605 | + $payment = $this->_create_payment_from_request_data($valid_data); | |
| 1606 | + $amount = $payment->amount(); | |
| 1607 | + // get the TXN for this payment | |
| 1608 | + $transaction = $payment->transaction(); | |
| 1609 | + // verify transaction | |
| 1610 | +			if ($transaction instanceof EE_Transaction) { | |
| 1611 | + // calculate_total_payments_and_update_status | |
| 1612 | + $this->_process_transaction_payments($transaction); | |
| 1613 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); | |
| 1614 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); | |
| 1615 | + // apply payment to registrations (if applicable) | |
| 1616 | +				if (! empty($REG_IDs)) { | |
| 1617 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); | |
| 1618 | + $this->_maybe_send_notifications(); | |
| 1619 | + // now process status changes for the same registrations | |
| 1620 | + $this->_process_registration_status_change($transaction, $REG_IDs); | |
| 1621 | + } | |
| 1622 | + $this->_maybe_send_notifications($payment); | |
| 1623 | + // prepare to render page | |
| 1624 | + do_action( | |
| 1625 | + 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', | |
| 1626 | + $transaction, | |
| 1627 | + $payment | |
| 1628 | + ); | |
| 1629 | +			} else { | |
| 1630 | + EE_Error::add_error( | |
| 1631 | + esc_html__( | |
| 1632 | + 'A valid Transaction for this payment could not be retrieved.', | |
| 1633 | + 'event_espresso' | |
| 1634 | + ), | |
| 1635 | + __FILE__, | |
| 1636 | + __FUNCTION__, | |
| 1637 | + __LINE__ | |
| 1638 | + ); | |
| 1639 | + } | |
| 1640 | +		} elseif ($has_access) { | |
| 1641 | + EE_Error::add_error( | |
| 1642 | + esc_html__( | |
| 1643 | + 'The payment form data could not be processed. Please try again.', | |
| 1644 | + 'event_espresso' | |
| 1645 | + ), | |
| 1646 | + __FILE__, | |
| 1647 | + __FUNCTION__, | |
| 1648 | + __LINE__ | |
| 1649 | + ); | |
| 1650 | +		} else { | |
| 1651 | + EE_Error::add_error( | |
| 1652 | + esc_html__( | |
| 1653 | + 'You do not have access to apply payments or refunds to a registration.', | |
| 1654 | + 'event_espresso' | |
| 1655 | + ), | |
| 1656 | + __FILE__, | |
| 1657 | + __FUNCTION__, | |
| 1658 | + __LINE__ | |
| 1659 | + ); | |
| 1660 | + } | |
| 1661 | + $query_args = [ | |
| 1662 | + 'page' => 'espresso_transactions', | |
| 1663 | + 'action' => 'view_transaction', | |
| 1664 | + 'TXN_ID' => $TXD_ID, | |
| 1665 | + ]; | |
| 1666 | + | |
| 1667 | + $this->_redirect_after_action( | |
| 1668 | + ! EE_Error::has_error(), | |
| 1669 | + $amount > 0 | |
| 1670 | +				? esc_html__('payment', 'event_espresso') | |
| 1671 | +				: esc_html__('refund', 'event_espresso'), | |
| 1672 | +			esc_html__('processed', 'event_espresso'), | |
| 1673 | + $query_args | |
| 1674 | + ); | |
| 1675 | + } | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + /** | |
| 1679 | + * _validate_payment_request_data | |
| 1680 | + * | |
| 1681 | + * @return array | |
| 1682 | + * @throws EE_Error | |
| 1683 | + * @throws InvalidArgumentException | |
| 1684 | + * @throws InvalidDataTypeException | |
| 1685 | + * @throws InvalidInterfaceException | |
| 1686 | + */ | |
| 1687 | + protected function _validate_payment_request_data() | |
| 1688 | +	{ | |
| 1689 | +		if (! $this->request->requestParamIsSet('txn_admin_payment')) { | |
| 1690 | + return []; | |
| 1691 | + } | |
| 1692 | + $payment_form = $this->_generate_payment_form_section(); | |
| 1693 | +		try { | |
| 1694 | +			if ($payment_form->was_submitted()) { | |
| 1695 | + $payment_form->receive_form_submission(); | |
| 1696 | +				if (! $payment_form->is_valid()) { | |
| 1697 | + $submission_error_messages = []; | |
| 1698 | +					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { | |
| 1699 | +						if ($validation_error instanceof EE_Validation_Error) { | |
| 1700 | + $form_input = $validation_error->get_form_section(); | |
| 1701 | + $submission_error_messages[] = sprintf( | |
| 1702 | +								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), | |
| 1703 | + $form_input instanceof EE_Form_Input_Base | |
| 1704 | + ? $form_input->html_label_text() | |
| 1705 | + : '', | |
| 1706 | + $validation_error->getMessage() | |
| 1707 | + ); | |
| 1708 | + } | |
| 1709 | + } | |
| 1710 | + EE_Error::add_error( | |
| 1711 | +						implode('<br />', $submission_error_messages), | |
| 1712 | + __FILE__, | |
| 1713 | + __FUNCTION__, | |
| 1714 | + __LINE__ | |
| 1715 | + ); | |
| 1716 | + return []; | |
| 1717 | + } | |
| 1718 | + } | |
| 1719 | +		} catch (EE_Error $e) { | |
| 1720 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 1721 | + return []; | |
| 1722 | + } | |
| 1723 | + | |
| 1724 | + return $payment_form->valid_data(); | |
| 1725 | + } | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + /** | |
| 1729 | + * _generate_payment_form_section | |
| 1730 | + * | |
| 1731 | + * @return EE_Form_Section_Proper | |
| 1732 | + * @throws EE_Error | |
| 1733 | + */ | |
| 1734 | + protected function _generate_payment_form_section() | |
| 1735 | +	{ | |
| 1736 | + return new EE_Form_Section_Proper( | |
| 1737 | + [ | |
| 1738 | + 'name' => 'txn_admin_payment', | |
| 1739 | + 'subsections' => [ | |
| 1740 | + 'PAY_ID' => new EE_Text_Input( | |
| 1741 | + [ | |
| 1742 | + 'default' => 0, | |
| 1743 | + 'required' => false, | |
| 1744 | +							'html_label_text'       => esc_html__('Payment ID', 'event_espresso'), | |
| 1745 | + 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1746 | + ] | |
| 1747 | + ), | |
| 1748 | + 'TXN_ID' => new EE_Text_Input( | |
| 1749 | + [ | |
| 1750 | + 'default' => 0, | |
| 1751 | + 'required' => true, | |
| 1752 | +							'html_label_text'       => esc_html__('Transaction ID', 'event_espresso'), | |
| 1753 | + 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1754 | + ] | |
| 1755 | + ), | |
| 1756 | + 'type' => new EE_Text_Input( | |
| 1757 | + [ | |
| 1758 | + 'default' => 1, | |
| 1759 | + 'required' => true, | |
| 1760 | +							'html_label_text'       => esc_html__('Payment or Refund', 'event_espresso'), | |
| 1761 | + 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1762 | + ] | |
| 1763 | + ), | |
| 1764 | + 'amount' => new EE_Text_Input( | |
| 1765 | + [ | |
| 1766 | + 'default' => 0, | |
| 1767 | + 'required' => true, | |
| 1768 | +							'html_label_text'       => esc_html__('Payment amount', 'event_espresso'), | |
| 1769 | + 'validation_strategies' => [new EE_Float_Normalization()], | |
| 1770 | + ] | |
| 1771 | + ), | |
| 1772 | + 'status' => new EE_Text_Input( | |
| 1773 | + [ | |
| 1774 | + 'default' => EEM_Payment::status_id_approved, | |
| 1775 | + 'required' => true, | |
| 1776 | +							'html_label_text' => esc_html__('Payment status', 'event_espresso'), | |
| 1777 | + ] | |
| 1778 | + ), | |
| 1779 | + 'PMD_ID' => new EE_Text_Input( | |
| 1780 | + [ | |
| 1781 | + 'default' => 2, | |
| 1782 | + 'required' => true, | |
| 1783 | +							'html_label_text'       => esc_html__('Payment Method', 'event_espresso'), | |
| 1784 | + 'validation_strategies' => [new EE_Int_Normalization()], | |
| 1785 | + ] | |
| 1786 | + ), | |
| 1787 | + 'date' => new EE_Text_Input( | |
| 1788 | + [ | |
| 1789 | + 'default' => time(), | |
| 1790 | + 'required' => true, | |
| 1791 | +							'html_label_text' => esc_html__('Payment date', 'event_espresso'), | |
| 1792 | + ] | |
| 1793 | + ), | |
| 1794 | + 'txn_id_chq_nmbr' => new EE_Text_Input( | |
| 1795 | + [ | |
| 1796 | + 'default' => '', | |
| 1797 | + 'required' => false, | |
| 1798 | +							'html_label_text'       => esc_html__('Transaction or Cheque Number', 'event_espresso'), | |
| 1799 | + 'validation_strategies' => [ | |
| 1800 | + new EE_Max_Length_Validation_Strategy( | |
| 1801 | +									esc_html__('Input too long', 'event_espresso'), | |
| 1802 | + 100 | |
| 1803 | + ), | |
| 1804 | + ], | |
| 1805 | + ] | |
| 1806 | + ), | |
| 1807 | + 'po_number' => new EE_Text_Input( | |
| 1808 | + [ | |
| 1809 | + 'default' => '', | |
| 1810 | + 'required' => false, | |
| 1811 | +							'html_label_text'       => esc_html__('Purchase Order Number', 'event_espresso'), | |
| 1812 | + 'validation_strategies' => [ | |
| 1813 | + new EE_Max_Length_Validation_Strategy( | |
| 1814 | +									esc_html__('Input too long', 'event_espresso'), | |
| 1815 | + 100 | |
| 1816 | + ), | |
| 1817 | + ], | |
| 1818 | + ] | |
| 1819 | + ), | |
| 1820 | + 'accounting' => new EE_Text_Input( | |
| 1821 | + [ | |
| 1822 | + 'default' => '', | |
| 1823 | + 'required' => false, | |
| 1824 | +							'html_label_text'       => esc_html__('Extra Field for Accounting', 'event_espresso'), | |
| 1825 | + 'validation_strategies' => [ | |
| 1826 | + new EE_Max_Length_Validation_Strategy( | |
| 1827 | +									esc_html__('Input too long', 'event_espresso'), | |
| 1828 | + 100 | |
| 1829 | + ), | |
| 1830 | + ], | |
| 1831 | + ] | |
| 1832 | + ), | |
| 1833 | + ], | |
| 1834 | + ] | |
| 1835 | + ); | |
| 1836 | + } | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + /** | |
| 1840 | + * _create_payment_from_request_data | |
| 1841 | + * | |
| 1842 | + * @param array $valid_data | |
| 1843 | + * @return EE_Payment | |
| 1844 | + * @throws EE_Error | |
| 1845 | + * @throws InvalidArgumentException | |
| 1846 | + * @throws InvalidDataTypeException | |
| 1847 | + * @throws InvalidInterfaceException | |
| 1848 | + * @throws ReflectionException | |
| 1849 | + */ | |
| 1850 | + protected function _create_payment_from_request_data($valid_data) | |
| 1851 | +	{ | |
| 1852 | + $PAY_ID = $valid_data['PAY_ID']; | |
| 1853 | + // get payment amount | |
| 1854 | + $amount = $valid_data['amount'] | |
| 1855 | + ? EEH_Money::strip_localized_money_formatting($valid_data['amount']) | |
| 1856 | + : 0; | |
| 1857 | + // payments have a type value of 1 and refunds have a type value of -1 | |
| 1858 | + // so multiplying amount by type will give a positive value for payments, and negative values for refunds | |
| 1859 | + $amount = $valid_data['type'] < 0 | |
| 1860 | + ? $amount * -1 | |
| 1861 | + : $amount; | |
| 1862 | + // for some reason the date string coming in has extra spaces between the date and time. This fixes that. | |
| 1863 | + $date = $valid_data['date'] | |
| 1864 | +			? preg_replace('/\s+/', ' ', $valid_data['date']) | |
| 1865 | +			: date('Y-m-d g:i a', current_time('timestamp')); | |
| 1866 | + $payment = EE_Payment::new_instance( | |
| 1867 | + [ | |
| 1868 | + 'TXN_ID' => $valid_data['TXN_ID'], | |
| 1869 | + 'STS_ID' => $valid_data['status'], | |
| 1870 | + 'PAY_timestamp' => $date, | |
| 1871 | + 'PAY_source' => EEM_Payment_Method::scope_admin, | |
| 1872 | + 'PMD_ID' => $valid_data['PMD_ID'], | |
| 1873 | + 'PAY_amount' => $amount, | |
| 1874 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], | |
| 1875 | + 'PAY_po_number' => $valid_data['po_number'], | |
| 1876 | + 'PAY_extra_accntng' => $valid_data['accounting'], | |
| 1877 | + 'PAY_details' => $valid_data, | |
| 1878 | + 'PAY_ID' => $PAY_ID, | |
| 1879 | + ], | |
| 1880 | + '', | |
| 1881 | + ['Y-m-d', 'g:i a'] | |
| 1882 | + ); | |
| 1883 | + | |
| 1884 | +		if (! $payment->save()) { | |
| 1885 | + EE_Error::add_error( | |
| 1886 | + sprintf( | |
| 1887 | +					esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), | |
| 1888 | + $payment->ID() | |
| 1889 | + ), | |
| 1890 | + __FILE__, | |
| 1891 | + __FUNCTION__, | |
| 1892 | + __LINE__ | |
| 1893 | + ); | |
| 1894 | + } | |
| 1895 | + | |
| 1896 | + return $payment; | |
| 1897 | + } | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + /** | |
| 1901 | + * _process_transaction_payments | |
| 1902 | + * | |
| 1903 | + * @param EE_Transaction $transaction | |
| 1904 | + * @return void | |
| 1905 | + * @throws EE_Error | |
| 1906 | + * @throws InvalidArgumentException | |
| 1907 | + * @throws ReflectionException | |
| 1908 | + * @throws InvalidDataTypeException | |
| 1909 | + * @throws InvalidInterfaceException | |
| 1910 | + */ | |
| 1911 | + protected function _process_transaction_payments(EE_Transaction $transaction) | |
| 1912 | +	{ | |
| 1913 | + /** @type EE_Transaction_Payments $transaction_payments */ | |
| 1914 | +		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | |
| 1915 | + // update the transaction with this payment | |
| 1916 | +		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { | |
| 1917 | + EE_Error::add_success( | |
| 1918 | + esc_html__( | |
| 1919 | + 'The payment has been processed successfully.', | |
| 1920 | + 'event_espresso' | |
| 1921 | + ), | |
| 1922 | + __FILE__, | |
| 1923 | + __FUNCTION__, | |
| 1924 | + __LINE__ | |
| 1925 | + ); | |
| 1926 | +		} else { | |
| 1927 | + EE_Error::add_error( | |
| 1928 | + esc_html__( | |
| 1929 | + 'The payment was processed successfully but the amount paid for the transaction was not updated.', | |
| 1930 | + 'event_espresso' | |
| 1931 | + ), | |
| 1932 | + __FILE__, | |
| 1933 | + __FUNCTION__, | |
| 1934 | + __LINE__ | |
| 1935 | + ); | |
| 1936 | + } | |
| 1937 | + } | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + /** | |
| 1941 | + * _get_REG_IDs_to_apply_payment_to | |
| 1942 | + * returns a list of registration IDs that the payment will apply to | |
| 1943 | + * | |
| 1944 | + * @param EE_Payment $payment | |
| 1945 | + * @return array | |
| 1946 | + * @throws EE_Error | |
| 1947 | + * @throws InvalidArgumentException | |
| 1948 | + * @throws InvalidDataTypeException | |
| 1949 | + * @throws InvalidInterfaceException | |
| 1950 | + * @throws ReflectionException | |
| 1951 | + */ | |
| 1952 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) | |
| 1953 | +	{ | |
| 1954 | + // grab array of IDs for specific registrations to apply changes to | |
| 1955 | + $apply_to_all = $this->request->getRequestParam( | |
| 1956 | + 'txn_admin_payment[apply_to_all_registrations]', | |
| 1957 | + false, | |
| 1958 | + DataType::BOOL | |
| 1959 | + ); | |
| 1960 | + $REG_IDs = ! $apply_to_all | |
| 1961 | + ? $this->request->getRequestParam( | |
| 1962 | + 'txn_admin_payment[registrations]', | |
| 1963 | + [], | |
| 1964 | + DataType::INT, | |
| 1965 | + true | |
| 1966 | + ) | |
| 1967 | + : []; | |
| 1968 | + // nothing specified ? then get all reg IDs | |
| 1969 | +		if ($apply_to_all || empty($REG_IDs)) { | |
| 1970 | + $registrations = $payment->transaction()->registrations( | |
| 1971 | + [ | |
| 1972 | + [ | |
| 1973 | + 'STS_ID' => [ | |
| 1974 | + 'NOT_IN', [ RegStatus::CANCELLED ] | |
| 1975 | + ] | |
| 1976 | + ] | |
| 1977 | + ] | |
| 1978 | + ); | |
| 1979 | + $REG_IDs = ! empty($registrations) | |
| 1980 | + ? array_keys($registrations) | |
| 1981 | + : $this->_get_existing_reg_payment_REG_IDs($payment); | |
| 1982 | + } | |
| 1983 | + // ensure that REG_IDs are integers and NOT strings | |
| 1984 | +		return array_map('absint', $REG_IDs); | |
| 1985 | + } | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + /** | |
| 1989 | + * @return array | |
| 1990 | + */ | |
| 1991 | + public function existing_reg_payment_REG_IDs() | |
| 1992 | +	{ | |
| 1993 | + return $this->_existing_reg_payment_REG_IDs; | |
| 1994 | + } | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + /** | |
| 1998 | + * @param array $existing_reg_payment_REG_IDs | |
| 1999 | + */ | |
| 2000 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) | |
| 2001 | +	{ | |
| 2002 | + $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; | |
| 2003 | + } | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + /** | |
| 2007 | + * _get_existing_reg_payment_REG_IDs | |
| 2008 | + * returns a list of registration IDs that the payment is currently related to | |
| 2009 | + * as recorded in the database | |
| 2010 | + * | |
| 2011 | + * @param EE_Payment $payment | |
| 2012 | + * @return array | |
| 2013 | + * @throws EE_Error | |
| 2014 | + * @throws InvalidArgumentException | |
| 2015 | + * @throws InvalidDataTypeException | |
| 2016 | + * @throws InvalidInterfaceException | |
| 2017 | + * @throws ReflectionException | |
| 2018 | + */ | |
| 2019 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) | |
| 2020 | +	{ | |
| 2021 | +		if ($this->existing_reg_payment_REG_IDs() === null) { | |
| 2022 | + // let's get any existing reg payment records for this payment | |
| 2023 | +			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); | |
| 2024 | + // but we only want the REG IDs, so grab the array keys | |
| 2025 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) | |
| 2026 | + ? array_keys($existing_reg_payment_REG_IDs) | |
| 2027 | + : []; | |
| 2028 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); | |
| 2029 | + } | |
| 2030 | + | |
| 2031 | + return $this->existing_reg_payment_REG_IDs(); | |
| 2032 | + } | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + /** | |
| 2036 | + * _remove_existing_registration_payments | |
| 2037 | + * this calculates the difference between existing relations | |
| 2038 | + * to the supplied payment and the new list registration IDs, | |
| 2039 | + * removes any related registrations that no longer apply, | |
| 2040 | + * and then updates the registration paid fields | |
| 2041 | + * | |
| 2042 | + * @param EE_Payment $payment | |
| 2043 | + * @param int $PAY_ID | |
| 2044 | + * @return bool; | |
| 2045 | + * @throws EE_Error | |
| 2046 | + * @throws InvalidArgumentException | |
| 2047 | + * @throws ReflectionException | |
| 2048 | + * @throws InvalidDataTypeException | |
| 2049 | + * @throws InvalidInterfaceException | |
| 2050 | + */ | |
| 2051 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) | |
| 2052 | +	{ | |
| 2053 | + // newly created payments will have nothing recorded for $PAY_ID | |
| 2054 | +		if (absint($PAY_ID) === 0) { | |
| 2055 | + return false; | |
| 2056 | + } | |
| 2057 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); | |
| 2058 | +		if (empty($existing_reg_payment_REG_IDs)) { | |
| 2059 | + return false; | |
| 2060 | + } | |
| 2061 | + /** @type EE_Transaction_Payments $transaction_payments */ | |
| 2062 | +		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | |
| 2063 | + | |
| 2064 | + return $transaction_payments->delete_registration_payments_and_update_registrations( | |
| 2065 | + $payment, | |
| 2066 | + [ | |
| 2067 | + [ | |
| 2068 | + 'PAY_ID' => $payment->ID(), | |
| 2069 | + 'REG_ID' => ['IN', $existing_reg_payment_REG_IDs], | |
| 2070 | + ], | |
| 2071 | + ] | |
| 2072 | + ); | |
| 2073 | + } | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + /** | |
| 2077 | + * _update_registration_payments | |
| 2078 | + * this applies the payments to the selected registrations | |
| 2079 | + * but only if they have not already been paid for | |
| 2080 | + * | |
| 2081 | + * @param EE_Transaction $transaction | |
| 2082 | + * @param EE_Payment $payment | |
| 2083 | + * @param array $REG_IDs | |
| 2084 | + * @return void | |
| 2085 | + * @throws EE_Error | |
| 2086 | + * @throws InvalidArgumentException | |
| 2087 | + * @throws ReflectionException | |
| 2088 | + * @throws RuntimeException | |
| 2089 | + * @throws InvalidDataTypeException | |
| 2090 | + * @throws InvalidInterfaceException | |
| 2091 | + */ | |
| 2092 | + protected function _update_registration_payments( | |
| 2093 | + EE_Transaction $transaction, | |
| 2094 | + EE_Payment $payment, | |
| 2095 | + $REG_IDs = [] | |
| 2096 | +	) { | |
| 2097 | + // we can pass our own custom set of registrations to RegistrationPayments::processRegistrationPayments() | |
| 2098 | + // so let's do that using our set of REG_IDs from the form | |
| 2099 | + $registration_query_where_params = [ | |
| 2100 | + 'REG_ID' => ['IN', $REG_IDs], | |
| 2101 | + ]; | |
| 2102 | + // but add in some conditions regarding payment, | |
| 2103 | + // so that we don't apply payments to registrations that are free or have already been paid for | |
| 2104 | + // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) | |
| 2105 | +		if (! $payment->is_a_refund()) { | |
| 2106 | + $registration_query_where_params['REG_final_price'] = ['!=', 0]; | |
| 2107 | + $registration_query_where_params['REG_final_price*'] = ['!=', 'REG_paid', true]; | |
| 2108 | + } | |
| 2109 | + $registrations = $transaction->registrations([$registration_query_where_params]); | |
| 2110 | +		if (! empty($registrations)) { | |
| 2111 | + /** @var RegistrationPayments $payment_processor */ | |
| 2112 | + $payment_processor = LoaderFactory::getShared(RegistrationPayments::class); | |
| 2113 | + $payment_processor->processRegistrationPayments($transaction, $payment, $registrations); | |
| 2114 | + } | |
| 2115 | + } | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + /** | |
| 2119 | + * _process_registration_status_change | |
| 2120 | + * This processes requested registration status changes for all the registrations | |
| 2121 | + * on a given transaction and (optionally) sends out notifications for the changes. | |
| 2122 | + * | |
| 2123 | + * @param EE_Transaction $transaction | |
| 2124 | + * @param array $REG_IDs | |
| 2125 | + * @return bool | |
| 2126 | + * @throws EE_Error | |
| 2127 | + * @throws InvalidArgumentException | |
| 2128 | + * @throws ReflectionException | |
| 2129 | + * @throws InvalidDataTypeException | |
| 2130 | + * @throws InvalidInterfaceException | |
| 2131 | + */ | |
| 2132 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = [], $reg_status = '') | |
| 2133 | +	{ | |
| 2134 | + // first if there is no change in status then we get out. | |
| 2135 | + $reg_status = $reg_status | |
| 2136 | +			?: $this->request->getRequestParam('txn_reg_status_change[reg_status]', 'NAN'); | |
| 2137 | +		if ($reg_status === 'NAN') { | |
| 2138 | + // no error message, no change requested, just nothing to do man. | |
| 2139 | + return false; | |
| 2140 | + } | |
| 2141 | + /** @type EE_Transaction_Processor $transaction_processor */ | |
| 2142 | +		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); | |
| 2143 | + | |
| 2144 | + // made it here dude? Oh WOW. K, let's take care of changing the statuses | |
| 2145 | + return $transaction_processor->manually_update_registration_statuses( | |
| 2146 | + $transaction, | |
| 2147 | + $reg_status, | |
| 2148 | + [['REG_ID' => ['IN', $REG_IDs]]] | |
| 2149 | + ); | |
| 2150 | + } | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + /** | |
| 2154 | + * _build_payment_json_response | |
| 2155 | + * | |
| 2156 | + * @access public | |
| 2157 | + * @param EE_Payment $payment | |
| 2158 | + * @param array $REG_IDs | |
| 2159 | + * @param bool | null $delete_txn_reg_status_change | |
| 2160 | + * @return array | |
| 2161 | + * @throws EE_Error | |
| 2162 | + * @throws InvalidArgumentException | |
| 2163 | + * @throws InvalidDataTypeException | |
| 2164 | + * @throws InvalidInterfaceException | |
| 2165 | + * @throws ReflectionException | |
| 2166 | + */ | |
| 2167 | + protected function _build_payment_json_response( | |
| 2168 | + EE_Payment $payment, | |
| 2169 | + $REG_IDs = [], | |
| 2170 | + $delete_txn_reg_status_change = null | |
| 2171 | +	) { | |
| 2172 | + // was the payment deleted ? | |
| 2173 | +		if (is_bool($delete_txn_reg_status_change)) { | |
| 2174 | + return [ | |
| 2175 | + 'PAY_ID' => $payment->ID(), | |
| 2176 | + 'amount' => $payment->amount(), | |
| 2177 | + 'total_paid' => $payment->transaction()->paid(), | |
| 2178 | + 'txn_status' => $payment->transaction()->status_ID(), | |
| 2179 | + 'pay_status' => $payment->STS_ID(), | |
| 2180 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), | |
| 2181 | + 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, | |
| 2182 | + ]; | |
| 2183 | + } | |
| 2184 | + | |
| 2185 | + $this->_get_payment_status_array(); | |
| 2186 | + $payment_method = $payment->payment_method(); | |
| 2187 | + return [ | |
| 2188 | + 'amount' => $payment->amount(), | |
| 2189 | + 'total_paid' => $payment->transaction()->paid(), | |
| 2190 | + 'txn_status' => $payment->transaction()->status_ID(), | |
| 2191 | + 'pay_status' => $payment->STS_ID(), | |
| 2192 | + 'PAY_ID' => $payment->ID(), | |
| 2193 | + 'STS_ID' => $payment->STS_ID(), | |
| 2194 | + 'status' => self::$_pay_status[ $payment->STS_ID() ], | |
| 2195 | +			'date'             => $payment->timestamp('Y-m-d', 'h:i a'), | |
| 2196 | + 'method' => strtoupper($payment->source()), | |
| 2197 | + 'PM_ID' => $payment_method instanceof EE_Payment_Method | |
| 2198 | + ? $payment_method->ID() | |
| 2199 | + : 1, | |
| 2200 | + 'gateway' => $payment_method instanceof EE_Payment_Method | |
| 2201 | + ? $payment_method->admin_name() | |
| 2202 | +				: esc_html__('Unknown', 'event_espresso'), | |
| 2203 | + 'gateway_response' => $payment->gateway_response(), | |
| 2204 | + 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), | |
| 2205 | + 'po_number' => $payment->po_number(), | |
| 2206 | + 'extra_accntng' => $payment->extra_accntng(), | |
| 2207 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), | |
| 2208 | + ]; | |
| 2209 | + } | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + /** | |
| 2213 | + * delete_payment | |
| 2214 | + * delete a payment or refund made towards a transaction | |
| 2215 | + * | |
| 2216 | + * @access public | |
| 2217 | + * @return void | |
| 2218 | + * @throws EE_Error | |
| 2219 | + * @throws InvalidArgumentException | |
| 2220 | + * @throws ReflectionException | |
| 2221 | + * @throws InvalidDataTypeException | |
| 2222 | + * @throws InvalidInterfaceException | |
| 2223 | + */ | |
| 2224 | + public function delete_payment() | |
| 2225 | +	{ | |
| 2226 | +		$TXD_ID = $this->request->getRequestParam('delete_txn_admin_payment[TXN_ID]', 0, 'int'); | |
| 2227 | + // $json_response_data = ['return_data' => false]; | |
| 2228 | +		$PAY_ID     = $this->request->getRequestParam('delete_txn_admin_payment[PAY_ID]', 0, 'int'); | |
| 2229 | + $amount = 0; | |
| 2230 | + $can_delete = $this->capabilities->current_user_can( | |
| 2231 | + 'ee_delete_payments', | |
| 2232 | + 'delete_payment_from_registration_details' | |
| 2233 | + ); | |
| 2234 | +		if ($PAY_ID && $can_delete) { | |
| 2235 | +			$delete_txn_reg_status_change = $this->request->getRequestParam('delete_txn_reg_status_change[reg_status]'); | |
| 2236 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); | |
| 2237 | +			if ($payment instanceof EE_Payment) { | |
| 2238 | + $amount = $payment->amount(); | |
| 2239 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); | |
| 2240 | + /** @type EE_Transaction_Payments $transaction_payments */ | |
| 2241 | +				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | |
| 2242 | +				if ($transaction_payments->delete_payment_and_update_transaction($payment)) { | |
| 2243 | +					if ($delete_txn_reg_status_change) { | |
| 2244 | + $this->_maybe_send_notifications(); | |
| 2245 | + $this->_process_registration_status_change( | |
| 2246 | + $payment->transaction(), | |
| 2247 | + $REG_IDs, | |
| 2248 | + $delete_txn_reg_status_change | |
| 2249 | + ); | |
| 2250 | + } | |
| 2251 | + } | |
| 2252 | +			} else { | |
| 2253 | + EE_Error::add_error( | |
| 2254 | +					esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), | |
| 2255 | + __FILE__, | |
| 2256 | + __FUNCTION__, | |
| 2257 | + __LINE__ | |
| 2258 | + ); | |
| 2259 | + } | |
| 2260 | +		} elseif ($can_delete) { | |
| 2261 | + EE_Error::add_error( | |
| 2262 | + esc_html__( | |
| 2263 | + 'A valid Payment ID was not received, therefore payment form data could not be loaded.', | |
| 2264 | + 'event_espresso' | |
| 2265 | + ), | |
| 2266 | + __FILE__, | |
| 2267 | + __FUNCTION__, | |
| 2268 | + __LINE__ | |
| 2269 | + ); | |
| 2270 | +		} else { | |
| 2271 | + EE_Error::add_error( | |
| 2272 | + esc_html__( | |
| 2273 | + 'You do not have access to delete a payment.', | |
| 2274 | + 'event_espresso' | |
| 2275 | + ), | |
| 2276 | + __FILE__, | |
| 2277 | + __FUNCTION__, | |
| 2278 | + __LINE__ | |
| 2279 | + ); | |
| 2280 | + } | |
| 2281 | + $query_args = [ | |
| 2282 | + 'page' => 'espresso_transactions', | |
| 2283 | + 'action' => 'view_transaction', | |
| 2284 | + 'TXN_ID' => $TXD_ID, | |
| 2285 | + ]; | |
| 2286 | + $this->_redirect_after_action( | |
| 2287 | + ! EE_Error::has_error(), | |
| 2288 | + $amount > 0 | |
| 2289 | +				? esc_html__('payment', 'event_espresso') | |
| 2290 | +				: esc_html__('refund', 'event_espresso'), | |
| 2291 | +			esc_html__('deleted', 'event_espresso'), | |
| 2292 | + $query_args | |
| 2293 | + ); | |
| 2294 | + } | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + /** | |
| 2298 | + * _registration_payment_data_array | |
| 2299 | + * adds info for 'owing' and 'paid' for each registration to the json response | |
| 2300 | + * | |
| 2301 | + * @access protected | |
| 2302 | + * @param array $REG_IDs | |
| 2303 | + * @return array | |
| 2304 | + * @throws EE_Error | |
| 2305 | + * @throws InvalidArgumentException | |
| 2306 | + * @throws InvalidDataTypeException | |
| 2307 | + * @throws InvalidInterfaceException | |
| 2308 | + * @throws ReflectionException | |
| 2309 | + */ | |
| 2310 | + protected function _registration_payment_data_array($REG_IDs) | |
| 2311 | +	{ | |
| 2312 | + $registration_payment_data = []; | |
| 2313 | + // if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. | |
| 2314 | +		if (! empty($REG_IDs)) { | |
| 2315 | + $registrations = EEM_Registration::instance()->get_all([['REG_ID' => ['IN', $REG_IDs]]]); | |
| 2316 | +			foreach ($registrations as $registration) { | |
| 2317 | +				if ($registration instanceof EE_Registration) { | |
| 2318 | + $registration_payment_data[ $registration->ID() ] = [ | |
| 2319 | + 'paid' => $registration->pretty_paid(), | |
| 2320 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), | |
| 2321 | + ]; | |
| 2322 | + } | |
| 2323 | + } | |
| 2324 | + } | |
| 2325 | + | |
| 2326 | + return $registration_payment_data; | |
| 2327 | + } | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + /** | |
| 2331 | + * _maybe_send_notifications | |
| 2332 | + * determines whether or not the admin has indicated that notifications should be sent. | |
| 2333 | + * If so, will toggle a filter switch for delivering registration notices. | |
| 2334 | + * If passed an EE_Payment object, then it will trigger payment notifications instead. | |
| 2335 | + * | |
| 2336 | + * @access protected | |
| 2337 | + * @param EE_Payment | null $payment | |
| 2338 | + */ | |
| 2339 | + protected function _maybe_send_notifications($payment = null) | |
| 2340 | +	{ | |
| 2341 | +		switch ($payment instanceof EE_Payment) { | |
| 2342 | + // payment notifications | |
| 2343 | + case true: | |
| 2344 | +				if ($this->request->getRequestParam('txn_payments[send_notifications]', false, 'bool')) { | |
| 2345 | + $this->_process_payment_notification($payment); | |
| 2346 | + } | |
| 2347 | + break; | |
| 2348 | + // registration notifications | |
| 2349 | + case false: | |
| 2350 | +				if ($this->request->getRequestParam('txn_reg_status_change[send_notifications]', false, 'bool')) { | |
| 2351 | +					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); | |
| 2352 | + } | |
| 2353 | + break; | |
| 2354 | + } | |
| 2355 | + } | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + /** | |
| 2359 | + * _send_payment_reminder | |
| 2360 | + * generates HTML for the View Transaction Details Admin page | |
| 2361 | + * | |
| 2362 | + * @access protected | |
| 2363 | + * @return void | |
| 2364 | + * @throws EE_Error | |
| 2365 | + * @throws InvalidArgumentException | |
| 2366 | + * @throws InvalidDataTypeException | |
| 2367 | + * @throws InvalidInterfaceException | |
| 2368 | + */ | |
| 2369 | + protected function _send_payment_reminder() | |
| 2370 | +	{ | |
| 2371 | +		$TXN_ID      = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 2372 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); | |
| 2373 | +		$redirect_to = $this->request->getRequestParam('redirect_to'); | |
| 2374 | + $query_args = $redirect_to | |
| 2375 | + ? ['action' => $redirect_to, 'TXN_ID' => $TXN_ID,] | |
| 2376 | + : []; | |
| 2377 | + do_action( | |
| 2378 | + 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', | |
| 2379 | + $transaction | |
| 2380 | + ); | |
| 2381 | + $this->_redirect_after_action( | |
| 2382 | + false, | |
| 2383 | +			esc_html__('payment reminder', 'event_espresso'), | |
| 2384 | +			esc_html__('sent', 'event_espresso'), | |
| 2385 | + $query_args, | |
| 2386 | + true | |
| 2387 | + ); | |
| 2388 | + } | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + /** | |
| 2392 | + * get_transactions | |
| 2393 | + * get transactions for given parameters (used by list table) | |
| 2394 | + * | |
| 2395 | + * @param int $per_page how many transactions displayed per page | |
| 2396 | + * @param boolean $count return the count or objects | |
| 2397 | + * @param string $view | |
| 2398 | + * @return EE_Transaction[]|int int = count || array of transaction objects | |
| 2399 | + * @throws EE_Error | |
| 2400 | + * @throws InvalidArgumentException | |
| 2401 | + * @throws InvalidDataTypeException | |
| 2402 | + * @throws InvalidInterfaceException | |
| 2403 | + * @throws ReflectionException | |
| 2404 | + */ | |
| 2405 | + public function get_transactions($per_page, $count = false, $view = '') | |
| 2406 | +	{ | |
| 2407 | + $start_date = wp_strip_all_tags( | |
| 2408 | +			$this->request->getRequestParam('txn-filter-start-date', date('m/d/Y', strtotime('-10 year'))) | |
| 2409 | + ); | |
| 2410 | + $end_date = wp_strip_all_tags( | |
| 2411 | +			$this->request->getRequestParam('txn-filter-end-date', date('m/d/Y')) | |
| 2412 | + ); | |
| 2413 | + | |
| 2414 | + // make sure our timestamps start and end right at the boundaries for each day | |
| 2415 | +		$start_date = date('Y-m-d', strtotime($start_date)) . ' 00:00:00'; | |
| 2416 | +		$end_date   = date('Y-m-d', strtotime($end_date)) . ' 23:59:59'; | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + // convert to timestamps | |
| 2420 | + $start_date = strtotime($start_date); | |
| 2421 | + $end_date = strtotime($end_date); | |
| 2422 | + | |
| 2423 | + // makes sure start date is the lowest value and vice versa | |
| 2424 | + $start_date = min($start_date, $end_date); | |
| 2425 | + $end_date = max($start_date, $end_date); | |
| 2426 | + | |
| 2427 | + // convert to correct format for query | |
| 2428 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query( | |
| 2429 | + 'TXN_timestamp', | |
| 2430 | +			date('Y-m-d H:i:s', $start_date), | |
| 2431 | + 'Y-m-d H:i:s' | |
| 2432 | + ); | |
| 2433 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query( | |
| 2434 | + 'TXN_timestamp', | |
| 2435 | +			date('Y-m-d H:i:s', $end_date), | |
| 2436 | + 'Y-m-d H:i:s' | |
| 2437 | + ); | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + // set orderby | |
| 2441 | +		$orderby = $this->request->getRequestParam('orderby'); | |
| 2442 | + | |
| 2443 | +		switch ($orderby) { | |
| 2444 | + case 'TXN_ID': | |
| 2445 | + break; | |
| 2446 | + case 'ATT_fname': | |
| 2447 | + $orderby = 'Registration.Attendee.ATT_fname'; | |
| 2448 | + break; | |
| 2449 | + case 'event_name': | |
| 2450 | + $orderby = 'Registration.Event.EVT_name'; | |
| 2451 | + break; | |
| 2452 | + default: // 'TXN_timestamp' | |
| 2453 | + $orderby = 'TXN_timestamp'; | |
| 2454 | + } | |
| 2455 | + | |
| 2456 | +		$sort         = $this->request->getRequestParam('order', 'DESC'); | |
| 2457 | +		$current_page = $this->request->getRequestParam('paged', 1, 'int'); | |
| 2458 | + | |
| 2459 | + $per_page = absint($per_page) | |
| 2460 | + ? $per_page | |
| 2461 | + : 10; | |
| 2462 | +		$per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); | |
| 2463 | + | |
| 2464 | + $offset = ($current_page - 1) * $per_page; | |
| 2465 | + $limit = [$offset, $per_page]; | |
| 2466 | + | |
| 2467 | + $_where = [ | |
| 2468 | + 'TXN_timestamp' => ['BETWEEN', [$start_date, $end_date]], | |
| 2469 | + 'Registration.REG_count' => 1, | |
| 2470 | + ]; | |
| 2471 | + | |
| 2472 | +		$EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int'); | |
| 2473 | +		if ($EVT_ID) { | |
| 2474 | + $_where['Registration.EVT_ID'] = $EVT_ID; | |
| 2475 | + } | |
| 2476 | + | |
| 2477 | +		$search_term = $this->request->getRequestParam('s'); | |
| 2478 | +		if ($search_term) { | |
| 2479 | + $search_term = '%' . $search_term . '%'; | |
| 2480 | + $_where['OR'] = [ | |
| 2481 | + 'Registration.Event.EVT_name' => ['LIKE', $search_term], | |
| 2482 | + 'Registration.Event.EVT_desc' => ['LIKE', $search_term], | |
| 2483 | + 'Registration.Event.EVT_short_desc' => ['LIKE', $search_term], | |
| 2484 | + 'Registration.Attendee.ATT_full_name' => ['LIKE', $search_term], | |
| 2485 | + 'Registration.Attendee.ATT_fname' => ['LIKE', $search_term], | |
| 2486 | + 'Registration.Attendee.ATT_lname' => ['LIKE', $search_term], | |
| 2487 | + 'Registration.Attendee.ATT_short_bio' => ['LIKE', $search_term], | |
| 2488 | + 'Registration.Attendee.ATT_email' => ['LIKE', $search_term], | |
| 2489 | + 'Registration.Attendee.ATT_address' => ['LIKE', $search_term], | |
| 2490 | + 'Registration.Attendee.ATT_address2' => ['LIKE', $search_term], | |
| 2491 | + 'Registration.Attendee.ATT_city' => ['LIKE', $search_term], | |
| 2492 | + 'Registration.REG_final_price' => ['LIKE', $search_term], | |
| 2493 | + 'Registration.REG_code' => ['LIKE', $search_term], | |
| 2494 | + 'Registration.REG_count' => ['LIKE', $search_term], | |
| 2495 | + 'Registration.REG_group_size' => ['LIKE', $search_term], | |
| 2496 | + 'Registration.Ticket.TKT_name' => ['LIKE', $search_term], | |
| 2497 | + 'Registration.Ticket.TKT_description' => ['LIKE', $search_term], | |
| 2498 | + 'Payment.PAY_source' => ['LIKE', $search_term], | |
| 2499 | + 'Payment.Payment_Method.PMD_name' => ['LIKE', $search_term], | |
| 2500 | + 'TXN_session_data' => ['LIKE', $search_term], | |
| 2501 | + 'Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_term], | |
| 2502 | + ]; | |
| 2503 | + } | |
| 2504 | + | |
| 2505 | +		$status = $this->request->getRequestParam('status'); | |
| 2506 | + // failed transactions | |
| 2507 | + $failed = (! empty($status) && $status === 'failed' && ! $count) || ($count && $view === 'failed'); | |
| 2508 | + $abandoned = (! empty($status) && $status === 'abandoned' && ! $count) || ($count && $view === 'abandoned'); | |
| 2509 | + $incomplete = (! empty($status) && $status === 'incomplete' && ! $count) || ($count && $view === 'incomplete'); | |
| 2510 | + | |
| 2511 | +		if ($failed) { | |
| 2512 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; | |
| 2513 | +		} elseif ($abandoned) { | |
| 2514 | + $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; | |
| 2515 | +		} elseif ($incomplete) { | |
| 2516 | + $_where['STS_ID'] = EEM_Transaction::incomplete_status_code; | |
| 2517 | +		} else { | |
| 2518 | + $_where['STS_ID'] = ['!=', EEM_Transaction::failed_status_code]; | |
| 2519 | + $_where['STS_ID*'] = ['!=', EEM_Transaction::abandoned_status_code]; | |
| 2520 | + } | |
| 2521 | + | |
| 2522 | + $query_params = apply_filters( | |
| 2523 | + 'FHEE__Transactions_Admin_Page___get_transactions_query_params', | |
| 2524 | + [ | |
| 2525 | + $_where, | |
| 2526 | + 'order_by' => [$orderby => $sort], | |
| 2527 | + 'limit' => $limit, | |
| 2528 | + 'default_where_conditions' => EE_Default_Where_Conditions::THIS_MODEL_ONLY, | |
| 2529 | + ], | |
| 2530 | + $this->request->requestParams(), | |
| 2531 | + $view, | |
| 2532 | + $count | |
| 2533 | + ); | |
| 2534 | + | |
| 2535 | + return $count | |
| 2536 | + ? EEM_Transaction::instance()->count([$query_params[0]], 'TXN_ID', true) | |
| 2537 | + : EEM_Transaction::instance()->get_all($query_params); | |
| 2538 | + } | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + /** | |
| 2542 | + * @throws EE_Error | |
| 2543 | + * @throws InvalidArgumentException | |
| 2544 | + * @throws InvalidDataTypeException | |
| 2545 | + * @throws InvalidInterfaceException | |
| 2546 | + * @throws ReflectionException | |
| 2547 | + * @throws RuntimeException | |
| 2548 | + * @since 4.9.79.p | |
| 2549 | + */ | |
| 2550 | + public function recalculateLineItems() | |
| 2551 | +	{ | |
| 2552 | +		$TXN_ID = $this->request->getRequestParam('TXN_ID', 0, 'int'); | |
| 2553 | + /** @var EE_Transaction $transaction */ | |
| 2554 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); | |
| 2555 | + $success = $transaction->recalculateLineItems(); | |
| 2556 | +		$redirect_to = $this->request->getRequestParam('redirect_to'); | |
| 2557 | + $query_args = $redirect_to | |
| 2558 | + ? ['action' => $redirect_to, 'TXN_ID' => $TXN_ID,] | |
| 2559 | + : []; | |
| 2560 | + $this->_redirect_after_action( | |
| 2561 | + $success, | |
| 2562 | +			esc_html__('Transaction taxes and totals', 'event_espresso'), | |
| 2563 | +			esc_html__('recalculated', 'event_espresso'), | |
| 2564 | + $query_args, | |
| 2565 | + true | |
| 2566 | + ); | |
| 2567 | + } | |
| 2568 | 2568 | } | 
| @@ -15,215 +15,215 @@ | ||
| 15 | 15 | */ | 
| 16 | 16 | class License_Keys_Admin_Page extends EE_Admin_Page | 
| 17 | 17 |  { | 
| 18 | - protected function _init_page_props() | |
| 19 | -    { | |
| 20 | - $this->page_slug = LICENSE_KEYS_PG_SLUG; | |
| 21 | - $this->page_label = LICENSE_KEYS_LABEL; | |
| 22 | - $this->_admin_base_url = LICENSE_KEYS_ADMIN_URL; | |
| 23 | - $this->_admin_base_path = LICENSE_KEYS_ADMIN; | |
| 24 | - } | |
| 25 | - | |
| 26 | - | |
| 27 | - protected function _ajax_hooks() | |
| 28 | -    { | |
| 29 | -        if (! $this->capabilities->current_user_can('manage_options', 'update-license-key')) { | |
| 30 | - return; | |
| 31 | - } | |
| 32 | -        add_action('wp_ajax_espresso_update_license', [$this, 'updateLicenseKey']); | |
| 33 | - } | |
| 34 | - | |
| 35 | - | |
| 36 | - protected function _define_page_props() | |
| 37 | -    { | |
| 38 | - $this->_admin_page_title = LICENSE_KEYS_LABEL; | |
| 39 | - } | |
| 40 | - | |
| 41 | - | |
| 42 | - protected function _set_page_routes() | |
| 43 | -    { | |
| 44 | - $this->_page_routes = [ | |
| 45 | - 'default' => [ | |
| 46 | - 'func' => [$this, 'licenseKeysAdminPage'], | |
| 47 | - 'capability' => 'manage_options', | |
| 48 | - ], | |
| 49 | - 'update_license_key' => [ | |
| 50 | - 'func' => [$this, 'updateLicenseKey'], | |
| 51 | - 'capability' => 'manage_options', | |
| 52 | - 'noheader' => true, | |
| 53 | - ], | |
| 54 | - ]; | |
| 55 | - } | |
| 56 | - | |
| 57 | - | |
| 58 | - protected function _set_page_config() | |
| 59 | -    { | |
| 60 | - $this->_page_config = [ | |
| 61 | - 'default' => [ | |
| 62 | - 'nav' => [ | |
| 63 | - 'label' => LICENSE_KEYS_LABEL, | |
| 64 | - 'icon' => 'dashicons-admin-network', | |
| 65 | - 'order' => 10, | |
| 66 | - ], | |
| 67 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes), | |
| 68 | - 'require_nonce' => false, | |
| 69 | - ], | |
| 70 | - ]; | |
| 71 | - } | |
| 72 | - | |
| 73 | - | |
| 74 | - protected function _add_screen_options() | |
| 75 | -    { | |
| 76 | - // TODO: Implement _add_screen_options() method. | |
| 77 | - } | |
| 78 | - | |
| 79 | - | |
| 80 | - protected function _add_feature_pointers() | |
| 81 | -    { | |
| 82 | - // TODO: Implement _add_feature_pointers() method. | |
| 83 | - } | |
| 84 | - | |
| 85 | - | |
| 86 | - public function load_scripts_styles() | |
| 87 | -    { | |
| 88 | - wp_enqueue_style( | |
| 89 | - 'license_keys_admin_style', | |
| 90 | - LICENSE_KEYS_ASSETS_URL . 'license_keys_admin.css', | |
| 91 | - [], | |
| 92 | - EVENT_ESPRESSO_VERSION | |
| 93 | - ); | |
| 94 | - | |
| 95 | - wp_enqueue_script( | |
| 96 | - 'license_keys_admin_js', | |
| 97 | - LICENSE_KEYS_ASSETS_URL . 'license_keys_admin.js', | |
| 98 | - ['jquery'], | |
| 99 | - EVENT_ESPRESSO_VERSION, | |
| 100 | - true | |
| 101 | - ); | |
| 102 | - wp_localize_script( | |
| 103 | - 'license_keys_admin_js', | |
| 104 | - 'eeLicenseData', | |
| 105 | - [ | |
| 106 | - 'domain' => home_url(), | |
| 107 | - 'statusMessages' => LicenseStatusDisplay::statusMessages(), | |
| 108 | - 'confirmDeactivation' => esc_html__( | |
| 109 | - 'Are you sure you want to deactivate this license?', | |
| 110 | - 'event_espresso' | |
| 111 | - ), | |
| 112 | - 'resetDeactivation' => esc_html__( | |
| 113 | - 'Are you sure you want to reset this license?', | |
| 114 | - 'event_espresso' | |
| 115 | - ), | |
| 116 | - ] | |
| 117 | - ); | |
| 118 | - } | |
| 119 | - | |
| 120 | - | |
| 121 | - public function admin_init() | |
| 122 | -    { | |
| 123 | - // TODO: Implement admin_init() method. | |
| 124 | - } | |
| 125 | - | |
| 126 | - | |
| 127 | - public function admin_notices() | |
| 128 | -    { | |
| 129 | - // TODO: Implement admin_notices() method. | |
| 130 | - } | |
| 131 | - | |
| 132 | - | |
| 133 | - public function admin_footer_scripts() | |
| 134 | -    { | |
| 135 | - // TODO: Implement admin_footer_scripts() method. | |
| 136 | - } | |
| 137 | - | |
| 138 | - | |
| 139 | - public function _before_page_setup() | |
| 140 | -    { | |
| 141 | - EE_Dependency_Map::instance()->registerDependencies( | |
| 142 | - LicenseManager::class, | |
| 143 | - [ | |
| 144 | - LicenseAPI::class => EE_Dependency_Map::load_from_cache, | |
| 145 | - LicenseKeyData::class => EE_Dependency_Map::load_from_cache, | |
| 146 | - PluginLicenseCollection::class => EE_Dependency_Map::load_from_cache, | |
| 147 | - ] | |
| 148 | - ); | |
| 149 | - EE_Dependency_Map::instance()->registerDependencies( | |
| 150 | - LicenseKeysAdminForm::class, | |
| 151 | - ['EE_Registry' => EE_Dependency_Map::load_from_cache] | |
| 152 | - ); | |
| 153 | - parent::_before_page_setup(); | |
| 154 | - } | |
| 155 | - | |
| 156 | - | |
| 157 | - private function getLicenseKeysAdminForm(): LicenseKeysAdminForm | |
| 158 | -    { | |
| 159 | - return $this->loader->getShared(LicenseKeysAdminForm::class); | |
| 160 | - } | |
| 161 | - | |
| 162 | - | |
| 163 | - /** | |
| 164 | - * @throws EE_Error | |
| 165 | - */ | |
| 166 | - public function licenseKeysAdminPage() | |
| 167 | -    { | |
| 168 | - $this->_template_args['admin_page_content'] = ''; | |
| 169 | -        try { | |
| 170 | - $license_keys_admin_form = $this->getLicenseKeysAdminForm(); | |
| 171 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( | |
| 172 | - $license_keys_admin_form->display(), | |
| 173 | - '', | |
| 174 | - 'padding' | |
| 175 | - ); | |
| 176 | -        } catch (Exception $e) { | |
| 177 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 178 | - } | |
| 179 | -        $this->_set_add_edit_form_tags('update_license_keys'); | |
| 180 | - $this->_set_publish_post_box_vars(); | |
| 181 | - $this->display_admin_page_with_sidebar(); | |
| 182 | - } | |
| 183 | - | |
| 184 | - | |
| 185 | - /** | |
| 186 | - * @throws EE_Error | |
| 187 | - */ | |
| 188 | - public function updateLicenseKey() | |
| 189 | -    { | |
| 190 | - $license_data = new stdClass(); | |
| 191 | -        try { | |
| 192 | - $license_form = $this->getLicenseKeysAdminForm(); | |
| 193 | - $license_data = $license_form->process($this->request->postParams()); | |
| 194 | -        } catch (Exception $exception) { | |
| 195 | - EE_Error::add_error( | |
| 196 | - sprintf( | |
| 197 | - esc_html__( | |
| 198 | - 'The following error occurred while attempting to update your license key: %1$s', | |
| 199 | - 'event_espresso' | |
| 200 | - ), | |
| 201 | - $exception->getMessage() | |
| 202 | - ), | |
| 203 | - __FILE__, | |
| 204 | - __FUNCTION__, | |
| 205 | - __LINE__ | |
| 206 | - ); | |
| 207 | - } | |
| 208 | - | |
| 209 | - $notices = EE_Error::get_notices(false, false, false); | |
| 210 | - | |
| 211 | -        if ($this->request->isAjax()) { | |
| 212 | - wp_send_json( | |
| 213 | - [ | |
| 214 | - 'return_data' => $license_data, | |
| 215 | - 'success' => $notices['success'], | |
| 216 | - 'errors' => $notices['errors'], | |
| 217 | - ] | |
| 218 | - ); | |
| 219 | - } | |
| 220 | - | |
| 221 | - $this->_redirect_after_action( | |
| 222 | - empty($notices['errors']), | |
| 223 | - '', | |
| 224 | - '', | |
| 225 | - ['action' => 'default'], | |
| 226 | - true | |
| 227 | - ); | |
| 228 | - } | |
| 18 | + protected function _init_page_props() | |
| 19 | +	{ | |
| 20 | + $this->page_slug = LICENSE_KEYS_PG_SLUG; | |
| 21 | + $this->page_label = LICENSE_KEYS_LABEL; | |
| 22 | + $this->_admin_base_url = LICENSE_KEYS_ADMIN_URL; | |
| 23 | + $this->_admin_base_path = LICENSE_KEYS_ADMIN; | |
| 24 | + } | |
| 25 | + | |
| 26 | + | |
| 27 | + protected function _ajax_hooks() | |
| 28 | +	{ | |
| 29 | +		if (! $this->capabilities->current_user_can('manage_options', 'update-license-key')) { | |
| 30 | + return; | |
| 31 | + } | |
| 32 | +		add_action('wp_ajax_espresso_update_license', [$this, 'updateLicenseKey']); | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | + protected function _define_page_props() | |
| 37 | +	{ | |
| 38 | + $this->_admin_page_title = LICENSE_KEYS_LABEL; | |
| 39 | + } | |
| 40 | + | |
| 41 | + | |
| 42 | + protected function _set_page_routes() | |
| 43 | +	{ | |
| 44 | + $this->_page_routes = [ | |
| 45 | + 'default' => [ | |
| 46 | + 'func' => [$this, 'licenseKeysAdminPage'], | |
| 47 | + 'capability' => 'manage_options', | |
| 48 | + ], | |
| 49 | + 'update_license_key' => [ | |
| 50 | + 'func' => [$this, 'updateLicenseKey'], | |
| 51 | + 'capability' => 'manage_options', | |
| 52 | + 'noheader' => true, | |
| 53 | + ], | |
| 54 | + ]; | |
| 55 | + } | |
| 56 | + | |
| 57 | + | |
| 58 | + protected function _set_page_config() | |
| 59 | +	{ | |
| 60 | + $this->_page_config = [ | |
| 61 | + 'default' => [ | |
| 62 | + 'nav' => [ | |
| 63 | + 'label' => LICENSE_KEYS_LABEL, | |
| 64 | + 'icon' => 'dashicons-admin-network', | |
| 65 | + 'order' => 10, | |
| 66 | + ], | |
| 67 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes), | |
| 68 | + 'require_nonce' => false, | |
| 69 | + ], | |
| 70 | + ]; | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + protected function _add_screen_options() | |
| 75 | +	{ | |
| 76 | + // TODO: Implement _add_screen_options() method. | |
| 77 | + } | |
| 78 | + | |
| 79 | + | |
| 80 | + protected function _add_feature_pointers() | |
| 81 | +	{ | |
| 82 | + // TODO: Implement _add_feature_pointers() method. | |
| 83 | + } | |
| 84 | + | |
| 85 | + | |
| 86 | + public function load_scripts_styles() | |
| 87 | +	{ | |
| 88 | + wp_enqueue_style( | |
| 89 | + 'license_keys_admin_style', | |
| 90 | + LICENSE_KEYS_ASSETS_URL . 'license_keys_admin.css', | |
| 91 | + [], | |
| 92 | + EVENT_ESPRESSO_VERSION | |
| 93 | + ); | |
| 94 | + | |
| 95 | + wp_enqueue_script( | |
| 96 | + 'license_keys_admin_js', | |
| 97 | + LICENSE_KEYS_ASSETS_URL . 'license_keys_admin.js', | |
| 98 | + ['jquery'], | |
| 99 | + EVENT_ESPRESSO_VERSION, | |
| 100 | + true | |
| 101 | + ); | |
| 102 | + wp_localize_script( | |
| 103 | + 'license_keys_admin_js', | |
| 104 | + 'eeLicenseData', | |
| 105 | + [ | |
| 106 | + 'domain' => home_url(), | |
| 107 | + 'statusMessages' => LicenseStatusDisplay::statusMessages(), | |
| 108 | + 'confirmDeactivation' => esc_html__( | |
| 109 | + 'Are you sure you want to deactivate this license?', | |
| 110 | + 'event_espresso' | |
| 111 | + ), | |
| 112 | + 'resetDeactivation' => esc_html__( | |
| 113 | + 'Are you sure you want to reset this license?', | |
| 114 | + 'event_espresso' | |
| 115 | + ), | |
| 116 | + ] | |
| 117 | + ); | |
| 118 | + } | |
| 119 | + | |
| 120 | + | |
| 121 | + public function admin_init() | |
| 122 | +	{ | |
| 123 | + // TODO: Implement admin_init() method. | |
| 124 | + } | |
| 125 | + | |
| 126 | + | |
| 127 | + public function admin_notices() | |
| 128 | +	{ | |
| 129 | + // TODO: Implement admin_notices() method. | |
| 130 | + } | |
| 131 | + | |
| 132 | + | |
| 133 | + public function admin_footer_scripts() | |
| 134 | +	{ | |
| 135 | + // TODO: Implement admin_footer_scripts() method. | |
| 136 | + } | |
| 137 | + | |
| 138 | + | |
| 139 | + public function _before_page_setup() | |
| 140 | +	{ | |
| 141 | + EE_Dependency_Map::instance()->registerDependencies( | |
| 142 | + LicenseManager::class, | |
| 143 | + [ | |
| 144 | + LicenseAPI::class => EE_Dependency_Map::load_from_cache, | |
| 145 | + LicenseKeyData::class => EE_Dependency_Map::load_from_cache, | |
| 146 | + PluginLicenseCollection::class => EE_Dependency_Map::load_from_cache, | |
| 147 | + ] | |
| 148 | + ); | |
| 149 | + EE_Dependency_Map::instance()->registerDependencies( | |
| 150 | + LicenseKeysAdminForm::class, | |
| 151 | + ['EE_Registry' => EE_Dependency_Map::load_from_cache] | |
| 152 | + ); | |
| 153 | + parent::_before_page_setup(); | |
| 154 | + } | |
| 155 | + | |
| 156 | + | |
| 157 | + private function getLicenseKeysAdminForm(): LicenseKeysAdminForm | |
| 158 | +	{ | |
| 159 | + return $this->loader->getShared(LicenseKeysAdminForm::class); | |
| 160 | + } | |
| 161 | + | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * @throws EE_Error | |
| 165 | + */ | |
| 166 | + public function licenseKeysAdminPage() | |
| 167 | +	{ | |
| 168 | + $this->_template_args['admin_page_content'] = ''; | |
| 169 | +		try { | |
| 170 | + $license_keys_admin_form = $this->getLicenseKeysAdminForm(); | |
| 171 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( | |
| 172 | + $license_keys_admin_form->display(), | |
| 173 | + '', | |
| 174 | + 'padding' | |
| 175 | + ); | |
| 176 | +		} catch (Exception $e) { | |
| 177 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); | |
| 178 | + } | |
| 179 | +		$this->_set_add_edit_form_tags('update_license_keys'); | |
| 180 | + $this->_set_publish_post_box_vars(); | |
| 181 | + $this->display_admin_page_with_sidebar(); | |
| 182 | + } | |
| 183 | + | |
| 184 | + | |
| 185 | + /** | |
| 186 | + * @throws EE_Error | |
| 187 | + */ | |
| 188 | + public function updateLicenseKey() | |
| 189 | +	{ | |
| 190 | + $license_data = new stdClass(); | |
| 191 | +		try { | |
| 192 | + $license_form = $this->getLicenseKeysAdminForm(); | |
| 193 | + $license_data = $license_form->process($this->request->postParams()); | |
| 194 | +		} catch (Exception $exception) { | |
| 195 | + EE_Error::add_error( | |
| 196 | + sprintf( | |
| 197 | + esc_html__( | |
| 198 | + 'The following error occurred while attempting to update your license key: %1$s', | |
| 199 | + 'event_espresso' | |
| 200 | + ), | |
| 201 | + $exception->getMessage() | |
| 202 | + ), | |
| 203 | + __FILE__, | |
| 204 | + __FUNCTION__, | |
| 205 | + __LINE__ | |
| 206 | + ); | |
| 207 | + } | |
| 208 | + | |
| 209 | + $notices = EE_Error::get_notices(false, false, false); | |
| 210 | + | |
| 211 | +		if ($this->request->isAjax()) { | |
| 212 | + wp_send_json( | |
| 213 | + [ | |
| 214 | + 'return_data' => $license_data, | |
| 215 | + 'success' => $notices['success'], | |
| 216 | + 'errors' => $notices['errors'], | |
| 217 | + ] | |
| 218 | + ); | |
| 219 | + } | |
| 220 | + | |
| 221 | + $this->_redirect_after_action( | |
| 222 | + empty($notices['errors']), | |
| 223 | + '', | |
| 224 | + '', | |
| 225 | + ['action' => 'default'], | |
| 226 | + true | |
| 227 | + ); | |
| 228 | + } | |
| 229 | 229 | } | 
| @@ -20,129 +20,129 @@ | ||
| 20 | 20 | */ | 
| 21 | 21 | class PueRequests extends Route | 
| 22 | 22 |  { | 
| 23 | - /** | |
| 24 | - * @var bool | |
| 25 | - * @since 5.0.0.p | |
| 26 | - */ | |
| 27 | - private bool $load_pue = true; | |
| 23 | + /** | |
| 24 | + * @var bool | |
| 25 | + * @since 5.0.0.p | |
| 26 | + */ | |
| 27 | + private bool $load_pue = true; | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | - /** | |
| 31 | - * returns true if the current request matches this route | |
| 32 | - * | |
| 33 | - * @return bool | |
| 34 | - * @since 5.0.0.p | |
| 35 | - */ | |
| 36 | - public function matchesCurrentRequest(): bool | |
| 37 | -    { | |
| 38 | - // route may match, but PUE loading is still conditional based on this filter | |
| 39 | - $this->load_pue = filter_var( | |
| 40 | -            apply_filters('FHEE__EE_System__brew_espresso__load_pue', true), | |
| 41 | - FILTER_VALIDATE_BOOLEAN | |
| 42 | - ); | |
| 43 | - return $this->request->isAdmin() || $this->request->isAjax() || $this->request->isActivation(); | |
| 44 | - } | |
| 30 | + /** | |
| 31 | + * returns true if the current request matches this route | |
| 32 | + * | |
| 33 | + * @return bool | |
| 34 | + * @since 5.0.0.p | |
| 35 | + */ | |
| 36 | + public function matchesCurrentRequest(): bool | |
| 37 | +	{ | |
| 38 | + // route may match, but PUE loading is still conditional based on this filter | |
| 39 | + $this->load_pue = filter_var( | |
| 40 | +			apply_filters('FHEE__EE_System__brew_espresso__load_pue', true), | |
| 41 | + FILTER_VALIDATE_BOOLEAN | |
| 42 | + ); | |
| 43 | + return $this->request->isAdmin() || $this->request->isAjax() || $this->request->isActivation(); | |
| 44 | + } | |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - /** | |
| 48 | - * @since 5.0.0.p | |
| 49 | - */ | |
| 50 | - protected function registerDependencies() | |
| 51 | -    { | |
| 52 | -        if ($this->load_pue) { | |
| 53 | - $this->dependency_map->registerDependencies( | |
| 54 | - 'EventEspresso\caffeinated\core\services\licensing\LicenseService', | |
| 55 | - [ | |
| 56 | - 'EventEspresso\caffeinated\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, | |
| 57 | - 'EventEspresso\caffeinated\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, | |
| 58 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache, | |
| 59 | - ] | |
| 60 | - ); | |
| 61 | - $this->dependency_map->registerDependencies( | |
| 62 | - 'EventEspresso\caffeinated\core\domain\services\pue\Stats', | |
| 63 | - [ | |
| 64 | - 'EventEspresso\caffeinated\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, | |
| 65 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, | |
| 66 | - 'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, | |
| 67 | - ] | |
| 68 | - ); | |
| 69 | - $this->dependency_map->registerDependencies( | |
| 70 | - 'EventEspresso\caffeinated\core\domain\services\pue\Config', | |
| 71 | - [ | |
| 72 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, | |
| 73 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, | |
| 74 | - ] | |
| 75 | - ); | |
| 76 | - $this->dependency_map->registerDependencies( | |
| 77 | - 'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer', | |
| 78 | - [ | |
| 79 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, | |
| 80 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, | |
| 81 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, | |
| 82 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, | |
| 83 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, | |
| 84 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, | |
| 85 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, | |
| 86 | - ] | |
| 87 | - ); | |
| 88 | - $this->dependency_map->registerDependencies( | |
| 89 | - 'EventEspresso\caffeinated\core\services\licensing\UserExperienceForm', | |
| 90 | - [ | |
| 91 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, | |
| 92 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, | |
| 93 | - ] | |
| 94 | - ); | |
| 95 | - } | |
| 96 | - } | |
| 47 | + /** | |
| 48 | + * @since 5.0.0.p | |
| 49 | + */ | |
| 50 | + protected function registerDependencies() | |
| 51 | +	{ | |
| 52 | +		if ($this->load_pue) { | |
| 53 | + $this->dependency_map->registerDependencies( | |
| 54 | + 'EventEspresso\caffeinated\core\services\licensing\LicenseService', | |
| 55 | + [ | |
| 56 | + 'EventEspresso\caffeinated\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, | |
| 57 | + 'EventEspresso\caffeinated\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, | |
| 58 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache, | |
| 59 | + ] | |
| 60 | + ); | |
| 61 | + $this->dependency_map->registerDependencies( | |
| 62 | + 'EventEspresso\caffeinated\core\domain\services\pue\Stats', | |
| 63 | + [ | |
| 64 | + 'EventEspresso\caffeinated\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, | |
| 65 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, | |
| 66 | + 'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, | |
| 67 | + ] | |
| 68 | + ); | |
| 69 | + $this->dependency_map->registerDependencies( | |
| 70 | + 'EventEspresso\caffeinated\core\domain\services\pue\Config', | |
| 71 | + [ | |
| 72 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, | |
| 73 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, | |
| 74 | + ] | |
| 75 | + ); | |
| 76 | + $this->dependency_map->registerDependencies( | |
| 77 | + 'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer', | |
| 78 | + [ | |
| 79 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, | |
| 80 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, | |
| 81 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, | |
| 82 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, | |
| 83 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, | |
| 84 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, | |
| 85 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, | |
| 86 | + ] | |
| 87 | + ); | |
| 88 | + $this->dependency_map->registerDependencies( | |
| 89 | + 'EventEspresso\caffeinated\core\services\licensing\UserExperienceForm', | |
| 90 | + [ | |
| 91 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, | |
| 92 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, | |
| 93 | + ] | |
| 94 | + ); | |
| 95 | + } | |
| 96 | + } | |
| 97 | 97 | |
| 98 | 98 | |
| 99 | - /** | |
| 100 | - * implements logic required to run during request | |
| 101 | - * | |
| 102 | - * @return bool | |
| 103 | - * @since 5.0.0.p | |
| 104 | - */ | |
| 105 | - protected function requestHandler(): bool | |
| 106 | -    { | |
| 107 | - add_filter( | |
| 108 | - 'FHEE__EE_Register_Addon__register', | |
| 109 | - [RegisterAddonPUE::class, 'registerPUE'], | |
| 110 | - 10, | |
| 111 | - 4 | |
| 112 | - ); | |
| 113 | - add_action( | |
| 114 | - 'AHEE__EE_Register_Addon___load_and_init_addon_class', | |
| 115 | - [RegisterAddonPUE::class, 'setAddonPueSlug'], | |
| 116 | - 10, | |
| 117 | - 2 | |
| 118 | - ); | |
| 119 | -        if ($this->load_pue) { | |
| 120 | -            add_action('AHEE__EE_System__brew_espresso__complete', [$this, 'loadLicenseService']); | |
| 121 | - add_filter( | |
| 122 | - 'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form', | |
| 123 | - [$this, 'loadUserExperienceForm'] | |
| 124 | - ); | |
| 125 | - } | |
| 99 | + /** | |
| 100 | + * implements logic required to run during request | |
| 101 | + * | |
| 102 | + * @return bool | |
| 103 | + * @since 5.0.0.p | |
| 104 | + */ | |
| 105 | + protected function requestHandler(): bool | |
| 106 | +	{ | |
| 107 | + add_filter( | |
| 108 | + 'FHEE__EE_Register_Addon__register', | |
| 109 | + [RegisterAddonPUE::class, 'registerPUE'], | |
| 110 | + 10, | |
| 111 | + 4 | |
| 112 | + ); | |
| 113 | + add_action( | |
| 114 | + 'AHEE__EE_Register_Addon___load_and_init_addon_class', | |
| 115 | + [RegisterAddonPUE::class, 'setAddonPueSlug'], | |
| 116 | + 10, | |
| 117 | + 2 | |
| 118 | + ); | |
| 119 | +		if ($this->load_pue) { | |
| 120 | +			add_action('AHEE__EE_System__brew_espresso__complete', [$this, 'loadLicenseService']); | |
| 121 | + add_filter( | |
| 122 | + 'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form', | |
| 123 | + [$this, 'loadUserExperienceForm'] | |
| 124 | + ); | |
| 125 | + } | |
| 126 | 126 | |
| 127 | - return true; | |
| 128 | - } | |
| 127 | + return true; | |
| 128 | + } | |
| 129 | 129 | |
| 130 | 130 | |
| 131 | - public function loadLicenseService() | |
| 132 | -    { | |
| 133 | - /** @var LicenseService $license_service */ | |
| 134 | - $license_service = $this->loader->getShared(LicenseService::class); | |
| 135 | - $license_service->loadPueClient(); | |
| 136 | - } | |
| 131 | + public function loadLicenseService() | |
| 132 | +	{ | |
| 133 | + /** @var LicenseService $license_service */ | |
| 134 | + $license_service = $this->loader->getShared(LicenseService::class); | |
| 135 | + $license_service->loadPueClient(); | |
| 136 | + } | |
| 137 | 137 | |
| 138 | 138 | |
| 139 | - /** | |
| 140 | - * @throws EE_Error | |
| 141 | - */ | |
| 142 | - public function loadUserExperienceForm(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper | |
| 143 | -    { | |
| 144 | - /** @var UserExperienceForm $uxip_form */ | |
| 145 | - $uxip_form = $this->loader->getShared(UserExperienceForm::class); | |
| 146 | - return $uxip_form->uxipFormSections($org_settings_form); | |
| 147 | - } | |
| 139 | + /** | |
| 140 | + * @throws EE_Error | |
| 141 | + */ | |
| 142 | + public function loadUserExperienceForm(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper | |
| 143 | +	{ | |
| 144 | + /** @var UserExperienceForm $uxip_form */ | |
| 145 | + $uxip_form = $this->loader->getShared(UserExperienceForm::class); | |
| 146 | + return $uxip_form->uxipFormSections($org_settings_form); | |
| 147 | + } | |
| 148 | 148 | } | 
| @@ -26,265 +26,265 @@ | ||
| 26 | 26 | */ | 
| 27 | 27 | class SettingsForm extends EE_Payment_Method_Form | 
| 28 | 28 |  { | 
| 29 | - /** | |
| 30 | - * Payment method. | |
| 31 | - * | |
| 32 | - * @var EE_PMT_Base|null | |
| 33 | - */ | |
| 34 | - protected $payment_method = null; | |
| 29 | + /** | |
| 30 | + * Payment method. | |
| 31 | + * | |
| 32 | + * @var EE_PMT_Base|null | |
| 33 | + */ | |
| 34 | + protected $payment_method = null; | |
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * Payment method instance. | |
| 38 | - * | |
| 39 | - * @var EE_PMT_Base|null | |
| 40 | - */ | |
| 41 | - protected $pm_instance = null; | |
| 36 | + /** | |
| 37 | + * Payment method instance. | |
| 38 | + * | |
| 39 | + * @var EE_PMT_Base|null | |
| 40 | + */ | |
| 41 | + protected $pm_instance = null; | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** | |
| 45 | - * Class constructor. | |
| 46 | - * | |
| 47 | - * @param EE_PMT_PayPalCheckout $payment_method | |
| 48 | - * @param EE_Payment_Method $pm_instance | |
| 49 | - * @throws EE_Error | |
| 50 | - * @throws ReflectionException | |
| 51 | - */ | |
| 52 | - public function __construct(EE_PMT_PayPalCheckout $payment_method, EE_Payment_Method $pm_instance) | |
| 53 | -    { | |
| 54 | - $form_parameters = []; | |
| 55 | - $this->payment_method = $payment_method; | |
| 56 | - $this->pm_instance = $pm_instance; | |
| 57 | - // Allow Advanced Card Checkout if PPCP checkout type was possible and selected when onboarding. | |
| 58 | - $allowed_type = PayPalExtraMetaManager::getPmOption($pm_instance, Domain::META_KEY_ALLOWED_CHECKOUT_TYPE); | |
| 59 | - $is_onboard = EED_PayPalOnboard::isOnboard($pm_instance); | |
| 60 | -        if ($is_onboard) { | |
| 61 | -            if ($allowed_type === 'ppcp' || $allowed_type === 'all') { | |
| 62 | - $form_parameters = $this->addCheckoutTypeSelect($form_parameters); | |
| 63 | - } | |
| 64 | - // If the checkout type is currently set to ACDC only, don't add funding options | |
| 65 | -            if ($pm_instance->get_extra_meta(Domain::META_KEY_CHECKOUT_TYPE, true) !== 'ppcp') { | |
| 66 | - $form_parameters = $this->addFundingOptions($form_parameters); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - // Build the PM form. | |
| 70 | - parent::__construct($form_parameters); | |
| 71 | - // Add a form for PayPal Onboard. | |
| 72 | - $this->addOnboardingForm($payment_method, $pm_instance); | |
| 73 | - // Add a form for PayPal Onboard. | |
| 74 | - add_filter( | |
| 75 | - 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', | |
| 76 | - [__CLASS__, 'addFeesNotice'], | |
| 77 | - 10, | |
| 78 | - 2 | |
| 79 | - ); | |
| 80 | - // Add the clear data button. | |
| 81 | - $this->clearMetadataButton($pm_instance); | |
| 82 | - // Disable inputs if needed. | |
| 83 | - $this->toggleSubsections($pm_instance); | |
| 84 | - } | |
| 44 | + /** | |
| 45 | + * Class constructor. | |
| 46 | + * | |
| 47 | + * @param EE_PMT_PayPalCheckout $payment_method | |
| 48 | + * @param EE_Payment_Method $pm_instance | |
| 49 | + * @throws EE_Error | |
| 50 | + * @throws ReflectionException | |
| 51 | + */ | |
| 52 | + public function __construct(EE_PMT_PayPalCheckout $payment_method, EE_Payment_Method $pm_instance) | |
| 53 | +	{ | |
| 54 | + $form_parameters = []; | |
| 55 | + $this->payment_method = $payment_method; | |
| 56 | + $this->pm_instance = $pm_instance; | |
| 57 | + // Allow Advanced Card Checkout if PPCP checkout type was possible and selected when onboarding. | |
| 58 | + $allowed_type = PayPalExtraMetaManager::getPmOption($pm_instance, Domain::META_KEY_ALLOWED_CHECKOUT_TYPE); | |
| 59 | + $is_onboard = EED_PayPalOnboard::isOnboard($pm_instance); | |
| 60 | +		if ($is_onboard) { | |
| 61 | +			if ($allowed_type === 'ppcp' || $allowed_type === 'all') { | |
| 62 | + $form_parameters = $this->addCheckoutTypeSelect($form_parameters); | |
| 63 | + } | |
| 64 | + // If the checkout type is currently set to ACDC only, don't add funding options | |
| 65 | +			if ($pm_instance->get_extra_meta(Domain::META_KEY_CHECKOUT_TYPE, true) !== 'ppcp') { | |
| 66 | + $form_parameters = $this->addFundingOptions($form_parameters); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + // Build the PM form. | |
| 70 | + parent::__construct($form_parameters); | |
| 71 | + // Add a form for PayPal Onboard. | |
| 72 | + $this->addOnboardingForm($payment_method, $pm_instance); | |
| 73 | + // Add a form for PayPal Onboard. | |
| 74 | + add_filter( | |
| 75 | + 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', | |
| 76 | + [__CLASS__, 'addFeesNotice'], | |
| 77 | + 10, | |
| 78 | + 2 | |
| 79 | + ); | |
| 80 | + // Add the clear data button. | |
| 81 | + $this->clearMetadataButton($pm_instance); | |
| 82 | + // Disable inputs if needed. | |
| 83 | + $this->toggleSubsections($pm_instance); | |
| 84 | + } | |
| 85 | 85 | |
| 86 | 86 | |
| 87 | - /** | |
| 88 | - * Adds an onboarding form as a subsection. | |
| 89 | - * | |
| 90 | - * @param EE_PMT_PayPalCheckout $payment_method | |
| 91 | - * @param EE_Payment_Method $pm_instance | |
| 92 | - * @return void | |
| 93 | - */ | |
| 94 | - public function addOnboardingForm(EE_PMT_PayPalCheckout $payment_method, EE_Payment_Method $pm_instance): void | |
| 95 | -    { | |
| 96 | - // Add the connect button before the app id field. | |
| 97 | -        try { | |
| 98 | - $this->add_subsections( | |
| 99 | - [ | |
| 100 | - 'paypal_onboard' => new OnboardingForm($payment_method, $pm_instance), | |
| 101 | - ], | |
| 102 | - 'PMD_debug_mode', | |
| 103 | - false | |
| 104 | - ); | |
| 105 | -        } catch (EE_Error $e) { | |
| 106 | - // Simply don't add the form. | |
| 107 | - } | |
| 108 | - } | |
| 87 | + /** | |
| 88 | + * Adds an onboarding form as a subsection. | |
| 89 | + * | |
| 90 | + * @param EE_PMT_PayPalCheckout $payment_method | |
| 91 | + * @param EE_Payment_Method $pm_instance | |
| 92 | + * @return void | |
| 93 | + */ | |
| 94 | + public function addOnboardingForm(EE_PMT_PayPalCheckout $payment_method, EE_Payment_Method $pm_instance): void | |
| 95 | +	{ | |
| 96 | + // Add the connect button before the app id field. | |
| 97 | +		try { | |
| 98 | + $this->add_subsections( | |
| 99 | + [ | |
| 100 | + 'paypal_onboard' => new OnboardingForm($payment_method, $pm_instance), | |
| 101 | + ], | |
| 102 | + 'PMD_debug_mode', | |
| 103 | + false | |
| 104 | + ); | |
| 105 | +		} catch (EE_Error $e) { | |
| 106 | + // Simply don't add the form. | |
| 107 | + } | |
| 108 | + } | |
| 109 | 109 | |
| 110 | 110 | |
| 111 | - /** | |
| 112 | - * Add fees notice. | |
| 113 | - * | |
| 114 | - * @param array $subsections | |
| 115 | - * @param EE_Payment_Method $payment_method | |
| 116 | - * @return array | |
| 117 | - * @throws EE_Error | |
| 118 | - * @throws ReflectionException | |
| 119 | - */ | |
| 120 | - public static function addFeesNotice(array $subsections, EE_Payment_Method $payment_method): array | |
| 121 | -    { | |
| 122 | - // We want to be able to disable fees. Also check if this is PayPal PM. | |
| 123 | -        if ((defined('EE_PPC_USE_PAYMENT_FEES') && ! EE_PPC_USE_PAYMENT_FEES) | |
| 124 | - || $payment_method->slug() !== 'paypalcheckout' | |
| 125 | -        ) { | |
| 126 | - return $subsections; | |
| 127 | - } | |
| 128 | - return EEH_Array::insert_into_array( | |
| 129 | - $subsections, | |
| 130 | - [ | |
| 131 | - 'partner_fees_notice' => new EE_Form_Section_HTML( | |
| 132 | - EEH_HTML::tr( | |
| 133 | - EEH_HTML::th() | |
| 134 | - . EEH_HTML::thx() | |
| 135 | - . EEH_HTML::td( | |
| 136 | - EEH_HTML::div( | |
| 137 | - EEH_HTML::strong( | |
| 138 | - esc_html__( | |
| 139 | - 'PayPal Partner Commission Fees are based upon the status of your Support License:', | |
| 140 | - 'event_espresso' | |
| 141 | - ) | |
| 142 | - ) | |
| 143 | - . EEH_HTML::ul() | |
| 144 | - . EEH_HTML::li( | |
| 145 | -                                    esc_html__('- Active licenses commission fees: 0%', 'event_espresso') | |
| 146 | - ) | |
| 147 | - . EEH_HTML::li( | |
| 148 | -                                    esc_html__('- Expired license commission fees: 3%', 'event_espresso') | |
| 149 | - ) | |
| 150 | - . EEH_HTML::ulx() | |
| 151 | - . esc_html__( | |
| 152 | - 'Keep your support license active for: lower fees, up-to-date software and have access to our support team. By connecting and processing payments you agree to these terms.', | |
| 153 | - 'event_espresso' | |
| 154 | - ), | |
| 155 | - '', | |
| 156 | - 'ee-status-outline ee-status-bg--info' | |
| 157 | - ) | |
| 158 | - ) | |
| 159 | - ) | |
| 160 | - ), | |
| 161 | - ], | |
| 162 | - 'fine_print' | |
| 163 | - ); | |
| 164 | - } | |
| 111 | + /** | |
| 112 | + * Add fees notice. | |
| 113 | + * | |
| 114 | + * @param array $subsections | |
| 115 | + * @param EE_Payment_Method $payment_method | |
| 116 | + * @return array | |
| 117 | + * @throws EE_Error | |
| 118 | + * @throws ReflectionException | |
| 119 | + */ | |
| 120 | + public static function addFeesNotice(array $subsections, EE_Payment_Method $payment_method): array | |
| 121 | +	{ | |
| 122 | + // We want to be able to disable fees. Also check if this is PayPal PM. | |
| 123 | +		if ((defined('EE_PPC_USE_PAYMENT_FEES') && ! EE_PPC_USE_PAYMENT_FEES) | |
| 124 | + || $payment_method->slug() !== 'paypalcheckout' | |
| 125 | +		) { | |
| 126 | + return $subsections; | |
| 127 | + } | |
| 128 | + return EEH_Array::insert_into_array( | |
| 129 | + $subsections, | |
| 130 | + [ | |
| 131 | + 'partner_fees_notice' => new EE_Form_Section_HTML( | |
| 132 | + EEH_HTML::tr( | |
| 133 | + EEH_HTML::th() | |
| 134 | + . EEH_HTML::thx() | |
| 135 | + . EEH_HTML::td( | |
| 136 | + EEH_HTML::div( | |
| 137 | + EEH_HTML::strong( | |
| 138 | + esc_html__( | |
| 139 | + 'PayPal Partner Commission Fees are based upon the status of your Support License:', | |
| 140 | + 'event_espresso' | |
| 141 | + ) | |
| 142 | + ) | |
| 143 | + . EEH_HTML::ul() | |
| 144 | + . EEH_HTML::li( | |
| 145 | +									esc_html__('- Active licenses commission fees: 0%', 'event_espresso') | |
| 146 | + ) | |
| 147 | + . EEH_HTML::li( | |
| 148 | +									esc_html__('- Expired license commission fees: 3%', 'event_espresso') | |
| 149 | + ) | |
| 150 | + . EEH_HTML::ulx() | |
| 151 | + . esc_html__( | |
| 152 | + 'Keep your support license active for: lower fees, up-to-date software and have access to our support team. By connecting and processing payments you agree to these terms.', | |
| 153 | + 'event_espresso' | |
| 154 | + ), | |
| 155 | + '', | |
| 156 | + 'ee-status-outline ee-status-bg--info' | |
| 157 | + ) | |
| 158 | + ) | |
| 159 | + ) | |
| 160 | + ), | |
| 161 | + ], | |
| 162 | + 'fine_print' | |
| 163 | + ); | |
| 164 | + } | |
| 165 | 165 | |
| 166 | 166 | |
| 167 | - /** | |
| 168 | - * Add a checkout type select. | |
| 169 | - * | |
| 170 | - * @param array $form_parameters | |
| 171 | - * @return array | |
| 172 | - * @throws EE_Error | |
| 173 | - * @throws ReflectionException | |
| 174 | - */ | |
| 175 | - public function addCheckoutTypeSelect(array $form_parameters): array | |
| 176 | -    { | |
| 177 | - $pm_slug = $this->pm_instance->slug(); | |
| 178 | - // Section to be displayed if onboard. | |
| 179 | - $form_parameters['extra_meta_inputs'][Domain::META_KEY_CHECKOUT_TYPE] = new EE_Select_Input( | |
| 180 | - [ | |
| 181 | -                'express_checkout' => esc_html__('Express Checkout', 'event_espresso'), | |
| 182 | -                'ppcp'             => esc_html__('Advanced Credit and Debit Card payments', 'event_espresso'), | |
| 183 | -                'all'              => esc_html__('Both, ACDC and Express Checkout', 'event_espresso'), | |
| 184 | - ], | |
| 185 | - [ | |
| 186 | - 'html_name' => "eep_checkout_type_option_$pm_slug", | |
| 187 | - 'html_id' => "eep_checkout_type_option_$pm_slug", | |
| 188 | - 'html_class' => "eep-checkout-type-option-$pm_slug", | |
| 189 | - 'required' => true, | |
| 190 | - 'default' => PayPalExtraMetaManager::getPmOption( | |
| 191 | - $this->pm_instance, | |
| 192 | - Domain::META_KEY_ALLOWED_CHECKOUT_TYPE | |
| 193 | - ), | |
| 194 | - ] | |
| 195 | - ); | |
| 196 | - return $form_parameters; | |
| 197 | - } | |
| 167 | + /** | |
| 168 | + * Add a checkout type select. | |
| 169 | + * | |
| 170 | + * @param array $form_parameters | |
| 171 | + * @return array | |
| 172 | + * @throws EE_Error | |
| 173 | + * @throws ReflectionException | |
| 174 | + */ | |
| 175 | + public function addCheckoutTypeSelect(array $form_parameters): array | |
| 176 | +	{ | |
| 177 | + $pm_slug = $this->pm_instance->slug(); | |
| 178 | + // Section to be displayed if onboard. | |
| 179 | + $form_parameters['extra_meta_inputs'][Domain::META_KEY_CHECKOUT_TYPE] = new EE_Select_Input( | |
| 180 | + [ | |
| 181 | +				'express_checkout' => esc_html__('Express Checkout', 'event_espresso'), | |
| 182 | +				'ppcp'             => esc_html__('Advanced Credit and Debit Card payments', 'event_espresso'), | |
| 183 | +				'all'              => esc_html__('Both, ACDC and Express Checkout', 'event_espresso'), | |
| 184 | + ], | |
| 185 | + [ | |
| 186 | + 'html_name' => "eep_checkout_type_option_$pm_slug", | |
| 187 | + 'html_id' => "eep_checkout_type_option_$pm_slug", | |
| 188 | + 'html_class' => "eep-checkout-type-option-$pm_slug", | |
| 189 | + 'required' => true, | |
| 190 | + 'default' => PayPalExtraMetaManager::getPmOption( | |
| 191 | + $this->pm_instance, | |
| 192 | + Domain::META_KEY_ALLOWED_CHECKOUT_TYPE | |
| 193 | + ), | |
| 194 | + ] | |
| 195 | + ); | |
| 196 | + return $form_parameters; | |
| 197 | + } | |
| 198 | 198 | |
| 199 | 199 | |
| 200 | - /** | |
| 201 | - * Add a checkout type select. | |
| 202 | - * | |
| 203 | - * @param array $form_parameters | |
| 204 | - * @return array | |
| 205 | - * @throws EE_Error | |
| 206 | - * @throws ReflectionException | |
| 207 | - */ | |
| 208 | - public function addFundingOptions(array $form_parameters): array | |
| 209 | -    { | |
| 210 | - $pm_slug = $this->pm_instance->slug(); | |
| 211 | - // Section to be displayed if onboard. | |
| 212 | - $form_parameters['extra_meta_inputs'][Domain::META_KEY_FUNDING_OPTIONS] = new EE_Checkbox_Multi_Input( | |
| 213 | - [ | |
| 214 | -                'venmo'    => esc_html__('Venmo', 'event_espresso'), | |
| 215 | -                'paylater' => esc_html__('PayLater', 'event_espresso'), | |
| 216 | - ], | |
| 217 | - [ | |
| 218 | - 'html_name' => "eep_checkout_funding_options_$pm_slug", | |
| 219 | - 'html_id' => "eep_checkout_funding_options_$pm_slug", | |
| 220 | - 'html_class' => "eep-checkout-funding-options-$pm_slug", | |
| 221 | -                'html_label_text' => esc_html__('Enable PayPal funding options:', 'event_espresso'), | |
| 222 | - 'default' => ['venmo', 'paylater'], | |
| 223 | - ] | |
| 224 | - ); | |
| 225 | - return $form_parameters; | |
| 226 | - } | |
| 200 | + /** | |
| 201 | + * Add a checkout type select. | |
| 202 | + * | |
| 203 | + * @param array $form_parameters | |
| 204 | + * @return array | |
| 205 | + * @throws EE_Error | |
| 206 | + * @throws ReflectionException | |
| 207 | + */ | |
| 208 | + public function addFundingOptions(array $form_parameters): array | |
| 209 | +	{ | |
| 210 | + $pm_slug = $this->pm_instance->slug(); | |
| 211 | + // Section to be displayed if onboard. | |
| 212 | + $form_parameters['extra_meta_inputs'][Domain::META_KEY_FUNDING_OPTIONS] = new EE_Checkbox_Multi_Input( | |
| 213 | + [ | |
| 214 | +				'venmo'    => esc_html__('Venmo', 'event_espresso'), | |
| 215 | +				'paylater' => esc_html__('PayLater', 'event_espresso'), | |
| 216 | + ], | |
| 217 | + [ | |
| 218 | + 'html_name' => "eep_checkout_funding_options_$pm_slug", | |
| 219 | + 'html_id' => "eep_checkout_funding_options_$pm_slug", | |
| 220 | + 'html_class' => "eep-checkout-funding-options-$pm_slug", | |
| 221 | +				'html_label_text' => esc_html__('Enable PayPal funding options:', 'event_espresso'), | |
| 222 | + 'default' => ['venmo', 'paylater'], | |
| 223 | + ] | |
| 224 | + ); | |
| 225 | + return $form_parameters; | |
| 226 | + } | |
| 227 | 227 | |
| 228 | 228 | |
| 229 | - /** | |
| 230 | - * Adds a button for clearing the PM metadata. | |
| 231 | - * | |
| 232 | - * @param EE_Payment_Method $pm_instance | |
| 233 | - * @return void | |
| 234 | - */ | |
| 235 | - public function clearMetadataButton(EE_Payment_Method $pm_instance): void | |
| 236 | -    { | |
| 237 | -        try { | |
| 238 | - $is_onboard = EED_PayPalOnboard::isOnboard($pm_instance); | |
| 239 | -            if ($is_onboard) { | |
| 240 | - return; | |
| 241 | - } | |
| 242 | - $button_text = sprintf( | |
| 243 | -                esc_html__('Clear %1$s metadata', 'event_espresso'), | |
| 244 | - $pm_instance->admin_name() | |
| 245 | - ); | |
| 246 | - $this->add_subsections( | |
| 247 | - [ | |
| 248 | - 'clear_pm_metadata' => new EE_Form_Section_HTML( | |
| 249 | - EEH_HTML::tr( | |
| 250 | -                            EEH_HTML::th(esc_html__('Clear PM metadata ?', 'event_espresso')) . | |
| 251 | - EEH_HTML::td( | |
| 252 | - EEH_HTML::link( | |
| 253 | - '', | |
| 254 | - $button_text, | |
| 255 | - $button_text, | |
| 256 | - 'eea_clear_metadata_' . $pm_instance->slug(), | |
| 257 | - 'espresso-button button button--secondary' | |
| 258 | - ) | |
| 259 | - ) | |
| 260 | - ) | |
| 261 | - ), | |
| 262 | - ], | |
| 263 | - 'PMD_order', | |
| 264 | - false | |
| 265 | - ); | |
| 266 | -        } catch (EE_Error $e) { | |
| 267 | - // Don't add the button if there's some error. | |
| 268 | - } | |
| 269 | - } | |
| 229 | + /** | |
| 230 | + * Adds a button for clearing the PM metadata. | |
| 231 | + * | |
| 232 | + * @param EE_Payment_Method $pm_instance | |
| 233 | + * @return void | |
| 234 | + */ | |
| 235 | + public function clearMetadataButton(EE_Payment_Method $pm_instance): void | |
| 236 | +	{ | |
| 237 | +		try { | |
| 238 | + $is_onboard = EED_PayPalOnboard::isOnboard($pm_instance); | |
| 239 | +			if ($is_onboard) { | |
| 240 | + return; | |
| 241 | + } | |
| 242 | + $button_text = sprintf( | |
| 243 | +				esc_html__('Clear %1$s metadata', 'event_espresso'), | |
| 244 | + $pm_instance->admin_name() | |
| 245 | + ); | |
| 246 | + $this->add_subsections( | |
| 247 | + [ | |
| 248 | + 'clear_pm_metadata' => new EE_Form_Section_HTML( | |
| 249 | + EEH_HTML::tr( | |
| 250 | +							EEH_HTML::th(esc_html__('Clear PM metadata ?', 'event_espresso')) . | |
| 251 | + EEH_HTML::td( | |
| 252 | + EEH_HTML::link( | |
| 253 | + '', | |
| 254 | + $button_text, | |
| 255 | + $button_text, | |
| 256 | + 'eea_clear_metadata_' . $pm_instance->slug(), | |
| 257 | + 'espresso-button button button--secondary' | |
| 258 | + ) | |
| 259 | + ) | |
| 260 | + ) | |
| 261 | + ), | |
| 262 | + ], | |
| 263 | + 'PMD_order', | |
| 264 | + false | |
| 265 | + ); | |
| 266 | +		} catch (EE_Error $e) { | |
| 267 | + // Don't add the button if there's some error. | |
| 268 | + } | |
| 269 | + } | |
| 270 | 270 | |
| 271 | 271 | |
| 272 | - /** | |
| 273 | - * Toggles subsections depending on the OAuth status etc. | |
| 274 | - * | |
| 275 | - * @param EE_Payment_Method $pm_instance | |
| 276 | - * @return void | |
| 277 | - * @throws EE_Error | |
| 278 | - */ | |
| 279 | - private function toggleSubsections(EE_Payment_Method $pm_instance): void | |
| 280 | -    { | |
| 281 | - $onboard = EED_PayPalOnboard::isOnboard($pm_instance); | |
| 282 | - // Don't allow changing the debug mode setting while connected. | |
| 283 | -        if ($onboard) { | |
| 284 | -            $debug_mode_input = $this->get_input('PMD_debug_mode', false); | |
| 285 | -            if (method_exists($debug_mode_input, 'isDisabled')) { | |
| 286 | - $debug_mode_input->disable(); | |
| 287 | - } | |
| 288 | - } | |
| 289 | - } | |
| 272 | + /** | |
| 273 | + * Toggles subsections depending on the OAuth status etc. | |
| 274 | + * | |
| 275 | + * @param EE_Payment_Method $pm_instance | |
| 276 | + * @return void | |
| 277 | + * @throws EE_Error | |
| 278 | + */ | |
| 279 | + private function toggleSubsections(EE_Payment_Method $pm_instance): void | |
| 280 | +	{ | |
| 281 | + $onboard = EED_PayPalOnboard::isOnboard($pm_instance); | |
| 282 | + // Don't allow changing the debug mode setting while connected. | |
| 283 | +		if ($onboard) { | |
| 284 | +			$debug_mode_input = $this->get_input('PMD_debug_mode', false); | |
| 285 | +			if (method_exists($debug_mode_input, 'isDisabled')) { | |
| 286 | + $debug_mode_input->disable(); | |
| 287 | + } | |
| 288 | + } | |
| 289 | + } | |
| 290 | 290 | } | 
| @@ -2,140 +2,140 @@ discard block | ||
| 2 | 2 | /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ | 
| 3 | 3 | $generated_i18n_strings = array( | 
| 4 | 4 | // Reference: packages/ui-components/src/Pagination/constants.ts:6 | 
| 5 | - __( '2', 'event_espresso' ), | |
| 5 | +	__('2', 'event_espresso'), | |
| 6 | 6 | |
| 7 | 7 | // Reference: packages/ui-components/src/Pagination/constants.ts:7 | 
| 8 | - __( '6', 'event_espresso' ), | |
| 8 | +	__('6', 'event_espresso'), | |
| 9 | 9 | |
| 10 | 10 | // Reference: packages/ui-components/src/Pagination/constants.ts:8 | 
| 11 | - __( '12', 'event_espresso' ), | |
| 11 | +	__('12', 'event_espresso'), | |
| 12 | 12 | |
| 13 | 13 | // Reference: packages/ui-components/src/Pagination/constants.ts:9 | 
| 14 | - __( '24', 'event_espresso' ), | |
| 14 | +	__('24', 'event_espresso'), | |
| 15 | 15 | |
| 16 | 16 | // Reference: packages/ui-components/src/Pagination/constants.ts:10 | 
| 17 | - __( '48', 'event_espresso' ), | |
| 17 | +	__('48', 'event_espresso'), | |
| 18 | 18 | |
| 19 | 19 | // Reference: packages/ui-components/src/Pagination/constants.ts:11 | 
| 20 | - __( '96', 'event_espresso' ), | |
| 20 | +	__('96', 'event_espresso'), | |
| 21 | 21 | |
| 22 | 22 | // Reference: domains/core/admin/blocks/src/components/AvatarImage.tsx:27 | 
| 23 | - __( 'contact avatar', 'event_espresso' ), | |
| 23 | +	__('contact avatar', 'event_espresso'), | |
| 24 | 24 | |
| 25 | 25 | // Reference: domains/core/admin/blocks/src/components/OrderByControl.tsx:12 | 
| 26 | - __( 'Order by', 'event_espresso' ), | |
| 26 | +	__('Order by', 'event_espresso'), | |
| 27 | 27 | |
| 28 | 28 | // Reference: domains/core/admin/blocks/src/components/RegStatusControl.tsx:17 | 
| 29 | 29 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectStatus.tsx:13 | 
| 30 | - __( 'Select Registration Status', 'event_espresso' ), | |
| 30 | +	__('Select Registration Status', 'event_espresso'), | |
| 31 | 31 | |
| 32 | 32 | // Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:14 | 
| 33 | - __( 'Ascending', 'event_espresso' ), | |
| 33 | +	__('Ascending', 'event_espresso'), | |
| 34 | 34 | |
| 35 | 35 | // Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:18 | 
| 36 | - __( 'Descending', 'event_espresso' ), | |
| 36 | +	__('Descending', 'event_espresso'), | |
| 37 | 37 | |
| 38 | 38 | // Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:24 | 
| 39 | - __( 'Sort order:', 'event_espresso' ), | |
| 39 | +	__('Sort order:', 'event_espresso'), | |
| 40 | 40 | |
| 41 | 41 | // Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:41 | 
| 42 | - __( 'There was some error fetching attendees list', 'event_espresso' ), | |
| 42 | +	__('There was some error fetching attendees list', 'event_espresso'), | |
| 43 | 43 | |
| 44 | 44 | // Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:47 | 
| 45 | - __( 'To get started, select what event you want to show attendees from in the block settings.', 'event_espresso' ), | |
| 45 | +	__('To get started, select what event you want to show attendees from in the block settings.', 'event_espresso'), | |
| 46 | 46 | |
| 47 | 47 | // Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:53 | 
| 48 | - __( 'There are no attendees for selected options.', 'event_espresso' ), | |
| 48 | +	__('There are no attendees for selected options.', 'event_espresso'), | |
| 49 | 49 | |
| 50 | 50 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:12 | 
| 51 | - __( 'Display on Archives', 'event_espresso' ), | |
| 51 | +	__('Display on Archives', 'event_espresso'), | |
| 52 | 52 | |
| 53 | 53 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:17 | 
| 54 | - __( 'Attendees are shown whenever this post is listed in an archive view.', 'event_espresso' ), | |
| 54 | +	__('Attendees are shown whenever this post is listed in an archive view.', 'event_espresso'), | |
| 55 | 55 | |
| 56 | 56 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:18 | 
| 57 | - __( 'Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso' ), | |
| 57 | +	__('Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso'), | |
| 58 | 58 | |
| 59 | 59 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:29 | 
| 60 | - __( 'Number of Attendees to Display:', 'event_espresso' ), | |
| 60 | +	__('Number of Attendees to Display:', 'event_espresso'), | |
| 61 | 61 | |
| 62 | 62 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:34 | 
| 63 | 63 | /* translators: %d attendees count */ | 
| 64 | - _n_noop( 'Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso' ), | |
| 64 | +	_n_noop('Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso'), | |
| 65 | 65 | |
| 66 | 66 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:27 | 
| 67 | - __( 'Display Gravatar', 'event_espresso' ), | |
| 67 | +	__('Display Gravatar', 'event_espresso'), | |
| 68 | 68 | |
| 69 | 69 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:32 | 
| 70 | - __( 'Gravatar images are shown for each attendee.', 'event_espresso' ), | |
| 70 | +	__('Gravatar images are shown for each attendee.', 'event_espresso'), | |
| 71 | 71 | |
| 72 | 72 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:33 | 
| 73 | - __( 'No gravatar images are shown for each attendee.', 'event_espresso' ), | |
| 73 | +	__('No gravatar images are shown for each attendee.', 'event_espresso'), | |
| 74 | 74 | |
| 75 | 75 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:38 | 
| 76 | - __( 'Size of Gravatar', 'event_espresso' ), | |
| 76 | +	__('Size of Gravatar', 'event_espresso'), | |
| 77 | 77 | |
| 78 | 78 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectDatetime.tsx:22 | 
| 79 | - __( 'Select Datetime', 'event_espresso' ), | |
| 79 | +	__('Select Datetime', 'event_espresso'), | |
| 80 | 80 | |
| 81 | 81 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectEvent.tsx:22 | 
| 82 | 82 | // Reference: domains/core/admin/blocks/src/event/controls/SelectEvent.tsx:22 | 
| 83 | - __( 'Select Event', 'event_espresso' ), | |
| 83 | +	__('Select Event', 'event_espresso'), | |
| 84 | 84 | |
| 85 | 85 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:11 | 
| 86 | - __( 'Attendee id', 'event_espresso' ), | |
| 86 | +	__('Attendee id', 'event_espresso'), | |
| 87 | 87 | |
| 88 | 88 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:15 | 
| 89 | - __( 'Last name only', 'event_espresso' ), | |
| 89 | +	__('Last name only', 'event_espresso'), | |
| 90 | 90 | |
| 91 | 91 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:19 | 
| 92 | - __( 'First name only', 'event_espresso' ), | |
| 92 | +	__('First name only', 'event_espresso'), | |
| 93 | 93 | |
| 94 | 94 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:23 | 
| 95 | - __( 'First, then Last name', 'event_espresso' ), | |
| 95 | +	__('First, then Last name', 'event_espresso'), | |
| 96 | 96 | |
| 97 | 97 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:27 | 
| 98 | - __( 'Last, then First name', 'event_espresso' ), | |
| 98 | +	__('Last, then First name', 'event_espresso'), | |
| 99 | 99 | |
| 100 | 100 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:41 | 
| 101 | - __( 'Order Attendees by:', 'event_espresso' ), | |
| 101 | +	__('Order Attendees by:', 'event_espresso'), | |
| 102 | 102 | |
| 103 | 103 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectTicket.tsx:22 | 
| 104 | - __( 'Select Ticket', 'event_espresso' ), | |
| 104 | +	__('Select Ticket', 'event_espresso'), | |
| 105 | 105 | |
| 106 | 106 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:21 | 
| 107 | - __( 'Filter By Settings', 'event_espresso' ), | |
| 107 | +	__('Filter By Settings', 'event_espresso'), | |
| 108 | 108 | |
| 109 | 109 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:36 | 
| 110 | - __( 'Gravatar Setttings', 'event_espresso' ), | |
| 110 | +	__('Gravatar Setttings', 'event_espresso'), | |
| 111 | 111 | |
| 112 | 112 | // Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:39 | 
| 113 | - __( 'Archive Settings', 'event_espresso' ), | |
| 113 | +	__('Archive Settings', 'event_espresso'), | |
| 114 | 114 | |
| 115 | 115 | // Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:10 | 
| 116 | - __( 'Event Attendees', 'event_espresso' ), | |
| 116 | +	__('Event Attendees', 'event_espresso'), | |
| 117 | 117 | |
| 118 | 118 | // Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:11 | 
| 119 | - __( 'Displays a list of people that have registered for the specified event', 'event_espresso' ), | |
| 119 | +	__('Displays a list of people that have registered for the specified event', 'event_espresso'), | |
| 120 | 120 | |
| 121 | 121 | // Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14 | 
| 122 | 122 | // Reference: domains/core/admin/blocks/src/event/index.tsx:12 | 
| 123 | 123 | // Reference: packages/edtr-services/src/constants.ts:25 | 
| 124 | - __( 'event', 'event_espresso' ), | |
| 124 | +	__('event', 'event_espresso'), | |
| 125 | 125 | |
| 126 | 126 | // Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14 | 
| 127 | - __( 'attendees', 'event_espresso' ), | |
| 127 | +	__('attendees', 'event_espresso'), | |
| 128 | 128 | |
| 129 | 129 | // Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14 | 
| 130 | - __( 'list', 'event_espresso' ), | |
| 130 | +	__('list', 'event_espresso'), | |
| 131 | 131 | |
| 132 | 132 | // Reference: domains/core/admin/blocks/src/event/DisplayField.tsx:41 | 
| 133 | - __( 'An unknown error occurred while fetching event details.', 'event_espresso' ), | |
| 133 | +	__('An unknown error occurred while fetching event details.', 'event_espresso'), | |
| 134 | 134 | |
| 135 | 135 | // Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:10 | 
| 136 | 136 | // Reference: domains/core/admin/blocks/src/services/utils.ts:24 | 
| 137 | 137 | // Reference: packages/utils/src/list/index.ts:13 | 
| 138 | - __( 'Select…', 'event_espresso' ), | |
| 138 | +	__('Select…', 'event_espresso'), | |
| 139 | 139 | |
| 140 | 140 | // Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:15 | 
| 141 | 141 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:75 | 
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:189 | 
| 145 | 145 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:48 | 
| 146 | 146 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:42 | 
| 147 | - __( 'Name', 'event_espresso' ), | |
| 147 | +	__('Name', 'event_espresso'), | |
| 148 | 148 | |
| 149 | 149 | // Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:19 | 
| 150 | 150 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:80 | 
| @@ -152,411 +152,411 @@ discard block | ||
| 152 | 152 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:194 | 
| 153 | 153 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:54 | 
| 154 | 154 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:47 | 
| 155 | - __( 'Description', 'event_espresso' ), | |
| 155 | +	__('Description', 'event_espresso'), | |
| 156 | 156 | |
| 157 | 157 | // Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:23 | 
| 158 | - __( 'Short description', 'event_espresso' ), | |
| 158 | +	__('Short description', 'event_espresso'), | |
| 159 | 159 | |
| 160 | 160 | // Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:35 | 
| 161 | - __( 'Select Field', 'event_espresso' ), | |
| 161 | +	__('Select Field', 'event_espresso'), | |
| 162 | 162 | |
| 163 | 163 | // Reference: domains/core/admin/blocks/src/event/controls/index.tsx:27 | 
| 164 | - __( 'Text Color', 'event_espresso' ), | |
| 164 | +	__('Text Color', 'event_espresso'), | |
| 165 | 165 | |
| 166 | 166 | // Reference: domains/core/admin/blocks/src/event/controls/index.tsx:32 | 
| 167 | - __( 'Background Color', 'event_espresso' ), | |
| 167 | +	__('Background Color', 'event_espresso'), | |
| 168 | 168 | |
| 169 | 169 | // Reference: domains/core/admin/blocks/src/event/controls/index.tsx:41 | 
| 170 | 170 | // Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:23 | 
| 171 | 171 | // Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:22 | 
| 172 | - __( 'Settings', 'event_espresso' ), | |
| 172 | +	__('Settings', 'event_espresso'), | |
| 173 | 173 | |
| 174 | 174 | // Reference: domains/core/admin/blocks/src/event/controls/index.tsx:45 | 
| 175 | - __( 'Typography', 'event_espresso' ), | |
| 175 | +	__('Typography', 'event_espresso'), | |
| 176 | 176 | |
| 177 | 177 | // Reference: domains/core/admin/blocks/src/event/controls/index.tsx:48 | 
| 178 | - __( 'Color', 'event_espresso' ), | |
| 178 | +	__('Color', 'event_espresso'), | |
| 179 | 179 | |
| 180 | 180 | // Reference: domains/core/admin/blocks/src/event/index.tsx:12 | 
| 181 | - __( 'field', 'event_espresso' ), | |
| 181 | +	__('field', 'event_espresso'), | |
| 182 | 182 | |
| 183 | 183 | // Reference: domains/core/admin/blocks/src/event/index.tsx:8 | 
| 184 | - __( 'Event Field', 'event_espresso' ), | |
| 184 | +	__('Event Field', 'event_espresso'), | |
| 185 | 185 | |
| 186 | 186 | // Reference: domains/core/admin/blocks/src/event/index.tsx:9 | 
| 187 | - __( 'Displays the selected field of an event', 'event_espresso' ), | |
| 187 | +	__('Displays the selected field of an event', 'event_espresso'), | |
| 188 | 188 | |
| 189 | 189 | // Reference: domains/core/admin/blocks/src/services/utils.ts:17 | 
| 190 | - __( 'Error', 'event_espresso' ), | |
| 190 | +	__('Error', 'event_espresso'), | |
| 191 | 191 | |
| 192 | 192 | // Reference: domains/core/admin/blocks/src/services/utils.ts:9 | 
| 193 | - __( 'Loading…', 'event_espresso' ), | |
| 193 | +	__('Loading…', 'event_espresso'), | |
| 194 | 194 | |
| 195 | 195 | // Reference: domains/core/admin/eventEditor/src/ui/EventDescription.tsx:33 | 
| 196 | - __( 'Event Description', 'event_espresso' ), | |
| 196 | +	__('Event Description', 'event_espresso'), | |
| 197 | 197 | |
| 198 | 198 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/ActiveStatus.tsx:28 | 
| 199 | - __( 'Active status', 'event_espresso' ), | |
| 199 | +	__('Active status', 'event_espresso'), | |
| 200 | 200 | |
| 201 | 201 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/AltRegPage.tsx:12 | 
| 202 | - __( 'Alternative Registration Page', 'event_espresso' ), | |
| 202 | +	__('Alternative Registration Page', 'event_espresso'), | |
| 203 | 203 | |
| 204 | 204 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/DefaultRegistrationStatus.tsx:25 | 
| 205 | - __( 'Default Registration Status', 'event_espresso' ), | |
| 205 | +	__('Default Registration Status', 'event_espresso'), | |
| 206 | 206 | |
| 207 | 207 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8 | 
| 208 | - __( 'Donations Enabled', 'event_espresso' ), | |
| 208 | +	__('Donations Enabled', 'event_espresso'), | |
| 209 | 209 | |
| 210 | 210 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8 | 
| 211 | - __( 'Donations Disabled', 'event_espresso' ), | |
| 211 | +	__('Donations Disabled', 'event_espresso'), | |
| 212 | 212 | |
| 213 | 213 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventManager.tsx:16 | 
| 214 | - __( 'Event Manager', 'event_espresso' ), | |
| 214 | +	__('Event Manager', 'event_espresso'), | |
| 215 | 215 | |
| 216 | 216 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventPhoneNumber.tsx:15 | 
| 217 | - __( 'Event Phone Number', 'event_espresso' ), | |
| 217 | +	__('Event Phone Number', 'event_espresso'), | |
| 218 | 218 | |
| 219 | 219 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/MaxRegistrations.tsx:13 | 
| 220 | - __( 'Max Registrations per Transaction', 'event_espresso' ), | |
| 220 | +	__('Max Registrations per Transaction', 'event_espresso'), | |
| 221 | 221 | |
| 222 | 222 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8 | 
| 223 | - __( 'Ticket Selector Enabled', 'event_espresso' ), | |
| 223 | +	__('Ticket Selector Enabled', 'event_espresso'), | |
| 224 | 224 | |
| 225 | 225 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8 | 
| 226 | - __( 'Ticket Selector Disabled', 'event_espresso' ), | |
| 226 | +	__('Ticket Selector Disabled', 'event_espresso'), | |
| 227 | 227 | |
| 228 | 228 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:41 | 
| 229 | - __( 'Event Details', 'event_espresso' ), | |
| 229 | +	__('Event Details', 'event_espresso'), | |
| 230 | 230 | |
| 231 | 231 | // Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:47 | 
| 232 | - __( 'Registration Options', 'event_espresso' ), | |
| 232 | +	__('Registration Options', 'event_espresso'), | |
| 233 | 233 | |
| 234 | 234 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10 | 
| 235 | - __( 'primary information about the date', 'event_espresso' ), | |
| 235 | +	__('primary information about the date', 'event_espresso'), | |
| 236 | 236 | |
| 237 | 237 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10 | 
| 238 | - __( 'Date Details', 'event_espresso' ), | |
| 238 | +	__('Date Details', 'event_espresso'), | |
| 239 | 239 | |
| 240 | 240 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11 | 
| 241 | 241 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16 | 
| 242 | 242 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16 | 
| 243 | - __( 'relations between tickets and dates', 'event_espresso' ), | |
| 243 | +	__('relations between tickets and dates', 'event_espresso'), | |
| 244 | 244 | |
| 245 | 245 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11 | 
| 246 | - __( 'Assign Tickets', 'event_espresso' ), | |
| 246 | +	__('Assign Tickets', 'event_espresso'), | |
| 247 | 247 | |
| 248 | 248 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/FooterButtons.tsx:22 | 
| 249 | - __( 'Save and assign tickets', 'event_espresso' ), | |
| 249 | +	__('Save and assign tickets', 'event_espresso'), | |
| 250 | 250 | |
| 251 | 251 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:30 | 
| 252 | 252 | /* translators: %d database id */ | 
| 253 | - __( 'Edit datetime %s', 'event_espresso' ), | |
| 253 | +	__('Edit datetime %s', 'event_espresso'), | |
| 254 | 254 | |
| 255 | 255 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:33 | 
| 256 | - __( 'New Datetime', 'event_espresso' ), | |
| 256 | +	__('New Datetime', 'event_espresso'), | |
| 257 | 257 | |
| 258 | 258 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:43 | 
| 259 | - __( 'modal for datetime', 'event_espresso' ), | |
| 259 | +	__('modal for datetime', 'event_espresso'), | |
| 260 | 260 | |
| 261 | 261 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:110 | 
| 262 | 262 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:107 | 
| 263 | 263 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:224 | 
| 264 | 264 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:106 | 
| 265 | - __( 'Details', 'event_espresso' ), | |
| 265 | +	__('Details', 'event_espresso'), | |
| 266 | 266 | |
| 267 | 267 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:114 | 
| 268 | 268 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:111 | 
| 269 | 269 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:83 | 
| 270 | - __( 'Capacity', 'event_espresso' ), | |
| 270 | +	__('Capacity', 'event_espresso'), | |
| 271 | 271 | |
| 272 | 272 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:119 | 
| 273 | - __( 'The maximum number of registrants that can attend the event at this particular date.', 'event_espresso' ), | |
| 273 | +	__('The maximum number of registrants that can attend the event at this particular date.', 'event_espresso'), | |
| 274 | 274 | |
| 275 | 275 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:123 | 
| 276 | - __( 'Set to 0 to close registration or leave blank for no limit.', 'event_espresso' ), | |
| 276 | +	__('Set to 0 to close registration or leave blank for no limit.', 'event_espresso'), | |
| 277 | 277 | |
| 278 | 278 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:129 | 
| 279 | 279 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:164 | 
| 280 | - __( 'Trash', 'event_espresso' ), | |
| 280 | +	__('Trash', 'event_espresso'), | |
| 281 | 281 | |
| 282 | 282 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:71 | 
| 283 | 283 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:44 | 
| 284 | 284 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:185 | 
| 285 | 285 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:44 | 
| 286 | - __( 'Basics', 'event_espresso' ), | |
| 286 | +	__('Basics', 'event_espresso'), | |
| 287 | 287 | |
| 288 | 288 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:88 | 
| 289 | 289 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:62 | 
| 290 | 290 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:62 | 
| 291 | - __( 'Dates', 'event_espresso' ), | |
| 291 | +	__('Dates', 'event_espresso'), | |
| 292 | 292 | |
| 293 | 293 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:92 | 
| 294 | 294 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:53 | 
| 295 | 295 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:206 | 
| 296 | - __( 'Start Date', 'event_espresso' ), | |
| 296 | +	__('Start Date', 'event_espresso'), | |
| 297 | 297 | |
| 298 | 298 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:99 | 
| 299 | 299 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:67 | 
| 300 | 300 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:213 | 
| 301 | - __( 'End Date', 'event_espresso' ), | |
| 301 | +	__('End Date', 'event_espresso'), | |
| 302 | 302 | |
| 303 | 303 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateRegistrationsLink.tsx:25 | 
| 304 | 304 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketRegistrationsLink.tsx:13 | 
| 305 | - __( 'total registrations.', 'event_espresso' ), | |
| 305 | +	__('total registrations.', 'event_espresso'), | |
| 306 | 306 | |
| 307 | 307 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateRegistrationsLink.tsx:26 | 
| 308 | - __( 'view ALL registrations for this date.', 'event_espresso' ), | |
| 308 | +	__('view ALL registrations for this date.', 'event_espresso'), | |
| 309 | 309 | |
| 310 | 310 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateSoldLink.tsx:13 | 
| 311 | - __( 'view approved registrations for this date.', 'event_espresso' ), | |
| 311 | +	__('view approved registrations for this date.', 'event_espresso'), | |
| 312 | 312 | |
| 313 | 313 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:35 | 
| 314 | 314 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/TableView.tsx:33 | 
| 315 | - __( 'Event Dates', 'event_espresso' ), | |
| 315 | +	__('Event Dates', 'event_espresso'), | |
| 316 | 316 | |
| 317 | 317 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:38 | 
| 318 | - __( 'loading event dates…', 'event_espresso' ), | |
| 318 | +	__('loading event dates…', 'event_espresso'), | |
| 319 | 319 | |
| 320 | 320 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:20 | 
| 321 | - __( 'Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso' ), | |
| 321 | +	__('Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso'), | |
| 322 | 322 | |
| 323 | 323 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:30 | 
| 324 | - __( 'Ticket Assignments', 'event_espresso' ), | |
| 324 | +	__('Ticket Assignments', 'event_espresso'), | |
| 325 | 325 | |
| 326 | 326 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:25 | 
| 327 | - __( 'Number of related tickets', 'event_espresso' ), | |
| 327 | +	__('Number of related tickets', 'event_espresso'), | |
| 328 | 328 | |
| 329 | 329 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:26 | 
| 330 | - __( 'There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso' ), | |
| 330 | +	__('There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso'), | |
| 331 | 331 | |
| 332 | 332 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:34 | 
| 333 | - __( 'assign tickets', 'event_espresso' ), | |
| 333 | +	__('assign tickets', 'event_espresso'), | |
| 334 | 334 | |
| 335 | 335 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:21 | 
| 336 | - __( 'event datetime main menu', 'event_espresso' ), | |
| 336 | +	__('event datetime main menu', 'event_espresso'), | |
| 337 | 337 | |
| 338 | 338 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:33 | 
| 339 | - __( 'edit datetime', 'event_espresso' ), | |
| 339 | +	__('edit datetime', 'event_espresso'), | |
| 340 | 340 | |
| 341 | 341 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:34 | 
| 342 | - __( 'copy datetime', 'event_espresso' ), | |
| 342 | +	__('copy datetime', 'event_espresso'), | |
| 343 | 343 | |
| 344 | 344 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:15 | 
| 345 | 345 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:48 | 
| 346 | - __( 'delete permanently', 'event_espresso' ), | |
| 346 | +	__('delete permanently', 'event_espresso'), | |
| 347 | 347 | |
| 348 | 348 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:15 | 
| 349 | - __( 'trash datetime', 'event_espresso' ), | |
| 349 | +	__('trash datetime', 'event_espresso'), | |
| 350 | 350 | |
| 351 | 351 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:18 | 
| 352 | - __( 'Permanently Delete Datetime?', 'event_espresso' ), | |
| 352 | +	__('Permanently Delete Datetime?', 'event_espresso'), | |
| 353 | 353 | |
| 354 | 354 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:18 | 
| 355 | - __( 'Move Datetime to Trash?', 'event_espresso' ), | |
| 355 | +	__('Move Datetime to Trash?', 'event_espresso'), | |
| 356 | 356 | |
| 357 | 357 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:20 | 
| 358 | - __( 'Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso' ), | |
| 358 | +	__('Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso'), | |
| 359 | 359 | |
| 360 | 360 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:23 | 
| 361 | - __( 'Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso' ), | |
| 361 | +	__('Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso'), | |
| 362 | 362 | |
| 363 | 363 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:33 | 
| 364 | - __( 'delete', 'event_espresso' ), | |
| 364 | +	__('delete', 'event_espresso'), | |
| 365 | 365 | |
| 366 | 366 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:34 | 
| 367 | 367 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:39 | 
| 368 | 368 | // Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:43 | 
| 369 | - __( 'bulk actions', 'event_espresso' ), | |
| 369 | +	__('bulk actions', 'event_espresso'), | |
| 370 | 370 | |
| 371 | 371 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:38 | 
| 372 | - __( 'edit datetime details', 'event_espresso' ), | |
| 372 | +	__('edit datetime details', 'event_espresso'), | |
| 373 | 373 | |
| 374 | 374 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:42 | 
| 375 | - __( 'delete datetimes', 'event_espresso' ), | |
| 375 | +	__('delete datetimes', 'event_espresso'), | |
| 376 | 376 | |
| 377 | 377 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:42 | 
| 378 | - __( 'trash datetimes', 'event_espresso' ), | |
| 378 | +	__('trash datetimes', 'event_espresso'), | |
| 379 | 379 | |
| 380 | 380 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:14 | 
| 381 | - __( 'Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso' ), | |
| 381 | +	__('Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso'), | |
| 382 | 382 | |
| 383 | 383 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15 | 
| 384 | - __( 'Are you sure you want to trash these datetimes?', 'event_espresso' ), | |
| 384 | +	__('Are you sure you want to trash these datetimes?', 'event_espresso'), | |
| 385 | 385 | |
| 386 | 386 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16 | 
| 387 | - __( 'Delete datetimes permanently', 'event_espresso' ), | |
| 387 | +	__('Delete datetimes permanently', 'event_espresso'), | |
| 388 | 388 | |
| 389 | 389 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16 | 
| 390 | - __( 'Trash datetimes', 'event_espresso' ), | |
| 390 | +	__('Trash datetimes', 'event_espresso'), | |
| 391 | 391 | |
| 392 | 392 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:21 | 
| 393 | - __( 'Bulk edit date details', 'event_espresso' ), | |
| 393 | +	__('Bulk edit date details', 'event_espresso'), | |
| 394 | 394 | |
| 395 | 395 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:22 | 
| 396 | - __( 'any changes will be applied to ALL of the selected dates.', 'event_espresso' ), | |
| 396 | +	__('any changes will be applied to ALL of the selected dates.', 'event_espresso'), | |
| 397 | 397 | |
| 398 | 398 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/formValidation.ts:12 | 
| 399 | 399 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/formValidation.ts:12 | 
| 400 | - __( 'Name must be at least three characters', 'event_espresso' ), | |
| 400 | +	__('Name must be at least three characters', 'event_espresso'), | |
| 401 | 401 | |
| 402 | 402 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:66 | 
| 403 | 403 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:66 | 
| 404 | - __( 'Shift dates', 'event_espresso' ), | |
| 404 | +	__('Shift dates', 'event_espresso'), | |
| 405 | 405 | |
| 406 | 406 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:91 | 
| 407 | 407 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:90 | 
| 408 | - __( 'earlier', 'event_espresso' ), | |
| 408 | +	__('earlier', 'event_espresso'), | |
| 409 | 409 | |
| 410 | 410 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:95 | 
| 411 | 411 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:94 | 
| 412 | - __( 'later', 'event_espresso' ), | |
| 412 | +	__('later', 'event_espresso'), | |
| 413 | 413 | |
| 414 | 414 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCapacity.tsx:31 | 
| 415 | 415 | /* translators: click to edit capacity<linebreak>(registration limit)… */ | 
| 416 | - __( 'click to edit capacity%s(registration limit)…', 'event_espresso' ), | |
| 416 | +	__('click to edit capacity%s(registration limit)…', 'event_espresso'), | |
| 417 | 417 | |
| 418 | 418 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:31 | 
| 419 | 419 | // Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:27 | 
| 420 | 420 | // Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:34 | 
| 421 | - __( 'starts', 'event_espresso' ), | |
| 421 | +	__('starts', 'event_espresso'), | |
| 422 | 422 | |
| 423 | 423 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32 | 
| 424 | 424 | // Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:34 | 
| 425 | 425 | // Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:47 | 
| 426 | - __( 'ends', 'event_espresso' ), | |
| 426 | +	__('ends', 'event_espresso'), | |
| 427 | 427 | |
| 428 | 428 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32 | 
| 429 | - __( 'started', 'event_espresso' ), | |
| 429 | +	__('started', 'event_espresso'), | |
| 430 | 430 | |
| 431 | 431 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32 | 
| 432 | - __( 'ended', 'event_espresso' ), | |
| 432 | +	__('ended', 'event_espresso'), | |
| 433 | 433 | |
| 434 | 434 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:46 | 
| 435 | - __( 'Edit Event Date', 'event_espresso' ), | |
| 435 | +	__('Edit Event Date', 'event_espresso'), | |
| 436 | 436 | |
| 437 | 437 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:50 | 
| 438 | - __( 'edit start and end dates', 'event_espresso' ), | |
| 438 | +	__('edit start and end dates', 'event_espresso'), | |
| 439 | 439 | |
| 440 | 440 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:16 | 
| 441 | 441 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:16 | 
| 442 | - __( 'sold', 'event_espresso' ), | |
| 442 | +	__('sold', 'event_espresso'), | |
| 443 | 443 | |
| 444 | 444 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:21 | 
| 445 | - __( 'capacity', 'event_espresso' ), | |
| 445 | +	__('capacity', 'event_espresso'), | |
| 446 | 446 | |
| 447 | 447 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:27 | 
| 448 | 448 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:26 | 
| 449 | - __( 'reg list', 'event_espresso' ), | |
| 449 | +	__('reg list', 'event_espresso'), | |
| 450 | 450 | |
| 451 | 451 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:44 | 
| 452 | 452 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:38 | 
| 453 | - __( 'add description…', 'event_espresso' ), | |
| 453 | +	__('add description…', 'event_espresso'), | |
| 454 | 454 | |
| 455 | 455 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:45 | 
| 456 | 456 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:36 | 
| 457 | - __( 'Edit description', 'event_espresso' ), | |
| 457 | +	__('Edit description', 'event_espresso'), | |
| 458 | 458 | |
| 459 | 459 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:46 | 
| 460 | 460 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:37 | 
| 461 | - __( 'click to edit description…', 'event_espresso' ), | |
| 461 | +	__('click to edit description…', 'event_espresso'), | |
| 462 | 462 | |
| 463 | 463 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:14 | 
| 464 | - __( 'View Registrations for this Date', 'event_espresso' ), | |
| 464 | +	__('View Registrations for this Date', 'event_espresso'), | |
| 465 | 465 | |
| 466 | 466 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:19 | 
| 467 | - __( 'Manage Ticket Assignments', 'event_espresso' ), | |
| 467 | +	__('Manage Ticket Assignments', 'event_espresso'), | |
| 468 | 468 | |
| 469 | 469 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:24 | 
| 470 | - __( 'Move Date to Trash', 'event_espresso' ), | |
| 470 | +	__('Move Date to Trash', 'event_espresso'), | |
| 471 | 471 | |
| 472 | 472 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:29 | 
| 473 | 473 | // Reference: packages/constants/src/datetime.ts:6 | 
| 474 | - __( 'Active', 'event_espresso' ), | |
| 474 | +	__('Active', 'event_espresso'), | |
| 475 | 475 | |
| 476 | 476 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:30 | 
| 477 | 477 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:29 | 
| 478 | - __( 'Trashed', 'event_espresso' ), | |
| 478 | +	__('Trashed', 'event_espresso'), | |
| 479 | 479 | |
| 480 | 480 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:31 | 
| 481 | 481 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:30 | 
| 482 | 482 | // Reference: packages/constants/src/datetime.ts:8 | 
| 483 | - __( 'Expired', 'event_espresso' ), | |
| 483 | +	__('Expired', 'event_espresso'), | |
| 484 | 484 | |
| 485 | 485 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:32 | 
| 486 | 486 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:32 | 
| 487 | - __( 'Sold Out', 'event_espresso' ), | |
| 487 | +	__('Sold Out', 'event_espresso'), | |
| 488 | 488 | |
| 489 | 489 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:33 | 
| 490 | 490 | // Reference: packages/constants/src/datetime.ts:12 | 
| 491 | - __( 'Upcoming', 'event_espresso' ), | |
| 491 | +	__('Upcoming', 'event_espresso'), | |
| 492 | 492 | |
| 493 | 493 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:9 | 
| 494 | - __( 'Edit Event Date Details', 'event_espresso' ), | |
| 494 | +	__('Edit Event Date Details', 'event_espresso'), | |
| 495 | 495 | |
| 496 | 496 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:41 | 
| 497 | 497 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:41 | 
| 498 | - __( 'click to edit title…', 'event_espresso' ), | |
| 498 | +	__('click to edit title…', 'event_espresso'), | |
| 499 | 499 | |
| 500 | 500 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:42 | 
| 501 | 501 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:42 | 
| 502 | - __( 'add title…', 'event_espresso' ), | |
| 502 | +	__('add title…', 'event_espresso'), | |
| 503 | 503 | |
| 504 | 504 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/ActiveDatesFilters.tsx:17 | 
| 505 | 505 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/ActiveTicketsFilters.tsx:17 | 
| 506 | - __( 'ON', 'event_espresso' ), | |
| 506 | +	__('ON', 'event_espresso'), | |
| 507 | 507 | |
| 508 | 508 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:10 | 
| 509 | - __( 'end dates only', 'event_espresso' ), | |
| 509 | +	__('end dates only', 'event_espresso'), | |
| 510 | 510 | |
| 511 | 511 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:11 | 
| 512 | - __( 'start and end dates', 'event_espresso' ), | |
| 512 | +	__('start and end dates', 'event_espresso'), | |
| 513 | 513 | |
| 514 | 514 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:16 | 
| 515 | - __( 'dates above 90% capacity', 'event_espresso' ), | |
| 515 | +	__('dates above 90% capacity', 'event_espresso'), | |
| 516 | 516 | |
| 517 | 517 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:17 | 
| 518 | - __( 'dates above 75% capacity', 'event_espresso' ), | |
| 518 | +	__('dates above 75% capacity', 'event_espresso'), | |
| 519 | 519 | |
| 520 | 520 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:18 | 
| 521 | - __( 'dates above 50% capacity', 'event_espresso' ), | |
| 521 | +	__('dates above 50% capacity', 'event_espresso'), | |
| 522 | 522 | |
| 523 | 523 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:19 | 
| 524 | - __( 'dates below 50% capacity', 'event_espresso' ), | |
| 524 | +	__('dates below 50% capacity', 'event_espresso'), | |
| 525 | 525 | |
| 526 | 526 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:23 | 
| 527 | - __( 'all dates', 'event_espresso' ), | |
| 527 | +	__('all dates', 'event_espresso'), | |
| 528 | 528 | |
| 529 | 529 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:24 | 
| 530 | - __( 'all active and upcoming', 'event_espresso' ), | |
| 530 | +	__('all active and upcoming', 'event_espresso'), | |
| 531 | 531 | |
| 532 | 532 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:25 | 
| 533 | - __( 'active dates only', 'event_espresso' ), | |
| 533 | +	__('active dates only', 'event_espresso'), | |
| 534 | 534 | |
| 535 | 535 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:26 | 
| 536 | - __( 'upcoming dates only', 'event_espresso' ), | |
| 536 | +	__('upcoming dates only', 'event_espresso'), | |
| 537 | 537 | |
| 538 | 538 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:27 | 
| 539 | - __( 'next active or upcoming only', 'event_espresso' ), | |
| 539 | +	__('next active or upcoming only', 'event_espresso'), | |
| 540 | 540 | |
| 541 | 541 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:28 | 
| 542 | - __( 'sold out dates only', 'event_espresso' ), | |
| 542 | +	__('sold out dates only', 'event_espresso'), | |
| 543 | 543 | |
| 544 | 544 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:29 | 
| 545 | - __( 'recently expired dates', 'event_espresso' ), | |
| 545 | +	__('recently expired dates', 'event_espresso'), | |
| 546 | 546 | |
| 547 | 547 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:30 | 
| 548 | - __( 'all expired dates', 'event_espresso' ), | |
| 548 | +	__('all expired dates', 'event_espresso'), | |
| 549 | 549 | |
| 550 | 550 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:31 | 
| 551 | - __( 'trashed dates only', 'event_espresso' ), | |
| 551 | +	__('trashed dates only', 'event_espresso'), | |
| 552 | 552 | |
| 553 | 553 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:35 | 
| 554 | 554 | // Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:9 | 
| 555 | 555 | // Reference: packages/dates/src/components/DateRangePicker/index.tsx:60 | 
| 556 | - __( 'start date', 'event_espresso' ), | |
| 556 | +	__('start date', 'event_espresso'), | |
| 557 | 557 | |
| 558 | 558 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:36 | 
| 559 | - __( 'name', 'event_espresso' ), | |
| 559 | +	__('name', 'event_espresso'), | |
| 560 | 560 | |
| 561 | 561 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:37 | 
| 562 | 562 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:33 | 
| @@ -564,176 +564,176 @@ discard block | ||
| 564 | 564 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/HeaderCell.tsx:27 | 
| 565 | 565 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:33 | 
| 566 | 566 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:23 | 
| 567 | - __( 'ID', 'event_espresso' ), | |
| 567 | +	__('ID', 'event_espresso'), | |
| 568 | 568 | |
| 569 | 569 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:38 | 
| 570 | 570 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:47 | 
| 571 | - __( 'custom order', 'event_espresso' ), | |
| 571 | +	__('custom order', 'event_espresso'), | |
| 572 | 572 | |
| 573 | 573 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:42 | 
| 574 | 574 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:51 | 
| 575 | - __( 'display', 'event_espresso' ), | |
| 575 | +	__('display', 'event_espresso'), | |
| 576 | 576 | |
| 577 | 577 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:43 | 
| 578 | - __( 'recurrence', 'event_espresso' ), | |
| 578 | +	__('recurrence', 'event_espresso'), | |
| 579 | 579 | |
| 580 | 580 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:44 | 
| 581 | 581 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:53 | 
| 582 | - __( 'sales', 'event_espresso' ), | |
| 582 | +	__('sales', 'event_espresso'), | |
| 583 | 583 | |
| 584 | 584 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:45 | 
| 585 | 585 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:55 | 
| 586 | - __( 'sort by', 'event_espresso' ), | |
| 586 | +	__('sort by', 'event_espresso'), | |
| 587 | 587 | |
| 588 | 588 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:46 | 
| 589 | 589 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:54 | 
| 590 | 590 | // Reference: packages/ee-components/src/EntityList/EntityListFilterBar.tsx:38 | 
| 591 | - __( 'search', 'event_espresso' ), | |
| 591 | +	__('search', 'event_espresso'), | |
| 592 | 592 | |
| 593 | 593 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:47 | 
| 594 | 594 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:56 | 
| 595 | - __( 'status', 'event_espresso' ), | |
| 595 | +	__('status', 'event_espresso'), | |
| 596 | 596 | |
| 597 | 597 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:9 | 
| 598 | - __( 'start dates only', 'event_espresso' ), | |
| 598 | +	__('start dates only', 'event_espresso'), | |
| 599 | 599 | |
| 600 | 600 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26 | 
| 601 | 601 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/NewDateModal.tsx:12 | 
| 602 | 602 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/OptionsModalButton.tsx:18 | 
| 603 | - __( 'Add New Date', 'event_espresso' ), | |
| 603 | +	__('Add New Date', 'event_espresso'), | |
| 604 | 604 | |
| 605 | 605 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26 | 
| 606 | - __( 'Add Single Date', 'event_espresso' ), | |
| 606 | +	__('Add Single Date', 'event_espresso'), | |
| 607 | 607 | |
| 608 | 608 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:44 | 
| 609 | - __( 'Add a single date that only occurs once', 'event_espresso' ), | |
| 609 | +	__('Add a single date that only occurs once', 'event_espresso'), | |
| 610 | 610 | |
| 611 | 611 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:46 | 
| 612 | - __( 'Single Date', 'event_espresso' ), | |
| 612 | +	__('Single Date', 'event_espresso'), | |
| 613 | 613 | |
| 614 | 614 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:108 | 
| 615 | - __( 'Reg list', 'event_espresso' ), | |
| 615 | +	__('Reg list', 'event_espresso'), | |
| 616 | 616 | |
| 617 | 617 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:109 | 
| 618 | - __( 'Regs', 'event_espresso' ), | |
| 618 | +	__('Regs', 'event_espresso'), | |
| 619 | 619 | |
| 620 | 620 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:124 | 
| 621 | 621 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:123 | 
| 622 | 622 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:59 | 
| 623 | - __( 'Actions', 'event_espresso' ), | |
| 623 | +	__('Actions', 'event_espresso'), | |
| 624 | 624 | |
| 625 | 625 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:54 | 
| 626 | - __( 'Start', 'event_espresso' ), | |
| 626 | +	__('Start', 'event_espresso'), | |
| 627 | 627 | |
| 628 | 628 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:68 | 
| 629 | - __( 'End', 'event_espresso' ), | |
| 629 | +	__('End', 'event_espresso'), | |
| 630 | 630 | |
| 631 | 631 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:84 | 
| 632 | - __( 'Cap', 'event_espresso' ), | |
| 632 | +	__('Cap', 'event_espresso'), | |
| 633 | 633 | |
| 634 | 634 | // Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:96 | 
| 635 | 635 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:100 | 
| 636 | - __( 'Sold', 'event_espresso' ), | |
| 636 | +	__('Sold', 'event_espresso'), | |
| 637 | 637 | |
| 638 | 638 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:33 | 
| 639 | 639 | // Reference: packages/form-builder/src/constants.ts:67 | 
| 640 | - __( 'Text Input', 'event_espresso' ), | |
| 640 | +	__('Text Input', 'event_espresso'), | |
| 641 | 641 | |
| 642 | 642 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:34 | 
| 643 | 643 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:32 | 
| 644 | - __( 'Attendee First Name', 'event_espresso' ), | |
| 644 | +	__('Attendee First Name', 'event_espresso'), | |
| 645 | 645 | |
| 646 | 646 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:39 | 
| 647 | 647 | /* translators: field name */ | 
| 648 | - __( 'Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso' ), | |
| 648 | +	__('Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso'), | |
| 649 | 649 | |
| 650 | 650 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:40 | 
| 651 | 651 | // Reference: packages/form-builder/src/constants.ts:82 | 
| 652 | - __( 'Email Address', 'event_espresso' ), | |
| 652 | +	__('Email Address', 'event_espresso'), | |
| 653 | 653 | |
| 654 | 654 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:41 | 
| 655 | 655 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:40 | 
| 656 | - __( 'Attendee Email Address', 'event_espresso' ), | |
| 656 | +	__('Attendee Email Address', 'event_espresso'), | |
| 657 | 657 | |
| 658 | 658 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:49 | 
| 659 | - __( 'Please add the required fields', 'event_espresso' ), | |
| 659 | +	__('Please add the required fields', 'event_espresso'), | |
| 660 | 660 | |
| 661 | 661 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/RegistrationForm.tsx:12 | 
| 662 | - __( 'Registration Form', 'event_espresso' ), | |
| 662 | +	__('Registration Form', 'event_espresso'), | |
| 663 | 663 | |
| 664 | 664 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:13 | 
| 665 | - __( 'primary registrant', 'event_espresso' ), | |
| 665 | +	__('primary registrant', 'event_espresso'), | |
| 666 | 666 | |
| 667 | 667 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:17 | 
| 668 | - __( 'purchaser', 'event_espresso' ), | |
| 668 | +	__('purchaser', 'event_espresso'), | |
| 669 | 669 | |
| 670 | 670 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:21 | 
| 671 | - __( 'registrants', 'event_espresso' ), | |
| 671 | +	__('registrants', 'event_espresso'), | |
| 672 | 672 | |
| 673 | 673 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:36 | 
| 674 | - __( 'Attendee Last Name', 'event_espresso' ), | |
| 674 | +	__('Attendee Last Name', 'event_espresso'), | |
| 675 | 675 | |
| 676 | 676 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:44 | 
| 677 | - __( 'Attendee Address', 'event_espresso' ), | |
| 677 | +	__('Attendee Address', 'event_espresso'), | |
| 678 | 678 | |
| 679 | 679 | // Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:9 | 
| 680 | - __( 'all', 'event_espresso' ), | |
| 680 | +	__('all', 'event_espresso'), | |
| 681 | 681 | |
| 682 | 682 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:18 | 
| 683 | - __( 'Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. | |
| 684 | -Please correct the assignments for the highlighted cells.', 'event_espresso' ), | |
| 683 | +	__('Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any.  | |
| 684 | +Please correct the assignments for the highlighted cells.', 'event_espresso'), | |
| 685 | 685 | |
| 686 | 686 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:22 | 
| 687 | - __( 'Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. | |
| 688 | -Please correct the assignments for the highlighted cells.', 'event_espresso' ), | |
| 687 | +	__('Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any.  | |
| 688 | +Please correct the assignments for the highlighted cells.', 'event_espresso'), | |
| 689 | 689 | |
| 690 | 690 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:32 | 
| 691 | - __( 'Please Update Assignments', 'event_espresso' ), | |
| 691 | +	__('Please Update Assignments', 'event_espresso'), | |
| 692 | 692 | |
| 693 | 693 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:26 | 
| 694 | - __( 'There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso' ), | |
| 694 | +	__('There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso'), | |
| 695 | 695 | |
| 696 | 696 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:29 | 
| 697 | - __( 'Alert!', 'event_espresso' ), | |
| 697 | +	__('Alert!', 'event_espresso'), | |
| 698 | 698 | |
| 699 | 699 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:42 | 
| 700 | 700 | /* translators: 1 entity id, 2 entity name */ | 
| 701 | - __( 'Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso' ), | |
| 701 | +	__('Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso'), | |
| 702 | 702 | |
| 703 | 703 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:49 | 
| 704 | 704 | /* translators: 1 entity id, 2 entity name */ | 
| 705 | - __( 'Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso' ), | |
| 705 | +	__('Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso'), | |
| 706 | 706 | |
| 707 | 707 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal.tsx:45 | 
| 708 | 708 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/Table.tsx:13 | 
| 709 | - __( 'Ticket Assignment Manager', 'event_espresso' ), | |
| 709 | +	__('Ticket Assignment Manager', 'event_espresso'), | |
| 710 | 710 | |
| 711 | 711 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:10 | 
| 712 | - __( 'existing relation', 'event_espresso' ), | |
| 712 | +	__('existing relation', 'event_espresso'), | |
| 713 | 713 | |
| 714 | 714 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:15 | 
| 715 | - __( 'remove existing relation', 'event_espresso' ), | |
| 715 | +	__('remove existing relation', 'event_espresso'), | |
| 716 | 716 | |
| 717 | 717 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:20 | 
| 718 | - __( 'add new relation', 'event_espresso' ), | |
| 718 | +	__('add new relation', 'event_espresso'), | |
| 719 | 719 | |
| 720 | 720 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:25 | 
| 721 | - __( 'invalid relation', 'event_espresso' ), | |
| 721 | +	__('invalid relation', 'event_espresso'), | |
| 722 | 722 | |
| 723 | 723 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:29 | 
| 724 | - __( 'no relation', 'event_espresso' ), | |
| 724 | +	__('no relation', 'event_espresso'), | |
| 725 | 725 | |
| 726 | 726 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:15 | 
| 727 | - __( 'Assignments', 'event_espresso' ), | |
| 727 | +	__('Assignments', 'event_espresso'), | |
| 728 | 728 | |
| 729 | 729 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:16 | 
| 730 | - __( 'Event Dates are listed below', 'event_espresso' ), | |
| 730 | +	__('Event Dates are listed below', 'event_espresso'), | |
| 731 | 731 | |
| 732 | 732 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:17 | 
| 733 | - __( 'Tickets are listed along the top', 'event_espresso' ), | |
| 733 | +	__('Tickets are listed along the top', 'event_espresso'), | |
| 734 | 734 | |
| 735 | 735 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:18 | 
| 736 | - __( 'Click the cell buttons to toggle assigments', 'event_espresso' ), | |
| 736 | +	__('Click the cell buttons to toggle assigments', 'event_espresso'), | |
| 737 | 737 | |
| 738 | 738 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/useSubmitButtonProps.ts:29 | 
| 739 | 739 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:16 | 
| @@ -742,1579 +742,1579 @@ discard block | ||
| 742 | 742 | // Reference: packages/tpc/src/buttons/useSubmitButtonProps.tsx:29 | 
| 743 | 743 | // Reference: packages/ui-components/src/Modal/useSubmitButtonProps.tsx:13 | 
| 744 | 744 | // Reference: packages/ui-components/src/Stepper/buttons/Submit.tsx:7 | 
| 745 | - __( 'Submit', 'event_espresso' ), | |
| 745 | +	__('Submit', 'event_espresso'), | |
| 746 | 746 | |
| 747 | 747 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:20 | 
| 748 | - __( 'All Dates', 'event_espresso' ), | |
| 748 | +	__('All Dates', 'event_espresso'), | |
| 749 | 749 | |
| 750 | 750 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:27 | 
| 751 | - __( 'dates by month', 'event_espresso' ), | |
| 751 | +	__('dates by month', 'event_espresso'), | |
| 752 | 752 | |
| 753 | 753 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowExpiredTicketsControl.tsx:16 | 
| 754 | - __( 'show expired tickets', 'event_espresso' ), | |
| 754 | +	__('show expired tickets', 'event_espresso'), | |
| 755 | 755 | |
| 756 | 756 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedDatesControl.tsx:13 | 
| 757 | - __( 'show trashed dates', 'event_espresso' ), | |
| 757 | +	__('show trashed dates', 'event_espresso'), | |
| 758 | 758 | |
| 759 | 759 | // Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedTicketsControl.tsx:16 | 
| 760 | - __( 'show trashed tickets', 'event_espresso' ), | |
| 760 | +	__('show trashed tickets', 'event_espresso'), | |
| 761 | 761 | |
| 762 | 762 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/Container.tsx:38 | 
| 763 | 763 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actions/Actions.tsx:25 | 
| 764 | - __( 'Default tickets', 'event_espresso' ), | |
| 764 | +	__('Default tickets', 'event_espresso'), | |
| 765 | 765 | |
| 766 | 766 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/ModalBody.tsx:63 | 
| 767 | 767 | // Reference: packages/edtr-services/src/constants.ts:26 | 
| 768 | - __( 'ticket', 'event_espresso' ), | |
| 768 | +	__('ticket', 'event_espresso'), | |
| 769 | 769 | |
| 770 | 770 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:26 | 
| 771 | 771 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:33 | 
| 772 | - __( 'Set ticket prices', 'event_espresso' ), | |
| 772 | +	__('Set ticket prices', 'event_espresso'), | |
| 773 | 773 | |
| 774 | 774 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:31 | 
| 775 | - __( 'Skip prices - Save', 'event_espresso' ), | |
| 775 | +	__('Skip prices - Save', 'event_espresso'), | |
| 776 | 776 | |
| 777 | 777 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:37 | 
| 778 | 778 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:57 | 
| 779 | - __( 'Ticket details', 'event_espresso' ), | |
| 779 | +	__('Ticket details', 'event_espresso'), | |
| 780 | 780 | |
| 781 | 781 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:38 | 
| 782 | - __( 'Save', 'event_espresso' ), | |
| 782 | +	__('Save', 'event_espresso'), | |
| 783 | 783 | |
| 784 | 784 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:22 | 
| 785 | 785 | /* translators: %s ticket id */ | 
| 786 | - __( 'Edit ticket %s', 'event_espresso' ), | |
| 786 | +	__('Edit ticket %s', 'event_espresso'), | |
| 787 | 787 | |
| 788 | 788 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:25 | 
| 789 | 789 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:33 | 
| 790 | - __( 'New Ticket Details', 'event_espresso' ), | |
| 790 | +	__('New Ticket Details', 'event_espresso'), | |
| 791 | 791 | |
| 792 | 792 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10 | 
| 793 | 793 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10 | 
| 794 | - __( 'primary information about the ticket', 'event_espresso' ), | |
| 794 | +	__('primary information about the ticket', 'event_espresso'), | |
| 795 | 795 | |
| 796 | 796 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10 | 
| 797 | 797 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10 | 
| 798 | - __( 'Ticket Details', 'event_espresso' ), | |
| 798 | +	__('Ticket Details', 'event_espresso'), | |
| 799 | 799 | |
| 800 | 800 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:12 | 
| 801 | 801 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:12 | 
| 802 | - __( 'apply ticket price modifiers and taxes', 'event_espresso' ), | |
| 802 | +	__('apply ticket price modifiers and taxes', 'event_espresso'), | |
| 803 | 803 | |
| 804 | 804 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:14 | 
| 805 | 805 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:14 | 
| 806 | - __( 'Price Calculator', 'event_espresso' ), | |
| 806 | +	__('Price Calculator', 'event_espresso'), | |
| 807 | 807 | |
| 808 | 808 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16 | 
| 809 | 809 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16 | 
| 810 | - __( 'Assign Dates', 'event_espresso' ), | |
| 810 | +	__('Assign Dates', 'event_espresso'), | |
| 811 | 811 | |
| 812 | 812 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:39 | 
| 813 | - __( 'Skip prices - assign dates', 'event_espresso' ), | |
| 813 | +	__('Skip prices - assign dates', 'event_espresso'), | |
| 814 | 814 | |
| 815 | 815 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:50 | 
| 816 | - __( 'Save and assign dates', 'event_espresso' ), | |
| 816 | +	__('Save and assign dates', 'event_espresso'), | |
| 817 | 817 | |
| 818 | 818 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:29 | 
| 819 | 819 | /* translators: %1$s ticket name, %2$s ticket id */ | 
| 820 | - __( 'Edit ticket "%1$s" - %2$s', 'event_espresso' ), | |
| 820 | +	__('Edit ticket "%1$s" - %2$s', 'event_espresso'), | |
| 821 | 821 | |
| 822 | 822 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:43 | 
| 823 | - __( 'modal for ticket', 'event_espresso' ), | |
| 823 | +	__('modal for ticket', 'event_espresso'), | |
| 824 | 824 | |
| 825 | 825 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:101 | 
| 826 | - __( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ), | |
| 826 | +	__('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'), | |
| 827 | 827 | |
| 828 | 828 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:107 | 
| 829 | 829 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:119 | 
| 830 | - __( 'Number of Uses', 'event_espresso' ), | |
| 830 | +	__('Number of Uses', 'event_espresso'), | |
| 831 | 831 | |
| 832 | 832 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:113 | 
| 833 | - __( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ), | |
| 833 | +	__('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'), | |
| 834 | 834 | |
| 835 | 835 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:117 | 
| 836 | - __( 'Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso' ), | |
| 836 | +	__('Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso'), | |
| 837 | 837 | |
| 838 | 838 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:125 | 
| 839 | 839 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:127 | 
| 840 | - __( 'Minimum Quantity', 'event_espresso' ), | |
| 840 | +	__('Minimum Quantity', 'event_espresso'), | |
| 841 | 841 | |
| 842 | 842 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:130 | 
| 843 | - __( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ), | |
| 843 | +	__('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'), | |
| 844 | 844 | |
| 845 | 845 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:134 | 
| 846 | - __( 'Leave blank for no minimum.', 'event_espresso' ), | |
| 846 | +	__('Leave blank for no minimum.', 'event_espresso'), | |
| 847 | 847 | |
| 848 | 848 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:140 | 
| 849 | 849 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:135 | 
| 850 | - __( 'Maximum Quantity', 'event_espresso' ), | |
| 850 | +	__('Maximum Quantity', 'event_espresso'), | |
| 851 | 851 | |
| 852 | 852 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:146 | 
| 853 | - __( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ), | |
| 853 | +	__('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'), | |
| 854 | 854 | |
| 855 | 855 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:150 | 
| 856 | - __( 'Leave blank for no maximum.', 'event_espresso' ), | |
| 856 | +	__('Leave blank for no maximum.', 'event_espresso'), | |
| 857 | 857 | |
| 858 | 858 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:156 | 
| 859 | 859 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:144 | 
| 860 | - __( 'Required Ticket', 'event_espresso' ), | |
| 860 | +	__('Required Ticket', 'event_espresso'), | |
| 861 | 861 | |
| 862 | 862 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:158 | 
| 863 | - __( 'If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso' ), | |
| 863 | +	__('If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso'), | |
| 864 | 864 | |
| 865 | 865 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:170 | 
| 866 | - __( 'Visibility', 'event_espresso' ), | |
| 866 | +	__('Visibility', 'event_espresso'), | |
| 867 | 867 | |
| 868 | 868 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:202 | 
| 869 | - __( 'Ticket Sales', 'event_espresso' ), | |
| 869 | +	__('Ticket Sales', 'event_espresso'), | |
| 870 | 870 | |
| 871 | 871 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:93 | 
| 872 | 872 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:110 | 
| 873 | - __( 'Quantity For Sale', 'event_espresso' ), | |
| 873 | +	__('Quantity For Sale', 'event_espresso'), | |
| 874 | 874 | |
| 875 | 875 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:99 | 
| 876 | - __( 'The maximum number of this ticket available for sale.', 'event_espresso' ), | |
| 876 | +	__('The maximum number of this ticket available for sale.', 'event_espresso'), | |
| 877 | 877 | |
| 878 | 878 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketRegistrationsLink.tsx:14 | 
| 879 | - __( 'view ALL registrations for this ticket.', 'event_espresso' ), | |
| 879 | +	__('view ALL registrations for this ticket.', 'event_espresso'), | |
| 880 | 880 | |
| 881 | 881 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketSoldLink.tsx:13 | 
| 882 | - __( 'view approved registrations for this ticket.', 'event_espresso' ), | |
| 882 | +	__('view approved registrations for this ticket.', 'event_espresso'), | |
| 883 | 883 | |
| 884 | 884 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:36 | 
| 885 | - __( 'Available Tickets', 'event_espresso' ), | |
| 885 | +	__('Available Tickets', 'event_espresso'), | |
| 886 | 886 | |
| 887 | 887 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:39 | 
| 888 | - __( 'loading tickets…', 'event_espresso' ), | |
| 888 | +	__('loading tickets…', 'event_espresso'), | |
| 889 | 889 | |
| 890 | 890 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:26 | 
| 891 | - __( 'Number of related dates', 'event_espresso' ), | |
| 891 | +	__('Number of related dates', 'event_espresso'), | |
| 892 | 892 | |
| 893 | 893 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:27 | 
| 894 | - __( 'There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso' ), | |
| 894 | +	__('There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso'), | |
| 895 | 895 | |
| 896 | 896 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:37 | 
| 897 | - __( 'assign dates', 'event_espresso' ), | |
| 897 | +	__('assign dates', 'event_espresso'), | |
| 898 | 898 | |
| 899 | 899 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:19 | 
| 900 | - __( 'Permanently Delete Ticket?', 'event_espresso' ), | |
| 900 | +	__('Permanently Delete Ticket?', 'event_espresso'), | |
| 901 | 901 | |
| 902 | 902 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:19 | 
| 903 | - __( 'Move Ticket to Trash?', 'event_espresso' ), | |
| 903 | +	__('Move Ticket to Trash?', 'event_espresso'), | |
| 904 | 904 | |
| 905 | 905 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:22 | 
| 906 | - __( 'Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso' ), | |
| 906 | +	__('Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso'), | |
| 907 | 907 | |
| 908 | 908 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:48 | 
| 909 | 909 | // Reference: packages/ee-components/src/SimpleTicketCard/actions/Trash.tsx:6 | 
| 910 | - __( 'trash ticket', 'event_espresso' ), | |
| 910 | +	__('trash ticket', 'event_espresso'), | |
| 911 | 911 | |
| 912 | 912 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:25 | 
| 913 | - __( 'ticket main menu', 'event_espresso' ), | |
| 913 | +	__('ticket main menu', 'event_espresso'), | |
| 914 | 914 | |
| 915 | 915 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:38 | 
| 916 | 916 | // Reference: packages/ee-components/src/SimpleTicketCard/actions/Edit.tsx:15 | 
| 917 | - __( 'edit ticket', 'event_espresso' ), | |
| 917 | +	__('edit ticket', 'event_espresso'), | |
| 918 | 918 | |
| 919 | 919 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:39 | 
| 920 | - __( 'copy ticket', 'event_espresso' ), | |
| 920 | +	__('copy ticket', 'event_espresso'), | |
| 921 | 921 | |
| 922 | 922 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:43 | 
| 923 | - __( 'edit ticket details', 'event_espresso' ), | |
| 923 | +	__('edit ticket details', 'event_espresso'), | |
| 924 | 924 | |
| 925 | 925 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47 | 
| 926 | - __( 'delete tickets', 'event_espresso' ), | |
| 926 | +	__('delete tickets', 'event_espresso'), | |
| 927 | 927 | |
| 928 | 928 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47 | 
| 929 | - __( 'trash tickets', 'event_espresso' ), | |
| 929 | +	__('trash tickets', 'event_espresso'), | |
| 930 | 930 | |
| 931 | 931 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:51 | 
| 932 | - __( 'edit ticket prices', 'event_espresso' ), | |
| 932 | +	__('edit ticket prices', 'event_espresso'), | |
| 933 | 933 | |
| 934 | 934 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:14 | 
| 935 | - __( 'Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso' ), | |
| 935 | +	__('Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso'), | |
| 936 | 936 | |
| 937 | 937 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15 | 
| 938 | - __( 'Are you sure you want to trash these tickets?', 'event_espresso' ), | |
| 938 | +	__('Are you sure you want to trash these tickets?', 'event_espresso'), | |
| 939 | 939 | |
| 940 | 940 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16 | 
| 941 | - __( 'Delete tickets permanently', 'event_espresso' ), | |
| 941 | +	__('Delete tickets permanently', 'event_espresso'), | |
| 942 | 942 | |
| 943 | 943 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16 | 
| 944 | - __( 'Trash tickets', 'event_espresso' ), | |
| 944 | +	__('Trash tickets', 'event_espresso'), | |
| 945 | 945 | |
| 946 | 946 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:21 | 
| 947 | - __( 'Bulk edit ticket details', 'event_espresso' ), | |
| 947 | +	__('Bulk edit ticket details', 'event_espresso'), | |
| 948 | 948 | |
| 949 | 949 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:22 | 
| 950 | - __( 'any changes will be applied to ALL of the selected tickets.', 'event_espresso' ), | |
| 950 | +	__('any changes will be applied to ALL of the selected tickets.', 'event_espresso'), | |
| 951 | 951 | |
| 952 | 952 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/EditPrices.tsx:19 | 
| 953 | - __( 'Bulk edit ticket prices', 'event_espresso' ), | |
| 953 | +	__('Bulk edit ticket prices', 'event_espresso'), | |
| 954 | 954 | |
| 955 | 955 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:20 | 
| 956 | - __( 'Edit all prices together', 'event_espresso' ), | |
| 956 | +	__('Edit all prices together', 'event_espresso'), | |
| 957 | 957 | |
| 958 | 958 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:21 | 
| 959 | - __( 'Edit all the selected ticket prices dynamically', 'event_espresso' ), | |
| 959 | +	__('Edit all the selected ticket prices dynamically', 'event_espresso'), | |
| 960 | 960 | |
| 961 | 961 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:25 | 
| 962 | - __( 'Edit prices individually', 'event_espresso' ), | |
| 962 | +	__('Edit prices individually', 'event_espresso'), | |
| 963 | 963 | |
| 964 | 964 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:26 | 
| 965 | - __( 'Edit prices for each ticket individually', 'event_espresso' ), | |
| 965 | +	__('Edit prices for each ticket individually', 'event_espresso'), | |
| 966 | 966 | |
| 967 | 967 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:14 | 
| 968 | 968 | // Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:34 | 
| 969 | 969 | // Reference: packages/form/src/ResetButton.tsx:18 | 
| 970 | 970 | // Reference: packages/tpc/src/buttons/useResetButtonProps.tsx:12 | 
| 971 | - __( 'Reset', 'event_espresso' ), | |
| 971 | +	__('Reset', 'event_espresso'), | |
| 972 | 972 | |
| 973 | 973 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:15 | 
| 974 | 974 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:76 | 
| 975 | 975 | // Reference: packages/ui-components/src/Modal/useCancelButtonProps.tsx:10 | 
| 976 | - __( 'Cancel', 'event_espresso' ), | |
| 976 | +	__('Cancel', 'event_espresso'), | |
| 977 | 977 | |
| 978 | 978 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/editSeparately/TPCInstance.tsx:26 | 
| 979 | 979 | /* translators: %s ticket name */ | 
| 980 | - __( 'Edit prices for Ticket: %s', 'event_espresso' ), | |
| 980 | +	__('Edit prices for Ticket: %s', 'event_espresso'), | |
| 981 | 981 | |
| 982 | 982 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:30 | 
| 983 | - __( 'sales start', 'event_espresso' ), | |
| 983 | +	__('sales start', 'event_espresso'), | |
| 984 | 984 | |
| 985 | 985 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:33 | 
| 986 | - __( 'sales began', 'event_espresso' ), | |
| 986 | +	__('sales began', 'event_espresso'), | |
| 987 | 987 | |
| 988 | 988 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:35 | 
| 989 | - __( 'sales ended', 'event_espresso' ), | |
| 989 | +	__('sales ended', 'event_espresso'), | |
| 990 | 990 | |
| 991 | 991 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:36 | 
| 992 | - __( 'sales end', 'event_espresso' ), | |
| 992 | +	__('sales end', 'event_espresso'), | |
| 993 | 993 | |
| 994 | 994 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:50 | 
| 995 | - __( 'Edit Ticket Sale Dates', 'event_espresso' ), | |
| 995 | +	__('Edit Ticket Sale Dates', 'event_espresso'), | |
| 996 | 996 | |
| 997 | 997 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:54 | 
| 998 | - __( 'edit ticket sales start and end dates', 'event_espresso' ), | |
| 998 | +	__('edit ticket sales start and end dates', 'event_espresso'), | |
| 999 | 999 | |
| 1000 | 1000 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:21 | 
| 1001 | - __( 'quantity', 'event_espresso' ), | |
| 1001 | +	__('quantity', 'event_espresso'), | |
| 1002 | 1002 | |
| 1003 | 1003 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:28 | 
| 1004 | 1004 | // Reference: packages/edtr-services/src/apollo/mutations/tickets/useUpdateTicketQtyByCapacity.ts:78 | 
| 1005 | - __( 'Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso' ), | |
| 1005 | +	__('Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso'), | |
| 1006 | 1006 | |
| 1007 | 1007 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:51 | 
| 1008 | - __( 'edit quantity of tickets available…', 'event_espresso' ), | |
| 1008 | +	__('edit quantity of tickets available…', 'event_espresso'), | |
| 1009 | 1009 | |
| 1010 | 1010 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:14 | 
| 1011 | - __( 'Manage Date Assignments', 'event_espresso' ), | |
| 1011 | +	__('Manage Date Assignments', 'event_espresso'), | |
| 1012 | 1012 | |
| 1013 | 1013 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:19 | 
| 1014 | 1014 | // Reference: packages/tpc/src/components/table/Table.tsx:43 | 
| 1015 | - __( 'Ticket Price Calculator', 'event_espresso' ), | |
| 1015 | +	__('Ticket Price Calculator', 'event_espresso'), | |
| 1016 | 1016 | |
| 1017 | 1017 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:24 | 
| 1018 | - __( 'Move Ticket to Trash', 'event_espresso' ), | |
| 1018 | +	__('Move Ticket to Trash', 'event_espresso'), | |
| 1019 | 1019 | |
| 1020 | 1020 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:31 | 
| 1021 | 1021 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:54 | 
| 1022 | - __( 'On Sale', 'event_espresso' ), | |
| 1022 | +	__('On Sale', 'event_espresso'), | |
| 1023 | 1023 | |
| 1024 | 1024 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:33 | 
| 1025 | - __( 'Pending', 'event_espresso' ), | |
| 1025 | +	__('Pending', 'event_espresso'), | |
| 1026 | 1026 | |
| 1027 | 1027 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:9 | 
| 1028 | - __( 'Edit Ticket Details', 'event_espresso' ), | |
| 1028 | +	__('Edit Ticket Details', 'event_espresso'), | |
| 1029 | 1029 | |
| 1030 | 1030 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:39 | 
| 1031 | - __( 'edit ticket total…', 'event_espresso' ), | |
| 1031 | +	__('edit ticket total…', 'event_espresso'), | |
| 1032 | 1032 | |
| 1033 | 1033 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:53 | 
| 1034 | - __( 'set price…', 'event_espresso' ), | |
| 1034 | +	__('set price…', 'event_espresso'), | |
| 1035 | 1035 | |
| 1036 | 1036 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:23 | 
| 1037 | - __( 'tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso' ), | |
| 1037 | +	__('tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso'), | |
| 1038 | 1038 | |
| 1039 | 1039 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:24 | 
| 1040 | - __( 'tickets list is unlinked and is showing tickets for all event dates', 'event_espresso' ), | |
| 1040 | +	__('tickets list is unlinked and is showing tickets for all event dates', 'event_espresso'), | |
| 1041 | 1041 | |
| 1042 | 1042 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:10 | 
| 1043 | - __( 'ticket sales start and end dates', 'event_espresso' ), | |
| 1043 | +	__('ticket sales start and end dates', 'event_espresso'), | |
| 1044 | 1044 | |
| 1045 | 1045 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:15 | 
| 1046 | - __( 'tickets with 90% or more sold', 'event_espresso' ), | |
| 1046 | +	__('tickets with 90% or more sold', 'event_espresso'), | |
| 1047 | 1047 | |
| 1048 | 1048 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:16 | 
| 1049 | - __( 'tickets with 75% or more sold', 'event_espresso' ), | |
| 1049 | +	__('tickets with 75% or more sold', 'event_espresso'), | |
| 1050 | 1050 | |
| 1051 | 1051 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:17 | 
| 1052 | - __( 'tickets with 50% or more sold', 'event_espresso' ), | |
| 1052 | +	__('tickets with 50% or more sold', 'event_espresso'), | |
| 1053 | 1053 | |
| 1054 | 1054 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:19 | 
| 1055 | - __( 'tickets with less than 50% sold', 'event_espresso' ), | |
| 1055 | +	__('tickets with less than 50% sold', 'event_espresso'), | |
| 1056 | 1056 | |
| 1057 | 1057 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:28 | 
| 1058 | - __( 'all tickets for all dates', 'event_espresso' ), | |
| 1058 | +	__('all tickets for all dates', 'event_espresso'), | |
| 1059 | 1059 | |
| 1060 | 1060 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:29 | 
| 1061 | - __( 'all on sale and sale pending', 'event_espresso' ), | |
| 1061 | +	__('all on sale and sale pending', 'event_espresso'), | |
| 1062 | 1062 | |
| 1063 | 1063 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:30 | 
| 1064 | - __( 'on sale tickets only', 'event_espresso' ), | |
| 1064 | +	__('on sale tickets only', 'event_espresso'), | |
| 1065 | 1065 | |
| 1066 | 1066 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:31 | 
| 1067 | - __( 'sale pending tickets only', 'event_espresso' ), | |
| 1067 | +	__('sale pending tickets only', 'event_espresso'), | |
| 1068 | 1068 | |
| 1069 | 1069 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:32 | 
| 1070 | - __( 'next on sale or sale pending only', 'event_espresso' ), | |
| 1070 | +	__('next on sale or sale pending only', 'event_espresso'), | |
| 1071 | 1071 | |
| 1072 | 1072 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:33 | 
| 1073 | - __( 'sold out tickets only', 'event_espresso' ), | |
| 1073 | +	__('sold out tickets only', 'event_espresso'), | |
| 1074 | 1074 | |
| 1075 | 1075 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:34 | 
| 1076 | - __( 'expired tickets only', 'event_espresso' ), | |
| 1076 | +	__('expired tickets only', 'event_espresso'), | |
| 1077 | 1077 | |
| 1078 | 1078 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:35 | 
| 1079 | - __( 'trashed tickets only', 'event_espresso' ), | |
| 1079 | +	__('trashed tickets only', 'event_espresso'), | |
| 1080 | 1080 | |
| 1081 | 1081 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:40 | 
| 1082 | - __( 'all tickets for above dates', 'event_espresso' ), | |
| 1082 | +	__('all tickets for above dates', 'event_espresso'), | |
| 1083 | 1083 | |
| 1084 | 1084 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:44 | 
| 1085 | - __( 'ticket sale date', 'event_espresso' ), | |
| 1085 | +	__('ticket sale date', 'event_espresso'), | |
| 1086 | 1086 | |
| 1087 | 1087 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:45 | 
| 1088 | - __( 'ticket name', 'event_espresso' ), | |
| 1088 | +	__('ticket name', 'event_espresso'), | |
| 1089 | 1089 | |
| 1090 | 1090 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:46 | 
| 1091 | - __( 'ticket ID', 'event_espresso' ), | |
| 1091 | +	__('ticket ID', 'event_espresso'), | |
| 1092 | 1092 | |
| 1093 | 1093 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:52 | 
| 1094 | - __( 'linked', 'event_espresso' ), | |
| 1094 | +	__('linked', 'event_espresso'), | |
| 1095 | 1095 | |
| 1096 | 1096 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:8 | 
| 1097 | - __( 'ticket sales start date only', 'event_espresso' ), | |
| 1097 | +	__('ticket sales start date only', 'event_espresso'), | |
| 1098 | 1098 | |
| 1099 | 1099 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:9 | 
| 1100 | - __( 'ticket sales end date only', 'event_espresso' ), | |
| 1100 | +	__('ticket sales end date only', 'event_espresso'), | |
| 1101 | 1101 | |
| 1102 | 1102 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:18 | 
| 1103 | - __( 'Add New Ticket', 'event_espresso' ), | |
| 1103 | +	__('Add New Ticket', 'event_espresso'), | |
| 1104 | 1104 | |
| 1105 | 1105 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:32 | 
| 1106 | - __( 'Add a single ticket and assign the dates to it', 'event_espresso' ), | |
| 1106 | +	__('Add a single ticket and assign the dates to it', 'event_espresso'), | |
| 1107 | 1107 | |
| 1108 | 1108 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:34 | 
| 1109 | - __( 'Single Ticket', 'event_espresso' ), | |
| 1109 | +	__('Single Ticket', 'event_espresso'), | |
| 1110 | 1110 | |
| 1111 | 1111 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/TableView.tsx:39 | 
| 1112 | - __( 'Tickets', 'event_espresso' ), | |
| 1112 | +	__('Tickets', 'event_espresso'), | |
| 1113 | 1113 | |
| 1114 | 1114 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:110 | 
| 1115 | - __( 'Reg List', 'event_espresso' ), | |
| 1115 | +	__('Reg List', 'event_espresso'), | |
| 1116 | 1116 | |
| 1117 | 1117 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:53 | 
| 1118 | - __( 'Goes on Sale', 'event_espresso' ), | |
| 1118 | +	__('Goes on Sale', 'event_espresso'), | |
| 1119 | 1119 | |
| 1120 | 1120 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:67 | 
| 1121 | - __( 'Sale Ends', 'event_espresso' ), | |
| 1121 | +	__('Sale Ends', 'event_espresso'), | |
| 1122 | 1122 | |
| 1123 | 1123 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:68 | 
| 1124 | - __( 'Ends', 'event_espresso' ), | |
| 1124 | +	__('Ends', 'event_espresso'), | |
| 1125 | 1125 | |
| 1126 | 1126 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:80 | 
| 1127 | - __( 'Price', 'event_espresso' ), | |
| 1127 | +	__('Price', 'event_espresso'), | |
| 1128 | 1128 | |
| 1129 | 1129 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:90 | 
| 1130 | - __( 'Qty', 'event_espresso' ), | |
| 1130 | +	__('Qty', 'event_espresso'), | |
| 1131 | 1131 | |
| 1132 | 1132 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:104 | 
| 1133 | - __( 'Venue telephone', 'event_espresso' ), | |
| 1133 | +	__('Venue telephone', 'event_espresso'), | |
| 1134 | 1134 | |
| 1135 | 1135 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:111 | 
| 1136 | - __( 'Edit this Venue', 'event_espresso' ), | |
| 1136 | +	__('Edit this Venue', 'event_espresso'), | |
| 1137 | 1137 | |
| 1138 | 1138 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:120 | 
| 1139 | - __( 'Select a Venue for the Event', 'event_espresso' ), | |
| 1139 | +	__('Select a Venue for the Event', 'event_espresso'), | |
| 1140 | 1140 | |
| 1141 | 1141 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:21 | 
| 1142 | - __( 'Venue Details', 'event_espresso' ), | |
| 1142 | +	__('Venue Details', 'event_espresso'), | |
| 1143 | 1143 | |
| 1144 | 1144 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:39 | 
| 1145 | - __( 'unlimited space', 'event_espresso' ), | |
| 1145 | +	__('unlimited space', 'event_espresso'), | |
| 1146 | 1146 | |
| 1147 | 1147 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:42 | 
| 1148 | 1148 | /* translators: %d venue capacity */ | 
| 1149 | - __( 'Space for up to %d people', 'event_espresso' ), | |
| 1149 | +	__('Space for up to %d people', 'event_espresso'), | |
| 1150 | 1150 | |
| 1151 | 1151 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:53 | 
| 1152 | - __( 'Venue address', 'event_espresso' ), | |
| 1152 | +	__('Venue address', 'event_espresso'), | |
| 1153 | 1153 | |
| 1154 | 1154 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:59 | 
| 1155 | - __( 'Venue Details card', 'event_espresso' ), | |
| 1155 | +	__('Venue Details card', 'event_espresso'), | |
| 1156 | 1156 | |
| 1157 | 1157 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:68 | 
| 1158 | - __( 'no image', 'event_espresso' ), | |
| 1158 | +	__('no image', 'event_espresso'), | |
| 1159 | 1159 | |
| 1160 | 1160 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:72 | 
| 1161 | - __( 'Venue name', 'event_espresso' ), | |
| 1161 | +	__('Venue name', 'event_espresso'), | |
| 1162 | 1162 | |
| 1163 | 1163 | // Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:96 | 
| 1164 | - __( 'Venue capacity', 'event_espresso' ), | |
| 1164 | +	__('Venue capacity', 'event_espresso'), | |
| 1165 | 1165 | |
| 1166 | 1166 | // Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:29 | 
| 1167 | - __( 'Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso' ), | |
| 1167 | +	__('Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso'), | |
| 1168 | 1168 | |
| 1169 | 1169 | // Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:40 | 
| 1170 | - __( 'Skip', 'event_espresso' ), | |
| 1170 | +	__('Skip', 'event_espresso'), | |
| 1171 | 1171 | |
| 1172 | 1172 | // Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:42 | 
| 1173 | - __( 'Sure I\'ll help', 'event_espresso' ), | |
| 1173 | +	__('Sure I\'ll help', 'event_espresso'), | |
| 1174 | 1174 | |
| 1175 | 1175 | // Reference: packages/adapters/src/Pagination/Pagination.tsx:23 | 
| 1176 | - __( 'pagination', 'event_espresso' ), | |
| 1176 | +	__('pagination', 'event_espresso'), | |
| 1177 | 1177 | |
| 1178 | 1178 | // Reference: packages/adapters/src/TagSelector/TagSelector.tsx:113 | 
| 1179 | - __( 'toggle menu', 'event_espresso' ), | |
| 1179 | +	__('toggle menu', 'event_espresso'), | |
| 1180 | 1180 | |
| 1181 | 1181 | // Reference: packages/constants/src/datetime.ts:10 | 
| 1182 | - __( 'Postponed', 'event_espresso' ), | |
| 1182 | +	__('Postponed', 'event_espresso'), | |
| 1183 | 1183 | |
| 1184 | 1184 | // Reference: packages/constants/src/datetime.ts:11 | 
| 1185 | - __( 'SoldOut', 'event_espresso' ), | |
| 1185 | +	__('SoldOut', 'event_espresso'), | |
| 1186 | 1186 | |
| 1187 | 1187 | // Reference: packages/constants/src/datetime.ts:7 | 
| 1188 | 1188 | // Reference: packages/predicates/src/registration/statusOptions.ts:11 | 
| 1189 | - __( 'Cancelled', 'event_espresso' ), | |
| 1189 | +	__('Cancelled', 'event_espresso'), | |
| 1190 | 1190 | |
| 1191 | 1191 | // Reference: packages/constants/src/datetime.ts:9 | 
| 1192 | - __( 'Inactive', 'event_espresso' ), | |
| 1192 | +	__('Inactive', 'event_espresso'), | |
| 1193 | 1193 | |
| 1194 | 1194 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:25 | 
| 1195 | - __( 'error creating %s', 'event_espresso' ), | |
| 1195 | +	__('error creating %s', 'event_espresso'), | |
| 1196 | 1196 | |
| 1197 | 1197 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:26 | 
| 1198 | - __( 'error deleting %s', 'event_espresso' ), | |
| 1198 | +	__('error deleting %s', 'event_espresso'), | |
| 1199 | 1199 | |
| 1200 | 1200 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:27 | 
| 1201 | - __( 'error updating %s', 'event_espresso' ), | |
| 1201 | +	__('error updating %s', 'event_espresso'), | |
| 1202 | 1202 | |
| 1203 | 1203 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:28 | 
| 1204 | - __( 'creating %s', 'event_espresso' ), | |
| 1204 | +	__('creating %s', 'event_espresso'), | |
| 1205 | 1205 | |
| 1206 | 1206 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:29 | 
| 1207 | - __( 'deleting %s', 'event_espresso' ), | |
| 1207 | +	__('deleting %s', 'event_espresso'), | |
| 1208 | 1208 | |
| 1209 | 1209 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:30 | 
| 1210 | - __( 'updating %s', 'event_espresso' ), | |
| 1210 | +	__('updating %s', 'event_espresso'), | |
| 1211 | 1211 | |
| 1212 | 1212 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:31 | 
| 1213 | - __( 'successfully created %s', 'event_espresso' ), | |
| 1213 | +	__('successfully created %s', 'event_espresso'), | |
| 1214 | 1214 | |
| 1215 | 1215 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:32 | 
| 1216 | - __( 'successfully deleted %s', 'event_espresso' ), | |
| 1216 | +	__('successfully deleted %s', 'event_espresso'), | |
| 1217 | 1217 | |
| 1218 | 1218 | // Reference: packages/data/src/mutations/useMutationWithFeedback.ts:33 | 
| 1219 | - __( 'successfully updated %s', 'event_espresso' ), | |
| 1219 | +	__('successfully updated %s', 'event_espresso'), | |
| 1220 | 1220 | |
| 1221 | 1221 | // Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:13 | 
| 1222 | - __( 'day in range', 'event_espresso' ), | |
| 1222 | +	__('day in range', 'event_espresso'), | |
| 1223 | 1223 | |
| 1224 | 1224 | // Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:17 | 
| 1225 | 1225 | // Reference: packages/dates/src/components/DateRangePicker/index.tsx:78 | 
| 1226 | - __( 'end date', 'event_espresso' ), | |
| 1226 | +	__('end date', 'event_espresso'), | |
| 1227 | 1227 | |
| 1228 | 1228 | // Reference: packages/dates/src/components/DateTimePicker.tsx:17 | 
| 1229 | 1229 | // Reference: packages/dates/src/components/TimePicker.tsx:17 | 
| 1230 | 1230 | // Reference: packages/form-builder/src/state/utils.ts:433 | 
| 1231 | - __( 'time', 'event_espresso' ), | |
| 1231 | +	__('time', 'event_espresso'), | |
| 1232 | 1232 | |
| 1233 | 1233 | // Reference: packages/dates/src/constants.ts:7 | 
| 1234 | - __( 'End Date & Time must be set later than the Start Date & Time', 'event_espresso' ), | |
| 1234 | +	__('End Date & Time must be set later than the Start Date & Time', 'event_espresso'), | |
| 1235 | 1235 | |
| 1236 | 1236 | // Reference: packages/dates/src/constants.ts:9 | 
| 1237 | - __( 'Start Date & Time must be set before the End Date & Time', 'event_espresso' ), | |
| 1237 | +	__('Start Date & Time must be set before the End Date & Time', 'event_espresso'), | |
| 1238 | 1238 | |
| 1239 | 1239 | // Reference: packages/dates/src/utils/misc.ts:16 | 
| 1240 | - __( 'month(s)', 'event_espresso' ), | |
| 1240 | +	__('month(s)', 'event_espresso'), | |
| 1241 | 1241 | |
| 1242 | 1242 | // Reference: packages/dates/src/utils/misc.ts:17 | 
| 1243 | - __( 'week(s)', 'event_espresso' ), | |
| 1243 | +	__('week(s)', 'event_espresso'), | |
| 1244 | 1244 | |
| 1245 | 1245 | // Reference: packages/dates/src/utils/misc.ts:18 | 
| 1246 | - __( 'day(s)', 'event_espresso' ), | |
| 1246 | +	__('day(s)', 'event_espresso'), | |
| 1247 | 1247 | |
| 1248 | 1248 | // Reference: packages/dates/src/utils/misc.ts:19 | 
| 1249 | - __( 'hour(s)', 'event_espresso' ), | |
| 1249 | +	__('hour(s)', 'event_espresso'), | |
| 1250 | 1250 | |
| 1251 | 1251 | // Reference: packages/dates/src/utils/misc.ts:20 | 
| 1252 | - __( 'minute(s)', 'event_espresso' ), | |
| 1252 | +	__('minute(s)', 'event_espresso'), | |
| 1253 | 1253 | |
| 1254 | 1254 | // Reference: packages/edtr-services/src/apollo/mutations/useReorderEntities.ts:63 | 
| 1255 | - __( 'order updated', 'event_espresso' ), | |
| 1255 | +	__('order updated', 'event_espresso'), | |
| 1256 | 1256 | |
| 1257 | 1257 | // Reference: packages/edtr-services/src/constants.ts:24 | 
| 1258 | - __( 'datetime', 'event_espresso' ), | |
| 1258 | +	__('datetime', 'event_espresso'), | |
| 1259 | 1259 | |
| 1260 | 1260 | // Reference: packages/edtr-services/src/constants.ts:27 | 
| 1261 | - __( 'price', 'event_espresso' ), | |
| 1261 | +	__('price', 'event_espresso'), | |
| 1262 | 1262 | |
| 1263 | 1263 | // Reference: packages/edtr-services/src/constants.ts:28 | 
| 1264 | 1264 | // Reference: packages/tpc/src/components/price/input/Type.tsx:30 | 
| 1265 | - __( 'price type', 'event_espresso' ), | |
| 1265 | +	__('price type', 'event_espresso'), | |
| 1266 | 1266 | |
| 1267 | 1267 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:38 | 
| 1268 | 1268 | // Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:39 | 
| 1269 | - __( 'End date has been adjusted', 'event_espresso' ), | |
| 1269 | +	__('End date has been adjusted', 'event_espresso'), | |
| 1270 | 1270 | |
| 1271 | 1271 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:59 | 
| 1272 | - __( 'Required', 'event_espresso' ), | |
| 1272 | +	__('Required', 'event_espresso'), | |
| 1273 | 1273 | |
| 1274 | 1274 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:64 | 
| 1275 | - __( 'Start Date is required', 'event_espresso' ), | |
| 1275 | +	__('Start Date is required', 'event_espresso'), | |
| 1276 | 1276 | |
| 1277 | 1277 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:68 | 
| 1278 | - __( 'End Date is required', 'event_espresso' ), | |
| 1278 | +	__('End Date is required', 'event_espresso'), | |
| 1279 | 1279 | |
| 1280 | 1280 | // Reference: packages/ee-components/src/EntityList/EntityList.tsx:30 | 
| 1281 | - __( 'no results found', 'event_espresso' ), | |
| 1281 | +	__('no results found', 'event_espresso'), | |
| 1282 | 1282 | |
| 1283 | 1283 | // Reference: packages/ee-components/src/EntityList/EntityList.tsx:31 | 
| 1284 | - __( 'try changing filter settings', 'event_espresso' ), | |
| 1284 | +	__('try changing filter settings', 'event_espresso'), | |
| 1285 | 1285 | |
| 1286 | 1286 | // Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:38 | 
| 1287 | 1287 | /* translators: %d entity id */ | 
| 1288 | - __( 'select entity with id %d', 'event_espresso' ), | |
| 1288 | +	__('select entity with id %d', 'event_espresso'), | |
| 1289 | 1289 | |
| 1290 | 1290 | // Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:41 | 
| 1291 | - __( 'select all entities', 'event_espresso' ), | |
| 1291 | +	__('select all entities', 'event_espresso'), | |
| 1292 | 1292 | |
| 1293 | 1293 | // Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:21 | 
| 1294 | - __( 'Note: ', 'event_espresso' ), | |
| 1294 | +	__('Note: ', 'event_espresso'), | |
| 1295 | 1295 | |
| 1296 | 1296 | // Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:21 | 
| 1297 | - __( 'any changes will be applied to ALL of the selected entities.', 'event_espresso' ), | |
| 1297 | +	__('any changes will be applied to ALL of the selected entities.', 'event_espresso'), | |
| 1298 | 1298 | |
| 1299 | 1299 | // Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:28 | 
| 1300 | - __( 'Bulk edit details', 'event_espresso' ), | |
| 1300 | +	__('Bulk edit details', 'event_espresso'), | |
| 1301 | 1301 | |
| 1302 | 1302 | // Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:17 | 
| 1303 | - __( 'Are you sure you want to bulk update the details?', 'event_espresso' ), | |
| 1303 | +	__('Are you sure you want to bulk update the details?', 'event_espresso'), | |
| 1304 | 1304 | |
| 1305 | 1305 | // Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:18 | 
| 1306 | - __( 'Bulk update details', 'event_espresso' ), | |
| 1306 | +	__('Bulk update details', 'event_espresso'), | |
| 1307 | 1307 | |
| 1308 | 1308 | // Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:26 | 
| 1309 | - __( 'set order', 'event_espresso' ), | |
| 1309 | +	__('set order', 'event_espresso'), | |
| 1310 | 1310 | |
| 1311 | 1311 | // Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:28 | 
| 1312 | - __( 'Set Custom Dates Order - this is how dates are ordered on the frontend', 'event_espresso' ), | |
| 1312 | +	__('Set Custom Dates Order - this is how dates are ordered on the frontend', 'event_espresso'), | |
| 1313 | 1313 | |
| 1314 | 1314 | // Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:29 | 
| 1315 | - __( 'Set Custom Tickets Order - this is how tickets are ordered on the frontend', 'event_espresso' ), | |
| 1315 | +	__('Set Custom Tickets Order - this is how tickets are ordered on the frontend', 'event_espresso'), | |
| 1316 | 1316 | |
| 1317 | 1317 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:33 | 
| 1318 | - __( 'delete form element', 'event_espresso' ), | |
| 1318 | +	__('delete form element', 'event_espresso'), | |
| 1319 | 1319 | |
| 1320 | 1320 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:50 | 
| 1321 | - __( 'form element settings', 'event_espresso' ), | |
| 1321 | +	__('form element settings', 'event_espresso'), | |
| 1322 | 1322 | |
| 1323 | 1323 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:60 | 
| 1324 | - __( 'copy form element', 'event_espresso' ), | |
| 1324 | +	__('copy form element', 'event_espresso'), | |
| 1325 | 1325 | |
| 1326 | 1326 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:70 | 
| 1327 | - __( 'click, hold, and drag to reorder form element', 'event_espresso' ), | |
| 1327 | +	__('click, hold, and drag to reorder form element', 'event_espresso'), | |
| 1328 | 1328 | |
| 1329 | 1329 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:20 | 
| 1330 | - __( 'remove option', 'event_espresso' ), | |
| 1330 | +	__('remove option', 'event_espresso'), | |
| 1331 | 1331 | |
| 1332 | 1332 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:42 | 
| 1333 | - __( 'value', 'event_espresso' ), | |
| 1333 | +	__('value', 'event_espresso'), | |
| 1334 | 1334 | |
| 1335 | 1335 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:52 | 
| 1336 | - __( 'label', 'event_espresso' ), | |
| 1336 | +	__('label', 'event_espresso'), | |
| 1337 | 1337 | |
| 1338 | 1338 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:63 | 
| 1339 | - __( 'click, hold, and drag to reorder field option', 'event_espresso' ), | |
| 1339 | +	__('click, hold, and drag to reorder field option', 'event_espresso'), | |
| 1340 | 1340 | |
| 1341 | 1341 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:61 | 
| 1342 | - __( 'Options are the choices you give people to select from.', 'event_espresso' ), | |
| 1342 | +	__('Options are the choices you give people to select from.', 'event_espresso'), | |
| 1343 | 1343 | |
| 1344 | 1344 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:63 | 
| 1345 | - __( 'The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso' ), | |
| 1345 | +	__('The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso'), | |
| 1346 | 1346 | |
| 1347 | 1347 | // Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:96 | 
| 1348 | - __( 'add new option', 'event_espresso' ), | |
| 1348 | +	__('add new option', 'event_espresso'), | |
| 1349 | 1349 | |
| 1350 | 1350 | // Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:27 | 
| 1351 | 1351 | // Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:26 | 
| 1352 | - __( 'Styles', 'event_espresso' ), | |
| 1352 | +	__('Styles', 'event_espresso'), | |
| 1353 | 1353 | |
| 1354 | 1354 | // Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:31 | 
| 1355 | - __( 'Validation', 'event_espresso' ), | |
| 1355 | +	__('Validation', 'event_espresso'), | |
| 1356 | 1356 | |
| 1357 | 1357 | // Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:18 | 
| 1358 | - __( 'Change input type', 'event_espresso' ), | |
| 1358 | +	__('Change input type', 'event_espresso'), | |
| 1359 | 1359 | |
| 1360 | 1360 | // Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:19 | 
| 1361 | - __( 'Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso' ), | |
| 1361 | +	__('Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso'), | |
| 1362 | 1362 | |
| 1363 | 1363 | // Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:40 | 
| 1364 | - __( 'type', 'event_espresso' ), | |
| 1364 | +	__('type', 'event_espresso'), | |
| 1365 | 1365 | |
| 1366 | 1366 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:26 | 
| 1367 | 1367 | // Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:17 | 
| 1368 | - __( 'public label', 'event_espresso' ), | |
| 1368 | +	__('public label', 'event_espresso'), | |
| 1369 | 1369 | |
| 1370 | 1370 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:33 | 
| 1371 | 1371 | // Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:22 | 
| 1372 | - __( 'admin label', 'event_espresso' ), | |
| 1372 | +	__('admin label', 'event_espresso'), | |
| 1373 | 1373 | |
| 1374 | 1374 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:40 | 
| 1375 | - __( 'content', 'event_espresso' ), | |
| 1375 | +	__('content', 'event_espresso'), | |
| 1376 | 1376 | |
| 1377 | 1377 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:48 | 
| 1378 | - __( 'options', 'event_espresso' ), | |
| 1378 | +	__('options', 'event_espresso'), | |
| 1379 | 1379 | |
| 1380 | 1380 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:51 | 
| 1381 | - __( 'placeholder', 'event_espresso' ), | |
| 1381 | +	__('placeholder', 'event_espresso'), | |
| 1382 | 1382 | |
| 1383 | 1383 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:57 | 
| 1384 | - __( 'admin only', 'event_espresso' ), | |
| 1384 | +	__('admin only', 'event_espresso'), | |
| 1385 | 1385 | |
| 1386 | 1386 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:62 | 
| 1387 | - __( 'help text', 'event_espresso' ), | |
| 1387 | +	__('help text', 'event_espresso'), | |
| 1388 | 1388 | |
| 1389 | 1389 | // Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:71 | 
| 1390 | - __( 'maps to', 'event_espresso' ), | |
| 1390 | +	__('maps to', 'event_espresso'), | |
| 1391 | 1391 | |
| 1392 | 1392 | // Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:15 | 
| 1393 | 1393 | // Reference: packages/form-builder/src/FormSection/Tabs/Styles.tsx:13 | 
| 1394 | - __( 'css class', 'event_espresso' ), | |
| 1394 | +	__('css class', 'event_espresso'), | |
| 1395 | 1395 | |
| 1396 | 1396 | // Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:20 | 
| 1397 | - __( 'help text css class', 'event_espresso' ), | |
| 1397 | +	__('help text css class', 'event_espresso'), | |
| 1398 | 1398 | |
| 1399 | 1399 | // Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:27 | 
| 1400 | - __( 'size', 'event_espresso' ), | |
| 1400 | +	__('size', 'event_espresso'), | |
| 1401 | 1401 | |
| 1402 | 1402 | // Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:35 | 
| 1403 | - __( 'step', 'event_espresso' ), | |
| 1403 | +	__('step', 'event_espresso'), | |
| 1404 | 1404 | |
| 1405 | 1405 | // Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:41 | 
| 1406 | - __( 'maxlength', 'event_espresso' ), | |
| 1406 | +	__('maxlength', 'event_espresso'), | |
| 1407 | 1407 | |
| 1408 | 1408 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:123 | 
| 1409 | - __( 'min', 'event_espresso' ), | |
| 1409 | +	__('min', 'event_espresso'), | |
| 1410 | 1410 | |
| 1411 | 1411 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:128 | 
| 1412 | - __( 'max', 'event_espresso' ), | |
| 1412 | +	__('max', 'event_espresso'), | |
| 1413 | 1413 | |
| 1414 | 1414 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:28 | 
| 1415 | - __( 'Germany', 'event_espresso' ), | |
| 1415 | +	__('Germany', 'event_espresso'), | |
| 1416 | 1416 | |
| 1417 | 1417 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:32 | 
| 1418 | - __( 'France', 'event_espresso' ), | |
| 1418 | +	__('France', 'event_espresso'), | |
| 1419 | 1419 | |
| 1420 | 1420 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:36 | 
| 1421 | - __( 'United Kingdom', 'event_espresso' ), | |
| 1421 | +	__('United Kingdom', 'event_espresso'), | |
| 1422 | 1422 | |
| 1423 | 1423 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:40 | 
| 1424 | - __( 'United States', 'event_espresso' ), | |
| 1424 | +	__('United States', 'event_espresso'), | |
| 1425 | 1425 | |
| 1426 | 1426 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:44 | 
| 1427 | - __( 'Custom', 'event_espresso' ), | |
| 1427 | +	__('Custom', 'event_espresso'), | |
| 1428 | 1428 | |
| 1429 | 1429 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:54 | 
| 1430 | - __( 'required', 'event_espresso' ), | |
| 1430 | +	__('required', 'event_espresso'), | |
| 1431 | 1431 | |
| 1432 | 1432 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:59 | 
| 1433 | - __( 'required text', 'event_espresso' ), | |
| 1433 | +	__('required text', 'event_espresso'), | |
| 1434 | 1434 | |
| 1435 | 1435 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:66 | 
| 1436 | - __( 'autocomplete', 'event_espresso' ), | |
| 1436 | +	__('autocomplete', 'event_espresso'), | |
| 1437 | 1437 | |
| 1438 | 1438 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:74 | 
| 1439 | - __( 'custom format', 'event_espresso' ), | |
| 1439 | +	__('custom format', 'event_espresso'), | |
| 1440 | 1440 | |
| 1441 | 1441 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:75 | 
| 1442 | - __( 'format', 'event_espresso' ), | |
| 1442 | +	__('format', 'event_espresso'), | |
| 1443 | 1443 | |
| 1444 | 1444 | // Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:83 | 
| 1445 | - __( 'pattern', 'event_espresso' ), | |
| 1445 | +	__('pattern', 'event_espresso'), | |
| 1446 | 1446 | |
| 1447 | 1447 | // Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:110 | 
| 1448 | - __( 'add new form element', 'event_espresso' ), | |
| 1448 | +	__('add new form element', 'event_espresso'), | |
| 1449 | 1449 | |
| 1450 | 1450 | // Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:117 | 
| 1451 | 1451 | // Reference: packages/form/src/renderers/RepeatableRenderer.tsx:52 | 
| 1452 | - __( 'Add', 'event_espresso' ), | |
| 1452 | +	__('Add', 'event_espresso'), | |
| 1453 | 1453 | |
| 1454 | 1454 | // Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:76 | 
| 1455 | - __( 'Add Form Element', 'event_espresso' ), | |
| 1455 | +	__('Add Form Element', 'event_espresso'), | |
| 1456 | 1456 | |
| 1457 | 1457 | // Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:85 | 
| 1458 | - __( 'form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso' ), | |
| 1458 | +	__('form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso'), | |
| 1459 | 1459 | |
| 1460 | 1460 | // Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:92 | 
| 1461 | - __( 'load existing form section', 'event_espresso' ), | |
| 1461 | +	__('load existing form section', 'event_espresso'), | |
| 1462 | 1462 | |
| 1463 | 1463 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:33 | 
| 1464 | - __( 'delete form section', 'event_espresso' ), | |
| 1464 | +	__('delete form section', 'event_espresso'), | |
| 1465 | 1465 | |
| 1466 | 1466 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:48 | 
| 1467 | - __( 'form section settings', 'event_espresso' ), | |
| 1467 | +	__('form section settings', 'event_espresso'), | |
| 1468 | 1468 | |
| 1469 | 1469 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:58 | 
| 1470 | - __( 'copy form section', 'event_espresso' ), | |
| 1470 | +	__('copy form section', 'event_espresso'), | |
| 1471 | 1471 | |
| 1472 | 1472 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:75 | 
| 1473 | - __( 'click, hold, and drag to reorder form section', 'event_espresso' ), | |
| 1473 | +	__('click, hold, and drag to reorder form section', 'event_espresso'), | |
| 1474 | 1474 | |
| 1475 | 1475 | // Reference: packages/form-builder/src/FormSection/FormSections.tsx:27 | 
| 1476 | - __( 'Add Form Section', 'event_espresso' ), | |
| 1476 | +	__('Add Form Section', 'event_espresso'), | |
| 1477 | 1477 | |
| 1478 | 1478 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:47 | 
| 1479 | - __( 'save form section for use in other forms', 'event_espresso' ), | |
| 1479 | +	__('save form section for use in other forms', 'event_espresso'), | |
| 1480 | 1480 | |
| 1481 | 1481 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:51 | 
| 1482 | - __( 'save as', 'event_espresso' ), | |
| 1482 | +	__('save as', 'event_espresso'), | |
| 1483 | 1483 | |
| 1484 | 1484 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:55 | 
| 1485 | - __( 'default', 'event_espresso' ), | |
| 1485 | +	__('default', 'event_espresso'), | |
| 1486 | 1486 | |
| 1487 | 1487 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:60 | 
| 1488 | - __( ' a copy of this form section will be automatically added to ALL new events', 'event_espresso' ), | |
| 1488 | +	__(' a copy of this form section will be automatically added to ALL new events', 'event_espresso'), | |
| 1489 | 1489 | |
| 1490 | 1490 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:64 | 
| 1491 | - __( 'shared', 'event_espresso' ), | |
| 1491 | +	__('shared', 'event_espresso'), | |
| 1492 | 1492 | |
| 1493 | 1493 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:67 | 
| 1494 | - __( 'a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso' ), | |
| 1494 | +	__('a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso'), | |
| 1495 | 1495 | |
| 1496 | 1496 | // Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:27 | 
| 1497 | - __( 'show label', 'event_espresso' ), | |
| 1497 | +	__('show label', 'event_espresso'), | |
| 1498 | 1498 | |
| 1499 | 1499 | // Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:33 | 
| 1500 | - __( 'applies to', 'event_espresso' ), | |
| 1500 | +	__('applies to', 'event_espresso'), | |
| 1501 | 1501 | |
| 1502 | 1502 | // Reference: packages/form-builder/src/constants.ts:102 | 
| 1503 | 1503 | // Reference: packages/form-builder/src/state/utils.ts:436 | 
| 1504 | - __( 'URL', 'event_espresso' ), | |
| 1504 | +	__('URL', 'event_espresso'), | |
| 1505 | 1505 | |
| 1506 | 1506 | // Reference: packages/form-builder/src/constants.ts:104 | 
| 1507 | - __( 'adds a text input for entering a URL address', 'event_espresso' ), | |
| 1507 | +	__('adds a text input for entering a URL address', 'event_espresso'), | |
| 1508 | 1508 | |
| 1509 | 1509 | // Reference: packages/form-builder/src/constants.ts:107 | 
| 1510 | - __( 'Date', 'event_espresso' ), | |
| 1510 | +	__('Date', 'event_espresso'), | |
| 1511 | 1511 | |
| 1512 | 1512 | // Reference: packages/form-builder/src/constants.ts:109 | 
| 1513 | - __( 'adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso' ), | |
| 1513 | +	__('adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso'), | |
| 1514 | 1514 | |
| 1515 | 1515 | // Reference: packages/form-builder/src/constants.ts:112 | 
| 1516 | 1516 | // Reference: packages/form-builder/src/state/utils.ts:369 | 
| 1517 | - __( 'Local Date', 'event_espresso' ), | |
| 1517 | +	__('Local Date', 'event_espresso'), | |
| 1518 | 1518 | |
| 1519 | 1519 | // Reference: packages/form-builder/src/constants.ts:117 | 
| 1520 | - __( 'Month', 'event_espresso' ), | |
| 1520 | +	__('Month', 'event_espresso'), | |
| 1521 | 1521 | |
| 1522 | 1522 | // Reference: packages/form-builder/src/constants.ts:119 | 
| 1523 | - __( 'adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso' ), | |
| 1523 | +	__('adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso'), | |
| 1524 | 1524 | |
| 1525 | 1525 | // Reference: packages/form-builder/src/constants.ts:122 | 
| 1526 | - __( 'Time', 'event_espresso' ), | |
| 1526 | +	__('Time', 'event_espresso'), | |
| 1527 | 1527 | |
| 1528 | 1528 | // Reference: packages/form-builder/src/constants.ts:124 | 
| 1529 | - __( 'adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso' ), | |
| 1529 | +	__('adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso'), | |
| 1530 | 1530 | |
| 1531 | 1531 | // Reference: packages/form-builder/src/constants.ts:127 | 
| 1532 | - __( 'Week', 'event_espresso' ), | |
| 1532 | +	__('Week', 'event_espresso'), | |
| 1533 | 1533 | |
| 1534 | 1534 | // Reference: packages/form-builder/src/constants.ts:129 | 
| 1535 | - __( 'adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso' ), | |
| 1535 | +	__('adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso'), | |
| 1536 | 1536 | |
| 1537 | 1537 | // Reference: packages/form-builder/src/constants.ts:132 | 
| 1538 | - __( 'Day Selector', 'event_espresso' ), | |
| 1538 | +	__('Day Selector', 'event_espresso'), | |
| 1539 | 1539 | |
| 1540 | 1540 | // Reference: packages/form-builder/src/constants.ts:134 | 
| 1541 | - __( 'adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso' ), | |
| 1541 | +	__('adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso'), | |
| 1542 | 1542 | |
| 1543 | 1543 | // Reference: packages/form-builder/src/constants.ts:137 | 
| 1544 | - __( 'Month Selector', 'event_espresso' ), | |
| 1544 | +	__('Month Selector', 'event_espresso'), | |
| 1545 | 1545 | |
| 1546 | 1546 | // Reference: packages/form-builder/src/constants.ts:139 | 
| 1547 | - __( 'adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso' ), | |
| 1547 | +	__('adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso'), | |
| 1548 | 1548 | |
| 1549 | 1549 | // Reference: packages/form-builder/src/constants.ts:142 | 
| 1550 | - __( 'Year Selector', 'event_espresso' ), | |
| 1550 | +	__('Year Selector', 'event_espresso'), | |
| 1551 | 1551 | |
| 1552 | 1552 | // Reference: packages/form-builder/src/constants.ts:144 | 
| 1553 | - __( 'adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso' ), | |
| 1553 | +	__('adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso'), | |
| 1554 | 1554 | |
| 1555 | 1555 | // Reference: packages/form-builder/src/constants.ts:147 | 
| 1556 | - __( 'Radio Buttons', 'event_espresso' ), | |
| 1556 | +	__('Radio Buttons', 'event_espresso'), | |
| 1557 | 1557 | |
| 1558 | 1558 | // Reference: packages/form-builder/src/constants.ts:149 | 
| 1559 | - __( 'adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso' ), | |
| 1559 | +	__('adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso'), | |
| 1560 | 1560 | |
| 1561 | 1561 | // Reference: packages/form-builder/src/constants.ts:152 | 
| 1562 | 1562 | // Reference: packages/form-builder/src/state/utils.ts:375 | 
| 1563 | - __( 'Decimal Number', 'event_espresso' ), | |
| 1563 | +	__('Decimal Number', 'event_espresso'), | |
| 1564 | 1564 | |
| 1565 | 1565 | // Reference: packages/form-builder/src/constants.ts:154 | 
| 1566 | - __( 'adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso' ), | |
| 1566 | +	__('adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso'), | |
| 1567 | 1567 | |
| 1568 | 1568 | // Reference: packages/form-builder/src/constants.ts:157 | 
| 1569 | 1569 | // Reference: packages/form-builder/src/state/utils.ts:378 | 
| 1570 | - __( 'Whole Number', 'event_espresso' ), | |
| 1570 | +	__('Whole Number', 'event_espresso'), | |
| 1571 | 1571 | |
| 1572 | 1572 | // Reference: packages/form-builder/src/constants.ts:159 | 
| 1573 | - __( 'adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso' ), | |
| 1573 | +	__('adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso'), | |
| 1574 | 1574 | |
| 1575 | 1575 | // Reference: packages/form-builder/src/constants.ts:162 | 
| 1576 | - __( 'Number Range', 'event_espresso' ), | |
| 1576 | +	__('Number Range', 'event_espresso'), | |
| 1577 | 1577 | |
| 1578 | 1578 | // Reference: packages/form-builder/src/constants.ts:167 | 
| 1579 | - __( 'Phone Number', 'event_espresso' ), | |
| 1579 | +	__('Phone Number', 'event_espresso'), | |
| 1580 | 1580 | |
| 1581 | 1581 | // Reference: packages/form-builder/src/constants.ts:172 | 
| 1582 | - __( 'Dropdown', 'event_espresso' ), | |
| 1582 | +	__('Dropdown', 'event_espresso'), | |
| 1583 | 1583 | |
| 1584 | 1584 | // Reference: packages/form-builder/src/constants.ts:174 | 
| 1585 | - __( 'adds a dropdown selector that accepts a single value', 'event_espresso' ), | |
| 1585 | +	__('adds a dropdown selector that accepts a single value', 'event_espresso'), | |
| 1586 | 1586 | |
| 1587 | 1587 | // Reference: packages/form-builder/src/constants.ts:177 | 
| 1588 | - __( 'Multi Select', 'event_espresso' ), | |
| 1588 | +	__('Multi Select', 'event_espresso'), | |
| 1589 | 1589 | |
| 1590 | 1590 | // Reference: packages/form-builder/src/constants.ts:179 | 
| 1591 | - __( 'adds a dropdown selector that accepts multiple values', 'event_espresso' ), | |
| 1591 | +	__('adds a dropdown selector that accepts multiple values', 'event_espresso'), | |
| 1592 | 1592 | |
| 1593 | 1593 | // Reference: packages/form-builder/src/constants.ts:182 | 
| 1594 | - __( 'Toggle/Switch', 'event_espresso' ), | |
| 1594 | +	__('Toggle/Switch', 'event_espresso'), | |
| 1595 | 1595 | |
| 1596 | 1596 | // Reference: packages/form-builder/src/constants.ts:184 | 
| 1597 | - __( 'adds a toggle or a switch to accept true or false value', 'event_espresso' ), | |
| 1597 | +	__('adds a toggle or a switch to accept true or false value', 'event_espresso'), | |
| 1598 | 1598 | |
| 1599 | 1599 | // Reference: packages/form-builder/src/constants.ts:187 | 
| 1600 | - __( 'Multi Checkbox', 'event_espresso' ), | |
| 1600 | +	__('Multi Checkbox', 'event_espresso'), | |
| 1601 | 1601 | |
| 1602 | 1602 | // Reference: packages/form-builder/src/constants.ts:189 | 
| 1603 | - __( 'adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso' ), | |
| 1603 | +	__('adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso'), | |
| 1604 | 1604 | |
| 1605 | 1605 | // Reference: packages/form-builder/src/constants.ts:192 | 
| 1606 | - __( 'Country Selector', 'event_espresso' ), | |
| 1606 | +	__('Country Selector', 'event_espresso'), | |
| 1607 | 1607 | |
| 1608 | 1608 | // Reference: packages/form-builder/src/constants.ts:194 | 
| 1609 | - __( 'adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso' ), | |
| 1609 | +	__('adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso'), | |
| 1610 | 1610 | |
| 1611 | 1611 | // Reference: packages/form-builder/src/constants.ts:197 | 
| 1612 | - __( 'State Selector', 'event_espresso' ), | |
| 1612 | +	__('State Selector', 'event_espresso'), | |
| 1613 | 1613 | |
| 1614 | 1614 | // Reference: packages/form-builder/src/constants.ts:202 | 
| 1615 | - __( 'Button', 'event_espresso' ), | |
| 1615 | +	__('Button', 'event_espresso'), | |
| 1616 | 1616 | |
| 1617 | 1617 | // Reference: packages/form-builder/src/constants.ts:204 | 
| 1618 | - __( 'adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso' ), | |
| 1618 | +	__('adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso'), | |
| 1619 | 1619 | |
| 1620 | 1620 | // Reference: packages/form-builder/src/constants.ts:207 | 
| 1621 | - __( 'Reset Button', 'event_espresso' ), | |
| 1621 | +	__('Reset Button', 'event_espresso'), | |
| 1622 | 1622 | |
| 1623 | 1623 | // Reference: packages/form-builder/src/constants.ts:209 | 
| 1624 | - __( 'adds a button that will reset the form back to its original state.', 'event_espresso' ), | |
| 1624 | +	__('adds a button that will reset the form back to its original state.', 'event_espresso'), | |
| 1625 | 1625 | |
| 1626 | 1626 | // Reference: packages/form-builder/src/constants.ts:55 | 
| 1627 | - __( 'Form Section', 'event_espresso' ), | |
| 1627 | +	__('Form Section', 'event_espresso'), | |
| 1628 | 1628 | |
| 1629 | 1629 | // Reference: packages/form-builder/src/constants.ts:57 | 
| 1630 | - __( 'Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso' ), | |
| 1630 | +	__('Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso'), | |
| 1631 | 1631 | |
| 1632 | 1632 | // Reference: packages/form-builder/src/constants.ts:62 | 
| 1633 | - __( 'HTML Block', 'event_espresso' ), | |
| 1633 | +	__('HTML Block', 'event_espresso'), | |
| 1634 | 1634 | |
| 1635 | 1635 | // Reference: packages/form-builder/src/constants.ts:64 | 
| 1636 | - __( 'allows you to add HTML like headings or text paragraphs to your form', 'event_espresso' ), | |
| 1636 | +	__('allows you to add HTML like headings or text paragraphs to your form', 'event_espresso'), | |
| 1637 | 1637 | |
| 1638 | 1638 | // Reference: packages/form-builder/src/constants.ts:69 | 
| 1639 | - __( 'adds a text input that only accepts plain text', 'event_espresso' ), | |
| 1639 | +	__('adds a text input that only accepts plain text', 'event_espresso'), | |
| 1640 | 1640 | |
| 1641 | 1641 | // Reference: packages/form-builder/src/constants.ts:72 | 
| 1642 | - __( 'Plain Text Area', 'event_espresso' ), | |
| 1642 | +	__('Plain Text Area', 'event_espresso'), | |
| 1643 | 1643 | |
| 1644 | 1644 | // Reference: packages/form-builder/src/constants.ts:74 | 
| 1645 | - __( 'adds a textarea block that only accepts plain text', 'event_espresso' ), | |
| 1645 | +	__('adds a textarea block that only accepts plain text', 'event_espresso'), | |
| 1646 | 1646 | |
| 1647 | 1647 | // Reference: packages/form-builder/src/constants.ts:77 | 
| 1648 | - __( 'HTML Text Area', 'event_espresso' ), | |
| 1648 | +	__('HTML Text Area', 'event_espresso'), | |
| 1649 | 1649 | |
| 1650 | 1650 | // Reference: packages/form-builder/src/constants.ts:79 | 
| 1651 | - __( 'adds a textarea block that accepts text including simple HTML markup', 'event_espresso' ), | |
| 1651 | +	__('adds a textarea block that accepts text including simple HTML markup', 'event_espresso'), | |
| 1652 | 1652 | |
| 1653 | 1653 | // Reference: packages/form-builder/src/constants.ts:84 | 
| 1654 | - __( 'adds a text input that only accepts a valid email address', 'event_espresso' ), | |
| 1654 | +	__('adds a text input that only accepts a valid email address', 'event_espresso'), | |
| 1655 | 1655 | |
| 1656 | 1656 | // Reference: packages/form-builder/src/constants.ts:87 | 
| 1657 | - __( 'Email Confirmation', 'event_espresso' ), | |
| 1657 | +	__('Email Confirmation', 'event_espresso'), | |
| 1658 | 1658 | |
| 1659 | 1659 | // Reference: packages/form-builder/src/constants.ts:92 | 
| 1660 | - __( 'Password', 'event_espresso' ), | |
| 1660 | +	__('Password', 'event_espresso'), | |
| 1661 | 1661 | |
| 1662 | 1662 | // Reference: packages/form-builder/src/constants.ts:94 | 
| 1663 | - __( 'adds a text input that accepts text but masks what the user enters', 'event_espresso' ), | |
| 1663 | +	__('adds a text input that accepts text but masks what the user enters', 'event_espresso'), | |
| 1664 | 1664 | |
| 1665 | 1665 | // Reference: packages/form-builder/src/constants.ts:97 | 
| 1666 | - __( 'Password Confirmation', 'event_espresso' ), | |
| 1666 | +	__('Password Confirmation', 'event_espresso'), | |
| 1667 | 1667 | |
| 1668 | 1668 | // Reference: packages/form-builder/src/data/useElementMutator.ts:54 | 
| 1669 | - __( 'element', 'event_espresso' ), | |
| 1669 | +	__('element', 'event_espresso'), | |
| 1670 | 1670 | |
| 1671 | 1671 | // Reference: packages/form-builder/src/data/useSectionMutator.ts:54 | 
| 1672 | - __( 'section', 'event_espresso' ), | |
| 1672 | +	__('section', 'event_espresso'), | |
| 1673 | 1673 | |
| 1674 | 1674 | // Reference: packages/form-builder/src/state/utils.ts:360 | 
| 1675 | - __( 'click', 'event_espresso' ), | |
| 1675 | +	__('click', 'event_espresso'), | |
| 1676 | 1676 | |
| 1677 | 1677 | // Reference: packages/form-builder/src/state/utils.ts:363 | 
| 1678 | - __( 'checkboxes', 'event_espresso' ), | |
| 1678 | +	__('checkboxes', 'event_espresso'), | |
| 1679 | 1679 | |
| 1680 | 1680 | // Reference: packages/form-builder/src/state/utils.ts:366 | 
| 1681 | - __( 'date', 'event_espresso' ), | |
| 1681 | +	__('date', 'event_espresso'), | |
| 1682 | 1682 | |
| 1683 | 1683 | // Reference: packages/form-builder/src/state/utils.ts:372 | 
| 1684 | - __( 'day', 'event_espresso' ), | |
| 1684 | +	__('day', 'event_espresso'), | |
| 1685 | 1685 | |
| 1686 | 1686 | // Reference: packages/form-builder/src/state/utils.ts:381 | 
| 1687 | - __( 'email address', 'event_espresso' ), | |
| 1687 | +	__('email address', 'event_espresso'), | |
| 1688 | 1688 | |
| 1689 | 1689 | // Reference: packages/form-builder/src/state/utils.ts:384 | 
| 1690 | - __( 'confirm email address', 'event_espresso' ), | |
| 1690 | +	__('confirm email address', 'event_espresso'), | |
| 1691 | 1691 | |
| 1692 | 1692 | // Reference: packages/form-builder/src/state/utils.ts:388 | 
| 1693 | - __( 'month', 'event_espresso' ), | |
| 1693 | +	__('month', 'event_espresso'), | |
| 1694 | 1694 | |
| 1695 | 1695 | // Reference: packages/form-builder/src/state/utils.ts:391 | 
| 1696 | - __( 'password', 'event_espresso' ), | |
| 1696 | +	__('password', 'event_espresso'), | |
| 1697 | 1697 | |
| 1698 | 1698 | // Reference: packages/form-builder/src/state/utils.ts:394 | 
| 1699 | - __( 'confirm password', 'event_espresso' ), | |
| 1699 | +	__('confirm password', 'event_espresso'), | |
| 1700 | 1700 | |
| 1701 | 1701 | // Reference: packages/form-builder/src/state/utils.ts:397 | 
| 1702 | - __( 'radio buttons', 'event_espresso' ), | |
| 1702 | +	__('radio buttons', 'event_espresso'), | |
| 1703 | 1703 | |
| 1704 | 1704 | // Reference: packages/form-builder/src/state/utils.ts:400 | 
| 1705 | - __( 'number range', 'event_espresso' ), | |
| 1705 | +	__('number range', 'event_espresso'), | |
| 1706 | 1706 | |
| 1707 | 1707 | // Reference: packages/form-builder/src/state/utils.ts:403 | 
| 1708 | - __( 'selection dropdown', 'event_espresso' ), | |
| 1708 | +	__('selection dropdown', 'event_espresso'), | |
| 1709 | 1709 | |
| 1710 | 1710 | // Reference: packages/form-builder/src/state/utils.ts:406 | 
| 1711 | - __( 'country', 'event_espresso' ), | |
| 1711 | +	__('country', 'event_espresso'), | |
| 1712 | 1712 | |
| 1713 | 1713 | // Reference: packages/form-builder/src/state/utils.ts:409 | 
| 1714 | - __( 'multi-select dropdown', 'event_espresso' ), | |
| 1714 | +	__('multi-select dropdown', 'event_espresso'), | |
| 1715 | 1715 | |
| 1716 | 1716 | // Reference: packages/form-builder/src/state/utils.ts:412 | 
| 1717 | - __( 'state/province', 'event_espresso' ), | |
| 1717 | +	__('state/province', 'event_espresso'), | |
| 1718 | 1718 | |
| 1719 | 1719 | // Reference: packages/form-builder/src/state/utils.ts:415 | 
| 1720 | - __( 'on/off switch', 'event_espresso' ), | |
| 1720 | +	__('on/off switch', 'event_espresso'), | |
| 1721 | 1721 | |
| 1722 | 1722 | // Reference: packages/form-builder/src/state/utils.ts:418 | 
| 1723 | - __( 'reset', 'event_espresso' ), | |
| 1723 | +	__('reset', 'event_espresso'), | |
| 1724 | 1724 | |
| 1725 | 1725 | // Reference: packages/form-builder/src/state/utils.ts:421 | 
| 1726 | - __( 'phone number', 'event_espresso' ), | |
| 1726 | +	__('phone number', 'event_espresso'), | |
| 1727 | 1727 | |
| 1728 | 1728 | // Reference: packages/form-builder/src/state/utils.ts:424 | 
| 1729 | - __( 'text', 'event_espresso' ), | |
| 1729 | +	__('text', 'event_espresso'), | |
| 1730 | 1730 | |
| 1731 | 1731 | // Reference: packages/form-builder/src/state/utils.ts:427 | 
| 1732 | - __( 'simple textarea', 'event_espresso' ), | |
| 1732 | +	__('simple textarea', 'event_espresso'), | |
| 1733 | 1733 | |
| 1734 | 1734 | // Reference: packages/form-builder/src/state/utils.ts:430 | 
| 1735 | - __( 'html textarea', 'event_espresso' ), | |
| 1735 | +	__('html textarea', 'event_espresso'), | |
| 1736 | 1736 | |
| 1737 | 1737 | // Reference: packages/form-builder/src/state/utils.ts:439 | 
| 1738 | - __( 'week', 'event_espresso' ), | |
| 1738 | +	__('week', 'event_espresso'), | |
| 1739 | 1739 | |
| 1740 | 1740 | // Reference: packages/form-builder/src/state/utils.ts:442 | 
| 1741 | - __( 'year', 'event_espresso' ), | |
| 1741 | +	__('year', 'event_espresso'), | |
| 1742 | 1742 | |
| 1743 | 1743 | // Reference: packages/form/src/adapters/WPMediaImage.tsx:13 | 
| 1744 | - __( 'Select Image', 'event_espresso' ), | |
| 1744 | +	__('Select Image', 'event_espresso'), | |
| 1745 | 1745 | |
| 1746 | 1746 | // Reference: packages/form/src/adapters/WPMediaImage.tsx:45 | 
| 1747 | 1747 | // Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:11 | 
| 1748 | 1748 | // Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:12 | 
| 1749 | 1749 | // Reference: packages/ui-components/src/SimpleEntityList/EntityTemplate.tsx:32 | 
| 1750 | - __( 'Select', 'event_espresso' ), | |
| 1750 | +	__('Select', 'event_espresso'), | |
| 1751 | 1751 | |
| 1752 | 1752 | // Reference: packages/form/src/renderers/FormRenderer.tsx:51 | 
| 1753 | - __( 'Form Errors', 'event_espresso' ), | |
| 1753 | +	__('Form Errors', 'event_espresso'), | |
| 1754 | 1754 | |
| 1755 | 1755 | // Reference: packages/form/src/renderers/RepeatableRenderer.tsx:36 | 
| 1756 | 1756 | /* translators: %d the entry number */ | 
| 1757 | - __( 'Entry %d', 'event_espresso' ), | |
| 1757 | +	__('Entry %d', 'event_espresso'), | |
| 1758 | 1758 | |
| 1759 | 1759 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:11 | 
| 1760 | 1760 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:17 | 
| 1761 | - __( 'sold out', 'event_espresso' ), | |
| 1761 | +	__('sold out', 'event_espresso'), | |
| 1762 | 1762 | |
| 1763 | 1763 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:14 | 
| 1764 | 1764 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:14 | 
| 1765 | - __( 'expired', 'event_espresso' ), | |
| 1765 | +	__('expired', 'event_espresso'), | |
| 1766 | 1766 | |
| 1767 | 1767 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:17 | 
| 1768 | - __( 'upcoming', 'event_espresso' ), | |
| 1768 | +	__('upcoming', 'event_espresso'), | |
| 1769 | 1769 | |
| 1770 | 1770 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:20 | 
| 1771 | - __( 'active', 'event_espresso' ), | |
| 1771 | +	__('active', 'event_espresso'), | |
| 1772 | 1772 | |
| 1773 | 1773 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:23 | 
| 1774 | 1774 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:11 | 
| 1775 | - __( 'trashed', 'event_espresso' ), | |
| 1775 | +	__('trashed', 'event_espresso'), | |
| 1776 | 1776 | |
| 1777 | 1777 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:26 | 
| 1778 | - __( 'cancelled', 'event_espresso' ), | |
| 1778 | +	__('cancelled', 'event_espresso'), | |
| 1779 | 1779 | |
| 1780 | 1780 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:29 | 
| 1781 | - __( 'postponed', 'event_espresso' ), | |
| 1781 | +	__('postponed', 'event_espresso'), | |
| 1782 | 1782 | |
| 1783 | 1783 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:33 | 
| 1784 | - __( 'inactive', 'event_espresso' ), | |
| 1784 | +	__('inactive', 'event_espresso'), | |
| 1785 | 1785 | |
| 1786 | 1786 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:20 | 
| 1787 | - __( 'pending', 'event_espresso' ), | |
| 1787 | +	__('pending', 'event_espresso'), | |
| 1788 | 1788 | |
| 1789 | 1789 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:23 | 
| 1790 | - __( 'on sale', 'event_espresso' ), | |
| 1790 | +	__('on sale', 'event_espresso'), | |
| 1791 | 1791 | |
| 1792 | 1792 | // Reference: packages/helpers/src/tickets/ticketVisibilityOptions.ts:7 | 
| 1793 | - __( 'Where the ticket can be viewed throughout the UI. ', 'event_espresso' ), | |
| 1793 | +	__('Where the ticket can be viewed throughout the UI. ', 'event_espresso'), | |
| 1794 | 1794 | |
| 1795 | 1795 | // Reference: packages/predicates/src/registration/statusOptions.ts:16 | 
| 1796 | - __( 'Declined', 'event_espresso' ), | |
| 1796 | +	__('Declined', 'event_espresso'), | |
| 1797 | 1797 | |
| 1798 | 1798 | // Reference: packages/predicates/src/registration/statusOptions.ts:21 | 
| 1799 | - __( 'Incomplete', 'event_espresso' ), | |
| 1799 | +	__('Incomplete', 'event_espresso'), | |
| 1800 | 1800 | |
| 1801 | 1801 | // Reference: packages/predicates/src/registration/statusOptions.ts:26 | 
| 1802 | - __( 'Not Approved', 'event_espresso' ), | |
| 1802 | +	__('Not Approved', 'event_espresso'), | |
| 1803 | 1803 | |
| 1804 | 1804 | // Reference: packages/predicates/src/registration/statusOptions.ts:31 | 
| 1805 | - __( 'Pending Payment', 'event_espresso' ), | |
| 1805 | +	__('Pending Payment', 'event_espresso'), | |
| 1806 | 1806 | |
| 1807 | 1807 | // Reference: packages/predicates/src/registration/statusOptions.ts:36 | 
| 1808 | - __( 'Wait List', 'event_espresso' ), | |
| 1808 | +	__('Wait List', 'event_espresso'), | |
| 1809 | 1809 | |
| 1810 | 1810 | // Reference: packages/predicates/src/registration/statusOptions.ts:6 | 
| 1811 | - __( 'Approved', 'event_espresso' ), | |
| 1811 | +	__('Approved', 'event_espresso'), | |
| 1812 | 1812 | |
| 1813 | 1813 | // Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:9 | 
| 1814 | 1814 | // Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:10 | 
| 1815 | - __( 'Select media', 'event_espresso' ), | |
| 1815 | +	__('Select media', 'event_espresso'), | |
| 1816 | 1816 | |
| 1817 | 1817 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/RichTextEditor.tsx:84 | 
| 1818 | - __( 'Write something…', 'event_espresso' ), | |
| 1818 | +	__('Write something…', 'event_espresso'), | |
| 1819 | 1819 | |
| 1820 | 1820 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/Toolbar.tsx:20 | 
| 1821 | - __( 'RTE Toolbar', 'event_espresso' ), | |
| 1821 | +	__('RTE Toolbar', 'event_espresso'), | |
| 1822 | 1822 | |
| 1823 | 1823 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:11 | 
| 1824 | - __( 'Normal', 'event_espresso' ), | |
| 1824 | +	__('Normal', 'event_espresso'), | |
| 1825 | 1825 | |
| 1826 | 1826 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:12 | 
| 1827 | - __( 'H1', 'event_espresso' ), | |
| 1827 | +	__('H1', 'event_espresso'), | |
| 1828 | 1828 | |
| 1829 | 1829 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:13 | 
| 1830 | - __( 'H2', 'event_espresso' ), | |
| 1830 | +	__('H2', 'event_espresso'), | |
| 1831 | 1831 | |
| 1832 | 1832 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:14 | 
| 1833 | - __( 'H3', 'event_espresso' ), | |
| 1833 | +	__('H3', 'event_espresso'), | |
| 1834 | 1834 | |
| 1835 | 1835 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:15 | 
| 1836 | - __( 'H4', 'event_espresso' ), | |
| 1836 | +	__('H4', 'event_espresso'), | |
| 1837 | 1837 | |
| 1838 | 1838 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:16 | 
| 1839 | - __( 'H5', 'event_espresso' ), | |
| 1839 | +	__('H5', 'event_espresso'), | |
| 1840 | 1840 | |
| 1841 | 1841 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:17 | 
| 1842 | - __( 'H6', 'event_espresso' ), | |
| 1842 | +	__('H6', 'event_espresso'), | |
| 1843 | 1843 | |
| 1844 | 1844 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:18 | 
| 1845 | - __( 'Block quote', 'event_espresso' ), | |
| 1845 | +	__('Block quote', 'event_espresso'), | |
| 1846 | 1846 | |
| 1847 | 1847 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:19 | 
| 1848 | - __( 'Code', 'event_espresso' ), | |
| 1848 | +	__('Code', 'event_espresso'), | |
| 1849 | 1849 | |
| 1850 | 1850 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:36 | 
| 1851 | - __( 'Set color', 'event_espresso' ), | |
| 1851 | +	__('Set color', 'event_espresso'), | |
| 1852 | 1852 | |
| 1853 | 1853 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:45 | 
| 1854 | - __( 'Text color', 'event_espresso' ), | |
| 1854 | +	__('Text color', 'event_espresso'), | |
| 1855 | 1855 | |
| 1856 | 1856 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:47 | 
| 1857 | - __( 'Background color', 'event_espresso' ), | |
| 1857 | +	__('Background color', 'event_espresso'), | |
| 1858 | 1858 | |
| 1859 | 1859 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:39 | 
| 1860 | - __( 'Add image', 'event_espresso' ), | |
| 1860 | +	__('Add image', 'event_espresso'), | |
| 1861 | 1861 | |
| 1862 | 1862 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:51 | 
| 1863 | - __( 'Image URL', 'event_espresso' ), | |
| 1863 | +	__('Image URL', 'event_espresso'), | |
| 1864 | 1864 | |
| 1865 | 1865 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:55 | 
| 1866 | - __( 'Alt text', 'event_espresso' ), | |
| 1866 | +	__('Alt text', 'event_espresso'), | |
| 1867 | 1867 | |
| 1868 | 1868 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:56 | 
| 1869 | - __( 'Width', 'event_espresso' ), | |
| 1869 | +	__('Width', 'event_espresso'), | |
| 1870 | 1870 | |
| 1871 | 1871 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:60 | 
| 1872 | - __( 'Height', 'event_espresso' ), | |
| 1872 | +	__('Height', 'event_espresso'), | |
| 1873 | 1873 | |
| 1874 | 1874 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:54 | 
| 1875 | - __( 'Edit link', 'event_espresso' ), | |
| 1875 | +	__('Edit link', 'event_espresso'), | |
| 1876 | 1876 | |
| 1877 | 1877 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:64 | 
| 1878 | - __( 'URL title', 'event_espresso' ), | |
| 1878 | +	__('URL title', 'event_espresso'), | |
| 1879 | 1879 | |
| 1880 | 1880 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:11 | 
| 1881 | - __( 'Unordered list', 'event_espresso' ), | |
| 1881 | +	__('Unordered list', 'event_espresso'), | |
| 1882 | 1882 | |
| 1883 | 1883 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:12 | 
| 1884 | - __( 'Ordered list', 'event_espresso' ), | |
| 1884 | +	__('Ordered list', 'event_espresso'), | |
| 1885 | 1885 | |
| 1886 | 1886 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:13 | 
| 1887 | 1887 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:13 | 
| 1888 | - __( 'Indent', 'event_espresso' ), | |
| 1888 | +	__('Indent', 'event_espresso'), | |
| 1889 | 1889 | |
| 1890 | 1890 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:14 | 
| 1891 | 1891 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:14 | 
| 1892 | - __( 'Outdent', 'event_espresso' ), | |
| 1892 | +	__('Outdent', 'event_espresso'), | |
| 1893 | 1893 | |
| 1894 | 1894 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:11 | 
| 1895 | - __( 'Unordered textalign', 'event_espresso' ), | |
| 1895 | +	__('Unordered textalign', 'event_espresso'), | |
| 1896 | 1896 | |
| 1897 | 1897 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:12 | 
| 1898 | - __( 'Ordered textalign', 'event_espresso' ), | |
| 1898 | +	__('Ordered textalign', 'event_espresso'), | |
| 1899 | 1899 | |
| 1900 | 1900 | // Reference: packages/rich-text-editor/src/components/RichTextEditor/render/Image/Toolbar.tsx:32 | 
| 1901 | - __( 'Image toolbar', 'event_espresso' ), | |
| 1901 | +	__('Image toolbar', 'event_espresso'), | |
| 1902 | 1902 | |
| 1903 | 1903 | // Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:62 | 
| 1904 | 1904 | // Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:35 | 
| 1905 | - __( 'Visual editor', 'event_espresso' ), | |
| 1905 | +	__('Visual editor', 'event_espresso'), | |
| 1906 | 1906 | |
| 1907 | 1907 | // Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:66 | 
| 1908 | 1908 | // Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:39 | 
| 1909 | - __( 'HTML editor', 'event_espresso' ), | |
| 1909 | +	__('HTML editor', 'event_espresso'), | |
| 1910 | 1910 | |
| 1911 | 1911 | // Reference: packages/rich-text-editor/src/rte-old/components/RichTextEditor/RichTextEditor.tsx:51 | 
| 1912 | - __( 'Mode', 'event_espresso' ), | |
| 1912 | +	__('Mode', 'event_espresso'), | |
| 1913 | 1913 | |
| 1914 | 1914 | // Reference: packages/rich-text-editor/src/rte-old/components/RichTextEditor/RichTextEditor.tsx:55 | 
| 1915 | - __( 'Text Mode - click to switch to html mode', 'event_espresso' ), | |
| 1915 | +	__('Text Mode - click to switch to html mode', 'event_espresso'), | |
| 1916 | 1916 | |
| 1917 | 1917 | // Reference: packages/rich-text-editor/src/rte-old/components/RichTextEditor/RichTextEditor.tsx:56 | 
| 1918 | - __( 'Html Mode - click to switch to plaintext mode', 'event_espresso' ), | |
| 1918 | +	__('Html Mode - click to switch to plaintext mode', 'event_espresso'), | |
| 1919 | 1919 | |
| 1920 | 1920 | // Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:68 | 
| 1921 | - __( 'Add Media', 'event_espresso' ), | |
| 1921 | +	__('Add Media', 'event_espresso'), | |
| 1922 | 1922 | |
| 1923 | 1923 | // Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:16 | 
| 1924 | - __( 'add new price modifier after this row', 'event_espresso' ), | |
| 1924 | +	__('add new price modifier after this row', 'event_espresso'), | |
| 1925 | 1925 | |
| 1926 | 1926 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:14 | 
| 1927 | - __( 'Delete all prices', 'event_espresso' ), | |
| 1927 | +	__('Delete all prices', 'event_espresso'), | |
| 1928 | 1928 | |
| 1929 | 1929 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:27 | 
| 1930 | - __( 'Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso' ), | |
| 1930 | +	__('Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso'), | |
| 1931 | 1931 | |
| 1932 | 1932 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:31 | 
| 1933 | - __( 'Delete all prices?', 'event_espresso' ), | |
| 1933 | +	__('Delete all prices?', 'event_espresso'), | |
| 1934 | 1934 | |
| 1935 | 1935 | // Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12 | 
| 1936 | - __( 'delete price modifier', 'event_espresso' ), | |
| 1936 | +	__('delete price modifier', 'event_espresso'), | |
| 1937 | 1937 | |
| 1938 | 1938 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:14 | 
| 1939 | - __( 'Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso' ), | |
| 1939 | +	__('Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso'), | |
| 1940 | 1940 | |
| 1941 | 1941 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:17 | 
| 1942 | - __( 'Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso' ), | |
| 1942 | +	__('Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso'), | |
| 1943 | 1943 | |
| 1944 | 1944 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21 | 
| 1945 | - __( 'Disable reverse calculate', 'event_espresso' ), | |
| 1945 | +	__('Disable reverse calculate', 'event_espresso'), | |
| 1946 | 1946 | |
| 1947 | 1947 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21 | 
| 1948 | - __( 'Enable reverse calculate', 'event_espresso' ), | |
| 1948 | +	__('Enable reverse calculate', 'event_espresso'), | |
| 1949 | 1949 | |
| 1950 | 1950 | // Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:28 | 
| 1951 | - __( 'ticket price calculator', 'event_espresso' ), | |
| 1951 | +	__('ticket price calculator', 'event_espresso'), | |
| 1952 | 1952 | |
| 1953 | 1953 | // Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:9 | 
| 1954 | - __( 'Add default taxes', 'event_espresso' ), | |
| 1954 | +	__('Add default taxes', 'event_espresso'), | |
| 1955 | 1955 | |
| 1956 | 1956 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:10 | 
| 1957 | - __( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ), | |
| 1957 | +	__('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'), | |
| 1958 | 1958 | |
| 1959 | 1959 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:14 | 
| 1960 | - __( 'Remove all taxes?', 'event_espresso' ), | |
| 1960 | +	__('Remove all taxes?', 'event_espresso'), | |
| 1961 | 1961 | |
| 1962 | 1962 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:7 | 
| 1963 | - __( 'Remove taxes', 'event_espresso' ), | |
| 1963 | +	__('Remove taxes', 'event_espresso'), | |
| 1964 | 1964 | |
| 1965 | 1965 | // Reference: packages/tpc/src/components/AddDefaultPricesButton.tsx:9 | 
| 1966 | - __( 'Add default prices', 'event_espresso' ), | |
| 1966 | +	__('Add default prices', 'event_espresso'), | |
| 1967 | 1967 | |
| 1968 | 1968 | // Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:29 | 
| 1969 | - __( 'Modify default prices.', 'event_espresso' ), | |
| 1969 | +	__('Modify default prices.', 'event_espresso'), | |
| 1970 | 1970 | |
| 1971 | 1971 | // Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:29 | 
| 1972 | - __( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ), | |
| 1972 | +	__('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'), | |
| 1973 | 1973 | |
| 1974 | 1974 | // Reference: packages/tpc/src/components/LockedTicketsBanner.tsx:12 | 
| 1975 | 1975 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:74 | 
| 1976 | - __( 'Price editing is disabled!', 'event_espresso' ), | |
| 1976 | +	__('Price editing is disabled!', 'event_espresso'), | |
| 1977 | 1977 | |
| 1978 | 1978 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:12 | 
| 1979 | - __( 'One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso' ), | |
| 1979 | +	__('One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso'), | |
| 1980 | 1980 | |
| 1981 | 1981 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:17 | 
| 1982 | 1982 | /* translators: %s link to price types admin */ | 
| 1983 | - __( 'Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso' ), | |
| 1983 | +	__('Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso'), | |
| 1984 | 1984 | |
| 1985 | 1985 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:18 | 
| 1986 | - __( 'price types admin page', 'event_espresso' ), | |
| 1986 | +	__('price types admin page', 'event_espresso'), | |
| 1987 | 1987 | |
| 1988 | 1988 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:26 | 
| 1989 | - __( 'Missing Price Types!', 'event_espresso' ), | |
| 1989 | +	__('Missing Price Types!', 'event_espresso'), | |
| 1990 | 1990 | |
| 1991 | 1991 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:14 | 
| 1992 | - __( 'This Ticket is Currently Free', 'event_espresso' ), | |
| 1992 | +	__('This Ticket is Currently Free', 'event_espresso'), | |
| 1993 | 1993 | |
| 1994 | 1994 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:21 | 
| 1995 | 1995 | /* translators: %s default prices */ | 
| 1996 | - __( 'Click the button below to load your %s into the calculator.', 'event_espresso' ), | |
| 1996 | +	__('Click the button below to load your %s into the calculator.', 'event_espresso'), | |
| 1997 | 1997 | |
| 1998 | 1998 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:22 | 
| 1999 | - __( 'default prices', 'event_espresso' ), | |
| 1999 | +	__('default prices', 'event_espresso'), | |
| 2000 | 2000 | |
| 2001 | 2001 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:29 | 
| 2002 | - __( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ), | |
| 2002 | +	__('Additional ticket price modifiers can be added or removed.', 'event_espresso'), | |
| 2003 | 2003 | |
| 2004 | 2004 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:31 | 
| 2005 | - __( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ), | |
| 2005 | +	__('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'), | |
| 2006 | 2006 | |
| 2007 | 2007 | // Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:22 | 
| 2008 | 2008 | // Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:7 | 
| 2009 | 2009 | // Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:10 | 
| 2010 | 2010 | // Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:52 | 
| 2011 | - __( 'Changes will be lost if you proceed.', 'event_espresso' ), | |
| 2011 | +	__('Changes will be lost if you proceed.', 'event_espresso'), | |
| 2012 | 2012 | |
| 2013 | 2013 | // Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:33 | 
| 2014 | 2014 | /* translators: %s ticket name */ | 
| 2015 | - __( 'Price Calculator for Ticket: %s', 'event_espresso' ), | |
| 2015 | +	__('Price Calculator for Ticket: %s', 'event_espresso'), | |
| 2016 | 2016 | |
| 2017 | 2017 | // Reference: packages/tpc/src/components/price/input/Description.tsx:15 | 
| 2018 | - __( 'price description', 'event_espresso' ), | |
| 2018 | +	__('price description', 'event_espresso'), | |
| 2019 | 2019 | |
| 2020 | 2020 | // Reference: packages/tpc/src/components/price/input/Description.tsx:18 | 
| 2021 | - __( 'description…', 'event_espresso' ), | |
| 2021 | +	__('description…', 'event_espresso'), | |
| 2022 | 2022 | |
| 2023 | 2023 | // Reference: packages/tpc/src/components/price/input/ID.tsx:7 | 
| 2024 | - __( 'price id', 'event_espresso' ), | |
| 2024 | +	__('price id', 'event_espresso'), | |
| 2025 | 2025 | |
| 2026 | 2026 | // Reference: packages/tpc/src/components/price/input/Name.tsx:15 | 
| 2027 | - __( 'price name', 'event_espresso' ), | |
| 2027 | +	__('price name', 'event_espresso'), | |
| 2028 | 2028 | |
| 2029 | 2029 | // Reference: packages/tpc/src/components/price/input/Name.tsx:18 | 
| 2030 | - __( 'label…', 'event_espresso' ), | |
| 2030 | +	__('label…', 'event_espresso'), | |
| 2031 | 2031 | |
| 2032 | 2032 | // Reference: packages/tpc/src/components/price/input/Order.tsx:21 | 
| 2033 | - __( 'price order', 'event_espresso' ), | |
| 2033 | +	__('price order', 'event_espresso'), | |
| 2034 | 2034 | |
| 2035 | 2035 | // Reference: packages/tpc/src/components/price/input/amount/Amount.tsx:85 | 
| 2036 | - __( 'amount', 'event_espresso' ), | |
| 2036 | +	__('amount', 'event_espresso'), | |
| 2037 | 2037 | |
| 2038 | 2038 | // Reference: packages/tpc/src/components/price/input/amount/Amount.tsx:89 | 
| 2039 | - __( 'amount…', 'event_espresso' ), | |
| 2039 | +	__('amount…', 'event_espresso'), | |
| 2040 | 2040 | |
| 2041 | 2041 | // Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:50 | 
| 2042 | - __( 'Total', 'event_espresso' ), | |
| 2042 | +	__('Total', 'event_espresso'), | |
| 2043 | 2043 | |
| 2044 | 2044 | // Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:59 | 
| 2045 | - __( 'ticket total', 'event_espresso' ), | |
| 2045 | +	__('ticket total', 'event_espresso'), | |
| 2046 | 2046 | |
| 2047 | 2047 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29 | 
| 2048 | - __( 'Order', 'event_espresso' ), | |
| 2048 | +	__('Order', 'event_espresso'), | |
| 2049 | 2049 | |
| 2050 | 2050 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35 | 
| 2051 | - __( 'Price Type', 'event_espresso' ), | |
| 2051 | +	__('Price Type', 'event_espresso'), | |
| 2052 | 2052 | |
| 2053 | 2053 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41 | 
| 2054 | - __( 'Label', 'event_espresso' ), | |
| 2054 | +	__('Label', 'event_espresso'), | |
| 2055 | 2055 | |
| 2056 | 2056 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53 | 
| 2057 | - __( 'Amount', 'event_espresso' ), | |
| 2057 | +	__('Amount', 'event_espresso'), | |
| 2058 | 2058 | |
| 2059 | 2059 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:22 | 
| 2060 | - __( 'Copy ticket', 'event_espresso' ), | |
| 2060 | +	__('Copy ticket', 'event_espresso'), | |
| 2061 | 2061 | |
| 2062 | 2062 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:26 | 
| 2063 | - __( 'Copy and archive this ticket', 'event_espresso' ), | |
| 2063 | +	__('Copy and archive this ticket', 'event_espresso'), | |
| 2064 | 2064 | |
| 2065 | 2065 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:29 | 
| 2066 | - __( 'OK', 'event_espresso' ), | |
| 2066 | +	__('OK', 'event_espresso'), | |
| 2067 | 2067 | |
| 2068 | 2068 | // Reference: packages/tpc/src/utils/constants.ts:8 | 
| 2069 | - __( 'Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso' ), | |
| 2069 | +	__('Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso'), | |
| 2070 | 2070 | |
| 2071 | 2071 | // Reference: packages/ui-components/src/ActiveFilters/ActiveFilters.tsx:8 | 
| 2072 | - __( 'active filters:', 'event_espresso' ), | |
| 2072 | +	__('active filters:', 'event_espresso'), | |
| 2073 | 2073 | |
| 2074 | 2074 | // Reference: packages/ui-components/src/ActiveFilters/FilterTag/index.tsx:15 | 
| 2075 | 2075 | /* translators: %s filter name */ | 
| 2076 | - __( 'remove filter - %s', 'event_espresso' ), | |
| 2076 | +	__('remove filter - %s', 'event_espresso'), | |
| 2077 | 2077 | |
| 2078 | 2078 | // Reference: packages/ui-components/src/Address/Address.tsx:105 | 
| 2079 | - __( 'Country:', 'event_espresso' ), | |
| 2079 | +	__('Country:', 'event_espresso'), | |
| 2080 | 2080 | |
| 2081 | 2081 | // Reference: packages/ui-components/src/Address/Address.tsx:113 | 
| 2082 | - __( 'Zip:', 'event_espresso' ), | |
| 2082 | +	__('Zip:', 'event_espresso'), | |
| 2083 | 2083 | |
| 2084 | 2084 | // Reference: packages/ui-components/src/Address/Address.tsx:81 | 
| 2085 | - __( 'Address:', 'event_espresso' ), | |
| 2085 | +	__('Address:', 'event_espresso'), | |
| 2086 | 2086 | |
| 2087 | 2087 | // Reference: packages/ui-components/src/Address/Address.tsx:89 | 
| 2088 | - __( 'City:', 'event_espresso' ), | |
| 2088 | +	__('City:', 'event_espresso'), | |
| 2089 | 2089 | |
| 2090 | 2090 | // Reference: packages/ui-components/src/Address/Address.tsx:97 | 
| 2091 | - __( 'State:', 'event_espresso' ), | |
| 2091 | +	__('State:', 'event_espresso'), | |
| 2092 | 2092 | |
| 2093 | 2093 | // Reference: packages/ui-components/src/CalendarDateRange/CalendarDateRange.tsx:37 | 
| 2094 | - __( 'to', 'event_espresso' ), | |
| 2094 | +	__('to', 'event_espresso'), | |
| 2095 | 2095 | |
| 2096 | 2096 | // Reference: packages/ui-components/src/CalendarPageDate/CalendarPageDate.tsx:54 | 
| 2097 | - __( 'TO', 'event_espresso' ), | |
| 2097 | +	__('TO', 'event_espresso'), | |
| 2098 | 2098 | |
| 2099 | 2099 | // Reference: packages/ui-components/src/ColorPicker/ColorPicker.tsx:60 | 
| 2100 | - __( 'Custom color', 'event_espresso' ), | |
| 2100 | +	__('Custom color', 'event_espresso'), | |
| 2101 | 2101 | |
| 2102 | 2102 | // Reference: packages/ui-components/src/ColorPicker/Swatch.tsx:23 | 
| 2103 | 2103 | /* translators: color name */ | 
| 2104 | - __( 'Color: %s', 'event_espresso' ), | |
| 2104 | +	__('Color: %s', 'event_espresso'), | |
| 2105 | 2105 | |
| 2106 | 2106 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:13 | 
| 2107 | - __( 'Cyan bluish gray', 'event_espresso' ), | |
| 2107 | +	__('Cyan bluish gray', 'event_espresso'), | |
| 2108 | 2108 | |
| 2109 | 2109 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:17 | 
| 2110 | - __( 'White', 'event_espresso' ), | |
| 2110 | +	__('White', 'event_espresso'), | |
| 2111 | 2111 | |
| 2112 | 2112 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:21 | 
| 2113 | - __( 'Pale pink', 'event_espresso' ), | |
| 2113 | +	__('Pale pink', 'event_espresso'), | |
| 2114 | 2114 | |
| 2115 | 2115 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:25 | 
| 2116 | - __( 'Vivid red', 'event_espresso' ), | |
| 2116 | +	__('Vivid red', 'event_espresso'), | |
| 2117 | 2117 | |
| 2118 | 2118 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:29 | 
| 2119 | - __( 'Luminous vivid orange', 'event_espresso' ), | |
| 2119 | +	__('Luminous vivid orange', 'event_espresso'), | |
| 2120 | 2120 | |
| 2121 | 2121 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:33 | 
| 2122 | - __( 'Luminous vivid amber', 'event_espresso' ), | |
| 2122 | +	__('Luminous vivid amber', 'event_espresso'), | |
| 2123 | 2123 | |
| 2124 | 2124 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:37 | 
| 2125 | - __( 'Light green cyan', 'event_espresso' ), | |
| 2125 | +	__('Light green cyan', 'event_espresso'), | |
| 2126 | 2126 | |
| 2127 | 2127 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:41 | 
| 2128 | - __( 'Vivid green cyan', 'event_espresso' ), | |
| 2128 | +	__('Vivid green cyan', 'event_espresso'), | |
| 2129 | 2129 | |
| 2130 | 2130 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:45 | 
| 2131 | - __( 'Pale cyan blue', 'event_espresso' ), | |
| 2131 | +	__('Pale cyan blue', 'event_espresso'), | |
| 2132 | 2132 | |
| 2133 | 2133 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:49 | 
| 2134 | - __( 'Vivid cyan blue', 'event_espresso' ), | |
| 2134 | +	__('Vivid cyan blue', 'event_espresso'), | |
| 2135 | 2135 | |
| 2136 | 2136 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:53 | 
| 2137 | - __( 'Vivid purple', 'event_espresso' ), | |
| 2137 | +	__('Vivid purple', 'event_espresso'), | |
| 2138 | 2138 | |
| 2139 | 2139 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:9 | 
| 2140 | - __( 'Black', 'event_espresso' ), | |
| 2140 | +	__('Black', 'event_espresso'), | |
| 2141 | 2141 | |
| 2142 | 2142 | // Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:8 | 
| 2143 | 2143 | // Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:24 | 
| 2144 | - __( 'Are you sure you want to close this?', 'event_espresso' ), | |
| 2144 | +	__('Are you sure you want to close this?', 'event_espresso'), | |
| 2145 | 2145 | |
| 2146 | 2146 | // Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:9 | 
| 2147 | 2147 | // Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:25 | 
| 2148 | - __( 'Yes, discard changes', 'event_espresso' ), | |
| 2148 | +	__('Yes, discard changes', 'event_espresso'), | |
| 2149 | 2149 | |
| 2150 | 2150 | // Reference: packages/ui-components/src/Confirm/ConfirmDelete.tsx:7 | 
| 2151 | - __( 'Are you sure you want to delete this?', 'event_espresso' ), | |
| 2151 | +	__('Are you sure you want to delete this?', 'event_espresso'), | |
| 2152 | 2152 | |
| 2153 | 2153 | // Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:11 | 
| 2154 | - __( 'Please confirm this action.', 'event_espresso' ), | |
| 2154 | +	__('Please confirm this action.', 'event_espresso'), | |
| 2155 | 2155 | |
| 2156 | 2156 | // Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:39 | 
| 2157 | - __( 'cancel', 'event_espresso' ), | |
| 2157 | +	__('cancel', 'event_espresso'), | |
| 2158 | 2158 | |
| 2159 | 2159 | // Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:40 | 
| 2160 | - __( 'confirm', 'event_espresso' ), | |
| 2160 | +	__('confirm', 'event_espresso'), | |
| 2161 | 2161 | |
| 2162 | 2162 | // Reference: packages/ui-components/src/CurrencyDisplay/CurrencyDisplay.tsx:34 | 
| 2163 | - __( 'free', 'event_espresso' ), | |
| 2163 | +	__('free', 'event_espresso'), | |
| 2164 | 2164 | |
| 2165 | 2165 | // Reference: packages/ui-components/src/DateTimeRangePicker/DateTimeRangePicker.tsx:117 | 
| 2166 | 2166 | // Reference: packages/ui-components/src/Popover/PopoverForm/PopoverForm.tsx:44 | 
| 2167 | - __( 'save', 'event_espresso' ), | |
| 2167 | +	__('save', 'event_espresso'), | |
| 2168 | 2168 | |
| 2169 | 2169 | // Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36 | 
| 2170 | - __( 'Hide Debug Info', 'event_espresso' ), | |
| 2170 | +	__('Hide Debug Info', 'event_espresso'), | |
| 2171 | 2171 | |
| 2172 | 2172 | // Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36 | 
| 2173 | - __( 'Show Debug Info', 'event_espresso' ), | |
| 2173 | +	__('Show Debug Info', 'event_espresso'), | |
| 2174 | 2174 | |
| 2175 | 2175 | // Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:49 | 
| 2176 | - __( 'Edit Start and End Dates and Times', 'event_espresso' ), | |
| 2176 | +	__('Edit Start and End Dates and Times', 'event_espresso'), | |
| 2177 | 2177 | |
| 2178 | 2178 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/CopyEntity.tsx:8 | 
| 2179 | - __( 'copy', 'event_espresso' ), | |
| 2179 | +	__('copy', 'event_espresso'), | |
| 2180 | 2180 | |
| 2181 | 2181 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/EditEntity.tsx:8 | 
| 2182 | - __( 'edit', 'event_espresso' ), | |
| 2182 | +	__('edit', 'event_espresso'), | |
| 2183 | 2183 | |
| 2184 | 2184 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/TrashEntity.tsx:8 | 
| 2185 | - __( 'trash', 'event_espresso' ), | |
| 2185 | +	__('trash', 'event_espresso'), | |
| 2186 | 2186 | |
| 2187 | 2187 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Untrash.tsx:8 | 
| 2188 | - __( 'untrash', 'event_espresso' ), | |
| 2188 | +	__('untrash', 'event_espresso'), | |
| 2189 | 2189 | |
| 2190 | 2190 | // Reference: packages/ui-components/src/EntityList/EntityList.tsx:23 | 
| 2191 | - __( 'OOPS!', 'event_espresso' ), | |
| 2191 | +	__('OOPS!', 'event_espresso'), | |
| 2192 | 2192 | |
| 2193 | 2193 | // Reference: packages/ui-components/src/EntityList/EntityList.tsx:23 | 
| 2194 | - __( 'Error Loading Entites List', 'event_espresso' ), | |
| 2194 | +	__('Error Loading Entites List', 'event_espresso'), | |
| 2195 | 2195 | |
| 2196 | 2196 | // Reference: packages/ui-components/src/EntityList/RegistrationsLink/index.tsx:12 | 
| 2197 | - __( 'click to open the registrations admin page in a new tab or window', 'event_espresso' ), | |
| 2197 | +	__('click to open the registrations admin page in a new tab or window', 'event_espresso'), | |
| 2198 | 2198 | |
| 2199 | 2199 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22 | 
| 2200 | - __( 'card view', 'event_espresso' ), | |
| 2200 | +	__('card view', 'event_espresso'), | |
| 2201 | 2201 | |
| 2202 | 2202 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:21 | 
| 2203 | - __( 'table view', 'event_espresso' ), | |
| 2203 | +	__('table view', 'event_espresso'), | |
| 2204 | 2204 | |
| 2205 | 2205 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8 | 
| 2206 | - __( 'hide bulk actions', 'event_espresso' ), | |
| 2206 | +	__('hide bulk actions', 'event_espresso'), | |
| 2207 | 2207 | |
| 2208 | 2208 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8 | 
| 2209 | - __( 'show bulk actions', 'event_espresso' ), | |
| 2209 | +	__('show bulk actions', 'event_espresso'), | |
| 2210 | 2210 | |
| 2211 | 2211 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:23 | 
| 2212 | - __( 'filters', 'event_espresso' ), | |
| 2212 | +	__('filters', 'event_espresso'), | |
| 2213 | 2213 | |
| 2214 | 2214 | // Reference: packages/ui-components/src/Legend/ToggleLegendButton.tsx:38 | 
| 2215 | - __( 'legend', 'event_espresso' ), | |
| 2215 | +	__('legend', 'event_espresso'), | |
| 2216 | 2216 | |
| 2217 | 2217 | // Reference: packages/ui-components/src/LoadingNotice/LoadingNotice.tsx:11 | 
| 2218 | - __( 'loading…', 'event_espresso' ), | |
| 2218 | +	__('loading…', 'event_espresso'), | |
| 2219 | 2219 | |
| 2220 | 2220 | // Reference: packages/ui-components/src/Modal/Modal.tsx:59 | 
| 2221 | - __( 'close modal', 'event_espresso' ), | |
| 2221 | +	__('close modal', 'event_espresso'), | |
| 2222 | 2222 | |
| 2223 | 2223 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:10 | 
| 2224 | - __( 'jump to previous', 'event_espresso' ), | |
| 2224 | +	__('jump to previous', 'event_espresso'), | |
| 2225 | 2225 | |
| 2226 | 2226 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:11 | 
| 2227 | - __( 'jump to next', 'event_espresso' ), | |
| 2227 | +	__('jump to next', 'event_espresso'), | |
| 2228 | 2228 | |
| 2229 | 2229 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:12 | 
| 2230 | - __( 'page', 'event_espresso' ), | |
| 2230 | +	__('page', 'event_espresso'), | |
| 2231 | 2231 | |
| 2232 | 2232 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:8 | 
| 2233 | - __( 'previous', 'event_espresso' ), | |
| 2233 | +	__('previous', 'event_espresso'), | |
| 2234 | 2234 | |
| 2235 | 2235 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:9 | 
| 2236 | - __( 'next', 'event_espresso' ), | |
| 2236 | +	__('next', 'event_espresso'), | |
| 2237 | 2237 | |
| 2238 | 2238 | // Reference: packages/ui-components/src/Pagination/PerPage.tsx:45 | 
| 2239 | 2239 | /* translators: %1$d is first item #, %2$d is last item #, %3$d is total items, ex: 20-30 of 100 items */ | 
| 2240 | - __( '%1$d-%2$d of %3$d items', 'event_espresso' ), | |
| 2240 | +	__('%1$d-%2$d of %3$d items', 'event_espresso'), | |
| 2241 | 2241 | |
| 2242 | 2242 | // Reference: packages/ui-components/src/Pagination/PerPage.tsx:54 | 
| 2243 | - __( 'items per page', 'event_espresso' ), | |
| 2243 | +	__('items per page', 'event_espresso'), | |
| 2244 | 2244 | |
| 2245 | 2245 | // Reference: packages/ui-components/src/Pagination/constants.ts:11 | 
| 2246 | 2246 | /* translators: %s is per page value */ | 
| 2247 | - __( '%s / page', 'event_espresso' ), | |
| 2247 | +	__('%s / page', 'event_espresso'), | |
| 2248 | 2248 | |
| 2249 | 2249 | // Reference: packages/ui-components/src/Pagination/constants.ts:12 | 
| 2250 | - __( 'show all', 'event_espresso' ), | |
| 2250 | +	__('show all', 'event_espresso'), | |
| 2251 | 2251 | |
| 2252 | 2252 | // Reference: packages/ui-components/src/Pagination/constants.ts:15 | 
| 2253 | - __( 'Next Page', 'event_espresso' ), | |
| 2253 | +	__('Next Page', 'event_espresso'), | |
| 2254 | 2254 | |
| 2255 | 2255 | // Reference: packages/ui-components/src/Pagination/constants.ts:16 | 
| 2256 | - __( 'Previous Page', 'event_espresso' ), | |
| 2256 | +	__('Previous Page', 'event_espresso'), | |
| 2257 | 2257 | |
| 2258 | 2258 | // Reference: packages/ui-components/src/PercentSign/index.tsx:10 | 
| 2259 | - __( '%', 'event_espresso' ), | |
| 2259 | +	__('%', 'event_espresso'), | |
| 2260 | 2260 | |
| 2261 | 2261 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:31 | 
| 2262 | 2262 | /* translators: entity type to select */ | 
| 2263 | - __( 'Select an existing %s to use as a template.', 'event_espresso' ), | |
| 2263 | +	__('Select an existing %s to use as a template.', 'event_espresso'), | |
| 2264 | 2264 | |
| 2265 | 2265 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:38 | 
| 2266 | - __( 'or', 'event_espresso' ), | |
| 2266 | +	__('or', 'event_espresso'), | |
| 2267 | 2267 | |
| 2268 | 2268 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:43 | 
| 2269 | 2269 | /* translators: entity type to add */ | 
| 2270 | - __( 'Add a new %s and insert details manually', 'event_espresso' ), | |
| 2270 | +	__('Add a new %s and insert details manually', 'event_espresso'), | |
| 2271 | 2271 | |
| 2272 | 2272 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:48 | 
| 2273 | - __( 'Add New', 'event_espresso' ), | |
| 2273 | +	__('Add New', 'event_espresso'), | |
| 2274 | 2274 | |
| 2275 | 2275 | // Reference: packages/ui-components/src/Stepper/buttons/Next.tsx:8 | 
| 2276 | - __( 'Next', 'event_espresso' ), | |
| 2276 | +	__('Next', 'event_espresso'), | |
| 2277 | 2277 | |
| 2278 | 2278 | // Reference: packages/ui-components/src/Stepper/buttons/Previous.tsx:8 | 
| 2279 | - __( 'Previous', 'event_espresso' ), | |
| 2279 | +	__('Previous', 'event_espresso'), | |
| 2280 | 2280 | |
| 2281 | 2281 | // Reference: packages/ui-components/src/Steps/Steps.tsx:31 | 
| 2282 | - __( 'Steps', 'event_espresso' ), | |
| 2282 | +	__('Steps', 'event_espresso'), | |
| 2283 | 2283 | |
| 2284 | 2284 | // Reference: packages/ui-components/src/TabbableText/index.tsx:21 | 
| 2285 | - __( 'click to edit…', 'event_espresso' ), | |
| 2285 | +	__('click to edit…', 'event_espresso'), | |
| 2286 | 2286 | |
| 2287 | 2287 | // Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:14 | 
| 2288 | - __( 'The Website\'s Time Zone', 'event_espresso' ), | |
| 2288 | +	__('The Website\'s Time Zone', 'event_espresso'), | |
| 2289 | 2289 | |
| 2290 | 2290 | // Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:19 | 
| 2291 | - __( 'UTC (Greenwich Mean Time)', 'event_espresso' ), | |
| 2291 | +	__('UTC (Greenwich Mean Time)', 'event_espresso'), | |
| 2292 | 2292 | |
| 2293 | 2293 | // Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:9 | 
| 2294 | - __( 'Your Local Time Zone', 'event_espresso' ), | |
| 2294 | +	__('Your Local Time Zone', 'event_espresso'), | |
| 2295 | 2295 | |
| 2296 | 2296 | // Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:25 | 
| 2297 | - __( 'click for timezone information', 'event_espresso' ), | |
| 2297 | +	__('click for timezone information', 'event_espresso'), | |
| 2298 | 2298 | |
| 2299 | 2299 | // Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:30 | 
| 2300 | - __( 'This Date Converted To:', 'event_espresso' ), | |
| 2300 | +	__('This Date Converted To:', 'event_espresso'), | |
| 2301 | 2301 | |
| 2302 | 2302 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:120 | 
| 2303 | - __( 'Add New Venue', 'event_espresso' ), | |
| 2303 | +	__('Add New Venue', 'event_espresso'), | |
| 2304 | 2304 | |
| 2305 | 2305 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:36 | 
| 2306 | - __( '~ no venue ~', 'event_espresso' ), | |
| 2306 | +	__('~ no venue ~', 'event_espresso'), | |
| 2307 | 2307 | |
| 2308 | 2308 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:43 | 
| 2309 | - __( 'assign venue…', 'event_espresso' ), | |
| 2309 | +	__('assign venue…', 'event_espresso'), | |
| 2310 | 2310 | |
| 2311 | 2311 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:44 | 
| 2312 | - __( 'click to select a venue…', 'event_espresso' ), | |
| 2312 | +	__('click to select a venue…', 'event_espresso'), | |
| 2313 | 2313 | |
| 2314 | 2314 | // Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:51 | 
| 2315 | - __( 'select all', 'event_espresso' ), | |
| 2315 | +	__('select all', 'event_espresso'), | |
| 2316 | 2316 | |
| 2317 | 2317 | // Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:54 | 
| 2318 | - __( 'apply', 'event_espresso' ) | |
| 2318 | +	__('apply', 'event_espresso') | |
| 2319 | 2319 | ); | 
| 2320 | 2320 | /* THIS IS THE END OF THE GENERATED FILE */ | 
| @@ -31,1244 +31,1244 @@ | ||
| 31 | 31 | */ | 
| 32 | 32 | final class EE_System implements ResettableInterface | 
| 33 | 33 |  { | 
| 34 | + /** | |
| 35 | + * indicates this is a 'normal' request. Ie, not activation, nor upgrade, nor activation. | |
| 36 | + * So examples of this would be a normal GET request on the frontend or backend, or a POST, etc | |
| 37 | + */ | |
| 38 | + const req_type_normal = 0; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * Indicates this is a brand new installation of EE so we should install | |
| 42 | + * tables and default data etc | |
| 43 | + */ | |
| 44 | + const req_type_new_activation = 1; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * we've detected that EE has been reactivated (or EE was activated during maintenance mode, | |
| 48 | + * and we just exited maintenance mode). We MUST check the database is setup properly | |
| 49 | + * and that default data is setup too | |
| 50 | + */ | |
| 51 | + const req_type_reactivation = 2; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * indicates that EE has been upgraded since its previous request. | |
| 55 | + * We may have data migration scripts to call and will want to trigger maintenance mode | |
| 56 | + */ | |
| 57 | + const req_type_upgrade = 3; | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * TODO will detect that EE has been DOWNGRADED. We probably don't want to run in this case... | |
| 61 | + */ | |
| 62 | + const req_type_downgrade = 4; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * @deprecated since version 4.6.0.dev.006 | |
| 66 | + * Now whenever a new_activation is detected the request type is still just | |
| 67 | + * new_activation (same for reactivation, upgrade, downgrade etc), but if we're in maintenance mode | |
| 68 | + * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required | |
| 69 | + * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode. | |
| 70 | + * (Specifically, when the migration manager indicates migrations are finished | |
| 71 | + * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called) | |
| 72 | + */ | |
| 73 | + const req_type_activation_but_not_installed = 5; | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * option prefix for recording the activation history (like core's "espresso_db_update") of addons | |
| 77 | + */ | |
| 78 | + const addon_activation_history_option_prefix = 'ee_addon_activation_history_'; | |
| 79 | + | |
| 80 | + private static ?EE_System $_instance = null; | |
| 81 | + | |
| 82 | + private ?LoaderInterface $loader; | |
| 83 | + | |
| 84 | + private ?EE_Maintenance_Mode $maintenance_mode; | |
| 85 | + | |
| 86 | + private ?EE_Registry $registry; | |
| 87 | + | |
| 88 | + private ?RequestInterface $request; | |
| 89 | + | |
| 90 | + private Router $router; | |
| 91 | + | |
| 92 | + private ?AddonManager $addon_manager = null; | |
| 93 | + | |
| 94 | + private ?EE_Capabilities $capabilities = null; | |
| 95 | + | |
| 96 | + protected ?FeatureFlags $feature = null; | |
| 97 | + | |
| 98 | + private ?RegisterCustomPostTypes $register_custom_post_types = null; | |
| 99 | + | |
| 100 | + private ?RegisterCustomTaxonomies $register_custom_taxonomies = null; | |
| 101 | + | |
| 102 | + private ?RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms = null; | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * Stores which type of request this is, options being one of the constants on EE_System starting with req_type_*. | |
| 106 | + * It can be a brand-new activation, a reactivation, an upgrade, a downgrade, or a normal request. | |
| 107 | + */ | |
| 108 | + private ?int $_req_type = null; | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Whether there was a non-micro version change in EE core version during this request | |
| 112 | + */ | |
| 113 | + private bool $_major_version_change = false; | |
| 114 | + | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * @singleton method used to instantiate class object | |
| 118 | + * @param LoaderInterface|null $loader | |
| 119 | + * @param EE_Maintenance_Mode|null $maintenance_mode | |
| 120 | + * @param EE_Registry|null $registry | |
| 121 | + * @param RequestInterface|null $request | |
| 122 | + * @param Router|null $router | |
| 123 | + * @param FeatureFlags|null $feature | |
| 124 | + * @return EE_System | |
| 125 | + */ | |
| 126 | + public static function instance( | |
| 127 | + ?LoaderInterface $loader = null, | |
| 128 | + ?EE_Maintenance_Mode $maintenance_mode = null, | |
| 129 | + ?EE_Registry $registry = null, | |
| 130 | + ?RequestInterface $request = null, | |
| 131 | + ?Router $router = null, | |
| 132 | + ?FeatureFlags $feature = null | |
| 133 | +	): EE_System { | |
| 134 | + // check if class object is instantiated | |
| 135 | +		if (! self::$_instance instanceof EE_System) { | |
| 136 | + self::$_instance = new self($loader, $maintenance_mode, $registry, $request, $router, $feature); | |
| 137 | + } | |
| 138 | + return self::$_instance; | |
| 139 | + } | |
| 140 | + | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * resets the instance and returns it | |
| 144 | + * | |
| 145 | + * @return EE_System | |
| 146 | + */ | |
| 147 | + public static function reset(): EE_System | |
| 148 | +	{ | |
| 149 | + self::$_instance->_req_type = null; | |
| 150 | + // make sure none of the old hooks are left hanging around | |
| 151 | +		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); | |
| 152 | + // we need to reset the migration manager in order for it to detect DMSs properly | |
| 153 | + EE_Data_Migration_Manager::reset(); | |
| 154 | + self::instance()->detect_activations_or_upgrades(); | |
| 155 | + self::instance()->perform_activations_upgrades_and_migrations(); | |
| 156 | + return self::instance(); | |
| 157 | + } | |
| 158 | + | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * sets hooks for running rest of system | |
| 162 | + * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point | |
| 163 | + * starting EE Addons from any other point may lead to problems | |
| 164 | + * | |
| 165 | + * @param LoaderInterface $loader | |
| 166 | + * @param EE_Maintenance_Mode $maintenance_mode | |
| 167 | + * @param EE_Registry $registry | |
| 168 | + * @param RequestInterface $request | |
| 169 | + * @param Router $router | |
| 170 | + * @param FeatureFlags $feature | |
| 171 | + */ | |
| 172 | + private function __construct( | |
| 173 | + LoaderInterface $loader, | |
| 174 | + EE_Maintenance_Mode $maintenance_mode, | |
| 175 | + EE_Registry $registry, | |
| 176 | + RequestInterface $request, | |
| 177 | + Router $router, | |
| 178 | + FeatureFlags $feature | |
| 179 | +	) { | |
| 180 | + $this->registry = $registry; | |
| 181 | + $this->loader = $loader; | |
| 182 | + $this->request = $request; | |
| 183 | + $this->router = $router; | |
| 184 | + $this->maintenance_mode = $maintenance_mode; | |
| 185 | + $this->feature = $feature; | |
| 186 | +		do_action('AHEE__EE_System__construct__begin', $this); | |
| 187 | + add_action( | |
| 188 | + 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 189 | + [$this, 'loadWpGraphQL'], | |
| 190 | + 3 | |
| 191 | + ); | |
| 192 | + add_action( | |
| 193 | + 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 194 | + [$this, 'loadCapabilities'], | |
| 195 | + 5 | |
| 196 | + ); | |
| 197 | + add_action( | |
| 198 | + 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 199 | + [$this, 'loadCommandBus'], | |
| 200 | + 7 | |
| 201 | + ); | |
| 202 | + add_action( | |
| 203 | + 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 204 | + [$this, 'loadPluginApi'], | |
| 205 | + 9 | |
| 206 | + ); | |
| 207 | + // give caff stuff a chance to play during the activation process too. | |
| 208 | + add_action( | |
| 209 | + 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 210 | + [$this, 'brewCaffeinated'], | |
| 211 | + 9 | |
| 212 | + ); | |
| 213 | + // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc | |
| 214 | + add_action( | |
| 215 | + 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 216 | + [$this, 'load_espresso_addons'] | |
| 217 | + ); | |
| 218 | + // when an ee addon is activated, we want to call the core hook(s) again | |
| 219 | + // because the newly-activated addon didn't get a chance to run at all | |
| 220 | +		add_action('activate_plugin', [$this, 'load_espresso_addons'], 1); | |
| 221 | + // detect whether install or upgrade | |
| 222 | + add_action( | |
| 223 | + 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', | |
| 224 | + [$this, 'detect_activations_or_upgrades'], | |
| 225 | + 3 | |
| 226 | + ); | |
| 227 | + // load EE_Config, EE_Textdomain, etc | |
| 228 | + add_action( | |
| 229 | + 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 230 | + [$this, 'load_core_configuration'], | |
| 231 | + 5 | |
| 232 | + ); | |
| 233 | + // load specifications for matching routes to current request | |
| 234 | + add_action( | |
| 235 | + 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 236 | + [$this, 'loadRouteMatchSpecifications'] | |
| 237 | + ); | |
| 238 | + // load specifications for custom post types | |
| 239 | + add_action( | |
| 240 | + 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 241 | + [$this, 'loadCustomPostTypes'] | |
| 242 | + ); | |
| 243 | + // load specifications for custom post types | |
| 244 | + add_action( | |
| 245 | + 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 246 | + [$this, 'loadCustomPostTypes'] | |
| 247 | + ); | |
| 248 | + // register shortcodes, modules, and widgets | |
| 249 | + add_action( | |
| 250 | + 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', | |
| 251 | + [$this, 'register_shortcodes_modules_and_widgets'], | |
| 252 | + 7 | |
| 253 | + ); | |
| 254 | + // you wanna get going? I wanna get going... let's get going! | |
| 255 | + add_action( | |
| 256 | + 'AHEE__EE_Bootstrap__brew_espresso', | |
| 257 | + [$this, 'brew_espresso'], | |
| 258 | + 9 | |
| 259 | + ); | |
| 260 | + // other housekeeping | |
| 261 | + // exclude EE critical pages from wp_list_pages | |
| 262 | + add_filter( | |
| 263 | + 'wp_list_pages_excludes', | |
| 264 | + [$this, 'remove_pages_from_wp_list_pages'], | |
| 265 | + 10 | |
| 266 | + ); | |
| 267 | + // ALL EE Addons should use the following hook point to attach their initial setup too | |
| 268 | + // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads | |
| 269 | +		do_action('AHEE__EE_System__construct__complete', $this); | |
| 270 | + } | |
| 271 | + | |
| 272 | + | |
| 273 | + /** | |
| 274 | + * load and setup EE_Capabilities | |
| 275 | + * | |
| 276 | + * @return void | |
| 277 | + */ | |
| 278 | + public function loadWpGraphQL() | |
| 279 | +	{ | |
| 280 | + espressoLoadWpGraphQL(); | |
| 281 | + } | |
| 282 | + | |
| 283 | + | |
| 284 | + /** | |
| 285 | + * load and setup EE_Capabilities | |
| 286 | + * | |
| 287 | + * @return void | |
| 288 | + */ | |
| 289 | + public function loadCapabilities() | |
| 290 | +	{ | |
| 291 | +		$this->capabilities = $this->loader->getShared('EE_Capabilities'); | |
| 292 | + } | |
| 293 | + | |
| 294 | + | |
| 295 | + /** | |
| 296 | + * create and cache the CommandBus, and also add middleware | |
| 297 | + * The CapChecker middleware requires the use of EE_Capabilities | |
| 298 | + * which is why we need to load the CommandBus after Caps are set up | |
| 299 | + * CommandBus middleware operate FIFO - First In First Out | |
| 300 | + * so LocateMovedCommands will run first in order to return any new commands | |
| 301 | + * | |
| 302 | + * @return void | |
| 303 | + */ | |
| 304 | + public function loadCommandBus() | |
| 305 | +	{ | |
| 306 | + $this->loader->getShared( | |
| 307 | + 'CommandBusInterface', | |
| 308 | + [ | |
| 309 | + null, | |
| 310 | + apply_filters( | |
| 311 | + 'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware', | |
| 312 | + [ | |
| 313 | +						$this->loader->getShared('EventEspresso\core\services\commands\middleware\LocateMovedCommands'), | |
| 314 | +						$this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'), | |
| 315 | +						$this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'), | |
| 316 | + ] | |
| 317 | + ), | |
| 318 | + ] | |
| 319 | + ); | |
| 320 | + } | |
| 321 | + | |
| 322 | + | |
| 323 | + /** | |
| 324 | + * @return void | |
| 325 | + * @throws Exception | |
| 326 | + */ | |
| 327 | + public function loadPluginApi() | |
| 328 | +	{ | |
| 329 | + $this->addon_manager = $this->loader->getShared(AddonManager::class); | |
| 330 | + $this->addon_manager->initialize(); | |
| 331 | +		$this->loader->getShared('EE_Request_Handler'); | |
| 332 | + } | |
| 333 | + | |
| 334 | + | |
| 335 | + /** | |
| 336 | + * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks | |
| 337 | + * that need to be setup before our EE_System launches. | |
| 338 | + * | |
| 339 | + * @return void | |
| 340 | + * @throws DomainException | |
| 341 | + * @throws InvalidArgumentException | |
| 342 | + * @throws InvalidDataTypeException | |
| 343 | + * @throws InvalidInterfaceException | |
| 344 | + * @throws InvalidClassException | |
| 345 | + * @throws InvalidFilePathException | |
| 346 | + * @throws EE_Error | |
| 347 | + * @throws Exception | |
| 348 | + */ | |
| 349 | + public function brewCaffeinated() | |
| 350 | +	{ | |
| 351 | + static $brew; | |
| 352 | + /** @var Domain $domain */ | |
| 353 | + $domain = DomainFactory::getEventEspressoCoreDomain(); | |
| 354 | +		if ($domain->isCaffeinated() && ! $brew instanceof EE_Brewing_Regular) { | |
| 355 | + require_once EE_CAFF_PATH . 'brewing_regular.php'; | |
| 356 | + /** @var EE_Brewing_Regular $brew */ | |
| 357 | + $brew = $this->loader->getShared(EE_Brewing_Regular::class); | |
| 358 | +			if (! $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING)) { | |
| 359 | + $brew->initializePUE(); | |
| 360 | + } | |
| 361 | + add_action( | |
| 362 | + 'AHEE__EE_System__load_core_configuration__begin', | |
| 363 | + [$brew, 'caffeinated'] | |
| 364 | + ); | |
| 365 | + } | |
| 366 | + } | |
| 367 | + | |
| 368 | + | |
| 369 | + /** | |
| 370 | + * load_espresso_addons | |
| 371 | + * allow addons to load first so that they can set hooks for running DMS's, etc | |
| 372 | + * this is hooked into both: | |
| 373 | + * 'AHEE__EE_Bootstrap__load_core_configuration' | |
| 374 | + * which runs during the WP 'plugins_loaded' action at priority 5 | |
| 375 | + * and the WP 'activate_plugin' hook point | |
| 376 | + * | |
| 377 | + * @return void | |
| 378 | + * @throws Exception | |
| 379 | + * @throws Throwable | |
| 380 | + */ | |
| 381 | + public function load_espresso_addons() | |
| 382 | +	{ | |
| 383 | + if ( | |
| 384 | + $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING) | |
| 385 | + && ! $this->request->isWordPressHeartbeat() | |
| 386 | +		) { | |
| 387 | + $core_license = new PluginLicense( | |
| 388 | + EVENT_ESPRESSO_MAIN_FILE, | |
| 389 | + Domain::LICENSE_PLUGIN_ID, | |
| 390 | + Domain::LICENSE_PLUGIN_NAME, | |
| 391 | + Domain::LICENSE_PLUGIN_SLUG, | |
| 392 | + espresso_version() | |
| 393 | + ); | |
| 394 | + $core_license->setHooks(); | |
| 395 | + $this->loader->share(PluginLicense::class, $core_license); | |
| 396 | + } | |
| 397 | + // looking for hooks? they've been moved into the AddonManager to maintain compatibility | |
| 398 | + $this->addon_manager->loadAddons(); | |
| 399 | + } | |
| 400 | + | |
| 401 | + | |
| 402 | + /** | |
| 403 | + * detect_activations_or_upgrades | |
| 404 | + * Checks for activation or upgrade of core first; | |
| 405 | + * then also checks if any registered addons have been activated or upgraded | |
| 406 | + * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' | |
| 407 | + * which runs during the WP 'plugins_loaded' action at priority 3 | |
| 408 | + * | |
| 409 | + * @access public | |
| 410 | + * @return void | |
| 411 | + * @throws EE_Error | |
| 412 | + */ | |
| 413 | + public function detect_activations_or_upgrades() | |
| 414 | +	{ | |
| 415 | + // first off: let's make sure to handle core | |
| 416 | + $this->detect_if_activation_or_upgrade(); | |
| 417 | +		foreach ($this->registry->addons as $addon) { | |
| 418 | +			if ($addon instanceof EE_Addon) { | |
| 419 | + // detect the request type for that addon | |
| 420 | + $addon->detect_req_type(); | |
| 421 | + } | |
| 422 | + } | |
| 423 | + } | |
| 424 | + | |
| 425 | + | |
| 426 | + /** | |
| 427 | + * detect_if_activation_or_upgrade | |
| 428 | + * Takes care of detecting whether this is a brand new install or code upgrade, | |
| 429 | + * and either setting up the DB or setting up maintenance mode etc. | |
| 430 | + * | |
| 431 | + * @access public | |
| 432 | + * @return void | |
| 433 | + * @throws EE_Error | |
| 434 | + */ | |
| 435 | + public function detect_if_activation_or_upgrade() | |
| 436 | +	{ | |
| 437 | +		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); | |
| 438 | + // check if db has been updated, or if its a brand-new installation | |
| 439 | + $espresso_db_update = $this->fix_espresso_db_upgrade_option(); | |
| 440 | + $request_type = $this->detect_req_type($espresso_db_update); | |
| 441 | +		switch ($request_type) { | |
| 442 | + case EE_System::req_type_new_activation: | |
| 443 | +				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); | |
| 444 | + $this->_handle_core_version_change($espresso_db_update); | |
| 445 | + break; | |
| 446 | + case EE_System::req_type_reactivation: | |
| 447 | +				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); | |
| 448 | + $this->_handle_core_version_change($espresso_db_update); | |
| 449 | + break; | |
| 450 | + case EE_System::req_type_upgrade: | |
| 451 | +				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); | |
| 452 | + // migrations may be required now that we've upgraded | |
| 453 | + $this->maintenance_mode->set_maintenance_mode_if_db_old(); | |
| 454 | + $this->_handle_core_version_change($espresso_db_update); | |
| 455 | + break; | |
| 456 | + case EE_System::req_type_downgrade: | |
| 457 | +				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); | |
| 458 | + // its possible migrations are no longer required | |
| 459 | + $this->maintenance_mode->set_maintenance_mode_if_db_old(); | |
| 460 | + $this->_handle_core_version_change($espresso_db_update); | |
| 461 | + break; | |
| 462 | + case EE_System::req_type_normal: | |
| 463 | + default: | |
| 464 | + break; | |
| 465 | + } | |
| 466 | +		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); | |
| 467 | + } | |
| 468 | + | |
| 469 | + | |
| 470 | + /** | |
| 471 | + * Updates the list of installed versions and sets hooks for | |
| 472 | + * initializing the database later during the request | |
| 473 | + * | |
| 474 | + * @param array $espresso_db_update | |
| 475 | + */ | |
| 476 | + private function _handle_core_version_change(array $espresso_db_update) | |
| 477 | +	{ | |
| 478 | + $this->update_list_of_installed_versions($espresso_db_update); | |
| 479 | + // get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) | |
| 480 | + add_action( | |
| 481 | + 'AHEE__EE_System__perform_activations_upgrades_and_migrations', | |
| 482 | + [$this, 'initialize_db_if_no_migrations_required'] | |
| 483 | + ); | |
| 484 | + } | |
| 485 | + | |
| 486 | + | |
| 487 | + /** | |
| 488 | + * standardizes the wp option 'espresso_db_upgrade' which actually stores | |
| 489 | + * information about what versions of EE have been installed and activated, | |
| 490 | + * NOT necessarily the state of the database | |
| 491 | + * | |
| 492 | + * @param mixed $espresso_db_update the value of the WordPress option. | |
| 493 | + * If not supplied, fetches it from the options table | |
| 494 | + * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction | |
| 495 | + */ | |
| 496 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null): array | |
| 497 | +	{ | |
| 498 | +		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); | |
| 499 | +		if (! $espresso_db_update) { | |
| 500 | +			$espresso_db_update = get_option('espresso_db_update'); | |
| 501 | + } | |
| 502 | + // check that option is an array | |
| 503 | +		if (! is_array($espresso_db_update)) { | |
| 504 | + // if option is FALSE, then it never existed | |
| 505 | +			if ($espresso_db_update === false) { | |
| 506 | + // make $espresso_db_update an array and save option with autoload OFF | |
| 507 | + $espresso_db_update = []; | |
| 508 | +				add_option('espresso_db_update', $espresso_db_update, '', 'no'); | |
| 509 | +			} else { | |
| 510 | + // option is NOT FALSE but also is NOT an array, so make it an array and save it | |
| 511 | + $espresso_db_update = [$espresso_db_update => []]; | |
| 512 | +				update_option('espresso_db_update', $espresso_db_update); | |
| 513 | + } | |
| 514 | +		} else { | |
| 515 | + $corrected_db_update = []; | |
| 516 | + // if IS an array, but is it an array where KEYS are version numbers, and values are arrays? | |
| 517 | +			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { | |
| 518 | +				if (is_int($should_be_version_string) && ! is_array($should_be_array)) { | |
| 519 | + // the key is an int, and the value IS NOT an array | |
| 520 | + // so it must be numerically-indexed, where values are versions installed... | |
| 521 | + // fix it! | |
| 522 | + $version_string = $should_be_array; | |
| 523 | + $corrected_db_update[ $version_string ] = ['unknown-date']; | |
| 524 | +				} else { | |
| 525 | + // ok it checks out | |
| 526 | + $corrected_db_update[ $should_be_version_string ] = $should_be_array; | |
| 527 | + } | |
| 528 | + } | |
| 529 | + $espresso_db_update = $corrected_db_update; | |
| 530 | +			update_option('espresso_db_update', $espresso_db_update); | |
| 531 | + } | |
| 532 | +		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); | |
| 533 | + return ! empty($espresso_db_update) | |
| 534 | + ? $espresso_db_update | |
| 535 | + : []; | |
| 536 | + } | |
| 537 | + | |
| 538 | + | |
| 539 | + /** | |
| 540 | + * Does the traditional work of setting up the plugin's database and adding default data. | |
| 541 | + * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade. | |
| 542 | + * NOTE: if we're in maintenance mode (which would be the case if we detect there are data | |
| 543 | + * migration scripts that need to be run and a version change happens), enqueues core for database initialization, | |
| 544 | + * so that it will be done when migrations are finished | |
| 545 | + * | |
| 546 | + * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too; | |
| 547 | + * @param boolean $verify_schema if true will re-check the database tables have the correct schema. | |
| 548 | + * This is a resource-intensive job | |
| 549 | + * so we prefer to only do it when necessary | |
| 550 | + * @return void | |
| 551 | + * @throws EE_Error | |
| 552 | + * @throws ReflectionException | |
| 553 | + */ | |
| 554 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true) | |
| 555 | +	{ | |
| 556 | + $request_type = $this->detect_req_type(); | |
| 557 | + // only initialize system if we're not in maintenance mode. | |
| 558 | +		if (! MaintenanceStatus::isFullSite()) { | |
| 559 | + /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ | |
| 560 | + $rewrite_rules = $this->loader->getShared( | |
| 561 | + 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' | |
| 562 | + ); | |
| 563 | + $rewrite_rules->flush(); | |
| 564 | +			if ($verify_schema) { | |
| 565 | + EEH_Activation::initialize_db_and_folders(); | |
| 566 | + } | |
| 567 | + EEH_Activation::initialize_db_content(); | |
| 568 | + EEH_Activation::system_initialization(); | |
| 569 | +			if ($initialize_addons_too) { | |
| 570 | + $this->initialize_addons(); | |
| 571 | + } | |
| 572 | +		} else { | |
| 573 | +			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); | |
| 574 | + } | |
| 575 | + if ( | |
| 576 | + $request_type === EE_System::req_type_new_activation | |
| 577 | + || $request_type === EE_System::req_type_reactivation | |
| 578 | + || ( | |
| 579 | + $request_type === EE_System::req_type_upgrade | |
| 580 | + && $this->is_major_version_change() | |
| 581 | + ) | |
| 582 | +		) { | |
| 583 | +			add_action('AHEE__EE_System__initialize_last', [$this, 'redirect_to_about_ee'], 9); | |
| 584 | + } | |
| 585 | + } | |
| 586 | + | |
| 587 | + | |
| 588 | + /** | |
| 589 | + * Initializes the db for all registered addons | |
| 590 | + * | |
| 591 | + * @throws EE_Error | |
| 592 | + * @throws ReflectionException | |
| 593 | + */ | |
| 594 | + public function initialize_addons() | |
| 595 | +	{ | |
| 596 | + // foreach registered addon, make sure its db is up-to-date too | |
| 597 | +		foreach ($this->registry->addons as $addon) { | |
| 598 | +			if ($addon instanceof EE_Addon) { | |
| 599 | + $addon->initialize_db_if_no_migrations_required(); | |
| 600 | + } | |
| 601 | + } | |
| 602 | + } | |
| 603 | + | |
| 604 | + | |
| 605 | + /** | |
| 606 | + * Adds the current code version to the saved wp option which stores a list of all ee versions ever installed. | |
| 607 | + * | |
| 608 | + * @param array $version_history | |
| 609 | + * @param string $current_version_to_add version to be added to the version history | |
| 610 | + * @return boolean success as to whether or not this option was changed | |
| 611 | + */ | |
| 612 | + public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null): bool | |
| 613 | +	{ | |
| 614 | +		if (! $version_history) { | |
| 615 | + $version_history = $this->fix_espresso_db_upgrade_option($version_history); | |
| 616 | + } | |
| 617 | +		if ($current_version_to_add === null) { | |
| 618 | + $current_version_to_add = espresso_version(); | |
| 619 | + } | |
| 620 | +		$version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time()); | |
| 621 | + // re-save | |
| 622 | +		return update_option('espresso_db_update', $version_history); | |
| 623 | + } | |
| 624 | + | |
| 625 | + | |
| 626 | + /** | |
| 627 | + * Detects if the current version indicated in the has existed in the list of | |
| 628 | + * previously-installed versions of EE (espresso_db_update). Does NOT modify it (ie, no side-effect) | |
| 629 | + * | |
| 630 | + * @param array|null $espresso_db_update array from the wp option stored under the name 'espresso_db_update'. | |
| 631 | + * If not supplied, fetches it from the options table. | |
| 632 | + * Also, caches its result so later parts of the code can also know whether | |
| 633 | + * there's been an update or not. This way we can add the current version to | |
| 634 | + * espresso_db_update, but still know if this is a new install or not | |
| 635 | + * @return int one of the constants on EE_System::req_type_ | |
| 636 | + */ | |
| 637 | + public function detect_req_type(?array $espresso_db_update = null): int | |
| 638 | +	{ | |
| 639 | +		if ($this->_req_type === null) { | |
| 640 | + $espresso_db_update = ! empty($espresso_db_update) | |
| 641 | + ? $espresso_db_update | |
| 642 | + : $this->fix_espresso_db_upgrade_option(); | |
| 643 | + $this->_req_type = EE_System::detect_req_type_given_activation_history( | |
| 644 | + $espresso_db_update, | |
| 645 | + 'ee_espresso_activation', | |
| 646 | + espresso_version() | |
| 647 | + ); | |
| 648 | + $this->_major_version_change = $this->_detect_major_version_change($espresso_db_update); | |
| 649 | + $this->request->setIsActivation($this->_req_type !== EE_System::req_type_normal); | |
| 650 | + } | |
| 651 | + return $this->_req_type; | |
| 652 | + } | |
| 653 | + | |
| 654 | + | |
| 655 | + /** | |
| 656 | + * Returns whether or not there was a non-micro version change (ie, change in either | |
| 657 | + * the first or second number in the version. Eg 4.9.0.rc.001 to 4.10.0.rc.000, | |
| 658 | + * but not 4.9.0.rc.0001 to 4.9.1.rc.0001 | |
| 659 | + * | |
| 660 | + * @param $activation_history | |
| 661 | + * @return bool | |
| 662 | + */ | |
| 663 | + private function _detect_major_version_change($activation_history): bool | |
| 664 | +	{ | |
| 665 | + $previous_version = EE_System::getMostRecentlyActiveVersion($activation_history); | |
| 666 | +		$previous_version_parts = explode('.', $previous_version); | |
| 667 | +		$current_version_parts  = explode('.', espresso_version()); | |
| 668 | + return isset( | |
| 669 | + $previous_version_parts[0], | |
| 670 | + $previous_version_parts[1], | |
| 671 | + $current_version_parts[0], | |
| 672 | + $current_version_parts[1] | |
| 673 | + ) && ( | |
| 674 | + $previous_version_parts[0] !== $current_version_parts[0] | |
| 675 | + || $previous_version_parts[1] !== $current_version_parts[1] | |
| 676 | + ); | |
| 677 | + } | |
| 678 | + | |
| 679 | + | |
| 680 | + /** | |
| 681 | + * Returns true if either the major or minor version of EE changed during this request. | |
| 682 | + * Eg 4.9.0.rc.001 to 4.10.0.rc.000, but not 4.9.0.rc.0001 to 4.9.1.rc.0001 | |
| 683 | + * | |
| 684 | + * @return bool | |
| 685 | + */ | |
| 686 | + public function is_major_version_change(): bool | |
| 687 | +	{ | |
| 688 | + return $this->_major_version_change; | |
| 689 | + } | |
| 690 | + | |
| 691 | + | |
| 692 | + /** | |
| 693 | + * Determines the request type for any ee addon, given three piece of info: the current array of activation | |
| 694 | + * histories (for core that' 'espresso_db_update' wp option); the name of the WordPress option which is temporarily | |
| 695 | + * set upon activation of the plugin (for core it's 'ee_espresso_activation'); and the version that this plugin was | |
| 696 | + * just activated to (for core that will always be espresso_version()) | |
| 697 | + * | |
| 698 | + * @param array|null $activation_history the option's value which stores the activation history for | |
| 699 | + * this | |
| 700 | + * ee plugin. for core that's 'espresso_db_update' | |
| 701 | + * @param string $activation_indicator_option_name the name of the WordPress option that is temporarily set to | |
| 702 | + * indicate that this plugin was just activated | |
| 703 | + * @param string $current_version the version that was just upgraded to (for core that will be | |
| 704 | + * espresso_version()) | |
| 705 | + * @return int one of the constants on EE_System::req_type_ | |
| 706 | + */ | |
| 707 | + public static function detect_req_type_given_activation_history( | |
| 708 | + array $activation_history, | |
| 709 | + string $activation_indicator_option_name, | |
| 710 | + string $current_version | |
| 711 | +	): int { | |
| 712 | + $version_change = self::compareVersionWithPrevious($activation_history, $current_version); | |
| 713 | + $is_activation = get_option($activation_indicator_option_name, false); | |
| 714 | + $req_type = self::getRequestType($activation_history, $version_change, $is_activation); | |
| 715 | +		if ($is_activation) { | |
| 716 | + // cleanup in aisle 6 | |
| 717 | + delete_option($activation_indicator_option_name); | |
| 718 | + } | |
| 719 | + return $req_type; | |
| 720 | + } | |
| 721 | + | |
| 722 | + | |
| 723 | + /** | |
| 724 | + * @param array $activation_history | |
| 725 | + * @param int $version_change | |
| 726 | + * @param bool $is_activation | |
| 727 | + * @return int | |
| 728 | + * @since 5.0.0.p | |
| 729 | + */ | |
| 730 | + private static function getRequestType(array $activation_history, int $version_change, bool $is_activation): int | |
| 731 | +	{ | |
| 732 | + // if no previous activation history exists, then this is a brand new install | |
| 733 | +		if (empty($activation_history)) { | |
| 734 | + return EE_System::req_type_new_activation; | |
| 735 | + } | |
| 736 | + // current version is higher than previous version, so it's an upgrade | |
| 737 | +		if ($version_change === 1) { | |
| 738 | + return EE_System::req_type_upgrade; | |
| 739 | + } | |
| 740 | + // current version is lower than previous version, so it's a downgrade | |
| 741 | +		if ($version_change === -1) { | |
| 742 | + return EE_System::req_type_downgrade; | |
| 743 | + } | |
| 744 | + // version hasn't changed since last version so check if the activation indicator is set | |
| 745 | + // to determine if it's a reactivation, or just a normal request | |
| 746 | + return $is_activation | |
| 747 | + ? EE_System::req_type_reactivation | |
| 748 | + : EE_System::req_type_normal; | |
| 749 | + } | |
| 750 | + | |
| 751 | + | |
| 752 | + /** | |
| 753 | + * Detects if the $version_to_upgrade_to is higher than the most recent version in | |
| 754 | + * the $activation_history_for_addon | |
| 755 | + * | |
| 756 | + * @param array $activation_history array where keys are versions, | |
| 757 | + * values are arrays of times activated (sometimes 'unknown-date') | |
| 758 | + * @param string $current_version | |
| 759 | + * @return int results of version_compare( $version_to_upgrade_to, $most_recently_active_version ). | |
| 760 | + * -1 if $version_to_upgrade_to is LOWER (downgrade); | |
| 761 | + * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); | |
| 762 | + * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; | |
| 763 | + */ | |
| 764 | + private static function compareVersionWithPrevious(array $activation_history, string $current_version): int | |
| 765 | +	{ | |
| 766 | + // find the most recently-activated version | |
| 767 | + $most_recently_active_version = EE_System::getMostRecentlyActiveVersion($activation_history); | |
| 768 | + return version_compare($current_version, $most_recently_active_version); | |
| 769 | + } | |
| 770 | + | |
| 771 | + | |
| 772 | + /** | |
| 773 | + * Gets the most recently active version listed in the activation history, | |
| 774 | + * and if none are found (ie, it's a brand new install) returns '0.0.0.dev.000'. | |
| 775 | + * | |
| 776 | + * @param array|null $activation_history (keys are versions, values are arrays of times activated, | |
| 777 | + * sometimes containing 'unknown-date' | |
| 778 | + * @return string | |
| 779 | + */ | |
| 780 | + private static function getMostRecentlyActiveVersion(?array $activation_history): string | |
| 781 | +	{ | |
| 782 | + $most_recent_activation_date = '1970-01-01 00:00:00'; | |
| 783 | + $most_recently_active_version = '0.0.0.dev.000'; | |
| 784 | +		if (is_array($activation_history)) { | |
| 785 | +			foreach ($activation_history as $version => $activation_dates) { | |
| 786 | + // check there is a record of when this version was activated. | |
| 787 | + // Otherwise, mark it as unknown | |
| 788 | +				if (! $activation_dates) { | |
| 789 | + $activation_dates = ['unknown-date']; | |
| 790 | + } | |
| 791 | + $activation_dates = is_string($activation_dates) | |
| 792 | + ? [$activation_dates] | |
| 793 | + : $activation_dates; | |
| 794 | +				foreach ($activation_dates as $activation_date) { | |
| 795 | +					if ($activation_date !== 'unknown-date' && $activation_date > $most_recent_activation_date) { | |
| 796 | + $most_recently_active_version = $version; | |
| 797 | + $most_recent_activation_date = $activation_date; | |
| 798 | + } | |
| 799 | + } | |
| 800 | + } | |
| 801 | + } | |
| 802 | + return $most_recently_active_version; | |
| 803 | + } | |
| 804 | + | |
| 805 | + | |
| 806 | + /** | |
| 807 | + * This redirects to the about EE page after activation | |
| 808 | + * | |
| 809 | + * @return void | |
| 810 | + */ | |
| 811 | + public function redirect_to_about_ee() | |
| 812 | +	{ | |
| 813 | + $notices = EE_Error::get_notices(false); | |
| 814 | + // if current user is an admin and it's not an ajax or rest request | |
| 815 | + if ( | |
| 816 | + ! isset($notices['errors']) | |
| 817 | + && $this->request->isAdmin() | |
| 818 | + && apply_filters( | |
| 819 | + 'FHEE__EE_System__redirect_to_about_ee__do_redirect', | |
| 820 | +				$this->capabilities->current_user_can('manage_options', 'espresso_about_default') | |
| 821 | + ) | |
| 822 | +		) { | |
| 823 | + $query_params = ['page' => 'espresso_about']; | |
| 824 | +			if (EE_System::instance()->detect_req_type() === EE_System::req_type_new_activation) { | |
| 825 | + $query_params['new_activation'] = true; | |
| 826 | + } | |
| 827 | +			if (EE_System::instance()->detect_req_type() === EE_System::req_type_reactivation) { | |
| 828 | + $query_params['reactivation'] = true; | |
| 829 | + } | |
| 830 | +			$url = add_query_arg($query_params, admin_url('admin.php')); | |
| 831 | + EEH_URL::safeRedirectAndExit($url); | |
| 832 | + } | |
| 833 | + } | |
| 834 | + | |
| 835 | + | |
| 836 | + /** | |
| 837 | + * load_core_configuration | |
| 838 | + * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration' | |
| 839 | + * which runs during the WP 'plugins_loaded' action at priority 5 | |
| 840 | + * | |
| 841 | + * @return void | |
| 842 | + * @throws ReflectionException | |
| 843 | + * @throws Exception | |
| 844 | + */ | |
| 845 | + public function load_core_configuration() | |
| 846 | +	{ | |
| 847 | +		do_action('AHEE__EE_System__load_core_configuration__begin', $this); | |
| 848 | +		$this->loader->getShared('EE_Load_Textdomain'); | |
| 849 | + // load textdomain | |
| 850 | + EE_Load_Textdomain::load_textdomain(); | |
| 851 | + /** @var EE_Config $config */ | |
| 852 | +		$config = $this->loader->getShared('EE_Config'); | |
| 853 | +		$this->loader->getShared('EE_Network_Config'); | |
| 854 | + // setup autoloaders | |
| 855 | + // enable logging? | |
| 856 | +		$this->loader->getShared('EventEspresso\core\services\orm\TrashLogger'); | |
| 857 | +		if ($config->admin->use_remote_logging) { | |
| 858 | +			$this->loader->getShared('EE_Log'); | |
| 859 | + } | |
| 860 | + // check for activation errors | |
| 861 | +		$activation_errors = get_option('ee_plugin_activation_errors', false); | |
| 862 | +		if ($activation_errors) { | |
| 863 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); | |
| 864 | +			update_option('ee_plugin_activation_errors', false); | |
| 865 | + } | |
| 866 | + // get model names | |
| 867 | + $this->_parse_model_names(); | |
| 868 | + // configure custom post type definitions | |
| 869 | +		$this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions'); | |
| 870 | +		$this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'); | |
| 871 | +		do_action('AHEE__EE_System__load_core_configuration__complete', $this); | |
| 872 | + } | |
| 873 | + | |
| 874 | + | |
| 875 | + /** | |
| 876 | + * cycles through all of the models/*.model.php files, and assembles an array of model names | |
| 877 | + * | |
| 878 | + * @return void | |
| 879 | + * @throws ReflectionException | |
| 880 | + */ | |
| 881 | + private function _parse_model_names() | |
| 882 | +	{ | |
| 883 | + // get all the files in the EE_MODELS folder that end in .model.php | |
| 884 | + $models = glob(EE_MODELS . '*.model.php'); | |
| 885 | + $model_names = []; | |
| 886 | + $non_abstract_db_models = []; | |
| 887 | +		foreach ($models as $model) { | |
| 888 | + // get model classname | |
| 889 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); | |
| 890 | +			$short_name      = str_replace('EEM_', '', $classname); | |
| 891 | + $reflectionClass = new ReflectionClass($classname); | |
| 892 | +			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { | |
| 893 | + $non_abstract_db_models[ $short_name ] = $classname; | |
| 894 | + } | |
| 895 | + $model_names[ $short_name ] = $classname; | |
| 896 | + } | |
| 897 | +		$this->registry->models                 = apply_filters('FHEE__EE_System__parse_model_names', $model_names); | |
| 898 | + $this->registry->non_abstract_db_models = apply_filters( | |
| 899 | + 'FHEE__EE_System__parse_implemented_model_names', | |
| 900 | + $non_abstract_db_models | |
| 901 | + ); | |
| 902 | + } | |
| 903 | + | |
| 904 | + | |
| 905 | + /** | |
| 906 | + * @throws Exception | |
| 907 | + * @throws Throwable | |
| 908 | + * @since 4.9.71.p | |
| 909 | + */ | |
| 910 | + public function loadRouteMatchSpecifications() | |
| 911 | +	{ | |
| 912 | +		try { | |
| 913 | +			$this->loader->getShared('EventEspresso\core\services\routing\RouteMatchSpecificationManager'); | |
| 914 | +			$this->loader->getShared('EventEspresso\core\services\routing\RouteCollection'); | |
| 915 | + $this->router->loadPrimaryRoutes(); | |
| 916 | +		} catch (Exception $exception) { | |
| 917 | + new ExceptionStackTraceDisplay($exception); | |
| 918 | + } | |
| 919 | +		do_action('AHEE__EE_System__loadRouteMatchSpecifications'); | |
| 920 | + } | |
| 921 | + | |
| 922 | + | |
| 923 | + /** | |
| 924 | + * loading CPT related classes earlier so that their definitions are available | |
| 925 | + * but not performing any actual registration with WP core until load_CPTs_and_session() is called | |
| 926 | + * | |
| 927 | + * @since 4.10.21.p | |
| 928 | + */ | |
| 929 | + public function loadCustomPostTypes() | |
| 930 | +	{ | |
| 931 | + $this->register_custom_taxonomies = $this->loader->getShared( | |
| 932 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' | |
| 933 | + ); | |
| 934 | + $this->register_custom_post_types = $this->loader->getShared( | |
| 935 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' | |
| 936 | + ); | |
| 937 | + $this->register_custom_taxonomy_terms = $this->loader->getShared( | |
| 938 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms' | |
| 939 | + ); | |
| 940 | + // integrate WP_Query with the EE models | |
| 941 | +		$this->loader->getShared('EE_CPT_Strategy'); | |
| 942 | + // load legacy EE_Request_Handler in case add-ons still need it | |
| 943 | +		$this->loader->getShared('EE_Request_Handler'); | |
| 944 | + } | |
| 945 | + | |
| 946 | + | |
| 947 | + /** | |
| 948 | + * register_shortcodes_modules_and_widgets | |
| 949 | + * generate lists of shortcodes and modules, then verify paths and classes | |
| 950 | + * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' | |
| 951 | + * which runs during the WP 'plugins_loaded' action at priority 7 | |
| 952 | + * | |
| 953 | + * @access public | |
| 954 | + * @return void | |
| 955 | + * @throws Exception | |
| 956 | + * @throws Throwable | |
| 957 | + */ | |
| 958 | + public function register_shortcodes_modules_and_widgets() | |
| 959 | +	{ | |
| 960 | + $this->router->registerShortcodesModulesAndWidgets(); | |
| 961 | +		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); | |
| 962 | + // check for addons using old hook point | |
| 963 | +		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { | |
| 964 | + $this->_incompatible_addon_error(); | |
| 965 | + } | |
| 966 | + } | |
| 967 | + | |
| 968 | + | |
| 969 | + /** | |
| 970 | + * _incompatible_addon_error | |
| 971 | + * | |
| 972 | + * @access public | |
| 973 | + * @return void | |
| 974 | + */ | |
| 975 | + private function _incompatible_addon_error() | |
| 976 | +	{ | |
| 977 | + // get array of classes hooking into here | |
| 978 | + $class_names = WordPressHooks::getClassNamesForAllCallbacksOnHook( | |
| 979 | + 'AHEE__EE_System__register_shortcodes_modules_and_addons' | |
| 980 | + ); | |
| 981 | +		if (! empty($class_names)) { | |
| 982 | + $msg = esc_html__( | |
| 983 | + 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', | |
| 984 | + 'event_espresso' | |
| 985 | + ); | |
| 986 | + $msg .= '<ul>'; | |
| 987 | +			foreach ($class_names as $class_name) { | |
| 988 | + $msg .= '<li><b>Event Espresso - ' | |
| 989 | + . str_replace( | |
| 990 | + ['EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'], | |
| 991 | + '', | |
| 992 | + $class_name | |
| 993 | + ) . '</b></li>'; | |
| 994 | + } | |
| 995 | + $msg .= '</ul>'; | |
| 996 | + $msg .= esc_html__( | |
| 997 | + 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', | |
| 998 | + 'event_espresso' | |
| 999 | + ); | |
| 1000 | + // save list of incompatible addons to wp-options for later use | |
| 1001 | +			add_option('ee_incompatible_addons', $class_names, '', 'no'); | |
| 1002 | +			if (is_admin()) { | |
| 1003 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); | |
| 1004 | + } | |
| 1005 | + } | |
| 1006 | + } | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + /** | |
| 1010 | + * brew_espresso | |
| 1011 | + * begins the process of setting hooks for initializing EE in the correct order | |
| 1012 | + * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point | |
| 1013 | + * which runs during the WP 'plugins_loaded' action at priority 9 | |
| 1014 | + * | |
| 1015 | + * @return void | |
| 1016 | + * @throws Exception | |
| 1017 | + * @throws Throwable | |
| 1018 | + */ | |
| 1019 | + public function brew_espresso() | |
| 1020 | +	{ | |
| 1021 | +		do_action('AHEE__EE_System__brew_espresso__begin', $this); | |
| 1022 | + // load some final core systems | |
| 1023 | +		add_action('init', [$this, 'set_hooks_for_core'], 1); | |
| 1024 | +		add_action('init', [$this, 'perform_activations_upgrades_and_migrations'], 3); | |
| 1025 | +		add_action('init', [$this, 'load_CPTs_and_session'], 5); | |
| 1026 | +		add_action('init', [$this, 'load_controllers'], 7); | |
| 1027 | +		add_action('init', [$this, 'core_loaded_and_ready'], 9); | |
| 1028 | +		add_action('init', [$this, 'initialize'], 10); | |
| 1029 | +		add_action('init', [$this, 'initialize_last'], 100); | |
| 1030 | + $this->router->brewEspresso(); | |
| 1031 | +		$this->loader->getShared('EventEspresso\PaymentMethods\Manager'); | |
| 1032 | +		$this->loader->getShared('EE_Payment_Method_Manager'); | |
| 1033 | +		do_action('AHEE__EE_System__brew_espresso__complete', $this); | |
| 1034 | + } | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + /** | |
| 34 | 1038 | /** | 
| 35 | - * indicates this is a 'normal' request. Ie, not activation, nor upgrade, nor activation. | |
| 36 | - * So examples of this would be a normal GET request on the frontend or backend, or a POST, etc | |
| 37 | - */ | |
| 38 | - const req_type_normal = 0; | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * Indicates this is a brand new installation of EE so we should install | |
| 42 | - * tables and default data etc | |
| 43 | - */ | |
| 44 | - const req_type_new_activation = 1; | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * we've detected that EE has been reactivated (or EE was activated during maintenance mode, | |
| 48 | - * and we just exited maintenance mode). We MUST check the database is setup properly | |
| 49 | - * and that default data is setup too | |
| 50 | - */ | |
| 51 | - const req_type_reactivation = 2; | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * indicates that EE has been upgraded since its previous request. | |
| 55 | - * We may have data migration scripts to call and will want to trigger maintenance mode | |
| 56 | - */ | |
| 57 | - const req_type_upgrade = 3; | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * TODO will detect that EE has been DOWNGRADED. We probably don't want to run in this case... | |
| 61 | - */ | |
| 62 | - const req_type_downgrade = 4; | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * @deprecated since version 4.6.0.dev.006 | |
| 66 | - * Now whenever a new_activation is detected the request type is still just | |
| 67 | - * new_activation (same for reactivation, upgrade, downgrade etc), but if we're in maintenance mode | |
| 68 | - * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required | |
| 69 | - * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode. | |
| 70 | - * (Specifically, when the migration manager indicates migrations are finished | |
| 71 | - * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called) | |
| 72 | - */ | |
| 73 | - const req_type_activation_but_not_installed = 5; | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * option prefix for recording the activation history (like core's "espresso_db_update") of addons | |
| 77 | - */ | |
| 78 | - const addon_activation_history_option_prefix = 'ee_addon_activation_history_'; | |
| 79 | - | |
| 80 | - private static ?EE_System $_instance = null; | |
| 81 | - | |
| 82 | - private ?LoaderInterface $loader; | |
| 83 | - | |
| 84 | - private ?EE_Maintenance_Mode $maintenance_mode; | |
| 85 | - | |
| 86 | - private ?EE_Registry $registry; | |
| 87 | - | |
| 88 | - private ?RequestInterface $request; | |
| 89 | - | |
| 90 | - private Router $router; | |
| 91 | - | |
| 92 | - private ?AddonManager $addon_manager = null; | |
| 93 | - | |
| 94 | - private ?EE_Capabilities $capabilities = null; | |
| 95 | - | |
| 96 | - protected ?FeatureFlags $feature = null; | |
| 97 | - | |
| 98 | - private ?RegisterCustomPostTypes $register_custom_post_types = null; | |
| 99 | - | |
| 100 | - private ?RegisterCustomTaxonomies $register_custom_taxonomies = null; | |
| 101 | - | |
| 102 | - private ?RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms = null; | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * Stores which type of request this is, options being one of the constants on EE_System starting with req_type_*. | |
| 106 | - * It can be a brand-new activation, a reactivation, an upgrade, a downgrade, or a normal request. | |
| 107 | - */ | |
| 108 | - private ?int $_req_type = null; | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * Whether there was a non-micro version change in EE core version during this request | |
| 112 | - */ | |
| 113 | - private bool $_major_version_change = false; | |
| 114 | - | |
| 115 | - | |
| 116 | - /** | |
| 117 | - * @singleton method used to instantiate class object | |
| 118 | - * @param LoaderInterface|null $loader | |
| 119 | - * @param EE_Maintenance_Mode|null $maintenance_mode | |
| 120 | - * @param EE_Registry|null $registry | |
| 121 | - * @param RequestInterface|null $request | |
| 122 | - * @param Router|null $router | |
| 123 | - * @param FeatureFlags|null $feature | |
| 124 | - * @return EE_System | |
| 125 | - */ | |
| 126 | - public static function instance( | |
| 127 | - ?LoaderInterface $loader = null, | |
| 128 | - ?EE_Maintenance_Mode $maintenance_mode = null, | |
| 129 | - ?EE_Registry $registry = null, | |
| 130 | - ?RequestInterface $request = null, | |
| 131 | - ?Router $router = null, | |
| 132 | - ?FeatureFlags $feature = null | |
| 133 | -    ): EE_System { | |
| 134 | - // check if class object is instantiated | |
| 135 | -        if (! self::$_instance instanceof EE_System) { | |
| 136 | - self::$_instance = new self($loader, $maintenance_mode, $registry, $request, $router, $feature); | |
| 137 | - } | |
| 138 | - return self::$_instance; | |
| 139 | - } | |
| 140 | - | |
| 141 | - | |
| 142 | - /** | |
| 143 | - * resets the instance and returns it | |
| 144 | - * | |
| 145 | - * @return EE_System | |
| 146 | - */ | |
| 147 | - public static function reset(): EE_System | |
| 148 | -    { | |
| 149 | - self::$_instance->_req_type = null; | |
| 150 | - // make sure none of the old hooks are left hanging around | |
| 151 | -        remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); | |
| 152 | - // we need to reset the migration manager in order for it to detect DMSs properly | |
| 153 | - EE_Data_Migration_Manager::reset(); | |
| 154 | - self::instance()->detect_activations_or_upgrades(); | |
| 155 | - self::instance()->perform_activations_upgrades_and_migrations(); | |
| 156 | - return self::instance(); | |
| 157 | - } | |
| 158 | - | |
| 159 | - | |
| 160 | - /** | |
| 161 | - * sets hooks for running rest of system | |
| 162 | - * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point | |
| 163 | - * starting EE Addons from any other point may lead to problems | |
| 164 | - * | |
| 165 | - * @param LoaderInterface $loader | |
| 166 | - * @param EE_Maintenance_Mode $maintenance_mode | |
| 167 | - * @param EE_Registry $registry | |
| 168 | - * @param RequestInterface $request | |
| 169 | - * @param Router $router | |
| 170 | - * @param FeatureFlags $feature | |
| 171 | - */ | |
| 172 | - private function __construct( | |
| 173 | - LoaderInterface $loader, | |
| 174 | - EE_Maintenance_Mode $maintenance_mode, | |
| 175 | - EE_Registry $registry, | |
| 176 | - RequestInterface $request, | |
| 177 | - Router $router, | |
| 178 | - FeatureFlags $feature | |
| 179 | -    ) { | |
| 180 | - $this->registry = $registry; | |
| 181 | - $this->loader = $loader; | |
| 182 | - $this->request = $request; | |
| 183 | - $this->router = $router; | |
| 184 | - $this->maintenance_mode = $maintenance_mode; | |
| 185 | - $this->feature = $feature; | |
| 186 | -        do_action('AHEE__EE_System__construct__begin', $this); | |
| 187 | - add_action( | |
| 188 | - 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 189 | - [$this, 'loadWpGraphQL'], | |
| 190 | - 3 | |
| 191 | - ); | |
| 192 | - add_action( | |
| 193 | - 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 194 | - [$this, 'loadCapabilities'], | |
| 195 | - 5 | |
| 196 | - ); | |
| 197 | - add_action( | |
| 198 | - 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 199 | - [$this, 'loadCommandBus'], | |
| 200 | - 7 | |
| 201 | - ); | |
| 202 | - add_action( | |
| 203 | - 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 204 | - [$this, 'loadPluginApi'], | |
| 205 | - 9 | |
| 206 | - ); | |
| 207 | - // give caff stuff a chance to play during the activation process too. | |
| 208 | - add_action( | |
| 209 | - 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 210 | - [$this, 'brewCaffeinated'], | |
| 211 | - 9 | |
| 212 | - ); | |
| 213 | - // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc | |
| 214 | - add_action( | |
| 215 | - 'AHEE__EE_Bootstrap__load_espresso_addons', | |
| 216 | - [$this, 'load_espresso_addons'] | |
| 217 | - ); | |
| 218 | - // when an ee addon is activated, we want to call the core hook(s) again | |
| 219 | - // because the newly-activated addon didn't get a chance to run at all | |
| 220 | -        add_action('activate_plugin', [$this, 'load_espresso_addons'], 1); | |
| 221 | - // detect whether install or upgrade | |
| 222 | - add_action( | |
| 223 | - 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', | |
| 224 | - [$this, 'detect_activations_or_upgrades'], | |
| 225 | - 3 | |
| 226 | - ); | |
| 227 | - // load EE_Config, EE_Textdomain, etc | |
| 228 | - add_action( | |
| 229 | - 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 230 | - [$this, 'load_core_configuration'], | |
| 231 | - 5 | |
| 232 | - ); | |
| 233 | - // load specifications for matching routes to current request | |
| 234 | - add_action( | |
| 235 | - 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 236 | - [$this, 'loadRouteMatchSpecifications'] | |
| 237 | - ); | |
| 238 | - // load specifications for custom post types | |
| 239 | - add_action( | |
| 240 | - 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 241 | - [$this, 'loadCustomPostTypes'] | |
| 242 | - ); | |
| 243 | - // load specifications for custom post types | |
| 244 | - add_action( | |
| 245 | - 'AHEE__EE_Bootstrap__load_core_configuration', | |
| 246 | - [$this, 'loadCustomPostTypes'] | |
| 247 | - ); | |
| 248 | - // register shortcodes, modules, and widgets | |
| 249 | - add_action( | |
| 250 | - 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', | |
| 251 | - [$this, 'register_shortcodes_modules_and_widgets'], | |
| 252 | - 7 | |
| 253 | - ); | |
| 254 | - // you wanna get going? I wanna get going... let's get going! | |
| 255 | - add_action( | |
| 256 | - 'AHEE__EE_Bootstrap__brew_espresso', | |
| 257 | - [$this, 'brew_espresso'], | |
| 258 | - 9 | |
| 259 | - ); | |
| 260 | - // other housekeeping | |
| 261 | - // exclude EE critical pages from wp_list_pages | |
| 262 | - add_filter( | |
| 263 | - 'wp_list_pages_excludes', | |
| 264 | - [$this, 'remove_pages_from_wp_list_pages'], | |
| 265 | - 10 | |
| 266 | - ); | |
| 267 | - // ALL EE Addons should use the following hook point to attach their initial setup too | |
| 268 | - // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads | |
| 269 | -        do_action('AHEE__EE_System__construct__complete', $this); | |
| 270 | - } | |
| 271 | - | |
| 272 | - | |
| 273 | - /** | |
| 274 | - * load and setup EE_Capabilities | |
| 275 | - * | |
| 276 | - * @return void | |
| 277 | - */ | |
| 278 | - public function loadWpGraphQL() | |
| 279 | -    { | |
| 280 | - espressoLoadWpGraphQL(); | |
| 281 | - } | |
| 282 | - | |
| 283 | - | |
| 284 | - /** | |
| 285 | - * load and setup EE_Capabilities | |
| 286 | - * | |
| 287 | - * @return void | |
| 288 | - */ | |
| 289 | - public function loadCapabilities() | |
| 290 | -    { | |
| 291 | -        $this->capabilities = $this->loader->getShared('EE_Capabilities'); | |
| 292 | - } | |
| 293 | - | |
| 294 | - | |
| 295 | - /** | |
| 296 | - * create and cache the CommandBus, and also add middleware | |
| 297 | - * The CapChecker middleware requires the use of EE_Capabilities | |
| 298 | - * which is why we need to load the CommandBus after Caps are set up | |
| 299 | - * CommandBus middleware operate FIFO - First In First Out | |
| 300 | - * so LocateMovedCommands will run first in order to return any new commands | |
| 301 | - * | |
| 302 | - * @return void | |
| 303 | - */ | |
| 304 | - public function loadCommandBus() | |
| 305 | -    { | |
| 306 | - $this->loader->getShared( | |
| 307 | - 'CommandBusInterface', | |
| 308 | - [ | |
| 309 | - null, | |
| 310 | - apply_filters( | |
| 311 | - 'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware', | |
| 312 | - [ | |
| 313 | -                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\LocateMovedCommands'), | |
| 314 | -                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'), | |
| 315 | -                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'), | |
| 316 | - ] | |
| 317 | - ), | |
| 318 | - ] | |
| 319 | - ); | |
| 320 | - } | |
| 321 | - | |
| 322 | - | |
| 323 | - /** | |
| 324 | - * @return void | |
| 325 | - * @throws Exception | |
| 326 | - */ | |
| 327 | - public function loadPluginApi() | |
| 328 | -    { | |
| 329 | - $this->addon_manager = $this->loader->getShared(AddonManager::class); | |
| 330 | - $this->addon_manager->initialize(); | |
| 331 | -        $this->loader->getShared('EE_Request_Handler'); | |
| 332 | - } | |
| 333 | - | |
| 334 | - | |
| 335 | - /** | |
| 336 | - * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks | |
| 337 | - * that need to be setup before our EE_System launches. | |
| 338 | - * | |
| 339 | - * @return void | |
| 340 | - * @throws DomainException | |
| 341 | - * @throws InvalidArgumentException | |
| 342 | - * @throws InvalidDataTypeException | |
| 343 | - * @throws InvalidInterfaceException | |
| 344 | - * @throws InvalidClassException | |
| 345 | - * @throws InvalidFilePathException | |
| 346 | - * @throws EE_Error | |
| 347 | - * @throws Exception | |
| 348 | - */ | |
| 349 | - public function brewCaffeinated() | |
| 350 | -    { | |
| 351 | - static $brew; | |
| 352 | - /** @var Domain $domain */ | |
| 353 | - $domain = DomainFactory::getEventEspressoCoreDomain(); | |
| 354 | -        if ($domain->isCaffeinated() && ! $brew instanceof EE_Brewing_Regular) { | |
| 355 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; | |
| 356 | - /** @var EE_Brewing_Regular $brew */ | |
| 357 | - $brew = $this->loader->getShared(EE_Brewing_Regular::class); | |
| 358 | -            if (! $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING)) { | |
| 359 | - $brew->initializePUE(); | |
| 360 | - } | |
| 361 | - add_action( | |
| 362 | - 'AHEE__EE_System__load_core_configuration__begin', | |
| 363 | - [$brew, 'caffeinated'] | |
| 364 | - ); | |
| 365 | - } | |
| 366 | - } | |
| 367 | - | |
| 368 | - | |
| 369 | - /** | |
| 370 | - * load_espresso_addons | |
| 371 | - * allow addons to load first so that they can set hooks for running DMS's, etc | |
| 372 | - * this is hooked into both: | |
| 373 | - * 'AHEE__EE_Bootstrap__load_core_configuration' | |
| 374 | - * which runs during the WP 'plugins_loaded' action at priority 5 | |
| 375 | - * and the WP 'activate_plugin' hook point | |
| 376 | - * | |
| 377 | - * @return void | |
| 378 | - * @throws Exception | |
| 379 | - * @throws Throwable | |
| 380 | - */ | |
| 381 | - public function load_espresso_addons() | |
| 382 | -    { | |
| 383 | - if ( | |
| 384 | - $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING) | |
| 385 | - && ! $this->request->isWordPressHeartbeat() | |
| 386 | -        ) { | |
| 387 | - $core_license = new PluginLicense( | |
| 388 | - EVENT_ESPRESSO_MAIN_FILE, | |
| 389 | - Domain::LICENSE_PLUGIN_ID, | |
| 390 | - Domain::LICENSE_PLUGIN_NAME, | |
| 391 | - Domain::LICENSE_PLUGIN_SLUG, | |
| 392 | - espresso_version() | |
| 393 | - ); | |
| 394 | - $core_license->setHooks(); | |
| 395 | - $this->loader->share(PluginLicense::class, $core_license); | |
| 396 | - } | |
| 397 | - // looking for hooks? they've been moved into the AddonManager to maintain compatibility | |
| 398 | - $this->addon_manager->loadAddons(); | |
| 399 | - } | |
| 400 | - | |
| 401 | - | |
| 402 | - /** | |
| 403 | - * detect_activations_or_upgrades | |
| 404 | - * Checks for activation or upgrade of core first; | |
| 405 | - * then also checks if any registered addons have been activated or upgraded | |
| 406 | - * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' | |
| 407 | - * which runs during the WP 'plugins_loaded' action at priority 3 | |
| 408 | - * | |
| 409 | - * @access public | |
| 410 | - * @return void | |
| 411 | - * @throws EE_Error | |
| 412 | - */ | |
| 413 | - public function detect_activations_or_upgrades() | |
| 414 | -    { | |
| 415 | - // first off: let's make sure to handle core | |
| 416 | - $this->detect_if_activation_or_upgrade(); | |
| 417 | -        foreach ($this->registry->addons as $addon) { | |
| 418 | -            if ($addon instanceof EE_Addon) { | |
| 419 | - // detect the request type for that addon | |
| 420 | - $addon->detect_req_type(); | |
| 421 | - } | |
| 422 | - } | |
| 423 | - } | |
| 424 | - | |
| 425 | - | |
| 426 | - /** | |
| 427 | - * detect_if_activation_or_upgrade | |
| 428 | - * Takes care of detecting whether this is a brand new install or code upgrade, | |
| 429 | - * and either setting up the DB or setting up maintenance mode etc. | |
| 430 | - * | |
| 431 | - * @access public | |
| 432 | - * @return void | |
| 433 | - * @throws EE_Error | |
| 434 | - */ | |
| 435 | - public function detect_if_activation_or_upgrade() | |
| 436 | -    { | |
| 437 | -        do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); | |
| 438 | - // check if db has been updated, or if its a brand-new installation | |
| 439 | - $espresso_db_update = $this->fix_espresso_db_upgrade_option(); | |
| 440 | - $request_type = $this->detect_req_type($espresso_db_update); | |
| 441 | -        switch ($request_type) { | |
| 442 | - case EE_System::req_type_new_activation: | |
| 443 | -                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); | |
| 444 | - $this->_handle_core_version_change($espresso_db_update); | |
| 445 | - break; | |
| 446 | - case EE_System::req_type_reactivation: | |
| 447 | -                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); | |
| 448 | - $this->_handle_core_version_change($espresso_db_update); | |
| 449 | - break; | |
| 450 | - case EE_System::req_type_upgrade: | |
| 451 | -                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); | |
| 452 | - // migrations may be required now that we've upgraded | |
| 453 | - $this->maintenance_mode->set_maintenance_mode_if_db_old(); | |
| 454 | - $this->_handle_core_version_change($espresso_db_update); | |
| 455 | - break; | |
| 456 | - case EE_System::req_type_downgrade: | |
| 457 | -                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); | |
| 458 | - // its possible migrations are no longer required | |
| 459 | - $this->maintenance_mode->set_maintenance_mode_if_db_old(); | |
| 460 | - $this->_handle_core_version_change($espresso_db_update); | |
| 461 | - break; | |
| 462 | - case EE_System::req_type_normal: | |
| 463 | - default: | |
| 464 | - break; | |
| 465 | - } | |
| 466 | -        do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); | |
| 467 | - } | |
| 468 | - | |
| 469 | - | |
| 470 | - /** | |
| 471 | - * Updates the list of installed versions and sets hooks for | |
| 472 | - * initializing the database later during the request | |
| 473 | - * | |
| 474 | - * @param array $espresso_db_update | |
| 475 | - */ | |
| 476 | - private function _handle_core_version_change(array $espresso_db_update) | |
| 477 | -    { | |
| 478 | - $this->update_list_of_installed_versions($espresso_db_update); | |
| 479 | - // get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) | |
| 480 | - add_action( | |
| 481 | - 'AHEE__EE_System__perform_activations_upgrades_and_migrations', | |
| 482 | - [$this, 'initialize_db_if_no_migrations_required'] | |
| 483 | - ); | |
| 484 | - } | |
| 485 | - | |
| 486 | - | |
| 487 | - /** | |
| 488 | - * standardizes the wp option 'espresso_db_upgrade' which actually stores | |
| 489 | - * information about what versions of EE have been installed and activated, | |
| 490 | - * NOT necessarily the state of the database | |
| 491 | - * | |
| 492 | - * @param mixed $espresso_db_update the value of the WordPress option. | |
| 493 | - * If not supplied, fetches it from the options table | |
| 494 | - * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction | |
| 495 | - */ | |
| 496 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null): array | |
| 497 | -    { | |
| 498 | -        do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); | |
| 499 | -        if (! $espresso_db_update) { | |
| 500 | -            $espresso_db_update = get_option('espresso_db_update'); | |
| 501 | - } | |
| 502 | - // check that option is an array | |
| 503 | -        if (! is_array($espresso_db_update)) { | |
| 504 | - // if option is FALSE, then it never existed | |
| 505 | -            if ($espresso_db_update === false) { | |
| 506 | - // make $espresso_db_update an array and save option with autoload OFF | |
| 507 | - $espresso_db_update = []; | |
| 508 | -                add_option('espresso_db_update', $espresso_db_update, '', 'no'); | |
| 509 | -            } else { | |
| 510 | - // option is NOT FALSE but also is NOT an array, so make it an array and save it | |
| 511 | - $espresso_db_update = [$espresso_db_update => []]; | |
| 512 | -                update_option('espresso_db_update', $espresso_db_update); | |
| 513 | - } | |
| 514 | -        } else { | |
| 515 | - $corrected_db_update = []; | |
| 516 | - // if IS an array, but is it an array where KEYS are version numbers, and values are arrays? | |
| 517 | -            foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { | |
| 518 | -                if (is_int($should_be_version_string) && ! is_array($should_be_array)) { | |
| 519 | - // the key is an int, and the value IS NOT an array | |
| 520 | - // so it must be numerically-indexed, where values are versions installed... | |
| 521 | - // fix it! | |
| 522 | - $version_string = $should_be_array; | |
| 523 | - $corrected_db_update[ $version_string ] = ['unknown-date']; | |
| 524 | -                } else { | |
| 525 | - // ok it checks out | |
| 526 | - $corrected_db_update[ $should_be_version_string ] = $should_be_array; | |
| 527 | - } | |
| 528 | - } | |
| 529 | - $espresso_db_update = $corrected_db_update; | |
| 530 | -            update_option('espresso_db_update', $espresso_db_update); | |
| 531 | - } | |
| 532 | -        do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); | |
| 533 | - return ! empty($espresso_db_update) | |
| 534 | - ? $espresso_db_update | |
| 535 | - : []; | |
| 536 | - } | |
| 537 | - | |
| 538 | - | |
| 539 | - /** | |
| 540 | - * Does the traditional work of setting up the plugin's database and adding default data. | |
| 541 | - * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade. | |
| 542 | - * NOTE: if we're in maintenance mode (which would be the case if we detect there are data | |
| 543 | - * migration scripts that need to be run and a version change happens), enqueues core for database initialization, | |
| 544 | - * so that it will be done when migrations are finished | |
| 545 | - * | |
| 546 | - * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too; | |
| 547 | - * @param boolean $verify_schema if true will re-check the database tables have the correct schema. | |
| 548 | - * This is a resource-intensive job | |
| 549 | - * so we prefer to only do it when necessary | |
| 550 | - * @return void | |
| 551 | - * @throws EE_Error | |
| 552 | - * @throws ReflectionException | |
| 553 | - */ | |
| 554 | - public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true) | |
| 555 | -    { | |
| 556 | - $request_type = $this->detect_req_type(); | |
| 557 | - // only initialize system if we're not in maintenance mode. | |
| 558 | -        if (! MaintenanceStatus::isFullSite()) { | |
| 559 | - /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ | |
| 560 | - $rewrite_rules = $this->loader->getShared( | |
| 561 | - 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' | |
| 562 | - ); | |
| 563 | - $rewrite_rules->flush(); | |
| 564 | -            if ($verify_schema) { | |
| 565 | - EEH_Activation::initialize_db_and_folders(); | |
| 566 | - } | |
| 567 | - EEH_Activation::initialize_db_content(); | |
| 568 | - EEH_Activation::system_initialization(); | |
| 569 | -            if ($initialize_addons_too) { | |
| 570 | - $this->initialize_addons(); | |
| 571 | - } | |
| 572 | -        } else { | |
| 573 | -            EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); | |
| 574 | - } | |
| 575 | - if ( | |
| 576 | - $request_type === EE_System::req_type_new_activation | |
| 577 | - || $request_type === EE_System::req_type_reactivation | |
| 578 | - || ( | |
| 579 | - $request_type === EE_System::req_type_upgrade | |
| 580 | - && $this->is_major_version_change() | |
| 581 | - ) | |
| 582 | -        ) { | |
| 583 | -            add_action('AHEE__EE_System__initialize_last', [$this, 'redirect_to_about_ee'], 9); | |
| 584 | - } | |
| 585 | - } | |
| 586 | - | |
| 587 | - | |
| 588 | - /** | |
| 589 | - * Initializes the db for all registered addons | |
| 590 | - * | |
| 591 | - * @throws EE_Error | |
| 592 | - * @throws ReflectionException | |
| 593 | - */ | |
| 594 | - public function initialize_addons() | |
| 595 | -    { | |
| 596 | - // foreach registered addon, make sure its db is up-to-date too | |
| 597 | -        foreach ($this->registry->addons as $addon) { | |
| 598 | -            if ($addon instanceof EE_Addon) { | |
| 599 | - $addon->initialize_db_if_no_migrations_required(); | |
| 600 | - } | |
| 601 | - } | |
| 602 | - } | |
| 603 | - | |
| 604 | - | |
| 605 | - /** | |
| 606 | - * Adds the current code version to the saved wp option which stores a list of all ee versions ever installed. | |
| 607 | - * | |
| 608 | - * @param array $version_history | |
| 609 | - * @param string $current_version_to_add version to be added to the version history | |
| 610 | - * @return boolean success as to whether or not this option was changed | |
| 611 | - */ | |
| 612 | - public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null): bool | |
| 613 | -    { | |
| 614 | -        if (! $version_history) { | |
| 615 | - $version_history = $this->fix_espresso_db_upgrade_option($version_history); | |
| 616 | - } | |
| 617 | -        if ($current_version_to_add === null) { | |
| 618 | - $current_version_to_add = espresso_version(); | |
| 619 | - } | |
| 620 | -        $version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time()); | |
| 621 | - // re-save | |
| 622 | -        return update_option('espresso_db_update', $version_history); | |
| 623 | - } | |
| 624 | - | |
| 625 | - | |
| 626 | - /** | |
| 627 | - * Detects if the current version indicated in the has existed in the list of | |
| 628 | - * previously-installed versions of EE (espresso_db_update). Does NOT modify it (ie, no side-effect) | |
| 629 | - * | |
| 630 | - * @param array|null $espresso_db_update array from the wp option stored under the name 'espresso_db_update'. | |
| 631 | - * If not supplied, fetches it from the options table. | |
| 632 | - * Also, caches its result so later parts of the code can also know whether | |
| 633 | - * there's been an update or not. This way we can add the current version to | |
| 634 | - * espresso_db_update, but still know if this is a new install or not | |
| 635 | - * @return int one of the constants on EE_System::req_type_ | |
| 636 | - */ | |
| 637 | - public function detect_req_type(?array $espresso_db_update = null): int | |
| 638 | -    { | |
| 639 | -        if ($this->_req_type === null) { | |
| 640 | - $espresso_db_update = ! empty($espresso_db_update) | |
| 641 | - ? $espresso_db_update | |
| 642 | - : $this->fix_espresso_db_upgrade_option(); | |
| 643 | - $this->_req_type = EE_System::detect_req_type_given_activation_history( | |
| 644 | - $espresso_db_update, | |
| 645 | - 'ee_espresso_activation', | |
| 646 | - espresso_version() | |
| 647 | - ); | |
| 648 | - $this->_major_version_change = $this->_detect_major_version_change($espresso_db_update); | |
| 649 | - $this->request->setIsActivation($this->_req_type !== EE_System::req_type_normal); | |
| 650 | - } | |
| 651 | - return $this->_req_type; | |
| 652 | - } | |
| 653 | - | |
| 654 | - | |
| 655 | - /** | |
| 656 | - * Returns whether or not there was a non-micro version change (ie, change in either | |
| 657 | - * the first or second number in the version. Eg 4.9.0.rc.001 to 4.10.0.rc.000, | |
| 658 | - * but not 4.9.0.rc.0001 to 4.9.1.rc.0001 | |
| 659 | - * | |
| 660 | - * @param $activation_history | |
| 661 | - * @return bool | |
| 662 | - */ | |
| 663 | - private function _detect_major_version_change($activation_history): bool | |
| 664 | -    { | |
| 665 | - $previous_version = EE_System::getMostRecentlyActiveVersion($activation_history); | |
| 666 | -        $previous_version_parts = explode('.', $previous_version); | |
| 667 | -        $current_version_parts  = explode('.', espresso_version()); | |
| 668 | - return isset( | |
| 669 | - $previous_version_parts[0], | |
| 670 | - $previous_version_parts[1], | |
| 671 | - $current_version_parts[0], | |
| 672 | - $current_version_parts[1] | |
| 673 | - ) && ( | |
| 674 | - $previous_version_parts[0] !== $current_version_parts[0] | |
| 675 | - || $previous_version_parts[1] !== $current_version_parts[1] | |
| 676 | - ); | |
| 677 | - } | |
| 678 | - | |
| 679 | - | |
| 680 | - /** | |
| 681 | - * Returns true if either the major or minor version of EE changed during this request. | |
| 682 | - * Eg 4.9.0.rc.001 to 4.10.0.rc.000, but not 4.9.0.rc.0001 to 4.9.1.rc.0001 | |
| 683 | - * | |
| 684 | - * @return bool | |
| 685 | - */ | |
| 686 | - public function is_major_version_change(): bool | |
| 687 | -    { | |
| 688 | - return $this->_major_version_change; | |
| 689 | - } | |
| 690 | - | |
| 691 | - | |
| 692 | - /** | |
| 693 | - * Determines the request type for any ee addon, given three piece of info: the current array of activation | |
| 694 | - * histories (for core that' 'espresso_db_update' wp option); the name of the WordPress option which is temporarily | |
| 695 | - * set upon activation of the plugin (for core it's 'ee_espresso_activation'); and the version that this plugin was | |
| 696 | - * just activated to (for core that will always be espresso_version()) | |
| 697 | - * | |
| 698 | - * @param array|null $activation_history the option's value which stores the activation history for | |
| 699 | - * this | |
| 700 | - * ee plugin. for core that's 'espresso_db_update' | |
| 701 | - * @param string $activation_indicator_option_name the name of the WordPress option that is temporarily set to | |
| 702 | - * indicate that this plugin was just activated | |
| 703 | - * @param string $current_version the version that was just upgraded to (for core that will be | |
| 704 | - * espresso_version()) | |
| 705 | - * @return int one of the constants on EE_System::req_type_ | |
| 706 | - */ | |
| 707 | - public static function detect_req_type_given_activation_history( | |
| 708 | - array $activation_history, | |
| 709 | - string $activation_indicator_option_name, | |
| 710 | - string $current_version | |
| 711 | -    ): int { | |
| 712 | - $version_change = self::compareVersionWithPrevious($activation_history, $current_version); | |
| 713 | - $is_activation = get_option($activation_indicator_option_name, false); | |
| 714 | - $req_type = self::getRequestType($activation_history, $version_change, $is_activation); | |
| 715 | -        if ($is_activation) { | |
| 716 | - // cleanup in aisle 6 | |
| 717 | - delete_option($activation_indicator_option_name); | |
| 718 | - } | |
| 719 | - return $req_type; | |
| 720 | - } | |
| 721 | - | |
| 722 | - | |
| 723 | - /** | |
| 724 | - * @param array $activation_history | |
| 725 | - * @param int $version_change | |
| 726 | - * @param bool $is_activation | |
| 727 | - * @return int | |
| 728 | - * @since 5.0.0.p | |
| 729 | - */ | |
| 730 | - private static function getRequestType(array $activation_history, int $version_change, bool $is_activation): int | |
| 731 | -    { | |
| 732 | - // if no previous activation history exists, then this is a brand new install | |
| 733 | -        if (empty($activation_history)) { | |
| 734 | - return EE_System::req_type_new_activation; | |
| 735 | - } | |
| 736 | - // current version is higher than previous version, so it's an upgrade | |
| 737 | -        if ($version_change === 1) { | |
| 738 | - return EE_System::req_type_upgrade; | |
| 739 | - } | |
| 740 | - // current version is lower than previous version, so it's a downgrade | |
| 741 | -        if ($version_change === -1) { | |
| 742 | - return EE_System::req_type_downgrade; | |
| 743 | - } | |
| 744 | - // version hasn't changed since last version so check if the activation indicator is set | |
| 745 | - // to determine if it's a reactivation, or just a normal request | |
| 746 | - return $is_activation | |
| 747 | - ? EE_System::req_type_reactivation | |
| 748 | - : EE_System::req_type_normal; | |
| 749 | - } | |
| 750 | - | |
| 751 | - | |
| 752 | - /** | |
| 753 | - * Detects if the $version_to_upgrade_to is higher than the most recent version in | |
| 754 | - * the $activation_history_for_addon | |
| 755 | - * | |
| 756 | - * @param array $activation_history array where keys are versions, | |
| 757 | - * values are arrays of times activated (sometimes 'unknown-date') | |
| 758 | - * @param string $current_version | |
| 759 | - * @return int results of version_compare( $version_to_upgrade_to, $most_recently_active_version ). | |
| 760 | - * -1 if $version_to_upgrade_to is LOWER (downgrade); | |
| 761 | - * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); | |
| 762 | - * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; | |
| 763 | - */ | |
| 764 | - private static function compareVersionWithPrevious(array $activation_history, string $current_version): int | |
| 765 | -    { | |
| 766 | - // find the most recently-activated version | |
| 767 | - $most_recently_active_version = EE_System::getMostRecentlyActiveVersion($activation_history); | |
| 768 | - return version_compare($current_version, $most_recently_active_version); | |
| 769 | - } | |
| 770 | - | |
| 771 | - | |
| 772 | - /** | |
| 773 | - * Gets the most recently active version listed in the activation history, | |
| 774 | - * and if none are found (ie, it's a brand new install) returns '0.0.0.dev.000'. | |
| 775 | - * | |
| 776 | - * @param array|null $activation_history (keys are versions, values are arrays of times activated, | |
| 777 | - * sometimes containing 'unknown-date' | |
| 778 | - * @return string | |
| 779 | - */ | |
| 780 | - private static function getMostRecentlyActiveVersion(?array $activation_history): string | |
| 781 | -    { | |
| 782 | - $most_recent_activation_date = '1970-01-01 00:00:00'; | |
| 783 | - $most_recently_active_version = '0.0.0.dev.000'; | |
| 784 | -        if (is_array($activation_history)) { | |
| 785 | -            foreach ($activation_history as $version => $activation_dates) { | |
| 786 | - // check there is a record of when this version was activated. | |
| 787 | - // Otherwise, mark it as unknown | |
| 788 | -                if (! $activation_dates) { | |
| 789 | - $activation_dates = ['unknown-date']; | |
| 790 | - } | |
| 791 | - $activation_dates = is_string($activation_dates) | |
| 792 | - ? [$activation_dates] | |
| 793 | - : $activation_dates; | |
| 794 | -                foreach ($activation_dates as $activation_date) { | |
| 795 | -                    if ($activation_date !== 'unknown-date' && $activation_date > $most_recent_activation_date) { | |
| 796 | - $most_recently_active_version = $version; | |
| 797 | - $most_recent_activation_date = $activation_date; | |
| 798 | - } | |
| 799 | - } | |
| 800 | - } | |
| 801 | - } | |
| 802 | - return $most_recently_active_version; | |
| 803 | - } | |
| 804 | - | |
| 805 | - | |
| 806 | - /** | |
| 807 | - * This redirects to the about EE page after activation | |
| 808 | - * | |
| 809 | - * @return void | |
| 810 | - */ | |
| 811 | - public function redirect_to_about_ee() | |
| 812 | -    { | |
| 813 | - $notices = EE_Error::get_notices(false); | |
| 814 | - // if current user is an admin and it's not an ajax or rest request | |
| 815 | - if ( | |
| 816 | - ! isset($notices['errors']) | |
| 817 | - && $this->request->isAdmin() | |
| 818 | - && apply_filters( | |
| 819 | - 'FHEE__EE_System__redirect_to_about_ee__do_redirect', | |
| 820 | -                $this->capabilities->current_user_can('manage_options', 'espresso_about_default') | |
| 821 | - ) | |
| 822 | -        ) { | |
| 823 | - $query_params = ['page' => 'espresso_about']; | |
| 824 | -            if (EE_System::instance()->detect_req_type() === EE_System::req_type_new_activation) { | |
| 825 | - $query_params['new_activation'] = true; | |
| 826 | - } | |
| 827 | -            if (EE_System::instance()->detect_req_type() === EE_System::req_type_reactivation) { | |
| 828 | - $query_params['reactivation'] = true; | |
| 829 | - } | |
| 830 | -            $url = add_query_arg($query_params, admin_url('admin.php')); | |
| 831 | - EEH_URL::safeRedirectAndExit($url); | |
| 832 | - } | |
| 833 | - } | |
| 834 | - | |
| 835 | - | |
| 836 | - /** | |
| 837 | - * load_core_configuration | |
| 838 | - * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration' | |
| 839 | - * which runs during the WP 'plugins_loaded' action at priority 5 | |
| 840 | - * | |
| 841 | - * @return void | |
| 842 | - * @throws ReflectionException | |
| 843 | - * @throws Exception | |
| 844 | - */ | |
| 845 | - public function load_core_configuration() | |
| 846 | -    { | |
| 847 | -        do_action('AHEE__EE_System__load_core_configuration__begin', $this); | |
| 848 | -        $this->loader->getShared('EE_Load_Textdomain'); | |
| 849 | - // load textdomain | |
| 850 | - EE_Load_Textdomain::load_textdomain(); | |
| 851 | - /** @var EE_Config $config */ | |
| 852 | -        $config = $this->loader->getShared('EE_Config'); | |
| 853 | -        $this->loader->getShared('EE_Network_Config'); | |
| 854 | - // setup autoloaders | |
| 855 | - // enable logging? | |
| 856 | -        $this->loader->getShared('EventEspresso\core\services\orm\TrashLogger'); | |
| 857 | -        if ($config->admin->use_remote_logging) { | |
| 858 | -            $this->loader->getShared('EE_Log'); | |
| 859 | - } | |
| 860 | - // check for activation errors | |
| 861 | -        $activation_errors = get_option('ee_plugin_activation_errors', false); | |
| 862 | -        if ($activation_errors) { | |
| 863 | - EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); | |
| 864 | -            update_option('ee_plugin_activation_errors', false); | |
| 865 | - } | |
| 866 | - // get model names | |
| 867 | - $this->_parse_model_names(); | |
| 868 | - // configure custom post type definitions | |
| 869 | -        $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions'); | |
| 870 | -        $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'); | |
| 871 | -        do_action('AHEE__EE_System__load_core_configuration__complete', $this); | |
| 872 | - } | |
| 873 | - | |
| 874 | - | |
| 875 | - /** | |
| 876 | - * cycles through all of the models/*.model.php files, and assembles an array of model names | |
| 877 | - * | |
| 878 | - * @return void | |
| 879 | - * @throws ReflectionException | |
| 880 | - */ | |
| 881 | - private function _parse_model_names() | |
| 882 | -    { | |
| 883 | - // get all the files in the EE_MODELS folder that end in .model.php | |
| 884 | - $models = glob(EE_MODELS . '*.model.php'); | |
| 885 | - $model_names = []; | |
| 886 | - $non_abstract_db_models = []; | |
| 887 | -        foreach ($models as $model) { | |
| 888 | - // get model classname | |
| 889 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); | |
| 890 | -            $short_name      = str_replace('EEM_', '', $classname); | |
| 891 | - $reflectionClass = new ReflectionClass($classname); | |
| 892 | -            if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { | |
| 893 | - $non_abstract_db_models[ $short_name ] = $classname; | |
| 894 | - } | |
| 895 | - $model_names[ $short_name ] = $classname; | |
| 896 | - } | |
| 897 | -        $this->registry->models                 = apply_filters('FHEE__EE_System__parse_model_names', $model_names); | |
| 898 | - $this->registry->non_abstract_db_models = apply_filters( | |
| 899 | - 'FHEE__EE_System__parse_implemented_model_names', | |
| 900 | - $non_abstract_db_models | |
| 901 | - ); | |
| 902 | - } | |
| 903 | - | |
| 904 | - | |
| 905 | - /** | |
| 906 | - * @throws Exception | |
| 907 | - * @throws Throwable | |
| 908 | - * @since 4.9.71.p | |
| 909 | - */ | |
| 910 | - public function loadRouteMatchSpecifications() | |
| 911 | -    { | |
| 912 | -        try { | |
| 913 | -            $this->loader->getShared('EventEspresso\core\services\routing\RouteMatchSpecificationManager'); | |
| 914 | -            $this->loader->getShared('EventEspresso\core\services\routing\RouteCollection'); | |
| 915 | - $this->router->loadPrimaryRoutes(); | |
| 916 | -        } catch (Exception $exception) { | |
| 917 | - new ExceptionStackTraceDisplay($exception); | |
| 918 | - } | |
| 919 | -        do_action('AHEE__EE_System__loadRouteMatchSpecifications'); | |
| 920 | - } | |
| 921 | - | |
| 922 | - | |
| 923 | - /** | |
| 924 | - * loading CPT related classes earlier so that their definitions are available | |
| 925 | - * but not performing any actual registration with WP core until load_CPTs_and_session() is called | |
| 926 | - * | |
| 927 | - * @since 4.10.21.p | |
| 928 | - */ | |
| 929 | - public function loadCustomPostTypes() | |
| 930 | -    { | |
| 931 | - $this->register_custom_taxonomies = $this->loader->getShared( | |
| 932 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' | |
| 933 | - ); | |
| 934 | - $this->register_custom_post_types = $this->loader->getShared( | |
| 935 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' | |
| 936 | - ); | |
| 937 | - $this->register_custom_taxonomy_terms = $this->loader->getShared( | |
| 938 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms' | |
| 939 | - ); | |
| 940 | - // integrate WP_Query with the EE models | |
| 941 | -        $this->loader->getShared('EE_CPT_Strategy'); | |
| 942 | - // load legacy EE_Request_Handler in case add-ons still need it | |
| 943 | -        $this->loader->getShared('EE_Request_Handler'); | |
| 944 | - } | |
| 945 | - | |
| 946 | - | |
| 947 | - /** | |
| 948 | - * register_shortcodes_modules_and_widgets | |
| 949 | - * generate lists of shortcodes and modules, then verify paths and classes | |
| 950 | - * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' | |
| 951 | - * which runs during the WP 'plugins_loaded' action at priority 7 | |
| 952 | - * | |
| 953 | - * @access public | |
| 954 | - * @return void | |
| 955 | - * @throws Exception | |
| 956 | - * @throws Throwable | |
| 957 | - */ | |
| 958 | - public function register_shortcodes_modules_and_widgets() | |
| 959 | -    { | |
| 960 | - $this->router->registerShortcodesModulesAndWidgets(); | |
| 961 | -        do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); | |
| 962 | - // check for addons using old hook point | |
| 963 | -        if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { | |
| 964 | - $this->_incompatible_addon_error(); | |
| 965 | - } | |
| 966 | - } | |
| 967 | - | |
| 968 | - | |
| 969 | - /** | |
| 970 | - * _incompatible_addon_error | |
| 971 | - * | |
| 972 | - * @access public | |
| 973 | - * @return void | |
| 974 | - */ | |
| 975 | - private function _incompatible_addon_error() | |
| 976 | -    { | |
| 977 | - // get array of classes hooking into here | |
| 978 | - $class_names = WordPressHooks::getClassNamesForAllCallbacksOnHook( | |
| 979 | - 'AHEE__EE_System__register_shortcodes_modules_and_addons' | |
| 980 | - ); | |
| 981 | -        if (! empty($class_names)) { | |
| 982 | - $msg = esc_html__( | |
| 983 | - 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', | |
| 984 | - 'event_espresso' | |
| 985 | - ); | |
| 986 | - $msg .= '<ul>'; | |
| 987 | -            foreach ($class_names as $class_name) { | |
| 988 | - $msg .= '<li><b>Event Espresso - ' | |
| 989 | - . str_replace( | |
| 990 | - ['EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'], | |
| 991 | - '', | |
| 992 | - $class_name | |
| 993 | - ) . '</b></li>'; | |
| 994 | - } | |
| 995 | - $msg .= '</ul>'; | |
| 996 | - $msg .= esc_html__( | |
| 997 | - 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', | |
| 998 | - 'event_espresso' | |
| 999 | - ); | |
| 1000 | - // save list of incompatible addons to wp-options for later use | |
| 1001 | -            add_option('ee_incompatible_addons', $class_names, '', 'no'); | |
| 1002 | -            if (is_admin()) { | |
| 1003 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); | |
| 1004 | - } | |
| 1005 | - } | |
| 1006 | - } | |
| 1007 | - | |
| 1008 | - | |
| 1009 | - /** | |
| 1010 | - * brew_espresso | |
| 1011 | - * begins the process of setting hooks for initializing EE in the correct order | |
| 1012 | - * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point | |
| 1013 | - * which runs during the WP 'plugins_loaded' action at priority 9 | |
| 1014 | - * | |
| 1015 | - * @return void | |
| 1016 | - * @throws Exception | |
| 1017 | - * @throws Throwable | |
| 1018 | - */ | |
| 1019 | - public function brew_espresso() | |
| 1020 | -    { | |
| 1021 | -        do_action('AHEE__EE_System__brew_espresso__begin', $this); | |
| 1022 | - // load some final core systems | |
| 1023 | -        add_action('init', [$this, 'set_hooks_for_core'], 1); | |
| 1024 | -        add_action('init', [$this, 'perform_activations_upgrades_and_migrations'], 3); | |
| 1025 | -        add_action('init', [$this, 'load_CPTs_and_session'], 5); | |
| 1026 | -        add_action('init', [$this, 'load_controllers'], 7); | |
| 1027 | -        add_action('init', [$this, 'core_loaded_and_ready'], 9); | |
| 1028 | -        add_action('init', [$this, 'initialize'], 10); | |
| 1029 | -        add_action('init', [$this, 'initialize_last'], 100); | |
| 1030 | - $this->router->brewEspresso(); | |
| 1031 | -        $this->loader->getShared('EventEspresso\PaymentMethods\Manager'); | |
| 1032 | -        $this->loader->getShared('EE_Payment_Method_Manager'); | |
| 1033 | -        do_action('AHEE__EE_System__brew_espresso__complete', $this); | |
| 1034 | - } | |
| 1035 | - | |
| 1036 | - | |
| 1037 | - /** | |
| 1038 | - /** | |
| 1039 | - * set_hooks_for_core | |
| 1040 | - * | |
| 1041 | - * @access public | |
| 1042 | - * @return void | |
| 1043 | - * @throws EE_Error | |
| 1044 | - */ | |
| 1045 | - public function set_hooks_for_core() | |
| 1046 | -    { | |
| 1047 | - $this->_deactivate_incompatible_addons(); | |
| 1048 | -        do_action('AHEE__EE_System__set_hooks_for_core'); | |
| 1049 | -        $this->loader->getShared('EventEspresso\core\domain\values\session\SessionLifespan'); | |
| 1050 | - // caps need to be initialized on every request so that capability maps are set. | |
| 1051 | - // @see https://events.codebasehq.com/projects/event-espresso/tickets/8674 | |
| 1052 | - $this->capabilities->init_caps(); | |
| 1053 | - } | |
| 1054 | - | |
| 1055 | - | |
| 1056 | - /** | |
| 1057 | - * Using the information gathered in EE_System::_incompatible_addon_error, | |
| 1058 | - * deactivates any addons considered incompatible with the current version of EE | |
| 1059 | - */ | |
| 1060 | - private function _deactivate_incompatible_addons() | |
| 1061 | -    { | |
| 1062 | -        $incompatible_addons = get_option('ee_incompatible_addons', []); | |
| 1063 | -        if (! empty($incompatible_addons)) { | |
| 1064 | -            $active_plugins = get_option('active_plugins', []); | |
| 1065 | -            foreach ($active_plugins as $active_plugin) { | |
| 1066 | -                foreach ($incompatible_addons as $incompatible_addon) { | |
| 1067 | -                    if (strpos($active_plugin, $incompatible_addon) !== false) { | |
| 1068 | - $this->request->unSetRequestParams(['activate'], true); | |
| 1069 | - espresso_deactivate_plugin($active_plugin); | |
| 1070 | - } | |
| 1071 | - } | |
| 1072 | - } | |
| 1073 | - } | |
| 1074 | - } | |
| 1075 | - | |
| 1076 | - | |
| 1077 | - /** | |
| 1078 | - * perform_activations_upgrades_and_migrations | |
| 1079 | - * | |
| 1080 | - * @access public | |
| 1081 | - * @return void | |
| 1082 | - */ | |
| 1083 | - public function perform_activations_upgrades_and_migrations() | |
| 1084 | -    { | |
| 1085 | -        do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); | |
| 1086 | - } | |
| 1087 | - | |
| 1088 | - | |
| 1089 | - /** | |
| 1090 | - * @return void | |
| 1091 | - * @throws DomainException | |
| 1092 | - */ | |
| 1093 | - public function load_CPTs_and_session() | |
| 1094 | -    { | |
| 1095 | -        do_action('AHEE__EE_System__load_CPTs_and_session__start'); | |
| 1096 | - $this->register_custom_taxonomies->registerCustomTaxonomies(); | |
| 1097 | - $this->register_custom_post_types->registerCustomPostTypes(); | |
| 1098 | - $this->register_custom_taxonomy_terms->registerCustomTaxonomyTerms(); | |
| 1099 | -        do_action('AHEE__EE_System__load_CPTs_and_session__complete'); | |
| 1100 | - } | |
| 1101 | - | |
| 1102 | - | |
| 1103 | - /** | |
| 1104 | - * load_controllers | |
| 1105 | - * this is the best place to load any additional controllers that needs access to EE core. | |
| 1106 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this | |
| 1107 | - * time | |
| 1108 | - * | |
| 1109 | - * @access public | |
| 1110 | - * @return void | |
| 1111 | - * @throws Exception | |
| 1112 | - * @throws Throwable | |
| 1113 | - */ | |
| 1114 | - public function load_controllers() | |
| 1115 | -    { | |
| 1116 | -        do_action('AHEE__EE_System__load_controllers__start'); | |
| 1117 | - $this->router->loadControllers(); | |
| 1118 | -        do_action('AHEE__EE_System__load_controllers__complete'); | |
| 1119 | - } | |
| 1120 | - | |
| 1121 | - | |
| 1122 | - /** | |
| 1123 | - * core_loaded_and_ready | |
| 1124 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode | |
| 1125 | - * | |
| 1126 | - * @access public | |
| 1127 | - * @return void | |
| 1128 | - * @throws Exception | |
| 1129 | - * @throws Throwable | |
| 1130 | - */ | |
| 1131 | - public function core_loaded_and_ready() | |
| 1132 | -    { | |
| 1133 | - $this->router->coreLoadedAndReady(); | |
| 1134 | -        do_action('AHEE__EE_System__core_loaded_and_ready'); | |
| 1135 | - // always load template tags, because it's faster than checking if it's a front-end request, and many page | |
| 1136 | - // builders require these even on the front-end | |
| 1137 | - require_once EE_PUBLIC . 'template_tags.php'; | |
| 1138 | -        do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); | |
| 1139 | - } | |
| 1140 | - | |
| 1141 | - | |
| 1142 | - /** | |
| 1143 | - * initialize | |
| 1144 | - * this is the best place to begin initializing client code | |
| 1145 | - * | |
| 1146 | - * @access public | |
| 1147 | - * @return void | |
| 1148 | - */ | |
| 1149 | - public function initialize() | |
| 1150 | -    { | |
| 1151 | -        do_action('AHEE__EE_System__initialize'); | |
| 1152 | - add_filter( | |
| 1153 | - 'safe_style_css', | |
| 1154 | -            function ($styles) { | |
| 1155 | - $styles[] = 'display'; | |
| 1156 | - $styles[] = 'visibility'; | |
| 1157 | - $styles[] = 'position'; | |
| 1158 | - $styles[] = 'top'; | |
| 1159 | - $styles[] = 'right'; | |
| 1160 | - $styles[] = 'bottom'; | |
| 1161 | - $styles[] = 'left'; | |
| 1162 | - $styles[] = 'resize'; | |
| 1163 | - $styles[] = 'max-width'; | |
| 1164 | - $styles[] = 'max-height'; | |
| 1165 | - return $styles; | |
| 1166 | - } | |
| 1167 | - ); | |
| 1168 | - } | |
| 1169 | - | |
| 1170 | - | |
| 1171 | - /** | |
| 1172 | - * initialize_last | |
| 1173 | - * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to | |
| 1174 | - * initialize has done so | |
| 1175 | - * | |
| 1176 | - * @access public | |
| 1177 | - * @return void | |
| 1178 | - * @throws Exception | |
| 1179 | - * @throws Throwable | |
| 1180 | - */ | |
| 1181 | - public function initialize_last() | |
| 1182 | -    { | |
| 1183 | - $this->router->initializeLast(); | |
| 1184 | -        do_action('AHEE__EE_System__initialize_last'); | |
| 1185 | - /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ | |
| 1186 | - $rewrite_rules = $this->loader->getShared( | |
| 1187 | - 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' | |
| 1188 | - ); | |
| 1189 | - $rewrite_rules->flushRewriteRules(); | |
| 1190 | -        add_action('admin_bar_init', [$this, 'addEspressoToolbar']); | |
| 1191 | - } | |
| 1192 | - | |
| 1193 | - | |
| 1194 | - /** | |
| 1195 | - * @return void | |
| 1196 | - */ | |
| 1197 | - public function addEspressoToolbar() | |
| 1198 | -    { | |
| 1199 | - $this->loader->getShared( | |
| 1200 | - 'EventEspresso\core\domain\services\admin\AdminToolBar', | |
| 1201 | - [$this->capabilities] | |
| 1202 | - ); | |
| 1203 | - } | |
| 1204 | - | |
| 1205 | - | |
| 1206 | - /** | |
| 1207 | - * do_not_cache | |
| 1208 | - * sets no cache headers and defines no cache constants for WP plugins | |
| 1209 | - * | |
| 1210 | - * @access public | |
| 1211 | - * @return void | |
| 1212 | - */ | |
| 1213 | - public static function do_not_cache() | |
| 1214 | -    { | |
| 1215 | - // set no cache constants | |
| 1216 | -        if (! defined('DONOTCACHEPAGE')) { | |
| 1217 | -            define('DONOTCACHEPAGE', true); | |
| 1218 | - } | |
| 1219 | -        if (! defined('DONOTCACHCEOBJECT')) { | |
| 1220 | -            define('DONOTCACHCEOBJECT', true); | |
| 1221 | - } | |
| 1222 | -        if (! defined('DONOTCACHEDB')) { | |
| 1223 | -            define('DONOTCACHEDB', true); | |
| 1224 | - } | |
| 1225 | - // add no cache headers | |
| 1226 | -        add_action('send_headers', ['EE_System', 'nocache_headers'], 10); | |
| 1227 | - // plus a little extra for nginx and Google Chrome | |
| 1228 | -        add_filter('nocache_headers', ['EE_System', 'extra_nocache_headers'], 10, 1); | |
| 1229 | - // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process | |
| 1230 | -        remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); | |
| 1231 | - } | |
| 1232 | - | |
| 1233 | - | |
| 1234 | - /** | |
| 1235 | - * extra_nocache_headers | |
| 1236 | - * | |
| 1237 | - * @access public | |
| 1238 | - * @param $headers | |
| 1239 | - * @return array | |
| 1240 | - */ | |
| 1241 | - public static function extra_nocache_headers($headers): array | |
| 1242 | -    { | |
| 1243 | - // for NGINX | |
| 1244 | - $headers['X-Accel-Expires'] = 0; | |
| 1245 | - // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" | |
| 1246 | - $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; | |
| 1247 | - return $headers; | |
| 1248 | - } | |
| 1249 | - | |
| 1250 | - | |
| 1251 | - /** | |
| 1252 | - * nocache_headers | |
| 1253 | - * | |
| 1254 | - * @access public | |
| 1255 | - * @return void | |
| 1256 | - */ | |
| 1257 | - public static function nocache_headers() | |
| 1258 | -    { | |
| 1259 | - nocache_headers(); | |
| 1260 | - } | |
| 1261 | - | |
| 1262 | - | |
| 1263 | - /** | |
| 1264 | - * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are | |
| 1265 | - * never returned with the function. | |
| 1266 | - * | |
| 1267 | - * @param array $exclude_array any existing pages being excluded are in this array. | |
| 1268 | - * @return array | |
| 1269 | - */ | |
| 1270 | - public function remove_pages_from_wp_list_pages(array $exclude_array): array | |
| 1271 | -    { | |
| 1272 | - return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); | |
| 1273 | - } | |
| 1039 | + * set_hooks_for_core | |
| 1040 | + * | |
| 1041 | + * @access public | |
| 1042 | + * @return void | |
| 1043 | + * @throws EE_Error | |
| 1044 | + */ | |
| 1045 | + public function set_hooks_for_core() | |
| 1046 | +	{ | |
| 1047 | + $this->_deactivate_incompatible_addons(); | |
| 1048 | +		do_action('AHEE__EE_System__set_hooks_for_core'); | |
| 1049 | +		$this->loader->getShared('EventEspresso\core\domain\values\session\SessionLifespan'); | |
| 1050 | + // caps need to be initialized on every request so that capability maps are set. | |
| 1051 | + // @see https://events.codebasehq.com/projects/event-espresso/tickets/8674 | |
| 1052 | + $this->capabilities->init_caps(); | |
| 1053 | + } | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + /** | |
| 1057 | + * Using the information gathered in EE_System::_incompatible_addon_error, | |
| 1058 | + * deactivates any addons considered incompatible with the current version of EE | |
| 1059 | + */ | |
| 1060 | + private function _deactivate_incompatible_addons() | |
| 1061 | +	{ | |
| 1062 | +		$incompatible_addons = get_option('ee_incompatible_addons', []); | |
| 1063 | +		if (! empty($incompatible_addons)) { | |
| 1064 | +			$active_plugins = get_option('active_plugins', []); | |
| 1065 | +			foreach ($active_plugins as $active_plugin) { | |
| 1066 | +				foreach ($incompatible_addons as $incompatible_addon) { | |
| 1067 | +					if (strpos($active_plugin, $incompatible_addon) !== false) { | |
| 1068 | + $this->request->unSetRequestParams(['activate'], true); | |
| 1069 | + espresso_deactivate_plugin($active_plugin); | |
| 1070 | + } | |
| 1071 | + } | |
| 1072 | + } | |
| 1073 | + } | |
| 1074 | + } | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + /** | |
| 1078 | + * perform_activations_upgrades_and_migrations | |
| 1079 | + * | |
| 1080 | + * @access public | |
| 1081 | + * @return void | |
| 1082 | + */ | |
| 1083 | + public function perform_activations_upgrades_and_migrations() | |
| 1084 | +	{ | |
| 1085 | +		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); | |
| 1086 | + } | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + /** | |
| 1090 | + * @return void | |
| 1091 | + * @throws DomainException | |
| 1092 | + */ | |
| 1093 | + public function load_CPTs_and_session() | |
| 1094 | +	{ | |
| 1095 | +		do_action('AHEE__EE_System__load_CPTs_and_session__start'); | |
| 1096 | + $this->register_custom_taxonomies->registerCustomTaxonomies(); | |
| 1097 | + $this->register_custom_post_types->registerCustomPostTypes(); | |
| 1098 | + $this->register_custom_taxonomy_terms->registerCustomTaxonomyTerms(); | |
| 1099 | +		do_action('AHEE__EE_System__load_CPTs_and_session__complete'); | |
| 1100 | + } | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + /** | |
| 1104 | + * load_controllers | |
| 1105 | + * this is the best place to load any additional controllers that needs access to EE core. | |
| 1106 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this | |
| 1107 | + * time | |
| 1108 | + * | |
| 1109 | + * @access public | |
| 1110 | + * @return void | |
| 1111 | + * @throws Exception | |
| 1112 | + * @throws Throwable | |
| 1113 | + */ | |
| 1114 | + public function load_controllers() | |
| 1115 | +	{ | |
| 1116 | +		do_action('AHEE__EE_System__load_controllers__start'); | |
| 1117 | + $this->router->loadControllers(); | |
| 1118 | +		do_action('AHEE__EE_System__load_controllers__complete'); | |
| 1119 | + } | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + /** | |
| 1123 | + * core_loaded_and_ready | |
| 1124 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode | |
| 1125 | + * | |
| 1126 | + * @access public | |
| 1127 | + * @return void | |
| 1128 | + * @throws Exception | |
| 1129 | + * @throws Throwable | |
| 1130 | + */ | |
| 1131 | + public function core_loaded_and_ready() | |
| 1132 | +	{ | |
| 1133 | + $this->router->coreLoadedAndReady(); | |
| 1134 | +		do_action('AHEE__EE_System__core_loaded_and_ready'); | |
| 1135 | + // always load template tags, because it's faster than checking if it's a front-end request, and many page | |
| 1136 | + // builders require these even on the front-end | |
| 1137 | + require_once EE_PUBLIC . 'template_tags.php'; | |
| 1138 | +		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); | |
| 1139 | + } | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + /** | |
| 1143 | + * initialize | |
| 1144 | + * this is the best place to begin initializing client code | |
| 1145 | + * | |
| 1146 | + * @access public | |
| 1147 | + * @return void | |
| 1148 | + */ | |
| 1149 | + public function initialize() | |
| 1150 | +	{ | |
| 1151 | +		do_action('AHEE__EE_System__initialize'); | |
| 1152 | + add_filter( | |
| 1153 | + 'safe_style_css', | |
| 1154 | +			function ($styles) { | |
| 1155 | + $styles[] = 'display'; | |
| 1156 | + $styles[] = 'visibility'; | |
| 1157 | + $styles[] = 'position'; | |
| 1158 | + $styles[] = 'top'; | |
| 1159 | + $styles[] = 'right'; | |
| 1160 | + $styles[] = 'bottom'; | |
| 1161 | + $styles[] = 'left'; | |
| 1162 | + $styles[] = 'resize'; | |
| 1163 | + $styles[] = 'max-width'; | |
| 1164 | + $styles[] = 'max-height'; | |
| 1165 | + return $styles; | |
| 1166 | + } | |
| 1167 | + ); | |
| 1168 | + } | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + /** | |
| 1172 | + * initialize_last | |
| 1173 | + * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to | |
| 1174 | + * initialize has done so | |
| 1175 | + * | |
| 1176 | + * @access public | |
| 1177 | + * @return void | |
| 1178 | + * @throws Exception | |
| 1179 | + * @throws Throwable | |
| 1180 | + */ | |
| 1181 | + public function initialize_last() | |
| 1182 | +	{ | |
| 1183 | + $this->router->initializeLast(); | |
| 1184 | +		do_action('AHEE__EE_System__initialize_last'); | |
| 1185 | + /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ | |
| 1186 | + $rewrite_rules = $this->loader->getShared( | |
| 1187 | + 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' | |
| 1188 | + ); | |
| 1189 | + $rewrite_rules->flushRewriteRules(); | |
| 1190 | +		add_action('admin_bar_init', [$this, 'addEspressoToolbar']); | |
| 1191 | + } | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + /** | |
| 1195 | + * @return void | |
| 1196 | + */ | |
| 1197 | + public function addEspressoToolbar() | |
| 1198 | +	{ | |
| 1199 | + $this->loader->getShared( | |
| 1200 | + 'EventEspresso\core\domain\services\admin\AdminToolBar', | |
| 1201 | + [$this->capabilities] | |
| 1202 | + ); | |
| 1203 | + } | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + /** | |
| 1207 | + * do_not_cache | |
| 1208 | + * sets no cache headers and defines no cache constants for WP plugins | |
| 1209 | + * | |
| 1210 | + * @access public | |
| 1211 | + * @return void | |
| 1212 | + */ | |
| 1213 | + public static function do_not_cache() | |
| 1214 | +	{ | |
| 1215 | + // set no cache constants | |
| 1216 | +		if (! defined('DONOTCACHEPAGE')) { | |
| 1217 | +			define('DONOTCACHEPAGE', true); | |
| 1218 | + } | |
| 1219 | +		if (! defined('DONOTCACHCEOBJECT')) { | |
| 1220 | +			define('DONOTCACHCEOBJECT', true); | |
| 1221 | + } | |
| 1222 | +		if (! defined('DONOTCACHEDB')) { | |
| 1223 | +			define('DONOTCACHEDB', true); | |
| 1224 | + } | |
| 1225 | + // add no cache headers | |
| 1226 | +		add_action('send_headers', ['EE_System', 'nocache_headers'], 10); | |
| 1227 | + // plus a little extra for nginx and Google Chrome | |
| 1228 | +		add_filter('nocache_headers', ['EE_System', 'extra_nocache_headers'], 10, 1); | |
| 1229 | + // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process | |
| 1230 | +		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); | |
| 1231 | + } | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + /** | |
| 1235 | + * extra_nocache_headers | |
| 1236 | + * | |
| 1237 | + * @access public | |
| 1238 | + * @param $headers | |
| 1239 | + * @return array | |
| 1240 | + */ | |
| 1241 | + public static function extra_nocache_headers($headers): array | |
| 1242 | +	{ | |
| 1243 | + // for NGINX | |
| 1244 | + $headers['X-Accel-Expires'] = 0; | |
| 1245 | + // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" | |
| 1246 | + $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; | |
| 1247 | + return $headers; | |
| 1248 | + } | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + /** | |
| 1252 | + * nocache_headers | |
| 1253 | + * | |
| 1254 | + * @access public | |
| 1255 | + * @return void | |
| 1256 | + */ | |
| 1257 | + public static function nocache_headers() | |
| 1258 | +	{ | |
| 1259 | + nocache_headers(); | |
| 1260 | + } | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + /** | |
| 1264 | + * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are | |
| 1265 | + * never returned with the function. | |
| 1266 | + * | |
| 1267 | + * @param array $exclude_array any existing pages being excluded are in this array. | |
| 1268 | + * @return array | |
| 1269 | + */ | |
| 1270 | + public function remove_pages_from_wp_list_pages(array $exclude_array): array | |
| 1271 | +	{ | |
| 1272 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); | |
| 1273 | + } | |
| 1274 | 1274 | } | 
| @@ -132,7 +132,7 @@ discard block | ||
| 132 | 132 | ?FeatureFlags $feature = null | 
| 133 | 133 |      ): EE_System { | 
| 134 | 134 | // check if class object is instantiated | 
| 135 | -        if (! self::$_instance instanceof EE_System) { | |
| 135 | +        if ( ! self::$_instance instanceof EE_System) { | |
| 136 | 136 | self::$_instance = new self($loader, $maintenance_mode, $registry, $request, $router, $feature); | 
| 137 | 137 | } | 
| 138 | 138 | return self::$_instance; | 
| @@ -352,10 +352,10 @@ discard block | ||
| 352 | 352 | /** @var Domain $domain */ | 
| 353 | 353 | $domain = DomainFactory::getEventEspressoCoreDomain(); | 
| 354 | 354 |          if ($domain->isCaffeinated() && ! $brew instanceof EE_Brewing_Regular) { | 
| 355 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; | |
| 355 | + require_once EE_CAFF_PATH.'brewing_regular.php'; | |
| 356 | 356 | /** @var EE_Brewing_Regular $brew */ | 
| 357 | 357 | $brew = $this->loader->getShared(EE_Brewing_Regular::class); | 
| 358 | -            if (! $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING)) { | |
| 358 | +            if ( ! $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING)) { | |
| 359 | 359 | $brew->initializePUE(); | 
| 360 | 360 | } | 
| 361 | 361 | add_action( | 
| @@ -496,11 +496,11 @@ discard block | ||
| 496 | 496 | private function fix_espresso_db_upgrade_option($espresso_db_update = null): array | 
| 497 | 497 |      { | 
| 498 | 498 |          do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); | 
| 499 | -        if (! $espresso_db_update) { | |
| 499 | +        if ( ! $espresso_db_update) { | |
| 500 | 500 |              $espresso_db_update = get_option('espresso_db_update'); | 
| 501 | 501 | } | 
| 502 | 502 | // check that option is an array | 
| 503 | -        if (! is_array($espresso_db_update)) { | |
| 503 | +        if ( ! is_array($espresso_db_update)) { | |
| 504 | 504 | // if option is FALSE, then it never existed | 
| 505 | 505 |              if ($espresso_db_update === false) { | 
| 506 | 506 | // make $espresso_db_update an array and save option with autoload OFF | 
| @@ -520,10 +520,10 @@ discard block | ||
| 520 | 520 | // so it must be numerically-indexed, where values are versions installed... | 
| 521 | 521 | // fix it! | 
| 522 | 522 | $version_string = $should_be_array; | 
| 523 | - $corrected_db_update[ $version_string ] = ['unknown-date']; | |
| 523 | + $corrected_db_update[$version_string] = ['unknown-date']; | |
| 524 | 524 |                  } else { | 
| 525 | 525 | // ok it checks out | 
| 526 | - $corrected_db_update[ $should_be_version_string ] = $should_be_array; | |
| 526 | + $corrected_db_update[$should_be_version_string] = $should_be_array; | |
| 527 | 527 | } | 
| 528 | 528 | } | 
| 529 | 529 | $espresso_db_update = $corrected_db_update; | 
| @@ -555,7 +555,7 @@ discard block | ||
| 555 | 555 |      { | 
| 556 | 556 | $request_type = $this->detect_req_type(); | 
| 557 | 557 | // only initialize system if we're not in maintenance mode. | 
| 558 | -        if (! MaintenanceStatus::isFullSite()) { | |
| 558 | +        if ( ! MaintenanceStatus::isFullSite()) { | |
| 559 | 559 | /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ | 
| 560 | 560 | $rewrite_rules = $this->loader->getShared( | 
| 561 | 561 | 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' | 
| @@ -611,13 +611,13 @@ discard block | ||
| 611 | 611 | */ | 
| 612 | 612 | public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null): bool | 
| 613 | 613 |      { | 
| 614 | -        if (! $version_history) { | |
| 614 | +        if ( ! $version_history) { | |
| 615 | 615 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); | 
| 616 | 616 | } | 
| 617 | 617 |          if ($current_version_to_add === null) { | 
| 618 | 618 | $current_version_to_add = espresso_version(); | 
| 619 | 619 | } | 
| 620 | -        $version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time()); | |
| 620 | +        $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); | |
| 621 | 621 | // re-save | 
| 622 | 622 |          return update_option('espresso_db_update', $version_history); | 
| 623 | 623 | } | 
| @@ -785,7 +785,7 @@ discard block | ||
| 785 | 785 |              foreach ($activation_history as $version => $activation_dates) { | 
| 786 | 786 | // check there is a record of when this version was activated. | 
| 787 | 787 | // Otherwise, mark it as unknown | 
| 788 | -                if (! $activation_dates) { | |
| 788 | +                if ( ! $activation_dates) { | |
| 789 | 789 | $activation_dates = ['unknown-date']; | 
| 790 | 790 | } | 
| 791 | 791 | $activation_dates = is_string($activation_dates) | 
| @@ -881,7 +881,7 @@ discard block | ||
| 881 | 881 | private function _parse_model_names() | 
| 882 | 882 |      { | 
| 883 | 883 | // get all the files in the EE_MODELS folder that end in .model.php | 
| 884 | - $models = glob(EE_MODELS . '*.model.php'); | |
| 884 | + $models = glob(EE_MODELS.'*.model.php'); | |
| 885 | 885 | $model_names = []; | 
| 886 | 886 | $non_abstract_db_models = []; | 
| 887 | 887 |          foreach ($models as $model) { | 
| @@ -890,9 +890,9 @@ discard block | ||
| 890 | 890 |              $short_name      = str_replace('EEM_', '', $classname); | 
| 891 | 891 | $reflectionClass = new ReflectionClass($classname); | 
| 892 | 892 |              if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { | 
| 893 | - $non_abstract_db_models[ $short_name ] = $classname; | |
| 893 | + $non_abstract_db_models[$short_name] = $classname; | |
| 894 | 894 | } | 
| 895 | - $model_names[ $short_name ] = $classname; | |
| 895 | + $model_names[$short_name] = $classname; | |
| 896 | 896 | } | 
| 897 | 897 |          $this->registry->models                 = apply_filters('FHEE__EE_System__parse_model_names', $model_names); | 
| 898 | 898 | $this->registry->non_abstract_db_models = apply_filters( | 
| @@ -978,7 +978,7 @@ discard block | ||
| 978 | 978 | $class_names = WordPressHooks::getClassNamesForAllCallbacksOnHook( | 
| 979 | 979 | 'AHEE__EE_System__register_shortcodes_modules_and_addons' | 
| 980 | 980 | ); | 
| 981 | -        if (! empty($class_names)) { | |
| 981 | +        if ( ! empty($class_names)) { | |
| 982 | 982 | $msg = esc_html__( | 
| 983 | 983 | 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', | 
| 984 | 984 | 'event_espresso' | 
| @@ -990,7 +990,7 @@ discard block | ||
| 990 | 990 | ['EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'], | 
| 991 | 991 | '', | 
| 992 | 992 | $class_name | 
| 993 | - ) . '</b></li>'; | |
| 993 | + ).'</b></li>'; | |
| 994 | 994 | } | 
| 995 | 995 | $msg .= '</ul>'; | 
| 996 | 996 | $msg .= esc_html__( | 
| @@ -1060,7 +1060,7 @@ discard block | ||
| 1060 | 1060 | private function _deactivate_incompatible_addons() | 
| 1061 | 1061 |      { | 
| 1062 | 1062 |          $incompatible_addons = get_option('ee_incompatible_addons', []); | 
| 1063 | -        if (! empty($incompatible_addons)) { | |
| 1063 | +        if ( ! empty($incompatible_addons)) { | |
| 1064 | 1064 |              $active_plugins = get_option('active_plugins', []); | 
| 1065 | 1065 |              foreach ($active_plugins as $active_plugin) { | 
| 1066 | 1066 |                  foreach ($incompatible_addons as $incompatible_addon) { | 
| @@ -1134,7 +1134,7 @@ discard block | ||
| 1134 | 1134 |          do_action('AHEE__EE_System__core_loaded_and_ready'); | 
| 1135 | 1135 | // always load template tags, because it's faster than checking if it's a front-end request, and many page | 
| 1136 | 1136 | // builders require these even on the front-end | 
| 1137 | - require_once EE_PUBLIC . 'template_tags.php'; | |
| 1137 | + require_once EE_PUBLIC.'template_tags.php'; | |
| 1138 | 1138 |          do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); | 
| 1139 | 1139 | } | 
| 1140 | 1140 | |
| @@ -1151,7 +1151,7 @@ discard block | ||
| 1151 | 1151 |          do_action('AHEE__EE_System__initialize'); | 
| 1152 | 1152 | add_filter( | 
| 1153 | 1153 | 'safe_style_css', | 
| 1154 | -            function ($styles) { | |
| 1154 | +            function($styles) { | |
| 1155 | 1155 | $styles[] = 'display'; | 
| 1156 | 1156 | $styles[] = 'visibility'; | 
| 1157 | 1157 | $styles[] = 'position'; | 
| @@ -1213,13 +1213,13 @@ discard block | ||
| 1213 | 1213 | public static function do_not_cache() | 
| 1214 | 1214 |      { | 
| 1215 | 1215 | // set no cache constants | 
| 1216 | -        if (! defined('DONOTCACHEPAGE')) { | |
| 1216 | +        if ( ! defined('DONOTCACHEPAGE')) { | |
| 1217 | 1217 |              define('DONOTCACHEPAGE', true); | 
| 1218 | 1218 | } | 
| 1219 | -        if (! defined('DONOTCACHCEOBJECT')) { | |
| 1219 | +        if ( ! defined('DONOTCACHCEOBJECT')) { | |
| 1220 | 1220 |              define('DONOTCACHCEOBJECT', true); | 
| 1221 | 1221 | } | 
| 1222 | -        if (! defined('DONOTCACHEDB')) { | |
| 1222 | +        if ( ! defined('DONOTCACHEDB')) { | |
| 1223 | 1223 |              define('DONOTCACHEDB', true); | 
| 1224 | 1224 | } | 
| 1225 | 1225 | // add no cache headers | 
| @@ -20,235 +20,235 @@ | ||
| 20 | 20 | */ | 
| 21 | 21 | class EEM_Form_Section extends EEM_Base | 
| 22 | 22 |  { | 
| 23 | - public const APPLIES_TO_ALL = 'all'; | |
| 24 | - | |
| 25 | - public const APPLIES_TO_PRIMARY = 'primary'; | |
| 26 | - | |
| 27 | - public const APPLIES_TO_PURCHASER = 'purchaser'; | |
| 28 | - | |
| 29 | - public const APPLIES_TO_REGISTRANTS = 'registrants'; | |
| 30 | - | |
| 31 | - protected static ?EEM_Form_Section $_instance = null; | |
| 32 | - | |
| 33 | - private RequestInterface $request; | |
| 34 | - | |
| 35 | - private array $valid_applies_to_options; | |
| 36 | - | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * EEM_Form_Section constructor. | |
| 40 | - * | |
| 41 | - * @param FormStatus $form_status | |
| 42 | - * @param string|null $timezone | |
| 43 | - * @throws EE_Error | |
| 44 | - */ | |
| 45 | - protected function __construct(FormStatus $form_status, ?string $timezone = '') | |
| 46 | -    { | |
| 47 | - $this->valid_applies_to_options = apply_filters( | |
| 48 | - 'FHEE__EEM_Form_Section__valid_applies_to_options', | |
| 49 | - [ | |
| 50 | -                EEM_Form_Section::APPLIES_TO_ALL         => esc_html__('All Registrants', 'event_espresso'), | |
| 51 | -                EEM_Form_Section::APPLIES_TO_PRIMARY     => esc_html__('Primary Registrant Only', 'event_espresso'), | |
| 52 | -                EEM_Form_Section::APPLIES_TO_PURCHASER   => esc_html__('Purchasing Agent', 'event_espresso'), | |
| 53 | -                EEM_Form_Section::APPLIES_TO_REGISTRANTS => esc_html__('Additional Registrants', 'event_espresso'), | |
| 54 | - ] | |
| 55 | - ); | |
| 56 | - | |
| 57 | -        $this->singular_item = esc_html__('Form Section', 'event_espresso'); | |
| 58 | -        $this->plural_item   = esc_html__('Form Sections', 'event_espresso'); | |
| 59 | - | |
| 60 | - $this->_tables = [ | |
| 61 | -            'Form_Section' => new EE_Primary_Table('esp_form_section', 'FSC_UUID'), | |
| 62 | - ]; | |
| 63 | - $this->_fields = [ | |
| 64 | - 'Form_Section' => [ | |
| 65 | - 'FSC_UUID' => new EE_Primary_Key_String_Field( | |
| 66 | - 'FSC_UUID', | |
| 67 | -                    esc_html__('Form Section UUID (universally unique identifier)', 'event_espresso') | |
| 68 | - ), | |
| 69 | - 'FSC_appliesTo' => new EE_Enum_Text_Field( | |
| 70 | - 'FSC_appliesTo', | |
| 71 | - esc_html( | |
| 72 | - sprintf( | |
| 73 | - /* translators: 1 class name */ | |
| 74 | - __( | |
| 75 | - 'Form user type that this form section should be presented to. Values correspond to the %s constants.', | |
| 76 | - 'event_espresso' | |
| 77 | - ), | |
| 78 | - 'EEM_Form_Section::APPLIES_TO_*' | |
| 79 | - ) | |
| 80 | - ), | |
| 81 | - false, | |
| 82 | - EEM_Form_Section::APPLIES_TO_ALL, | |
| 83 | - $this->valid_applies_to_options | |
| 84 | - ), | |
| 85 | - 'FSC_attributes' => new EE_JSON_Field( | |
| 86 | - 'FSC_attributes', | |
| 87 | - esc_html__( | |
| 88 | - 'JSON string of HTML attributes, such as class, to be applied to this form section\'s container.', | |
| 89 | - 'event_espresso' | |
| 90 | - ), | |
| 91 | - false, | |
| 92 | -                    '{}' | |
| 93 | - ), | |
| 94 | - 'FSC_belongsTo' => new EE_Plain_Text_Field( | |
| 95 | - 'FSC_belongsTo', | |
| 96 | -                    esc_html__('UUID of parent form section that this one belongs to.', 'event_espresso'), | |
| 97 | - false, | |
| 98 | - '' | |
| 99 | - ), | |
| 100 | - 'FSC_label' => new EE_JSON_Field( | |
| 101 | - 'FSC_label', | |
| 102 | - esc_html__( | |
| 103 | - 'JSON string of properties pertaining to a form section\'s label.', | |
| 104 | - 'event_espresso' | |
| 105 | - ), | |
| 106 | - false, | |
| 107 | -                    '{}' | |
| 108 | - ), | |
| 109 | - 'FSC_order' => new EE_Integer_Field( | |
| 110 | - 'FSC_order', | |
| 111 | -                    esc_html__('Order in which form section appears in a form.', 'event_espresso'), | |
| 112 | - false, | |
| 113 | - 0 | |
| 114 | - ), | |
| 115 | - 'FSC_status' => new EE_Enum_Text_Field( | |
| 116 | - 'FSC_status', | |
| 117 | - esc_html( | |
| 118 | - sprintf( | |
| 119 | - /* translators: 1 class name */ | |
| 120 | - __( | |
| 121 | - 'Whether form section is active, archived, shared, trashed, or used as a default on new forms. Values correspond to the %1$s class constants.', | |
| 122 | - 'event_espresso' | |
| 123 | - ), | |
| 124 | - 'EventEspresso\core\services\form\meta\FormStatus' | |
| 125 | - ) | |
| 126 | - ), | |
| 127 | - false, | |
| 128 | - FormStatus::ACTIVE, | |
| 129 | - $form_status->validStatusOptions() | |
| 130 | - ), | |
| 131 | - 'FSC_wpUser' => new EE_WP_User_Field( | |
| 132 | - 'FSC_wpUser', | |
| 133 | -                    esc_html__('ID of the WP User that created this form section.', 'event_espresso'), | |
| 134 | - false | |
| 135 | - ), | |
| 136 | - ], | |
| 137 | - ]; | |
| 138 | - $this->_model_relations = [ | |
| 139 | - 'Form_Element' => new EE_Has_Many_Relation(), | |
| 140 | - 'Form_Submission' => new EE_Has_Many_Relation(), | |
| 141 | - 'WP_User' => new EE_Belongs_To_Relation(), | |
| 142 | - ]; | |
| 143 | - // this model is generally available for reading | |
| 144 | - $restrictions = []; | |
| 145 | - $restrictions[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); | |
| 146 | -        $restrictions[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('FSC_applies_to'); | |
| 147 | -        $restrictions[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Reg_Form('FSC_applies_to'); | |
| 148 | -        $restrictions[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Reg_Form('FSC_applies_to'); | |
| 149 | - $this->_cap_restriction_generators = $restrictions; | |
| 150 | - parent::__construct($timezone); | |
| 151 | -        $this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface'); | |
| 152 | - } | |
| 153 | - | |
| 154 | - | |
| 155 | - /** | |
| 156 | - * @param array $query_params | |
| 157 | - * @return array | |
| 158 | - */ | |
| 159 | - private function addDefaultWhereConditions(array $query_params): array | |
| 160 | -    { | |
| 161 | - // might need to add a way to identify GQL requests for admin domains | |
| 162 | - $admin_request = $this->request->isAdmin() || $this->request->isAdminAjax(); | |
| 163 | - $query_params['default_where_conditions'] = $admin_request | |
| 164 | - ? EE_Default_Where_Conditions::NONE | |
| 165 | - : EE_Default_Where_Conditions::ALL; | |
| 166 | - return $query_params; | |
| 167 | - } | |
| 168 | - | |
| 169 | - | |
| 170 | - /** | |
| 171 | - * form sections should always be sorted in ascending order via the FSC_order field | |
| 172 | - * | |
| 173 | - * @param array $query_params | |
| 174 | - * @return array | |
| 175 | - */ | |
| 176 | - private function addOrderByQueryParams(array $query_params): array | |
| 177 | -    { | |
| 178 | - $query_params['order_by'] = ['FSC_order' => 'ASC']; | |
| 179 | - return $query_params; | |
| 180 | - } | |
| 181 | - | |
| 182 | - | |
| 183 | - /** | |
| 184 | - * returns an array of Form Sections that should be added by default to new Events | |
| 185 | - * | |
| 186 | - * @return EE_Form_Section[] | |
| 187 | - * @throws EE_Error | |
| 188 | - */ | |
| 189 | - public function getDefaultFormSections(): array | |
| 190 | -    { | |
| 191 | - return $this->getFormSections(['FSC_status' => FormStatus::DEFAULT]); | |
| 192 | - } | |
| 193 | - | |
| 194 | - | |
| 195 | - /** | |
| 196 | - * returns an array of Form Sections for the specified parent Form Section | |
| 197 | - * | |
| 198 | - * @param string $FSC_UUID | |
| 199 | - * @return EE_Form_Section[] | |
| 200 | - * @throws EE_Error | |
| 201 | - */ | |
| 202 | - public function getChildFormSections(string $FSC_UUID): array | |
| 203 | -    { | |
| 204 | - return $this->getFormSections(['FSC_belongsTo' => $FSC_UUID]); | |
| 205 | - } | |
| 206 | - | |
| 207 | - | |
| 208 | - /** | |
| 209 | - * @return EE_Form_Section[] | |
| 210 | - * @throws EE_Error | |
| 211 | - */ | |
| 212 | - public function getFormSections(array $where_params): array | |
| 213 | -    { | |
| 214 | - $query_params = $this->addDefaultWhereConditions([$where_params]); | |
| 215 | - $query_params = $this->addOrderByQueryParams($query_params); | |
| 216 | - return $this->get_all($query_params); | |
| 217 | - } | |
| 218 | - | |
| 219 | - | |
| 220 | - /** | |
| 221 | - * returns an array of Form Sections for the specified Event | |
| 222 | - * | |
| 223 | - * @param EE_Event $event | |
| 224 | - * @return EE_Form_Section[] | |
| 225 | - * @throws EE_Error | |
| 226 | - * @throws ReflectionException | |
| 227 | - */ | |
| 228 | - public function getFormSectionsForEvent(EE_Event $event): array | |
| 229 | -    { | |
| 230 | - $FSC_UUID = $event->registrationFormUuid(); | |
| 231 | - return ! empty($FSC_UUID) | |
| 232 | - ? $this->getFormSections( | |
| 233 | - [ | |
| 234 | - 'OR' => [ | |
| 235 | - 'FSC_UUID' => $FSC_UUID, // top level form | |
| 236 | - 'FSC_belongsTo' => $FSC_UUID, // child form sections | |
| 237 | - ], | |
| 238 | - ] | |
| 239 | - ) | |
| 240 | - : []; | |
| 241 | - } | |
| 242 | - | |
| 243 | - | |
| 244 | - /** | |
| 245 | - * @param bool $constants_only | |
| 246 | - * @return array | |
| 247 | - */ | |
| 248 | - public function validAppliesToOptions(bool $constants_only = false): array | |
| 249 | -    { | |
| 250 | - return $constants_only | |
| 251 | - ? array_keys($this->valid_applies_to_options) | |
| 252 | - : $this->valid_applies_to_options; | |
| 253 | - } | |
| 23 | + public const APPLIES_TO_ALL = 'all'; | |
| 24 | + | |
| 25 | + public const APPLIES_TO_PRIMARY = 'primary'; | |
| 26 | + | |
| 27 | + public const APPLIES_TO_PURCHASER = 'purchaser'; | |
| 28 | + | |
| 29 | + public const APPLIES_TO_REGISTRANTS = 'registrants'; | |
| 30 | + | |
| 31 | + protected static ?EEM_Form_Section $_instance = null; | |
| 32 | + | |
| 33 | + private RequestInterface $request; | |
| 34 | + | |
| 35 | + private array $valid_applies_to_options; | |
| 36 | + | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * EEM_Form_Section constructor. | |
| 40 | + * | |
| 41 | + * @param FormStatus $form_status | |
| 42 | + * @param string|null $timezone | |
| 43 | + * @throws EE_Error | |
| 44 | + */ | |
| 45 | + protected function __construct(FormStatus $form_status, ?string $timezone = '') | |
| 46 | +	{ | |
| 47 | + $this->valid_applies_to_options = apply_filters( | |
| 48 | + 'FHEE__EEM_Form_Section__valid_applies_to_options', | |
| 49 | + [ | |
| 50 | +				EEM_Form_Section::APPLIES_TO_ALL         => esc_html__('All Registrants', 'event_espresso'), | |
| 51 | +				EEM_Form_Section::APPLIES_TO_PRIMARY     => esc_html__('Primary Registrant Only', 'event_espresso'), | |
| 52 | +				EEM_Form_Section::APPLIES_TO_PURCHASER   => esc_html__('Purchasing Agent', 'event_espresso'), | |
| 53 | +				EEM_Form_Section::APPLIES_TO_REGISTRANTS => esc_html__('Additional Registrants', 'event_espresso'), | |
| 54 | + ] | |
| 55 | + ); | |
| 56 | + | |
| 57 | +		$this->singular_item = esc_html__('Form Section', 'event_espresso'); | |
| 58 | +		$this->plural_item   = esc_html__('Form Sections', 'event_espresso'); | |
| 59 | + | |
| 60 | + $this->_tables = [ | |
| 61 | +			'Form_Section' => new EE_Primary_Table('esp_form_section', 'FSC_UUID'), | |
| 62 | + ]; | |
| 63 | + $this->_fields = [ | |
| 64 | + 'Form_Section' => [ | |
| 65 | + 'FSC_UUID' => new EE_Primary_Key_String_Field( | |
| 66 | + 'FSC_UUID', | |
| 67 | +					esc_html__('Form Section UUID (universally unique identifier)', 'event_espresso') | |
| 68 | + ), | |
| 69 | + 'FSC_appliesTo' => new EE_Enum_Text_Field( | |
| 70 | + 'FSC_appliesTo', | |
| 71 | + esc_html( | |
| 72 | + sprintf( | |
| 73 | + /* translators: 1 class name */ | |
| 74 | + __( | |
| 75 | + 'Form user type that this form section should be presented to. Values correspond to the %s constants.', | |
| 76 | + 'event_espresso' | |
| 77 | + ), | |
| 78 | + 'EEM_Form_Section::APPLIES_TO_*' | |
| 79 | + ) | |
| 80 | + ), | |
| 81 | + false, | |
| 82 | + EEM_Form_Section::APPLIES_TO_ALL, | |
| 83 | + $this->valid_applies_to_options | |
| 84 | + ), | |
| 85 | + 'FSC_attributes' => new EE_JSON_Field( | |
| 86 | + 'FSC_attributes', | |
| 87 | + esc_html__( | |
| 88 | + 'JSON string of HTML attributes, such as class, to be applied to this form section\'s container.', | |
| 89 | + 'event_espresso' | |
| 90 | + ), | |
| 91 | + false, | |
| 92 | +					'{}' | |
| 93 | + ), | |
| 94 | + 'FSC_belongsTo' => new EE_Plain_Text_Field( | |
| 95 | + 'FSC_belongsTo', | |
| 96 | +					esc_html__('UUID of parent form section that this one belongs to.', 'event_espresso'), | |
| 97 | + false, | |
| 98 | + '' | |
| 99 | + ), | |
| 100 | + 'FSC_label' => new EE_JSON_Field( | |
| 101 | + 'FSC_label', | |
| 102 | + esc_html__( | |
| 103 | + 'JSON string of properties pertaining to a form section\'s label.', | |
| 104 | + 'event_espresso' | |
| 105 | + ), | |
| 106 | + false, | |
| 107 | +					'{}' | |
| 108 | + ), | |
| 109 | + 'FSC_order' => new EE_Integer_Field( | |
| 110 | + 'FSC_order', | |
| 111 | +					esc_html__('Order in which form section appears in a form.', 'event_espresso'), | |
| 112 | + false, | |
| 113 | + 0 | |
| 114 | + ), | |
| 115 | + 'FSC_status' => new EE_Enum_Text_Field( | |
| 116 | + 'FSC_status', | |
| 117 | + esc_html( | |
| 118 | + sprintf( | |
| 119 | + /* translators: 1 class name */ | |
| 120 | + __( | |
| 121 | + 'Whether form section is active, archived, shared, trashed, or used as a default on new forms. Values correspond to the %1$s class constants.', | |
| 122 | + 'event_espresso' | |
| 123 | + ), | |
| 124 | + 'EventEspresso\core\services\form\meta\FormStatus' | |
| 125 | + ) | |
| 126 | + ), | |
| 127 | + false, | |
| 128 | + FormStatus::ACTIVE, | |
| 129 | + $form_status->validStatusOptions() | |
| 130 | + ), | |
| 131 | + 'FSC_wpUser' => new EE_WP_User_Field( | |
| 132 | + 'FSC_wpUser', | |
| 133 | +					esc_html__('ID of the WP User that created this form section.', 'event_espresso'), | |
| 134 | + false | |
| 135 | + ), | |
| 136 | + ], | |
| 137 | + ]; | |
| 138 | + $this->_model_relations = [ | |
| 139 | + 'Form_Element' => new EE_Has_Many_Relation(), | |
| 140 | + 'Form_Submission' => new EE_Has_Many_Relation(), | |
| 141 | + 'WP_User' => new EE_Belongs_To_Relation(), | |
| 142 | + ]; | |
| 143 | + // this model is generally available for reading | |
| 144 | + $restrictions = []; | |
| 145 | + $restrictions[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); | |
| 146 | +		$restrictions[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('FSC_applies_to'); | |
| 147 | +		$restrictions[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Reg_Form('FSC_applies_to'); | |
| 148 | +		$restrictions[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Reg_Form('FSC_applies_to'); | |
| 149 | + $this->_cap_restriction_generators = $restrictions; | |
| 150 | + parent::__construct($timezone); | |
| 151 | +		$this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface'); | |
| 152 | + } | |
| 153 | + | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * @param array $query_params | |
| 157 | + * @return array | |
| 158 | + */ | |
| 159 | + private function addDefaultWhereConditions(array $query_params): array | |
| 160 | +	{ | |
| 161 | + // might need to add a way to identify GQL requests for admin domains | |
| 162 | + $admin_request = $this->request->isAdmin() || $this->request->isAdminAjax(); | |
| 163 | + $query_params['default_where_conditions'] = $admin_request | |
| 164 | + ? EE_Default_Where_Conditions::NONE | |
| 165 | + : EE_Default_Where_Conditions::ALL; | |
| 166 | + return $query_params; | |
| 167 | + } | |
| 168 | + | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * form sections should always be sorted in ascending order via the FSC_order field | |
| 172 | + * | |
| 173 | + * @param array $query_params | |
| 174 | + * @return array | |
| 175 | + */ | |
| 176 | + private function addOrderByQueryParams(array $query_params): array | |
| 177 | +	{ | |
| 178 | + $query_params['order_by'] = ['FSC_order' => 'ASC']; | |
| 179 | + return $query_params; | |
| 180 | + } | |
| 181 | + | |
| 182 | + | |
| 183 | + /** | |
| 184 | + * returns an array of Form Sections that should be added by default to new Events | |
| 185 | + * | |
| 186 | + * @return EE_Form_Section[] | |
| 187 | + * @throws EE_Error | |
| 188 | + */ | |
| 189 | + public function getDefaultFormSections(): array | |
| 190 | +	{ | |
| 191 | + return $this->getFormSections(['FSC_status' => FormStatus::DEFAULT]); | |
| 192 | + } | |
| 193 | + | |
| 194 | + | |
| 195 | + /** | |
| 196 | + * returns an array of Form Sections for the specified parent Form Section | |
| 197 | + * | |
| 198 | + * @param string $FSC_UUID | |
| 199 | + * @return EE_Form_Section[] | |
| 200 | + * @throws EE_Error | |
| 201 | + */ | |
| 202 | + public function getChildFormSections(string $FSC_UUID): array | |
| 203 | +	{ | |
| 204 | + return $this->getFormSections(['FSC_belongsTo' => $FSC_UUID]); | |
| 205 | + } | |
| 206 | + | |
| 207 | + | |
| 208 | + /** | |
| 209 | + * @return EE_Form_Section[] | |
| 210 | + * @throws EE_Error | |
| 211 | + */ | |
| 212 | + public function getFormSections(array $where_params): array | |
| 213 | +	{ | |
| 214 | + $query_params = $this->addDefaultWhereConditions([$where_params]); | |
| 215 | + $query_params = $this->addOrderByQueryParams($query_params); | |
| 216 | + return $this->get_all($query_params); | |
| 217 | + } | |
| 218 | + | |
| 219 | + | |
| 220 | + /** | |
| 221 | + * returns an array of Form Sections for the specified Event | |
| 222 | + * | |
| 223 | + * @param EE_Event $event | |
| 224 | + * @return EE_Form_Section[] | |
| 225 | + * @throws EE_Error | |
| 226 | + * @throws ReflectionException | |
| 227 | + */ | |
| 228 | + public function getFormSectionsForEvent(EE_Event $event): array | |
| 229 | +	{ | |
| 230 | + $FSC_UUID = $event->registrationFormUuid(); | |
| 231 | + return ! empty($FSC_UUID) | |
| 232 | + ? $this->getFormSections( | |
| 233 | + [ | |
| 234 | + 'OR' => [ | |
| 235 | + 'FSC_UUID' => $FSC_UUID, // top level form | |
| 236 | + 'FSC_belongsTo' => $FSC_UUID, // child form sections | |
| 237 | + ], | |
| 238 | + ] | |
| 239 | + ) | |
| 240 | + : []; | |
| 241 | + } | |
| 242 | + | |
| 243 | + | |
| 244 | + /** | |
| 245 | + * @param bool $constants_only | |
| 246 | + * @return array | |
| 247 | + */ | |
| 248 | + public function validAppliesToOptions(bool $constants_only = false): array | |
| 249 | +	{ | |
| 250 | + return $constants_only | |
| 251 | + ? array_keys($this->valid_applies_to_options) | |
| 252 | + : $this->valid_applies_to_options; | |
| 253 | + } | |
| 254 | 254 | } | 
| @@ -9,49 +9,49 @@ | ||
| 9 | 9 | */ | 
| 10 | 10 | class EEM_Currency_Payment_Method extends EEM_Base | 
| 11 | 11 |  { | 
| 12 | - protected static ?EEM_Currency_Payment_Method $_instance = null; | |
| 12 | + protected static ?EEM_Currency_Payment_Method $_instance = null; | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | - /** | |
| 16 | - * @param string|null $timezone | |
| 17 | - * @throws EE_Error | |
| 18 | - */ | |
| 19 | - protected function __construct(?string $timezone = '') | |
| 20 | -    { | |
| 21 | -        $this->singular_item    = esc_html__('Currency Usable by Payment Method', 'event_espresso'); | |
| 22 | -        $this->plural_item      = esc_html__('Currencies Usable by Payment Methods', 'event_espresso'); | |
| 23 | - $this->_tables = [ | |
| 24 | -            'Currency_Payment_Method' => new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID'), | |
| 25 | - ]; | |
| 26 | - $this->_fields = [ | |
| 27 | - 'Currency_Payment_Method' => [ | |
| 28 | - 'CPM_ID' => new EE_Primary_Key_Int_Field( | |
| 29 | - 'CPM_ID', | |
| 30 | -                    esc_html__('Currency to Payment Method LInk ID', 'event_espresso') | |
| 31 | - ), | |
| 32 | - 'CUR_code' => new EE_Foreign_Key_String_Field( | |
| 33 | - 'CUR_code', | |
| 34 | -                    esc_html__('Currency Code', 'event_espresso'), | |
| 35 | - false, | |
| 36 | - '', | |
| 37 | - 'Currency' | |
| 38 | - ), | |
| 39 | - 'PMD_ID' => new EE_Foreign_Key_Int_Field( | |
| 40 | - 'PMD_ID', | |
| 41 | -                    esc_html__('Payment Method ID', 'event_espresso'), | |
| 42 | - false, | |
| 43 | - 0, | |
| 44 | - 'Payment_Method' | |
| 45 | - ), | |
| 46 | - ], | |
| 47 | - ]; | |
| 48 | - $this->_model_relations = [ | |
| 49 | - 'Currency' => new EE_Belongs_To_Relation(), | |
| 50 | - 'Payment_Method' => new EE_Belongs_To_Relation(), | |
| 51 | - ]; | |
| 52 | - // this model is generally available for reading | |
| 53 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); | |
| 54 | - $this->_caps_slug = 'payment_methods'; | |
| 55 | - parent::__construct($timezone); | |
| 56 | - } | |
| 15 | + /** | |
| 16 | + * @param string|null $timezone | |
| 17 | + * @throws EE_Error | |
| 18 | + */ | |
| 19 | + protected function __construct(?string $timezone = '') | |
| 20 | +	{ | |
| 21 | +		$this->singular_item    = esc_html__('Currency Usable by Payment Method', 'event_espresso'); | |
| 22 | +		$this->plural_item      = esc_html__('Currencies Usable by Payment Methods', 'event_espresso'); | |
| 23 | + $this->_tables = [ | |
| 24 | +			'Currency_Payment_Method' => new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID'), | |
| 25 | + ]; | |
| 26 | + $this->_fields = [ | |
| 27 | + 'Currency_Payment_Method' => [ | |
| 28 | + 'CPM_ID' => new EE_Primary_Key_Int_Field( | |
| 29 | + 'CPM_ID', | |
| 30 | +					esc_html__('Currency to Payment Method LInk ID', 'event_espresso') | |
| 31 | + ), | |
| 32 | + 'CUR_code' => new EE_Foreign_Key_String_Field( | |
| 33 | + 'CUR_code', | |
| 34 | +					esc_html__('Currency Code', 'event_espresso'), | |
| 35 | + false, | |
| 36 | + '', | |
| 37 | + 'Currency' | |
| 38 | + ), | |
| 39 | + 'PMD_ID' => new EE_Foreign_Key_Int_Field( | |
| 40 | + 'PMD_ID', | |
| 41 | +					esc_html__('Payment Method ID', 'event_espresso'), | |
| 42 | + false, | |
| 43 | + 0, | |
| 44 | + 'Payment_Method' | |
| 45 | + ), | |
| 46 | + ], | |
| 47 | + ]; | |
| 48 | + $this->_model_relations = [ | |
| 49 | + 'Currency' => new EE_Belongs_To_Relation(), | |
| 50 | + 'Payment_Method' => new EE_Belongs_To_Relation(), | |
| 51 | + ]; | |
| 52 | + // this model is generally available for reading | |
| 53 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); | |
| 54 | + $this->_caps_slug = 'payment_methods'; | |
| 55 | + parent::__construct($timezone); | |
| 56 | + } | |
| 57 | 57 | } | 
| @@ -27,228 +27,228 @@ | ||
| 27 | 27 | */ | 
| 28 | 28 | class EEM_Form_Element extends EEM_Base | 
| 29 | 29 |  { | 
| 30 | - protected static ?EEM_Form_Element $_instance = null; | |
| 31 | - | |
| 32 | - private RequestInterface $request; | |
| 33 | - | |
| 34 | - private InputTypes $input_types; | |
| 35 | - | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * EEM_Form_Element constructor. | |
| 39 | - * | |
| 40 | - * @param FormStatus $form_status | |
| 41 | - * @param InputTypes $input_types | |
| 42 | - * @param string|null $timezone | |
| 43 | - * @throws EE_Error | |
| 44 | - */ | |
| 45 | - protected function __construct(FormStatus $form_status, InputTypes $input_types, ?string $timezone = '') | |
| 46 | -    { | |
| 47 | - $this->input_types = $input_types; | |
| 48 | -        $this->singular_item = esc_html__('Form Element', 'event_espresso'); | |
| 49 | -        $this->plural_item   = esc_html__('Form Elements', 'event_espresso'); | |
| 50 | - | |
| 51 | - $this->_tables = [ | |
| 52 | -            'Form_Element' => new EE_Primary_Table('esp_form_element', 'FIN_UUID'), | |
| 53 | - ]; | |
| 54 | - $this->_fields = [ | |
| 55 | - 'Form_Element' => [ | |
| 56 | - 'FIN_UUID' => new EE_Primary_Key_String_Field( | |
| 57 | - 'FIN_UUID', | |
| 58 | -                    esc_html__('Form Element UUID (universally unique identifier)', 'event_espresso') | |
| 59 | - ), | |
| 60 | - 'FSC_UUID' => new EE_Foreign_Key_String_Field( | |
| 61 | - 'FSC_UUID', | |
| 62 | -                    esc_html__('UUID of parent form section this form input belongs to.', 'event_espresso'), | |
| 63 | - false, | |
| 64 | - null, | |
| 65 | - ['Form_Section'], | |
| 66 | - false | |
| 67 | - ), | |
| 68 | - 'FIN_adminOnly' => new EE_Boolean_Field( | |
| 69 | - 'FIN_adminOnly', | |
| 70 | - esc_html__( | |
| 71 | - 'Whether or not input is only displayed in the admin. If false, input will appear in public forms', | |
| 72 | - 'event_espresso' | |
| 73 | - ), | |
| 74 | - false, | |
| 75 | - false | |
| 76 | - ), | |
| 77 | - 'FIN_attributes' => new EE_JSON_Field( | |
| 78 | - 'FIN_attributes', | |
| 79 | - esc_html__( | |
| 80 | - 'JSON string of HTML attributes such as class, max, min, placeholder, type, etc.', | |
| 81 | - 'event_espresso' | |
| 82 | - ), | |
| 83 | - true, | |
| 84 | -                    '{}' | |
| 85 | - ), | |
| 86 | - 'FIN_helpText' => new EE_JSON_Field( | |
| 87 | - 'FIN_helpText', | |
| 88 | - esc_html__( | |
| 89 | - 'JSON string of properties pertaining to any help text required for an input.', | |
| 90 | - 'event_espresso' | |
| 91 | - ), | |
| 92 | - true, | |
| 93 | -                    '{}' | |
| 94 | - ), | |
| 95 | - 'FIN_label' => new EE_JSON_Field( | |
| 96 | - 'FIN_label', | |
| 97 | - esc_html__( | |
| 98 | - 'JSON string of properties pertaining to an element\'s label.', | |
| 99 | - 'event_espresso' | |
| 100 | - ), | |
| 101 | - true, | |
| 102 | -                    '{}' | |
| 103 | - ), | |
| 104 | - 'FIN_mapsTo' => new EE_Plain_Text_Field( | |
| 105 | - 'FIN_mapsTo', | |
| 106 | - esc_html__( | |
| 107 | - 'Model and Fields name that this element maps to; ex: Attendee.email', | |
| 108 | - 'event_espresso' | |
| 109 | - ), | |
| 110 | - true, | |
| 111 | - null | |
| 112 | - ), | |
| 113 | - 'FIN_options' => new EE_JSON_Field( | |
| 114 | - 'FIN_options', | |
| 115 | - esc_html__( | |
| 116 | - 'JSON string of options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc.', | |
| 117 | - 'event_espresso' | |
| 118 | - ), | |
| 119 | - true, | |
| 120 | - '[]' | |
| 121 | - ), | |
| 122 | - 'FIN_order' => new EE_Integer_Field( | |
| 123 | - 'FIN_order', | |
| 124 | -                    esc_html__('Order in which form input appears in a form.', 'event_espresso'), | |
| 125 | - false, | |
| 126 | - 0 | |
| 127 | - ), | |
| 128 | - 'FIN_required' => new EE_JSON_Field( | |
| 129 | - 'FIN_required', | |
| 130 | - esc_html__( | |
| 131 | - 'properties pertaining to an input\'s required status and the validation text to display.', | |
| 132 | - 'event_espresso' | |
| 133 | - ), | |
| 134 | - false, | |
| 135 | -                    '{"required":false,"validationText":""}' | |
| 136 | - ), | |
| 137 | - 'FIN_status' => new EE_Enum_Text_Field( | |
| 138 | - 'FIN_status', | |
| 139 | - esc_html( | |
| 140 | - sprintf( | |
| 141 | - /* translators: 1 class name */ | |
| 142 | - esc_html__( | |
| 143 | - 'Whether form element is active, archived, trashed, or used as a default on new forms. Values correspond to the %1$s class constants.', | |
| 144 | - 'event_espresso' | |
| 145 | - ), | |
| 146 | - 'EventEspresso\core\services\form\meta\FormStatus' | |
| 147 | - ) | |
| 148 | - ), | |
| 149 | - false, | |
| 150 | - FormStatus::ACTIVE, | |
| 151 | - $form_status->validStatusOptions() | |
| 152 | - ), | |
| 153 | - 'FIN_type' => new EE_Enum_Text_Field( | |
| 154 | - 'FIN_type', | |
| 155 | -                    esc_html__('Form element type.', 'event_espresso'), | |
| 156 | - false, | |
| 157 | - Text::TYPE_TEXT, | |
| 158 | - $input_types->validTypeOptions() | |
| 159 | - ), | |
| 160 | - 'FIN_wpUser' => new EE_WP_User_Field( | |
| 161 | - 'FIN_wpUser', | |
| 162 | -                    esc_html__('ID of the WP User that created this form input.', 'event_espresso'), | |
| 163 | - false | |
| 164 | - ), | |
| 165 | - ], | |
| 166 | - ]; | |
| 167 | - | |
| 168 | - $this->_model_relations = [ | |
| 169 | - 'Form_Section' => new EE_Belongs_To_Relation(), | |
| 170 | - 'WP_User' => new EE_Belongs_To_Relation(), | |
| 171 | - ]; | |
| 172 | - // this model is generally available for reading | |
| 173 | - $this->_cap_restriction_generators = [ | |
| 174 | - EEM_Base::caps_read => new EE_Restriction_Generator_Public(), | |
| 175 | -            EEM_Base::caps_read_admin => new EE_Restriction_Generator_Reg_Form('FIN_applies_to'), | |
| 176 | -            EEM_Base::caps_edit       => new EE_Restriction_Generator_Reg_Form('FIN_applies_to'), | |
| 177 | -            EEM_Base::caps_delete     => new EE_Restriction_Generator_Reg_Form('FIN_applies_to'), | |
| 178 | - ]; | |
| 179 | - parent::__construct($timezone); | |
| 180 | -        $this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface'); | |
| 181 | - } | |
| 182 | - | |
| 183 | - | |
| 184 | - /** | |
| 185 | - * @param array $query_params | |
| 186 | - * @return array | |
| 187 | - */ | |
| 188 | - private function addDefaultWhereConditions(array $query_params): array | |
| 189 | -    { | |
| 190 | - // might need to add a way to identify GQL requests for admin domains | |
| 191 | - $admin_request = $this->request->isAdmin() || $this->request->isAdminAjax(); | |
| 192 | - $query_params['default_where_conditions'] = $admin_request | |
| 193 | - ? EE_Default_Where_Conditions::NONE | |
| 194 | - : EE_Default_Where_Conditions::ALL; | |
| 195 | - return $query_params; | |
| 196 | - } | |
| 197 | - | |
| 198 | - | |
| 199 | - /** | |
| 200 | - * form inputs should always be sorted in ascending order via the FIN_order field | |
| 201 | - * | |
| 202 | - * @param array $query_params | |
| 203 | - * @return array | |
| 204 | - */ | |
| 205 | - private function addOrderByQueryParams(array $query_params): array | |
| 206 | -    { | |
| 207 | - $query_params['order_by'] = ['FIN_order' => 'ASC']; | |
| 208 | - return $query_params; | |
| 209 | - } | |
| 210 | - | |
| 211 | - | |
| 212 | - /** | |
| 213 | - * @param EE_Form_Section $form_section | |
| 214 | - * @param EE_Form_Element[] $all_form_elements | |
| 215 | - * @return EE_Form_Element[] | |
| 216 | - * @throws EE_Error | |
| 217 | - * @throws ReflectionException | |
| 218 | - */ | |
| 219 | - public function filterFormElementsForFormSection(EE_Form_Section $form_section, array $all_form_elements): array | |
| 220 | -    { | |
| 221 | - return array_filter($all_form_elements, $form_section->formElementFilter()); | |
| 222 | - } | |
| 223 | - | |
| 224 | - | |
| 225 | - /** | |
| 226 | - * @param EE_Form_Section[] $form_sections | |
| 227 | - * @return EE_Form_Element[] | |
| 228 | - * @throws EE_Error | |
| 229 | - * @throws ReflectionException | |
| 230 | - */ | |
| 231 | - public function getAllFormElementsForFormSections(array $form_sections): array | |
| 232 | -    { | |
| 233 | - $FSC_UUIDs = []; | |
| 234 | -        foreach ($form_sections as $form_section) { | |
| 235 | -            if ($form_section instanceof EE_Form_Section) { | |
| 236 | - $FSC_UUIDs[] = $form_section->UUID(); | |
| 237 | - } | |
| 238 | - } | |
| 239 | - $where_params = ['FSC_UUID' => ['IN', $FSC_UUIDs]]; | |
| 240 | - $query_params = $this->addDefaultWhereConditions([$where_params]); | |
| 241 | - $query_params = $this->addOrderByQueryParams($query_params); | |
| 242 | - return $this->get_all($query_params); | |
| 243 | - } | |
| 244 | - | |
| 245 | - | |
| 246 | - /** | |
| 247 | - * @param bool $constants_only | |
| 248 | - * @return array | |
| 249 | - */ | |
| 250 | - public function validTypeOptions(bool $constants_only = false): array | |
| 251 | -    { | |
| 252 | - return $this->input_types->validTypeOptions($constants_only); | |
| 253 | - } | |
| 30 | + protected static ?EEM_Form_Element $_instance = null; | |
| 31 | + | |
| 32 | + private RequestInterface $request; | |
| 33 | + | |
| 34 | + private InputTypes $input_types; | |
| 35 | + | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * EEM_Form_Element constructor. | |
| 39 | + * | |
| 40 | + * @param FormStatus $form_status | |
| 41 | + * @param InputTypes $input_types | |
| 42 | + * @param string|null $timezone | |
| 43 | + * @throws EE_Error | |
| 44 | + */ | |
| 45 | + protected function __construct(FormStatus $form_status, InputTypes $input_types, ?string $timezone = '') | |
| 46 | +	{ | |
| 47 | + $this->input_types = $input_types; | |
| 48 | +		$this->singular_item = esc_html__('Form Element', 'event_espresso'); | |
| 49 | +		$this->plural_item   = esc_html__('Form Elements', 'event_espresso'); | |
| 50 | + | |
| 51 | + $this->_tables = [ | |
| 52 | +			'Form_Element' => new EE_Primary_Table('esp_form_element', 'FIN_UUID'), | |
| 53 | + ]; | |
| 54 | + $this->_fields = [ | |
| 55 | + 'Form_Element' => [ | |
| 56 | + 'FIN_UUID' => new EE_Primary_Key_String_Field( | |
| 57 | + 'FIN_UUID', | |
| 58 | +					esc_html__('Form Element UUID (universally unique identifier)', 'event_espresso') | |
| 59 | + ), | |
| 60 | + 'FSC_UUID' => new EE_Foreign_Key_String_Field( | |
| 61 | + 'FSC_UUID', | |
| 62 | +					esc_html__('UUID of parent form section this form input belongs to.', 'event_espresso'), | |
| 63 | + false, | |
| 64 | + null, | |
| 65 | + ['Form_Section'], | |
| 66 | + false | |
| 67 | + ), | |
| 68 | + 'FIN_adminOnly' => new EE_Boolean_Field( | |
| 69 | + 'FIN_adminOnly', | |
| 70 | + esc_html__( | |
| 71 | + 'Whether or not input is only displayed in the admin. If false, input will appear in public forms', | |
| 72 | + 'event_espresso' | |
| 73 | + ), | |
| 74 | + false, | |
| 75 | + false | |
| 76 | + ), | |
| 77 | + 'FIN_attributes' => new EE_JSON_Field( | |
| 78 | + 'FIN_attributes', | |
| 79 | + esc_html__( | |
| 80 | + 'JSON string of HTML attributes such as class, max, min, placeholder, type, etc.', | |
| 81 | + 'event_espresso' | |
| 82 | + ), | |
| 83 | + true, | |
| 84 | +					'{}' | |
| 85 | + ), | |
| 86 | + 'FIN_helpText' => new EE_JSON_Field( | |
| 87 | + 'FIN_helpText', | |
| 88 | + esc_html__( | |
| 89 | + 'JSON string of properties pertaining to any help text required for an input.', | |
| 90 | + 'event_espresso' | |
| 91 | + ), | |
| 92 | + true, | |
| 93 | +					'{}' | |
| 94 | + ), | |
| 95 | + 'FIN_label' => new EE_JSON_Field( | |
| 96 | + 'FIN_label', | |
| 97 | + esc_html__( | |
| 98 | + 'JSON string of properties pertaining to an element\'s label.', | |
| 99 | + 'event_espresso' | |
| 100 | + ), | |
| 101 | + true, | |
| 102 | +					'{}' | |
| 103 | + ), | |
| 104 | + 'FIN_mapsTo' => new EE_Plain_Text_Field( | |
| 105 | + 'FIN_mapsTo', | |
| 106 | + esc_html__( | |
| 107 | + 'Model and Fields name that this element maps to; ex: Attendee.email', | |
| 108 | + 'event_espresso' | |
| 109 | + ), | |
| 110 | + true, | |
| 111 | + null | |
| 112 | + ), | |
| 113 | + 'FIN_options' => new EE_JSON_Field( | |
| 114 | + 'FIN_options', | |
| 115 | + esc_html__( | |
| 116 | + 'JSON string of options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc.', | |
| 117 | + 'event_espresso' | |
| 118 | + ), | |
| 119 | + true, | |
| 120 | + '[]' | |
| 121 | + ), | |
| 122 | + 'FIN_order' => new EE_Integer_Field( | |
| 123 | + 'FIN_order', | |
| 124 | +					esc_html__('Order in which form input appears in a form.', 'event_espresso'), | |
| 125 | + false, | |
| 126 | + 0 | |
| 127 | + ), | |
| 128 | + 'FIN_required' => new EE_JSON_Field( | |
| 129 | + 'FIN_required', | |
| 130 | + esc_html__( | |
| 131 | + 'properties pertaining to an input\'s required status and the validation text to display.', | |
| 132 | + 'event_espresso' | |
| 133 | + ), | |
| 134 | + false, | |
| 135 | +					'{"required":false,"validationText":""}' | |
| 136 | + ), | |
| 137 | + 'FIN_status' => new EE_Enum_Text_Field( | |
| 138 | + 'FIN_status', | |
| 139 | + esc_html( | |
| 140 | + sprintf( | |
| 141 | + /* translators: 1 class name */ | |
| 142 | + esc_html__( | |
| 143 | + 'Whether form element is active, archived, trashed, or used as a default on new forms. Values correspond to the %1$s class constants.', | |
| 144 | + 'event_espresso' | |
| 145 | + ), | |
| 146 | + 'EventEspresso\core\services\form\meta\FormStatus' | |
| 147 | + ) | |
| 148 | + ), | |
| 149 | + false, | |
| 150 | + FormStatus::ACTIVE, | |
| 151 | + $form_status->validStatusOptions() | |
| 152 | + ), | |
| 153 | + 'FIN_type' => new EE_Enum_Text_Field( | |
| 154 | + 'FIN_type', | |
| 155 | +					esc_html__('Form element type.', 'event_espresso'), | |
| 156 | + false, | |
| 157 | + Text::TYPE_TEXT, | |
| 158 | + $input_types->validTypeOptions() | |
| 159 | + ), | |
| 160 | + 'FIN_wpUser' => new EE_WP_User_Field( | |
| 161 | + 'FIN_wpUser', | |
| 162 | +					esc_html__('ID of the WP User that created this form input.', 'event_espresso'), | |
| 163 | + false | |
| 164 | + ), | |
| 165 | + ], | |
| 166 | + ]; | |
| 167 | + | |
| 168 | + $this->_model_relations = [ | |
| 169 | + 'Form_Section' => new EE_Belongs_To_Relation(), | |
| 170 | + 'WP_User' => new EE_Belongs_To_Relation(), | |
| 171 | + ]; | |
| 172 | + // this model is generally available for reading | |
| 173 | + $this->_cap_restriction_generators = [ | |
| 174 | + EEM_Base::caps_read => new EE_Restriction_Generator_Public(), | |
| 175 | +			EEM_Base::caps_read_admin => new EE_Restriction_Generator_Reg_Form('FIN_applies_to'), | |
| 176 | +			EEM_Base::caps_edit       => new EE_Restriction_Generator_Reg_Form('FIN_applies_to'), | |
| 177 | +			EEM_Base::caps_delete     => new EE_Restriction_Generator_Reg_Form('FIN_applies_to'), | |
| 178 | + ]; | |
| 179 | + parent::__construct($timezone); | |
| 180 | +		$this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface'); | |
| 181 | + } | |
| 182 | + | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * @param array $query_params | |
| 186 | + * @return array | |
| 187 | + */ | |
| 188 | + private function addDefaultWhereConditions(array $query_params): array | |
| 189 | +	{ | |
| 190 | + // might need to add a way to identify GQL requests for admin domains | |
| 191 | + $admin_request = $this->request->isAdmin() || $this->request->isAdminAjax(); | |
| 192 | + $query_params['default_where_conditions'] = $admin_request | |
| 193 | + ? EE_Default_Where_Conditions::NONE | |
| 194 | + : EE_Default_Where_Conditions::ALL; | |
| 195 | + return $query_params; | |
| 196 | + } | |
| 197 | + | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * form inputs should always be sorted in ascending order via the FIN_order field | |
| 201 | + * | |
| 202 | + * @param array $query_params | |
| 203 | + * @return array | |
| 204 | + */ | |
| 205 | + private function addOrderByQueryParams(array $query_params): array | |
| 206 | +	{ | |
| 207 | + $query_params['order_by'] = ['FIN_order' => 'ASC']; | |
| 208 | + return $query_params; | |
| 209 | + } | |
| 210 | + | |
| 211 | + | |
| 212 | + /** | |
| 213 | + * @param EE_Form_Section $form_section | |
| 214 | + * @param EE_Form_Element[] $all_form_elements | |
| 215 | + * @return EE_Form_Element[] | |
| 216 | + * @throws EE_Error | |
| 217 | + * @throws ReflectionException | |
| 218 | + */ | |
| 219 | + public function filterFormElementsForFormSection(EE_Form_Section $form_section, array $all_form_elements): array | |
| 220 | +	{ | |
| 221 | + return array_filter($all_form_elements, $form_section->formElementFilter()); | |
| 222 | + } | |
| 223 | + | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * @param EE_Form_Section[] $form_sections | |
| 227 | + * @return EE_Form_Element[] | |
| 228 | + * @throws EE_Error | |
| 229 | + * @throws ReflectionException | |
| 230 | + */ | |
| 231 | + public function getAllFormElementsForFormSections(array $form_sections): array | |
| 232 | +	{ | |
| 233 | + $FSC_UUIDs = []; | |
| 234 | +		foreach ($form_sections as $form_section) { | |
| 235 | +			if ($form_section instanceof EE_Form_Section) { | |
| 236 | + $FSC_UUIDs[] = $form_section->UUID(); | |
| 237 | + } | |
| 238 | + } | |
| 239 | + $where_params = ['FSC_UUID' => ['IN', $FSC_UUIDs]]; | |
| 240 | + $query_params = $this->addDefaultWhereConditions([$where_params]); | |
| 241 | + $query_params = $this->addOrderByQueryParams($query_params); | |
| 242 | + return $this->get_all($query_params); | |
| 243 | + } | |
| 244 | + | |
| 245 | + | |
| 246 | + /** | |
| 247 | + * @param bool $constants_only | |
| 248 | + * @return array | |
| 249 | + */ | |
| 250 | + public function validTypeOptions(bool $constants_only = false): array | |
| 251 | +	{ | |
| 252 | + return $this->input_types->validTypeOptions($constants_only); | |
| 253 | + } | |
| 254 | 254 | } |