@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | } else { |
| 68 | 68 | $datatype = 'String'; |
| 69 | 69 | } |
| 70 | - $default_value = ModelDataTranslator::prepareFieldValueForJson( |
|
| 70 | + $default_value = ModelDataTranslator::prepareFieldValueForJson( |
|
| 71 | 71 | $field_obj, |
| 72 | 72 | $field_obj->get_default_value(), |
| 73 | 73 | $this->getModelVersionInfo()->requestedVersion() |
| 74 | 74 | ); |
| 75 | - $field_json = [ |
|
| 75 | + $field_json = [ |
|
| 76 | 76 | 'name' => $field_name, |
| 77 | 77 | 'nicename' => wp_specialchars_decode($field_obj->get_nicename(), ENT_QUOTES), |
| 78 | 78 | 'has_rendered_format' => $this->getModelVersionInfo()->fieldHasRenderedFormat($field_obj), |
@@ -84,27 +84,27 @@ discard block |
||
| 84 | 84 | 'table_alias' => $field_obj->get_table_alias(), |
| 85 | 85 | 'table_column' => $field_obj->get_table_column(), |
| 86 | 86 | ]; |
| 87 | - $fields_json[ $field_json['name'] ] = $field_json; |
|
| 87 | + $fields_json[$field_json['name']] = $field_json; |
|
| 88 | 88 | } |
| 89 | - $fields_json = array_merge( |
|
| 89 | + $fields_json = array_merge( |
|
| 90 | 90 | $fields_json, |
| 91 | 91 | $this->getModelVersionInfo()->extraResourcePropertiesForModel($model) |
| 92 | 92 | ); |
| 93 | - $response[ $model_name ]['fields'] = apply_filters( |
|
| 93 | + $response[$model_name]['fields'] = apply_filters( |
|
| 94 | 94 | 'FHEE__Meta__handle_request_models_meta__fields', |
| 95 | 95 | $fields_json, |
| 96 | 96 | $model |
| 97 | 97 | ); |
| 98 | - $relations_json = []; |
|
| 98 | + $relations_json = []; |
|
| 99 | 99 | foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
| 100 | - $relation_json = [ |
|
| 100 | + $relation_json = [ |
|
| 101 | 101 | 'name' => $relation_name, |
| 102 | 102 | 'type' => str_replace('EE_', '', get_class($relation_obj)), |
| 103 | 103 | 'single' => $relation_obj instanceof EE_Belongs_To_Relation, |
| 104 | 104 | ]; |
| 105 | - $relations_json[ $relation_name ] = $relation_json; |
|
| 105 | + $relations_json[$relation_name] = $relation_json; |
|
| 106 | 106 | } |
| 107 | - $response[ $model_name ]['relations'] = apply_filters( |
|
| 107 | + $response[$model_name]['relations'] = apply_filters( |
|
| 108 | 108 | 'FHEE__Meta__handle_request_models_meta__relations', |
| 109 | 109 | $relations_json, |
| 110 | 110 | $model |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | $response_data = $rest_response_obj->get_data(); |
| 126 | 126 | $addons = []; |
| 127 | 127 | foreach (EE_Registry::instance()->addons as $addon) { |
| 128 | - $addon_json = [ |
|
| 128 | + $addon_json = [ |
|
| 129 | 129 | 'name' => $addon->name(), |
| 130 | 130 | 'version' => $addon->version(), |
| 131 | 131 | ]; |
| 132 | - $addons[ $addon_json['name'] ] = $addon_json; |
|
| 132 | + $addons[$addon_json['name']] = $addon_json; |
|
| 133 | 133 | } |
| 134 | 134 | $response_data['ee'] = [ |
| 135 | 135 | 'version' => EEM_System_Status::instance()->get_ee_version(), |
@@ -26,125 +26,125 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Meta extends Base |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @param WP_REST_Request $request |
|
| 31 | - * @param string $version |
|
| 32 | - * @return WP_REST_Response |
|
| 33 | - */ |
|
| 34 | - public static function handleRequestModelsMeta(WP_REST_Request $request, string $version): WP_REST_Response |
|
| 35 | - { |
|
| 36 | - $controller = new Meta(); |
|
| 37 | - try { |
|
| 38 | - $controller->setRequestedVersion($version); |
|
| 39 | - return $controller->sendResponse($controller->getModelsMetadataEntity()); |
|
| 40 | - } catch (Exception $e) { |
|
| 41 | - return $controller->sendResponse($e); |
|
| 42 | - } |
|
| 43 | - } |
|
| 29 | + /** |
|
| 30 | + * @param WP_REST_Request $request |
|
| 31 | + * @param string $version |
|
| 32 | + * @return WP_REST_Response |
|
| 33 | + */ |
|
| 34 | + public static function handleRequestModelsMeta(WP_REST_Request $request, string $version): WP_REST_Response |
|
| 35 | + { |
|
| 36 | + $controller = new Meta(); |
|
| 37 | + try { |
|
| 38 | + $controller->setRequestedVersion($version); |
|
| 39 | + return $controller->sendResponse($controller->getModelsMetadataEntity()); |
|
| 40 | + } catch (Exception $e) { |
|
| 41 | + return $controller->sendResponse($e); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Gets the model metadata resource entity |
|
| 48 | - * |
|
| 49 | - * @return array for JSON response, describing all the models available in teh requested version |
|
| 50 | - * @throws ReflectionException |
|
| 51 | - * @throws EE_Error |
|
| 52 | - */ |
|
| 53 | - protected function getModelsMetadataEntity(): array |
|
| 54 | - { |
|
| 55 | - $response = []; |
|
| 56 | - foreach ($this->getModelVersionInfo()->modelsForRequestedVersion() as $model_name => $model_classname) { |
|
| 57 | - $model = $this->getModelVersionInfo()->loadModel($model_name); |
|
| 58 | - $fields_json = []; |
|
| 59 | - foreach ($this->getModelVersionInfo()->fieldsOnModelInThisVersion($model) as $field_name => $field_obj) { |
|
| 60 | - if ($this->getModelVersionInfo()->fieldIsIgnored($field_obj)) { |
|
| 61 | - continue; |
|
| 62 | - } |
|
| 63 | - if ($field_obj instanceof EE_Boolean_Field) { |
|
| 64 | - $datatype = 'Boolean'; |
|
| 65 | - } elseif ($field_obj->get_wpdb_data_type() == '%d') { |
|
| 66 | - $datatype = 'Number'; |
|
| 67 | - } elseif ($field_name instanceof EE_Serialized_Text_Field) { |
|
| 68 | - $datatype = 'Object'; |
|
| 69 | - } else { |
|
| 70 | - $datatype = 'String'; |
|
| 71 | - } |
|
| 72 | - $default_value = ModelDataTranslator::prepareFieldValueForJson( |
|
| 73 | - $field_obj, |
|
| 74 | - $field_obj->get_default_value(), |
|
| 75 | - $this->getModelVersionInfo()->requestedVersion() |
|
| 76 | - ); |
|
| 77 | - $field_json = [ |
|
| 78 | - 'name' => $field_name, |
|
| 79 | - 'nicename' => wp_specialchars_decode($field_obj->get_nicename(), ENT_QUOTES), |
|
| 80 | - 'has_rendered_format' => $this->getModelVersionInfo()->fieldHasRenderedFormat($field_obj), |
|
| 81 | - 'has_pretty_format' => $this->getModelVersionInfo()->fieldHasPrettyFormat($field_obj), |
|
| 82 | - 'type' => str_replace('EE_', '', get_class($field_obj)), |
|
| 83 | - 'datatype' => $datatype, |
|
| 84 | - 'nullable' => $field_obj->is_nullable(), |
|
| 85 | - 'default' => $default_value, |
|
| 86 | - 'table_alias' => $field_obj->get_table_alias(), |
|
| 87 | - 'table_column' => $field_obj->get_table_column(), |
|
| 88 | - ]; |
|
| 89 | - $fields_json[ $field_json['name'] ] = $field_json; |
|
| 90 | - } |
|
| 91 | - $fields_json = array_merge( |
|
| 92 | - $fields_json, |
|
| 93 | - $this->getModelVersionInfo()->extraResourcePropertiesForModel($model) |
|
| 94 | - ); |
|
| 95 | - $response[ $model_name ]['fields'] = apply_filters( |
|
| 96 | - 'FHEE__Meta__handle_request_models_meta__fields', |
|
| 97 | - $fields_json, |
|
| 98 | - $model |
|
| 99 | - ); |
|
| 100 | - $relations_json = []; |
|
| 101 | - foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 102 | - $relation_json = [ |
|
| 103 | - 'name' => $relation_name, |
|
| 104 | - 'type' => str_replace('EE_', '', get_class($relation_obj)), |
|
| 105 | - 'single' => $relation_obj instanceof EE_Belongs_To_Relation, |
|
| 106 | - ]; |
|
| 107 | - $relations_json[ $relation_name ] = $relation_json; |
|
| 108 | - } |
|
| 109 | - $response[ $model_name ]['relations'] = apply_filters( |
|
| 110 | - 'FHEE__Meta__handle_request_models_meta__relations', |
|
| 111 | - $relations_json, |
|
| 112 | - $model |
|
| 113 | - ); |
|
| 114 | - } |
|
| 115 | - return $response; |
|
| 116 | - } |
|
| 46 | + /** |
|
| 47 | + * Gets the model metadata resource entity |
|
| 48 | + * |
|
| 49 | + * @return array for JSON response, describing all the models available in teh requested version |
|
| 50 | + * @throws ReflectionException |
|
| 51 | + * @throws EE_Error |
|
| 52 | + */ |
|
| 53 | + protected function getModelsMetadataEntity(): array |
|
| 54 | + { |
|
| 55 | + $response = []; |
|
| 56 | + foreach ($this->getModelVersionInfo()->modelsForRequestedVersion() as $model_name => $model_classname) { |
|
| 57 | + $model = $this->getModelVersionInfo()->loadModel($model_name); |
|
| 58 | + $fields_json = []; |
|
| 59 | + foreach ($this->getModelVersionInfo()->fieldsOnModelInThisVersion($model) as $field_name => $field_obj) { |
|
| 60 | + if ($this->getModelVersionInfo()->fieldIsIgnored($field_obj)) { |
|
| 61 | + continue; |
|
| 62 | + } |
|
| 63 | + if ($field_obj instanceof EE_Boolean_Field) { |
|
| 64 | + $datatype = 'Boolean'; |
|
| 65 | + } elseif ($field_obj->get_wpdb_data_type() == '%d') { |
|
| 66 | + $datatype = 'Number'; |
|
| 67 | + } elseif ($field_name instanceof EE_Serialized_Text_Field) { |
|
| 68 | + $datatype = 'Object'; |
|
| 69 | + } else { |
|
| 70 | + $datatype = 'String'; |
|
| 71 | + } |
|
| 72 | + $default_value = ModelDataTranslator::prepareFieldValueForJson( |
|
| 73 | + $field_obj, |
|
| 74 | + $field_obj->get_default_value(), |
|
| 75 | + $this->getModelVersionInfo()->requestedVersion() |
|
| 76 | + ); |
|
| 77 | + $field_json = [ |
|
| 78 | + 'name' => $field_name, |
|
| 79 | + 'nicename' => wp_specialchars_decode($field_obj->get_nicename(), ENT_QUOTES), |
|
| 80 | + 'has_rendered_format' => $this->getModelVersionInfo()->fieldHasRenderedFormat($field_obj), |
|
| 81 | + 'has_pretty_format' => $this->getModelVersionInfo()->fieldHasPrettyFormat($field_obj), |
|
| 82 | + 'type' => str_replace('EE_', '', get_class($field_obj)), |
|
| 83 | + 'datatype' => $datatype, |
|
| 84 | + 'nullable' => $field_obj->is_nullable(), |
|
| 85 | + 'default' => $default_value, |
|
| 86 | + 'table_alias' => $field_obj->get_table_alias(), |
|
| 87 | + 'table_column' => $field_obj->get_table_column(), |
|
| 88 | + ]; |
|
| 89 | + $fields_json[ $field_json['name'] ] = $field_json; |
|
| 90 | + } |
|
| 91 | + $fields_json = array_merge( |
|
| 92 | + $fields_json, |
|
| 93 | + $this->getModelVersionInfo()->extraResourcePropertiesForModel($model) |
|
| 94 | + ); |
|
| 95 | + $response[ $model_name ]['fields'] = apply_filters( |
|
| 96 | + 'FHEE__Meta__handle_request_models_meta__fields', |
|
| 97 | + $fields_json, |
|
| 98 | + $model |
|
| 99 | + ); |
|
| 100 | + $relations_json = []; |
|
| 101 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 102 | + $relation_json = [ |
|
| 103 | + 'name' => $relation_name, |
|
| 104 | + 'type' => str_replace('EE_', '', get_class($relation_obj)), |
|
| 105 | + 'single' => $relation_obj instanceof EE_Belongs_To_Relation, |
|
| 106 | + ]; |
|
| 107 | + $relations_json[ $relation_name ] = $relation_json; |
|
| 108 | + } |
|
| 109 | + $response[ $model_name ]['relations'] = apply_filters( |
|
| 110 | + 'FHEE__Meta__handle_request_models_meta__relations', |
|
| 111 | + $relations_json, |
|
| 112 | + $model |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | + return $response; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Adds EE metadata to the index |
|
| 121 | - * |
|
| 122 | - * @param WP_REST_Response $rest_response_obj |
|
| 123 | - * @return WP_REST_Response |
|
| 124 | - */ |
|
| 125 | - public static function filterEeMetadataIntoIndex(WP_REST_Response $rest_response_obj): WP_REST_Response |
|
| 126 | - { |
|
| 127 | - $response_data = $rest_response_obj->get_data(); |
|
| 128 | - $addons = []; |
|
| 129 | - foreach (EE_Registry::instance()->addons as $addon) { |
|
| 130 | - $addon_json = [ |
|
| 131 | - 'name' => $addon->name(), |
|
| 132 | - 'version' => $addon->version(), |
|
| 133 | - ]; |
|
| 134 | - $addons[ $addon_json['name'] ] = $addon_json; |
|
| 135 | - } |
|
| 136 | - $response_data['ee'] = [ |
|
| 137 | - 'version' => EEM_System_Status::instance()->get_ee_version(), |
|
| 138 | - // @codingStandardsIgnoreStart |
|
| 139 | - 'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API', |
|
| 140 | - // @codingStandardsIgnoreEnd |
|
| 141 | - 'addons' => $addons, |
|
| 142 | - 'maintenance_mode' => EE_Maintenance_Mode::instance()->real_level(), |
|
| 143 | - 'served_core_versions' => array_keys(EED_Core_Rest_Api::versions_served()), |
|
| 144 | - ]; |
|
| 145 | - $rest_response_obj->set_data($response_data); |
|
| 146 | - return $rest_response_obj; |
|
| 147 | - } |
|
| 119 | + /** |
|
| 120 | + * Adds EE metadata to the index |
|
| 121 | + * |
|
| 122 | + * @param WP_REST_Response $rest_response_obj |
|
| 123 | + * @return WP_REST_Response |
|
| 124 | + */ |
|
| 125 | + public static function filterEeMetadataIntoIndex(WP_REST_Response $rest_response_obj): WP_REST_Response |
|
| 126 | + { |
|
| 127 | + $response_data = $rest_response_obj->get_data(); |
|
| 128 | + $addons = []; |
|
| 129 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
| 130 | + $addon_json = [ |
|
| 131 | + 'name' => $addon->name(), |
|
| 132 | + 'version' => $addon->version(), |
|
| 133 | + ]; |
|
| 134 | + $addons[ $addon_json['name'] ] = $addon_json; |
|
| 135 | + } |
|
| 136 | + $response_data['ee'] = [ |
|
| 137 | + 'version' => EEM_System_Status::instance()->get_ee_version(), |
|
| 138 | + // @codingStandardsIgnoreStart |
|
| 139 | + 'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API', |
|
| 140 | + // @codingStandardsIgnoreEnd |
|
| 141 | + 'addons' => $addons, |
|
| 142 | + 'maintenance_mode' => EE_Maintenance_Mode::instance()->real_level(), |
|
| 143 | + 'served_core_versions' => array_keys(EED_Core_Rest_Api::versions_served()), |
|
| 144 | + ]; |
|
| 145 | + $rest_response_obj->set_data($response_data); |
|
| 146 | + return $rest_response_obj; |
|
| 147 | + } |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -37,138 +37,138 @@ |
||
| 37 | 37 | * @since 4.0 |
| 38 | 38 | */ |
| 39 | 39 | if (function_exists('espresso_version')) { |
| 40 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 41 | - /** |
|
| 42 | - * espresso_duplicate_plugin_error |
|
| 43 | - * displays if more than one version of EE is activated at the same time. |
|
| 44 | - */ |
|
| 45 | - function espresso_duplicate_plugin_error() |
|
| 46 | - { |
|
| 47 | - ?> |
|
| 40 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 41 | + /** |
|
| 42 | + * espresso_duplicate_plugin_error |
|
| 43 | + * displays if more than one version of EE is activated at the same time. |
|
| 44 | + */ |
|
| 45 | + function espresso_duplicate_plugin_error() |
|
| 46 | + { |
|
| 47 | + ?> |
|
| 48 | 48 | <div class="error"> |
| 49 | 49 | <p> |
| 50 | 50 | <?php |
| 51 | - echo esc_html__( |
|
| 52 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
| 53 | - 'event_espresso' |
|
| 54 | - ); ?> |
|
| 51 | + echo esc_html__( |
|
| 52 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
| 53 | + 'event_espresso' |
|
| 54 | + ); ?> |
|
| 55 | 55 | </p> |
| 56 | 56 | </div> |
| 57 | 57 | <?php |
| 58 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 58 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 62 | 62 | } else { |
| 63 | - define('EE_MIN_PHP_VER_REQUIRED', '7.4.0'); |
|
| 64 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 65 | - /** |
|
| 66 | - * espresso_minimum_php_version_error |
|
| 67 | - * |
|
| 68 | - * @return void |
|
| 69 | - */ |
|
| 70 | - function espresso_minimum_php_version_error() |
|
| 71 | - { |
|
| 72 | - ?> |
|
| 63 | + define('EE_MIN_PHP_VER_REQUIRED', '7.4.0'); |
|
| 64 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 65 | + /** |
|
| 66 | + * espresso_minimum_php_version_error |
|
| 67 | + * |
|
| 68 | + * @return void |
|
| 69 | + */ |
|
| 70 | + function espresso_minimum_php_version_error() |
|
| 71 | + { |
|
| 72 | + ?> |
|
| 73 | 73 | <div class="error"> |
| 74 | 74 | <p> |
| 75 | 75 | <?php |
| 76 | - printf( |
|
| 77 | - esc_html__( |
|
| 78 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 79 | - 'event_espresso' |
|
| 80 | - ), |
|
| 81 | - EE_MIN_PHP_VER_REQUIRED, |
|
| 82 | - PHP_VERSION, |
|
| 83 | - '<br/>', |
|
| 84 | - '<a href="https://www.php.net/downloads.php">https://php.net/downloads.php</a>' |
|
| 85 | - ); |
|
| 86 | - ?> |
|
| 76 | + printf( |
|
| 77 | + esc_html__( |
|
| 78 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 79 | + 'event_espresso' |
|
| 80 | + ), |
|
| 81 | + EE_MIN_PHP_VER_REQUIRED, |
|
| 82 | + PHP_VERSION, |
|
| 83 | + '<br/>', |
|
| 84 | + '<a href="https://www.php.net/downloads.php">https://php.net/downloads.php</a>' |
|
| 85 | + ); |
|
| 86 | + ?> |
|
| 87 | 87 | </p> |
| 88 | 88 | </div> |
| 89 | 89 | <?php |
| 90 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 91 | - } |
|
| 90 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 94 | - } else { |
|
| 95 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 93 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 94 | + } else { |
|
| 95 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 96 | 96 | |
| 97 | - require_once __DIR__ . '/vendor/autoload.php'; |
|
| 97 | + require_once __DIR__ . '/vendor/autoload.php'; |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * espresso_version |
|
| 101 | - * Returns the plugin version |
|
| 102 | - * |
|
| 103 | - * @return string |
|
| 104 | - */ |
|
| 105 | - function espresso_version(): string |
|
| 106 | - { |
|
| 107 | - return apply_filters('FHEE__espresso__espresso_version', '5.0.26.rc.000'); |
|
| 108 | - } |
|
| 99 | + /** |
|
| 100 | + * espresso_version |
|
| 101 | + * Returns the plugin version |
|
| 102 | + * |
|
| 103 | + * @return string |
|
| 104 | + */ |
|
| 105 | + function espresso_version(): string |
|
| 106 | + { |
|
| 107 | + return apply_filters('FHEE__espresso__espresso_version', '5.0.26.rc.000'); |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * espresso_plugin_activation |
|
| 112 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 113 | - */ |
|
| 114 | - function espresso_plugin_activation() |
|
| 115 | - { |
|
| 116 | - update_option('ee_espresso_activation', true); |
|
| 117 | - update_option('event-espresso-core_allow_tracking', 'no'); |
|
| 118 | - update_option('event-espresso-core_tracking_notice', 'hide'); |
|
| 119 | - // Run WP GraphQL activation callback |
|
| 120 | - espressoLoadWpGraphQL(); |
|
| 121 | - graphql_activation_callback(); |
|
| 122 | - } |
|
| 110 | + /** |
|
| 111 | + * espresso_plugin_activation |
|
| 112 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 113 | + */ |
|
| 114 | + function espresso_plugin_activation() |
|
| 115 | + { |
|
| 116 | + update_option('ee_espresso_activation', true); |
|
| 117 | + update_option('event-espresso-core_allow_tracking', 'no'); |
|
| 118 | + update_option('event-espresso-core_tracking_notice', 'hide'); |
|
| 119 | + // Run WP GraphQL activation callback |
|
| 120 | + espressoLoadWpGraphQL(); |
|
| 121 | + graphql_activation_callback(); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 124 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * espresso_plugin_deactivation |
|
| 128 | - */ |
|
| 129 | - function espresso_plugin_deactivation() |
|
| 130 | - { |
|
| 131 | - // Run WP GraphQL deactivation callback |
|
| 132 | - espressoLoadWpGraphQL(); |
|
| 133 | - graphql_deactivation_callback(); |
|
| 134 | - delete_option('event-espresso-core_allow_tracking'); |
|
| 135 | - delete_option('event-espresso-core_tracking_notice'); |
|
| 136 | - } |
|
| 137 | - register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
| 126 | + /** |
|
| 127 | + * espresso_plugin_deactivation |
|
| 128 | + */ |
|
| 129 | + function espresso_plugin_deactivation() |
|
| 130 | + { |
|
| 131 | + // Run WP GraphQL deactivation callback |
|
| 132 | + espressoLoadWpGraphQL(); |
|
| 133 | + graphql_deactivation_callback(); |
|
| 134 | + delete_option('event-espresso-core_allow_tracking'); |
|
| 135 | + delete_option('event-espresso-core_tracking_notice'); |
|
| 136 | + } |
|
| 137 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
| 138 | 138 | |
| 139 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 140 | - bootstrap_espresso(); |
|
| 141 | - } |
|
| 139 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 140 | + bootstrap_espresso(); |
|
| 141 | + } |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (! function_exists('espresso_deactivate_plugin')) { |
| 145 | - /** |
|
| 146 | - * deactivate_plugin |
|
| 147 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 148 | - * |
|
| 149 | - * @access public |
|
| 150 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 151 | - * @return void |
|
| 152 | - */ |
|
| 153 | - function espresso_deactivate_plugin(string $plugin_basename = '') |
|
| 154 | - { |
|
| 155 | - if (! function_exists('deactivate_plugins')) { |
|
| 156 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 157 | - } |
|
| 158 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
| 159 | - deactivate_plugins($plugin_basename); |
|
| 160 | - } |
|
| 145 | + /** |
|
| 146 | + * deactivate_plugin |
|
| 147 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 148 | + * |
|
| 149 | + * @access public |
|
| 150 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 151 | + * @return void |
|
| 152 | + */ |
|
| 153 | + function espresso_deactivate_plugin(string $plugin_basename = '') |
|
| 154 | + { |
|
| 155 | + if (! function_exists('deactivate_plugins')) { |
|
| 156 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 157 | + } |
|
| 158 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
| 159 | + deactivate_plugins($plugin_basename); |
|
| 160 | + } |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | if (! function_exists('espressoLoadWpGraphQL')) { |
| 165 | - function espressoLoadWpGraphQL() |
|
| 166 | - { |
|
| 167 | - if ( |
|
| 168 | - ! class_exists('WPGraphQL') |
|
| 169 | - && is_readable(__DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php') |
|
| 170 | - ) { |
|
| 171 | - require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php'; |
|
| 172 | - } |
|
| 173 | - } |
|
| 165 | + function espressoLoadWpGraphQL() |
|
| 166 | + { |
|
| 167 | + if ( |
|
| 168 | + ! class_exists('WPGraphQL') |
|
| 169 | + && is_readable(__DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php') |
|
| 170 | + ) { |
|
| 171 | + require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php'; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | 174 | } |
@@ -19,149 +19,149 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class PayPalLogger |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Log an error, return a json message and maybe exit. |
|
| 24 | - * |
|
| 25 | - * @param string $error_message |
|
| 26 | - * @param array $data |
|
| 27 | - * @param EE_Payment_Method|null $paypal_pm |
|
| 28 | - * @param mixed $object_logged |
|
| 29 | - * @param bool $return_json Should we echo json and exit |
|
| 30 | - * @param bool $popup_log |
|
| 31 | - * @param bool $show_alert Show an alert on the front end or not |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public static function errorLogAndExit( |
|
| 35 | - string $error_message = '', |
|
| 36 | - array $data = [], |
|
| 37 | - ?EE_Payment_Method $paypal_pm = null, |
|
| 38 | - bool $return_json = true, |
|
| 39 | - bool $popup_log = false, |
|
| 40 | - bool $show_alert = false, |
|
| 41 | - $object_logged = null |
|
| 42 | - ): void { |
|
| 43 | - PayPalLogger::errorLog($error_message, $data, $paypal_pm, $popup_log, $object_logged); |
|
| 44 | - // Do we echo json and exit or just close the window ? |
|
| 45 | - if ($return_json) { |
|
| 46 | - PayPalLogger::exitWithJson($error_message, $show_alert); |
|
| 47 | - } |
|
| 48 | - if ($popup_log) { |
|
| 49 | - PayPalLogger::logInWindow($error_message); |
|
| 50 | - } |
|
| 51 | - PayPalLogger::closeWindowAndExit(); |
|
| 52 | - } |
|
| 22 | + /** |
|
| 23 | + * Log an error, return a json message and maybe exit. |
|
| 24 | + * |
|
| 25 | + * @param string $error_message |
|
| 26 | + * @param array $data |
|
| 27 | + * @param EE_Payment_Method|null $paypal_pm |
|
| 28 | + * @param mixed $object_logged |
|
| 29 | + * @param bool $return_json Should we echo json and exit |
|
| 30 | + * @param bool $popup_log |
|
| 31 | + * @param bool $show_alert Show an alert on the front end or not |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public static function errorLogAndExit( |
|
| 35 | + string $error_message = '', |
|
| 36 | + array $data = [], |
|
| 37 | + ?EE_Payment_Method $paypal_pm = null, |
|
| 38 | + bool $return_json = true, |
|
| 39 | + bool $popup_log = false, |
|
| 40 | + bool $show_alert = false, |
|
| 41 | + $object_logged = null |
|
| 42 | + ): void { |
|
| 43 | + PayPalLogger::errorLog($error_message, $data, $paypal_pm, $popup_log, $object_logged); |
|
| 44 | + // Do we echo json and exit or just close the window ? |
|
| 45 | + if ($return_json) { |
|
| 46 | + PayPalLogger::exitWithJson($error_message, $show_alert); |
|
| 47 | + } |
|
| 48 | + if ($popup_log) { |
|
| 49 | + PayPalLogger::logInWindow($error_message); |
|
| 50 | + } |
|
| 51 | + PayPalLogger::closeWindowAndExit(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Log an error, return a json message. |
|
| 57 | - * |
|
| 58 | - * @param string $error_message |
|
| 59 | - * @param array $data |
|
| 60 | - * @param EE_Payment_Method|null $paypal_pm |
|
| 61 | - * @param mixed $object_logged |
|
| 62 | - * @param bool $popup_log |
|
| 63 | - * @return bool |
|
| 64 | - */ |
|
| 65 | - public static function errorLog( |
|
| 66 | - string $error_message = '', |
|
| 67 | - array $data = [], |
|
| 68 | - ?EE_Payment_Method $paypal_pm = null, |
|
| 69 | - bool $popup_log = false, |
|
| 70 | - $object_logged = null |
|
| 71 | - ): bool { |
|
| 72 | - $default_msg = 'PayPal Commerce error'; |
|
| 73 | - if ($data) { |
|
| 74 | - $data = PayPalLogger::cleanDataArray($data); |
|
| 75 | - $default_msg = $error_message; |
|
| 76 | - } |
|
| 77 | - try { |
|
| 78 | - if (! $paypal_pm instanceof EE_Payment_Method) { |
|
| 79 | - // Default to the standard PP Commerce PM. |
|
| 80 | - $paypal_pm = EEM_Payment_Method::instance()->get_one_by_slug(Domain::PM_SLUG); |
|
| 81 | - } |
|
| 82 | - $paypal_gateway = $paypal_pm->type_obj()->get_gateway(); |
|
| 83 | - if ($paypal_gateway instanceof EE_Gateway) { |
|
| 84 | - $paypal_gateway->log([$default_msg => $data], $object_logged); |
|
| 85 | - } |
|
| 86 | - if ($popup_log) { |
|
| 87 | - PayPalLogger::logInWindow(json_encode($data)); |
|
| 88 | - } |
|
| 89 | - } catch (ReflectionException|EE_Error $error) { |
|
| 90 | - new ExceptionLogger($error); |
|
| 91 | - return false; |
|
| 92 | - } |
|
| 93 | - // Yes, always return true. |
|
| 94 | - return true; |
|
| 95 | - } |
|
| 55 | + /** |
|
| 56 | + * Log an error, return a json message. |
|
| 57 | + * |
|
| 58 | + * @param string $error_message |
|
| 59 | + * @param array $data |
|
| 60 | + * @param EE_Payment_Method|null $paypal_pm |
|
| 61 | + * @param mixed $object_logged |
|
| 62 | + * @param bool $popup_log |
|
| 63 | + * @return bool |
|
| 64 | + */ |
|
| 65 | + public static function errorLog( |
|
| 66 | + string $error_message = '', |
|
| 67 | + array $data = [], |
|
| 68 | + ?EE_Payment_Method $paypal_pm = null, |
|
| 69 | + bool $popup_log = false, |
|
| 70 | + $object_logged = null |
|
| 71 | + ): bool { |
|
| 72 | + $default_msg = 'PayPal Commerce error'; |
|
| 73 | + if ($data) { |
|
| 74 | + $data = PayPalLogger::cleanDataArray($data); |
|
| 75 | + $default_msg = $error_message; |
|
| 76 | + } |
|
| 77 | + try { |
|
| 78 | + if (! $paypal_pm instanceof EE_Payment_Method) { |
|
| 79 | + // Default to the standard PP Commerce PM. |
|
| 80 | + $paypal_pm = EEM_Payment_Method::instance()->get_one_by_slug(Domain::PM_SLUG); |
|
| 81 | + } |
|
| 82 | + $paypal_gateway = $paypal_pm->type_obj()->get_gateway(); |
|
| 83 | + if ($paypal_gateway instanceof EE_Gateway) { |
|
| 84 | + $paypal_gateway->log([$default_msg => $data], $object_logged); |
|
| 85 | + } |
|
| 86 | + if ($popup_log) { |
|
| 87 | + PayPalLogger::logInWindow(json_encode($data)); |
|
| 88 | + } |
|
| 89 | + } catch (ReflectionException|EE_Error $error) { |
|
| 90 | + new ExceptionLogger($error); |
|
| 91 | + return false; |
|
| 92 | + } |
|
| 93 | + // Yes, always return true. |
|
| 94 | + return true; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Clean the array of data from sensitive information. |
|
| 100 | - * |
|
| 101 | - * @param array $data |
|
| 102 | - * @return array |
|
| 103 | - */ |
|
| 104 | - private static function cleanDataArray(array $data): array |
|
| 105 | - { |
|
| 106 | - $sensitive_data = [ |
|
| 107 | - 'access_token', |
|
| 108 | - 'refresh_token', |
|
| 109 | - 'nonce', |
|
| 110 | - 'seller_nonce', |
|
| 111 | - 'client_secret', |
|
| 112 | - Domain::API_KEY_AUTH_CODE, |
|
| 113 | - 'Authorization', |
|
| 114 | - 'merchantIdInPayPal', |
|
| 115 | - ]; |
|
| 116 | - foreach ($data as $key => $value) { |
|
| 117 | - if (is_string($value)) { |
|
| 118 | - // Json encoded ? |
|
| 119 | - $value = json_decode($value) ?? $value; |
|
| 120 | - } |
|
| 121 | - $value = is_array($value) ? PayPalLogger::cleanDataArray($value) : $value; |
|
| 122 | - // Validate the data type. Some objects won't encode easily, so try getting from them some basic info. |
|
| 123 | - if (is_object($value)) { |
|
| 124 | - $obj_vars = get_object_vars($value); |
|
| 125 | - $value = ! empty($obj_vars) ? PayPalLogger::cleanDataArray($obj_vars) : get_class($value); |
|
| 126 | - } |
|
| 127 | - if (is_string($key) && in_array($key, $sensitive_data)) { |
|
| 128 | - $data[ $key ] = empty($value) ? '**empty**' : '**hidden**'; |
|
| 129 | - } else { |
|
| 130 | - $data[ $key ] = $value; |
|
| 131 | - } |
|
| 132 | - } |
|
| 133 | - return $data; |
|
| 134 | - } |
|
| 98 | + /** |
|
| 99 | + * Clean the array of data from sensitive information. |
|
| 100 | + * |
|
| 101 | + * @param array $data |
|
| 102 | + * @return array |
|
| 103 | + */ |
|
| 104 | + private static function cleanDataArray(array $data): array |
|
| 105 | + { |
|
| 106 | + $sensitive_data = [ |
|
| 107 | + 'access_token', |
|
| 108 | + 'refresh_token', |
|
| 109 | + 'nonce', |
|
| 110 | + 'seller_nonce', |
|
| 111 | + 'client_secret', |
|
| 112 | + Domain::API_KEY_AUTH_CODE, |
|
| 113 | + 'Authorization', |
|
| 114 | + 'merchantIdInPayPal', |
|
| 115 | + ]; |
|
| 116 | + foreach ($data as $key => $value) { |
|
| 117 | + if (is_string($value)) { |
|
| 118 | + // Json encoded ? |
|
| 119 | + $value = json_decode($value) ?? $value; |
|
| 120 | + } |
|
| 121 | + $value = is_array($value) ? PayPalLogger::cleanDataArray($value) : $value; |
|
| 122 | + // Validate the data type. Some objects won't encode easily, so try getting from them some basic info. |
|
| 123 | + if (is_object($value)) { |
|
| 124 | + $obj_vars = get_object_vars($value); |
|
| 125 | + $value = ! empty($obj_vars) ? PayPalLogger::cleanDataArray($obj_vars) : get_class($value); |
|
| 126 | + } |
|
| 127 | + if (is_string($key) && in_array($key, $sensitive_data)) { |
|
| 128 | + $data[ $key ] = empty($value) ? '**empty**' : '**hidden**'; |
|
| 129 | + } else { |
|
| 130 | + $data[ $key ] = $value; |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + return $data; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Return error message as json allowing to show an alert on the front-end. |
|
| 139 | - * |
|
| 140 | - * @param string $error_message |
|
| 141 | - * @param bool $show_alert |
|
| 142 | - * @return void |
|
| 143 | - */ |
|
| 144 | - public static function exitWithJson(string $error_message = '', bool $show_alert = false) |
|
| 145 | - { |
|
| 146 | - wp_send_json( |
|
| 147 | - [ |
|
| 148 | - 'error' => $error_message, |
|
| 149 | - 'message' => $error_message, |
|
| 150 | - 'alert' => $show_alert, |
|
| 151 | - ] |
|
| 152 | - ); |
|
| 153 | - } |
|
| 137 | + /** |
|
| 138 | + * Return error message as json allowing to show an alert on the front-end. |
|
| 139 | + * |
|
| 140 | + * @param string $error_message |
|
| 141 | + * @param bool $show_alert |
|
| 142 | + * @return void |
|
| 143 | + */ |
|
| 144 | + public static function exitWithJson(string $error_message = '', bool $show_alert = false) |
|
| 145 | + { |
|
| 146 | + wp_send_json( |
|
| 147 | + [ |
|
| 148 | + 'error' => $error_message, |
|
| 149 | + 'message' => $error_message, |
|
| 150 | + 'alert' => $show_alert, |
|
| 151 | + ] |
|
| 152 | + ); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Close the OAuth window with JS. |
|
| 158 | - * |
|
| 159 | - * @param string $message |
|
| 160 | - * @return void |
|
| 161 | - */ |
|
| 162 | - public static function logInWindow(string $message): void |
|
| 163 | - { |
|
| 164 | - $js_out = '<script type="text/javascript"> |
|
| 156 | + /** |
|
| 157 | + * Close the OAuth window with JS. |
|
| 158 | + * |
|
| 159 | + * @param string $message |
|
| 160 | + * @return void |
|
| 161 | + */ |
|
| 162 | + public static function logInWindow(string $message): void |
|
| 163 | + { |
|
| 164 | + $js_out = '<script type="text/javascript"> |
|
| 165 | 165 | if (window.opener) { |
| 166 | 166 | try { |
| 167 | 167 | window.opener.console.log("' . $message . '"); |
@@ -170,22 +170,22 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | </script>'; |
| 173 | - echo $js_out; |
|
| 174 | - wp_die(); |
|
| 175 | - } |
|
| 173 | + echo $js_out; |
|
| 174 | + wp_die(); |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Close the JS opened auth window. |
|
| 180 | - * |
|
| 181 | - * @param string $message |
|
| 182 | - * @return void |
|
| 183 | - */ |
|
| 184 | - public static function closeWindowAndExit(string $message = ''): void |
|
| 185 | - { |
|
| 186 | - $js_out = '<script type="text/javascript">'; |
|
| 187 | - if (! empty($message)) { |
|
| 188 | - $js_out .= ' |
|
| 178 | + /** |
|
| 179 | + * Close the JS opened auth window. |
|
| 180 | + * |
|
| 181 | + * @param string $message |
|
| 182 | + * @return void |
|
| 183 | + */ |
|
| 184 | + public static function closeWindowAndExit(string $message = ''): void |
|
| 185 | + { |
|
| 186 | + $js_out = '<script type="text/javascript">'; |
|
| 187 | + if (! empty($message)) { |
|
| 188 | + $js_out .= ' |
|
| 189 | 189 | if (window.opener) { |
| 190 | 190 | try { |
| 191 | 191 | window.opener.console.log("' . $message . '"); |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | '; |
| 197 | - } |
|
| 198 | - $js_out .= 'window.opener = self; |
|
| 197 | + } |
|
| 198 | + $js_out .= 'window.opener = self; |
|
| 199 | 199 | window.close(); |
| 200 | 200 | </script>'; |
| 201 | - echo $js_out; |
|
| 202 | - wp_die(); |
|
| 203 | - } |
|
| 201 | + echo $js_out; |
|
| 202 | + wp_die(); |
|
| 203 | + } |
|
| 204 | 204 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $default_msg = $error_message; |
| 76 | 76 | } |
| 77 | 77 | try { |
| 78 | - if (! $paypal_pm instanceof EE_Payment_Method) { |
|
| 78 | + if ( ! $paypal_pm instanceof EE_Payment_Method) { |
|
| 79 | 79 | // Default to the standard PP Commerce PM. |
| 80 | 80 | $paypal_pm = EEM_Payment_Method::instance()->get_one_by_slug(Domain::PM_SLUG); |
| 81 | 81 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if ($popup_log) { |
| 87 | 87 | PayPalLogger::logInWindow(json_encode($data)); |
| 88 | 88 | } |
| 89 | - } catch (ReflectionException|EE_Error $error) { |
|
| 89 | + } catch (ReflectionException | EE_Error $error) { |
|
| 90 | 90 | new ExceptionLogger($error); |
| 91 | 91 | return false; |
| 92 | 92 | } |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | $value = ! empty($obj_vars) ? PayPalLogger::cleanDataArray($obj_vars) : get_class($value); |
| 126 | 126 | } |
| 127 | 127 | if (is_string($key) && in_array($key, $sensitive_data)) { |
| 128 | - $data[ $key ] = empty($value) ? '**empty**' : '**hidden**'; |
|
| 128 | + $data[$key] = empty($value) ? '**empty**' : '**hidden**'; |
|
| 129 | 129 | } else { |
| 130 | - $data[ $key ] = $value; |
|
| 130 | + $data[$key] = $value; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | return $data; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | $js_out = '<script type="text/javascript"> |
| 165 | 165 | if (window.opener) { |
| 166 | 166 | try { |
| 167 | - window.opener.console.log("' . $message . '"); |
|
| 167 | + window.opener.console.log("' . $message.'"); |
|
| 168 | 168 | } catch (e) { |
| 169 | - console.log("' . $message . '"); |
|
| 169 | + console.log("' . $message.'"); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | </script>'; |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | public static function closeWindowAndExit(string $message = ''): void |
| 185 | 185 | { |
| 186 | 186 | $js_out = '<script type="text/javascript">'; |
| 187 | - if (! empty($message)) { |
|
| 187 | + if ( ! empty($message)) { |
|
| 188 | 188 | $js_out .= ' |
| 189 | 189 | if (window.opener) { |
| 190 | 190 | try { |
| 191 | - window.opener.console.log("' . $message . '"); |
|
| 191 | + window.opener.console.log("' . $message.'"); |
|
| 192 | 192 | } catch (e) { |
| 193 | - console.log("' . $message . '"); |
|
| 193 | + console.log("' . $message.'"); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | '; |
@@ -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:191 |
| 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:196 |
| 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:22 |
| 171 | 171 | // Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:21 |
| 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:226 |
| 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:166 |
| 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:187 |
| 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:208 |
| 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:215 |
| 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:43 |
| 452 | 452 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:35 |
| 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:44 |
| 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:45 |
| 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:61 |
| 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,1570 +742,1570 @@ 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 | - __( 'The maximum number of this ticket available for sale.', 'event_espresso' ), |
|
| 826 | + __('The maximum number of this ticket available for sale.', 'event_espresso'), |
|
| 827 | 827 | |
| 828 | 828 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:103 |
| 829 | - __( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ), |
|
| 829 | + __('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'), |
|
| 830 | 830 | |
| 831 | 831 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:109 |
| 832 | 832 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:119 |
| 833 | - __( 'Number of Uses', 'event_espresso' ), |
|
| 833 | + __('Number of Uses', 'event_espresso'), |
|
| 834 | 834 | |
| 835 | 835 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:115 |
| 836 | - __( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ), |
|
| 836 | + __('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'), |
|
| 837 | 837 | |
| 838 | 838 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:119 |
| 839 | - __( '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' ), |
|
| 839 | + __('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'), |
|
| 840 | 840 | |
| 841 | 841 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:127 |
| 842 | 842 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:127 |
| 843 | - __( 'Minimum Quantity', 'event_espresso' ), |
|
| 843 | + __('Minimum Quantity', 'event_espresso'), |
|
| 844 | 844 | |
| 845 | 845 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:132 |
| 846 | - __( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ), |
|
| 846 | + __('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'), |
|
| 847 | 847 | |
| 848 | 848 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:136 |
| 849 | - __( 'Leave blank for no minimum.', 'event_espresso' ), |
|
| 849 | + __('Leave blank for no minimum.', 'event_espresso'), |
|
| 850 | 850 | |
| 851 | 851 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:142 |
| 852 | 852 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:135 |
| 853 | - __( 'Maximum Quantity', 'event_espresso' ), |
|
| 853 | + __('Maximum Quantity', 'event_espresso'), |
|
| 854 | 854 | |
| 855 | 855 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:148 |
| 856 | - __( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ), |
|
| 856 | + __('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'), |
|
| 857 | 857 | |
| 858 | 858 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:152 |
| 859 | - __( 'Leave blank for no maximum.', 'event_espresso' ), |
|
| 859 | + __('Leave blank for no maximum.', 'event_espresso'), |
|
| 860 | 860 | |
| 861 | 861 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:158 |
| 862 | 862 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:144 |
| 863 | - __( 'Required Ticket', 'event_espresso' ), |
|
| 863 | + __('Required Ticket', 'event_espresso'), |
|
| 864 | 864 | |
| 865 | 865 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:160 |
| 866 | - __( 'If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso' ), |
|
| 866 | + __('If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso'), |
|
| 867 | 867 | |
| 868 | 868 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:172 |
| 869 | - __( 'Visibility', 'event_espresso' ), |
|
| 869 | + __('Visibility', 'event_espresso'), |
|
| 870 | 870 | |
| 871 | 871 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:204 |
| 872 | - __( 'Ticket Sales', 'event_espresso' ), |
|
| 872 | + __('Ticket Sales', 'event_espresso'), |
|
| 873 | 873 | |
| 874 | 874 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:95 |
| 875 | 875 | // Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:110 |
| 876 | - __( 'Quantity For Sale', 'event_espresso' ), |
|
| 876 | + __('Quantity 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:79 |
| 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:20 |
| 1294 | - __( 'Note: ', 'event_espresso' ), |
|
| 1294 | + __('Note: ', 'event_espresso'), |
|
| 1295 | 1295 | |
| 1296 | 1296 | // Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20 |
| 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:27 |
| 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:32 |
| 1318 | - __( 'delete form element', 'event_espresso' ), |
|
| 1318 | + __('delete form element', 'event_espresso'), |
|
| 1319 | 1319 | |
| 1320 | 1320 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:49 |
| 1321 | - __( 'form element settings', 'event_espresso' ), |
|
| 1321 | + __('form element settings', 'event_espresso'), |
|
| 1322 | 1322 | |
| 1323 | 1323 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:59 |
| 1324 | - __( 'copy form element', 'event_espresso' ), |
|
| 1324 | + __('copy form element', 'event_espresso'), |
|
| 1325 | 1325 | |
| 1326 | 1326 | // Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:69 |
| 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:26 |
| 1351 | 1351 | // Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:25 |
| 1352 | - __( 'Styles', 'event_espresso' ), |
|
| 1352 | + __('Styles', 'event_espresso'), |
|
| 1353 | 1353 | |
| 1354 | 1354 | // Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:30 |
| 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:32 |
| 1464 | - __( 'delete form section', 'event_espresso' ), |
|
| 1464 | + __('delete form section', 'event_espresso'), |
|
| 1465 | 1465 | |
| 1466 | 1466 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:47 |
| 1467 | - __( 'form section settings', 'event_espresso' ), |
|
| 1467 | + __('form section settings', 'event_espresso'), |
|
| 1468 | 1468 | |
| 1469 | 1469 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:57 |
| 1470 | - __( 'copy form section', 'event_espresso' ), |
|
| 1470 | + __('copy form section', 'event_espresso'), |
|
| 1471 | 1471 | |
| 1472 | 1472 | // Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:74 |
| 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:26 |
| 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:58 |
| 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:61 |
| 1491 | - __( 'shared', 'event_espresso' ), |
|
| 1491 | + __('shared', 'event_espresso'), |
|
| 1492 | 1492 | |
| 1493 | 1493 | // Reference: packages/form-builder/src/FormSection/SaveSection.tsx:64 |
| 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:6 |
| 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/toolbarButtons/WPMedia.tsx:68 |
| 1912 | - __( 'Add Media', 'event_espresso' ), |
|
| 1912 | + __('Add Media', 'event_espresso'), |
|
| 1913 | 1913 | |
| 1914 | 1914 | // Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:16 |
| 1915 | - __( 'add new price modifier after this row', 'event_espresso' ), |
|
| 1915 | + __('add new price modifier after this row', 'event_espresso'), |
|
| 1916 | 1916 | |
| 1917 | 1917 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:14 |
| 1918 | - __( 'Delete all prices', 'event_espresso' ), |
|
| 1918 | + __('Delete all prices', 'event_espresso'), |
|
| 1919 | 1919 | |
| 1920 | 1920 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:27 |
| 1921 | - __( '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' ), |
|
| 1921 | + __('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'), |
|
| 1922 | 1922 | |
| 1923 | 1923 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:31 |
| 1924 | - __( 'Delete all prices?', 'event_espresso' ), |
|
| 1924 | + __('Delete all prices?', 'event_espresso'), |
|
| 1925 | 1925 | |
| 1926 | 1926 | // Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12 |
| 1927 | - __( 'delete price modifier', 'event_espresso' ), |
|
| 1927 | + __('delete price modifier', 'event_espresso'), |
|
| 1928 | 1928 | |
| 1929 | 1929 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:14 |
| 1930 | - __( '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' ), |
|
| 1930 | + __('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'), |
|
| 1931 | 1931 | |
| 1932 | 1932 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:17 |
| 1933 | - __( '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' ), |
|
| 1933 | + __('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'), |
|
| 1934 | 1934 | |
| 1935 | 1935 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21 |
| 1936 | - __( 'Disable reverse calculate', 'event_espresso' ), |
|
| 1936 | + __('Disable reverse calculate', 'event_espresso'), |
|
| 1937 | 1937 | |
| 1938 | 1938 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21 |
| 1939 | - __( 'Enable reverse calculate', 'event_espresso' ), |
|
| 1939 | + __('Enable reverse calculate', 'event_espresso'), |
|
| 1940 | 1940 | |
| 1941 | 1941 | // Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:28 |
| 1942 | - __( 'ticket price calculator', 'event_espresso' ), |
|
| 1942 | + __('ticket price calculator', 'event_espresso'), |
|
| 1943 | 1943 | |
| 1944 | 1944 | // Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:9 |
| 1945 | - __( 'Add default taxes', 'event_espresso' ), |
|
| 1945 | + __('Add default taxes', 'event_espresso'), |
|
| 1946 | 1946 | |
| 1947 | 1947 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:10 |
| 1948 | - __( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ), |
|
| 1948 | + __('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'), |
|
| 1949 | 1949 | |
| 1950 | 1950 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:14 |
| 1951 | - __( 'Remove all taxes?', 'event_espresso' ), |
|
| 1951 | + __('Remove all taxes?', 'event_espresso'), |
|
| 1952 | 1952 | |
| 1953 | 1953 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:7 |
| 1954 | - __( 'Remove taxes', 'event_espresso' ), |
|
| 1954 | + __('Remove taxes', 'event_espresso'), |
|
| 1955 | 1955 | |
| 1956 | 1956 | // Reference: packages/tpc/src/components/AddDefaultPricesButton.tsx:9 |
| 1957 | - __( 'Add default prices', 'event_espresso' ), |
|
| 1957 | + __('Add default prices', 'event_espresso'), |
|
| 1958 | 1958 | |
| 1959 | 1959 | // Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:29 |
| 1960 | - __( 'Modify default prices.', 'event_espresso' ), |
|
| 1960 | + __('Modify default prices.', 'event_espresso'), |
|
| 1961 | 1961 | |
| 1962 | 1962 | // Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:29 |
| 1963 | - __( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ), |
|
| 1963 | + __('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'), |
|
| 1964 | 1964 | |
| 1965 | 1965 | // Reference: packages/tpc/src/components/LockedTicketsBanner.tsx:12 |
| 1966 | 1966 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:74 |
| 1967 | - __( 'Price editing is disabled!', 'event_espresso' ), |
|
| 1967 | + __('Price editing is disabled!', 'event_espresso'), |
|
| 1968 | 1968 | |
| 1969 | 1969 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:12 |
| 1970 | - __( 'One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso' ), |
|
| 1970 | + __('One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso'), |
|
| 1971 | 1971 | |
| 1972 | 1972 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:17 |
| 1973 | 1973 | /* translators: %s link to price types admin */ |
| 1974 | - __( 'Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso' ), |
|
| 1974 | + __('Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso'), |
|
| 1975 | 1975 | |
| 1976 | 1976 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:18 |
| 1977 | - __( 'price types admin page', 'event_espresso' ), |
|
| 1977 | + __('price types admin page', 'event_espresso'), |
|
| 1978 | 1978 | |
| 1979 | 1979 | // Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:26 |
| 1980 | - __( 'Missing Price Types!', 'event_espresso' ), |
|
| 1980 | + __('Missing Price Types!', 'event_espresso'), |
|
| 1981 | 1981 | |
| 1982 | 1982 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:14 |
| 1983 | - __( 'This Ticket is Currently Free', 'event_espresso' ), |
|
| 1983 | + __('This Ticket is Currently Free', 'event_espresso'), |
|
| 1984 | 1984 | |
| 1985 | 1985 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:21 |
| 1986 | 1986 | /* translators: %s default prices */ |
| 1987 | - __( 'Click the button below to load your %s into the calculator.', 'event_espresso' ), |
|
| 1987 | + __('Click the button below to load your %s into the calculator.', 'event_espresso'), |
|
| 1988 | 1988 | |
| 1989 | 1989 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:22 |
| 1990 | - __( 'default prices', 'event_espresso' ), |
|
| 1990 | + __('default prices', 'event_espresso'), |
|
| 1991 | 1991 | |
| 1992 | 1992 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:29 |
| 1993 | - __( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ), |
|
| 1993 | + __('Additional ticket price modifiers can be added or removed.', 'event_espresso'), |
|
| 1994 | 1994 | |
| 1995 | 1995 | // Reference: packages/tpc/src/components/NoPricesBanner.tsx:31 |
| 1996 | - __( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ), |
|
| 1996 | + __('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'), |
|
| 1997 | 1997 | |
| 1998 | 1998 | // Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:22 |
| 1999 | 1999 | // Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:7 |
| 2000 | 2000 | // Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:10 |
| 2001 | 2001 | // Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:52 |
| 2002 | - __( 'Changes will be lost if you proceed.', 'event_espresso' ), |
|
| 2002 | + __('Changes will be lost if you proceed.', 'event_espresso'), |
|
| 2003 | 2003 | |
| 2004 | 2004 | // Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:33 |
| 2005 | 2005 | /* translators: %s ticket name */ |
| 2006 | - __( 'Price Calculator for Ticket: %s', 'event_espresso' ), |
|
| 2006 | + __('Price Calculator for Ticket: %s', 'event_espresso'), |
|
| 2007 | 2007 | |
| 2008 | 2008 | // Reference: packages/tpc/src/components/price/input/Description.tsx:15 |
| 2009 | - __( 'price description', 'event_espresso' ), |
|
| 2009 | + __('price description', 'event_espresso'), |
|
| 2010 | 2010 | |
| 2011 | 2011 | // Reference: packages/tpc/src/components/price/input/Description.tsx:18 |
| 2012 | - __( 'description…', 'event_espresso' ), |
|
| 2012 | + __('description…', 'event_espresso'), |
|
| 2013 | 2013 | |
| 2014 | 2014 | // Reference: packages/tpc/src/components/price/input/ID.tsx:7 |
| 2015 | - __( 'price id', 'event_espresso' ), |
|
| 2015 | + __('price id', 'event_espresso'), |
|
| 2016 | 2016 | |
| 2017 | 2017 | // Reference: packages/tpc/src/components/price/input/Name.tsx:15 |
| 2018 | - __( 'price name', 'event_espresso' ), |
|
| 2018 | + __('price name', 'event_espresso'), |
|
| 2019 | 2019 | |
| 2020 | 2020 | // Reference: packages/tpc/src/components/price/input/Name.tsx:18 |
| 2021 | - __( 'label…', 'event_espresso' ), |
|
| 2021 | + __('label…', 'event_espresso'), |
|
| 2022 | 2022 | |
| 2023 | 2023 | // Reference: packages/tpc/src/components/price/input/Order.tsx:21 |
| 2024 | - __( 'price order', 'event_espresso' ), |
|
| 2024 | + __('price order', 'event_espresso'), |
|
| 2025 | 2025 | |
| 2026 | 2026 | // Reference: packages/tpc/src/components/price/input/amount/Amount.tsx:85 |
| 2027 | - __( 'amount', 'event_espresso' ), |
|
| 2027 | + __('amount', 'event_espresso'), |
|
| 2028 | 2028 | |
| 2029 | 2029 | // Reference: packages/tpc/src/components/price/input/amount/Amount.tsx:89 |
| 2030 | - __( 'amount…', 'event_espresso' ), |
|
| 2030 | + __('amount…', 'event_espresso'), |
|
| 2031 | 2031 | |
| 2032 | 2032 | // Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:50 |
| 2033 | - __( 'Total', 'event_espresso' ), |
|
| 2033 | + __('Total', 'event_espresso'), |
|
| 2034 | 2034 | |
| 2035 | 2035 | // Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:59 |
| 2036 | - __( 'ticket total', 'event_espresso' ), |
|
| 2036 | + __('ticket total', 'event_espresso'), |
|
| 2037 | 2037 | |
| 2038 | 2038 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29 |
| 2039 | - __( 'Order', 'event_espresso' ), |
|
| 2039 | + __('Order', 'event_espresso'), |
|
| 2040 | 2040 | |
| 2041 | 2041 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35 |
| 2042 | - __( 'Price Type', 'event_espresso' ), |
|
| 2042 | + __('Price Type', 'event_espresso'), |
|
| 2043 | 2043 | |
| 2044 | 2044 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41 |
| 2045 | - __( 'Label', 'event_espresso' ), |
|
| 2045 | + __('Label', 'event_espresso'), |
|
| 2046 | 2046 | |
| 2047 | 2047 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53 |
| 2048 | - __( 'Amount', 'event_espresso' ), |
|
| 2048 | + __('Amount', 'event_espresso'), |
|
| 2049 | 2049 | |
| 2050 | 2050 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:22 |
| 2051 | - __( 'Copy ticket', 'event_espresso' ), |
|
| 2051 | + __('Copy ticket', 'event_espresso'), |
|
| 2052 | 2052 | |
| 2053 | 2053 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:26 |
| 2054 | - __( 'Copy and archive this ticket', 'event_espresso' ), |
|
| 2054 | + __('Copy and archive this ticket', 'event_espresso'), |
|
| 2055 | 2055 | |
| 2056 | 2056 | // Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:29 |
| 2057 | - __( 'OK', 'event_espresso' ), |
|
| 2057 | + __('OK', 'event_espresso'), |
|
| 2058 | 2058 | |
| 2059 | 2059 | // Reference: packages/tpc/src/utils/constants.ts:8 |
| 2060 | - __( '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' ), |
|
| 2060 | + __('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'), |
|
| 2061 | 2061 | |
| 2062 | 2062 | // Reference: packages/ui-components/src/ActiveFilters/ActiveFilters.tsx:8 |
| 2063 | - __( 'active filters:', 'event_espresso' ), |
|
| 2063 | + __('active filters:', 'event_espresso'), |
|
| 2064 | 2064 | |
| 2065 | 2065 | // Reference: packages/ui-components/src/ActiveFilters/FilterTag/index.tsx:15 |
| 2066 | 2066 | /* translators: %s filter name */ |
| 2067 | - __( 'remove filter - %s', 'event_espresso' ), |
|
| 2067 | + __('remove filter - %s', 'event_espresso'), |
|
| 2068 | 2068 | |
| 2069 | 2069 | // Reference: packages/ui-components/src/Address/Address.tsx:105 |
| 2070 | - __( 'Country:', 'event_espresso' ), |
|
| 2070 | + __('Country:', 'event_espresso'), |
|
| 2071 | 2071 | |
| 2072 | 2072 | // Reference: packages/ui-components/src/Address/Address.tsx:113 |
| 2073 | - __( 'Zip:', 'event_espresso' ), |
|
| 2073 | + __('Zip:', 'event_espresso'), |
|
| 2074 | 2074 | |
| 2075 | 2075 | // Reference: packages/ui-components/src/Address/Address.tsx:81 |
| 2076 | - __( 'Address:', 'event_espresso' ), |
|
| 2076 | + __('Address:', 'event_espresso'), |
|
| 2077 | 2077 | |
| 2078 | 2078 | // Reference: packages/ui-components/src/Address/Address.tsx:89 |
| 2079 | - __( 'City:', 'event_espresso' ), |
|
| 2079 | + __('City:', 'event_espresso'), |
|
| 2080 | 2080 | |
| 2081 | 2081 | // Reference: packages/ui-components/src/Address/Address.tsx:97 |
| 2082 | - __( 'State:', 'event_espresso' ), |
|
| 2082 | + __('State:', 'event_espresso'), |
|
| 2083 | 2083 | |
| 2084 | 2084 | // Reference: packages/ui-components/src/CalendarDateRange/CalendarDateRange.tsx:37 |
| 2085 | - __( 'to', 'event_espresso' ), |
|
| 2085 | + __('to', 'event_espresso'), |
|
| 2086 | 2086 | |
| 2087 | 2087 | // Reference: packages/ui-components/src/CalendarPageDate/CalendarPageDate.tsx:54 |
| 2088 | - __( 'TO', 'event_espresso' ), |
|
| 2088 | + __('TO', 'event_espresso'), |
|
| 2089 | 2089 | |
| 2090 | 2090 | // Reference: packages/ui-components/src/ColorPicker/ColorPicker.tsx:60 |
| 2091 | - __( 'Custom color', 'event_espresso' ), |
|
| 2091 | + __('Custom color', 'event_espresso'), |
|
| 2092 | 2092 | |
| 2093 | 2093 | // Reference: packages/ui-components/src/ColorPicker/Swatch.tsx:23 |
| 2094 | 2094 | /* translators: color name */ |
| 2095 | - __( 'Color: %s', 'event_espresso' ), |
|
| 2095 | + __('Color: %s', 'event_espresso'), |
|
| 2096 | 2096 | |
| 2097 | 2097 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:13 |
| 2098 | - __( 'Cyan bluish gray', 'event_espresso' ), |
|
| 2098 | + __('Cyan bluish gray', 'event_espresso'), |
|
| 2099 | 2099 | |
| 2100 | 2100 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:17 |
| 2101 | - __( 'White', 'event_espresso' ), |
|
| 2101 | + __('White', 'event_espresso'), |
|
| 2102 | 2102 | |
| 2103 | 2103 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:21 |
| 2104 | - __( 'Pale pink', 'event_espresso' ), |
|
| 2104 | + __('Pale pink', 'event_espresso'), |
|
| 2105 | 2105 | |
| 2106 | 2106 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:25 |
| 2107 | - __( 'Vivid red', 'event_espresso' ), |
|
| 2107 | + __('Vivid red', 'event_espresso'), |
|
| 2108 | 2108 | |
| 2109 | 2109 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:29 |
| 2110 | - __( 'Luminous vivid orange', 'event_espresso' ), |
|
| 2110 | + __('Luminous vivid orange', 'event_espresso'), |
|
| 2111 | 2111 | |
| 2112 | 2112 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:33 |
| 2113 | - __( 'Luminous vivid amber', 'event_espresso' ), |
|
| 2113 | + __('Luminous vivid amber', 'event_espresso'), |
|
| 2114 | 2114 | |
| 2115 | 2115 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:37 |
| 2116 | - __( 'Light green cyan', 'event_espresso' ), |
|
| 2116 | + __('Light green cyan', 'event_espresso'), |
|
| 2117 | 2117 | |
| 2118 | 2118 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:41 |
| 2119 | - __( 'Vivid green cyan', 'event_espresso' ), |
|
| 2119 | + __('Vivid green cyan', 'event_espresso'), |
|
| 2120 | 2120 | |
| 2121 | 2121 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:45 |
| 2122 | - __( 'Pale cyan blue', 'event_espresso' ), |
|
| 2122 | + __('Pale cyan blue', 'event_espresso'), |
|
| 2123 | 2123 | |
| 2124 | 2124 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:49 |
| 2125 | - __( 'Vivid cyan blue', 'event_espresso' ), |
|
| 2125 | + __('Vivid cyan blue', 'event_espresso'), |
|
| 2126 | 2126 | |
| 2127 | 2127 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:53 |
| 2128 | - __( 'Vivid purple', 'event_espresso' ), |
|
| 2128 | + __('Vivid purple', 'event_espresso'), |
|
| 2129 | 2129 | |
| 2130 | 2130 | // Reference: packages/ui-components/src/ColorPicker/constants.ts:9 |
| 2131 | - __( 'Black', 'event_espresso' ), |
|
| 2131 | + __('Black', 'event_espresso'), |
|
| 2132 | 2132 | |
| 2133 | 2133 | // Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:8 |
| 2134 | 2134 | // Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:24 |
| 2135 | - __( 'Are you sure you want to close this?', 'event_espresso' ), |
|
| 2135 | + __('Are you sure you want to close this?', 'event_espresso'), |
|
| 2136 | 2136 | |
| 2137 | 2137 | // Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:9 |
| 2138 | 2138 | // Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:25 |
| 2139 | - __( 'Yes, discard changes', 'event_espresso' ), |
|
| 2139 | + __('Yes, discard changes', 'event_espresso'), |
|
| 2140 | 2140 | |
| 2141 | 2141 | // Reference: packages/ui-components/src/Confirm/ConfirmDelete.tsx:7 |
| 2142 | - __( 'Are you sure you want to delete this?', 'event_espresso' ), |
|
| 2142 | + __('Are you sure you want to delete this?', 'event_espresso'), |
|
| 2143 | 2143 | |
| 2144 | 2144 | // Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:11 |
| 2145 | - __( 'Please confirm this action.', 'event_espresso' ), |
|
| 2145 | + __('Please confirm this action.', 'event_espresso'), |
|
| 2146 | 2146 | |
| 2147 | 2147 | // Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:39 |
| 2148 | - __( 'cancel', 'event_espresso' ), |
|
| 2148 | + __('cancel', 'event_espresso'), |
|
| 2149 | 2149 | |
| 2150 | 2150 | // Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:40 |
| 2151 | - __( 'confirm', 'event_espresso' ), |
|
| 2151 | + __('confirm', 'event_espresso'), |
|
| 2152 | 2152 | |
| 2153 | 2153 | // Reference: packages/ui-components/src/CurrencyDisplay/CurrencyDisplay.tsx:34 |
| 2154 | - __( 'free', 'event_espresso' ), |
|
| 2154 | + __('free', 'event_espresso'), |
|
| 2155 | 2155 | |
| 2156 | 2156 | // Reference: packages/ui-components/src/DateTimeRangePicker/DateTimeRangePicker.tsx:117 |
| 2157 | 2157 | // Reference: packages/ui-components/src/Popover/PopoverForm/PopoverForm.tsx:44 |
| 2158 | - __( 'save', 'event_espresso' ), |
|
| 2158 | + __('save', 'event_espresso'), |
|
| 2159 | 2159 | |
| 2160 | 2160 | // Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36 |
| 2161 | - __( 'Hide Debug Info', 'event_espresso' ), |
|
| 2161 | + __('Hide Debug Info', 'event_espresso'), |
|
| 2162 | 2162 | |
| 2163 | 2163 | // Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36 |
| 2164 | - __( 'Show Debug Info', 'event_espresso' ), |
|
| 2164 | + __('Show Debug Info', 'event_espresso'), |
|
| 2165 | 2165 | |
| 2166 | 2166 | // Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:49 |
| 2167 | - __( 'Edit Start and End Dates and Times', 'event_espresso' ), |
|
| 2167 | + __('Edit Start and End Dates and Times', 'event_espresso'), |
|
| 2168 | 2168 | |
| 2169 | 2169 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/CopyEntity.tsx:8 |
| 2170 | - __( 'copy', 'event_espresso' ), |
|
| 2170 | + __('copy', 'event_espresso'), |
|
| 2171 | 2171 | |
| 2172 | 2172 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/EditEntity.tsx:8 |
| 2173 | - __( 'edit', 'event_espresso' ), |
|
| 2173 | + __('edit', 'event_espresso'), |
|
| 2174 | 2174 | |
| 2175 | 2175 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/TrashEntity.tsx:8 |
| 2176 | - __( 'trash', 'event_espresso' ), |
|
| 2176 | + __('trash', 'event_espresso'), |
|
| 2177 | 2177 | |
| 2178 | 2178 | // Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Untrash.tsx:8 |
| 2179 | - __( 'untrash', 'event_espresso' ), |
|
| 2179 | + __('untrash', 'event_espresso'), |
|
| 2180 | 2180 | |
| 2181 | 2181 | // Reference: packages/ui-components/src/EntityList/EntityList.tsx:23 |
| 2182 | - __( 'OOPS!', 'event_espresso' ), |
|
| 2182 | + __('OOPS!', 'event_espresso'), |
|
| 2183 | 2183 | |
| 2184 | 2184 | // Reference: packages/ui-components/src/EntityList/EntityList.tsx:23 |
| 2185 | - __( 'Error Loading Entites List', 'event_espresso' ), |
|
| 2185 | + __('Error Loading Entites List', 'event_espresso'), |
|
| 2186 | 2186 | |
| 2187 | 2187 | // Reference: packages/ui-components/src/EntityList/RegistrationsLink/index.tsx:12 |
| 2188 | - __( 'click to open the registrations admin page in a new tab or window', 'event_espresso' ), |
|
| 2188 | + __('click to open the registrations admin page in a new tab or window', 'event_espresso'), |
|
| 2189 | 2189 | |
| 2190 | 2190 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22 |
| 2191 | - __( 'card view', 'event_espresso' ), |
|
| 2191 | + __('card view', 'event_espresso'), |
|
| 2192 | 2192 | |
| 2193 | 2193 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:21 |
| 2194 | - __( 'table view', 'event_espresso' ), |
|
| 2194 | + __('table view', 'event_espresso'), |
|
| 2195 | 2195 | |
| 2196 | 2196 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8 |
| 2197 | - __( 'hide bulk actions', 'event_espresso' ), |
|
| 2197 | + __('hide bulk actions', 'event_espresso'), |
|
| 2198 | 2198 | |
| 2199 | 2199 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8 |
| 2200 | - __( 'show bulk actions', 'event_espresso' ), |
|
| 2200 | + __('show bulk actions', 'event_espresso'), |
|
| 2201 | 2201 | |
| 2202 | 2202 | // Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:23 |
| 2203 | - __( 'filters', 'event_espresso' ), |
|
| 2203 | + __('filters', 'event_espresso'), |
|
| 2204 | 2204 | |
| 2205 | 2205 | // Reference: packages/ui-components/src/Legend/ToggleLegendButton.tsx:38 |
| 2206 | - __( 'legend', 'event_espresso' ), |
|
| 2206 | + __('legend', 'event_espresso'), |
|
| 2207 | 2207 | |
| 2208 | 2208 | // Reference: packages/ui-components/src/LoadingNotice/LoadingNotice.tsx:11 |
| 2209 | - __( 'loading…', 'event_espresso' ), |
|
| 2209 | + __('loading…', 'event_espresso'), |
|
| 2210 | 2210 | |
| 2211 | 2211 | // Reference: packages/ui-components/src/Modal/Modal.tsx:59 |
| 2212 | - __( 'close modal', 'event_espresso' ), |
|
| 2212 | + __('close modal', 'event_espresso'), |
|
| 2213 | 2213 | |
| 2214 | 2214 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:10 |
| 2215 | - __( 'jump to previous', 'event_espresso' ), |
|
| 2215 | + __('jump to previous', 'event_espresso'), |
|
| 2216 | 2216 | |
| 2217 | 2217 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:11 |
| 2218 | - __( 'jump to next', 'event_espresso' ), |
|
| 2218 | + __('jump to next', 'event_espresso'), |
|
| 2219 | 2219 | |
| 2220 | 2220 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:12 |
| 2221 | - __( 'page', 'event_espresso' ), |
|
| 2221 | + __('page', 'event_espresso'), |
|
| 2222 | 2222 | |
| 2223 | 2223 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:8 |
| 2224 | - __( 'previous', 'event_espresso' ), |
|
| 2224 | + __('previous', 'event_espresso'), |
|
| 2225 | 2225 | |
| 2226 | 2226 | // Reference: packages/ui-components/src/Pagination/ItemRender.tsx:9 |
| 2227 | - __( 'next', 'event_espresso' ), |
|
| 2227 | + __('next', 'event_espresso'), |
|
| 2228 | 2228 | |
| 2229 | 2229 | // Reference: packages/ui-components/src/Pagination/PerPage.tsx:45 |
| 2230 | 2230 | /* translators: %1$d is first item #, %2$d is last item #, %3$d is total items, ex: 20-30 of 100 items */ |
| 2231 | - __( '%1$d-%2$d of %3$d items', 'event_espresso' ), |
|
| 2231 | + __('%1$d-%2$d of %3$d items', 'event_espresso'), |
|
| 2232 | 2232 | |
| 2233 | 2233 | // Reference: packages/ui-components/src/Pagination/PerPage.tsx:54 |
| 2234 | - __( 'items per page', 'event_espresso' ), |
|
| 2234 | + __('items per page', 'event_espresso'), |
|
| 2235 | 2235 | |
| 2236 | 2236 | // Reference: packages/ui-components/src/Pagination/constants.ts:11 |
| 2237 | 2237 | /* translators: %s is per page value */ |
| 2238 | - __( '%s / page', 'event_espresso' ), |
|
| 2238 | + __('%s / page', 'event_espresso'), |
|
| 2239 | 2239 | |
| 2240 | 2240 | // Reference: packages/ui-components/src/Pagination/constants.ts:12 |
| 2241 | - __( 'show all', 'event_espresso' ), |
|
| 2241 | + __('show all', 'event_espresso'), |
|
| 2242 | 2242 | |
| 2243 | 2243 | // Reference: packages/ui-components/src/Pagination/constants.ts:15 |
| 2244 | - __( 'Next Page', 'event_espresso' ), |
|
| 2244 | + __('Next Page', 'event_espresso'), |
|
| 2245 | 2245 | |
| 2246 | 2246 | // Reference: packages/ui-components/src/Pagination/constants.ts:16 |
| 2247 | - __( 'Previous Page', 'event_espresso' ), |
|
| 2247 | + __('Previous Page', 'event_espresso'), |
|
| 2248 | 2248 | |
| 2249 | 2249 | // Reference: packages/ui-components/src/PercentSign/index.tsx:10 |
| 2250 | - __( '%', 'event_espresso' ), |
|
| 2250 | + __('%', 'event_espresso'), |
|
| 2251 | 2251 | |
| 2252 | 2252 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:31 |
| 2253 | 2253 | /* translators: entity type to select */ |
| 2254 | - __( 'Select an existing %s to use as a template.', 'event_espresso' ), |
|
| 2254 | + __('Select an existing %s to use as a template.', 'event_espresso'), |
|
| 2255 | 2255 | |
| 2256 | 2256 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:38 |
| 2257 | - __( 'or', 'event_espresso' ), |
|
| 2257 | + __('or', 'event_espresso'), |
|
| 2258 | 2258 | |
| 2259 | 2259 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:43 |
| 2260 | 2260 | /* translators: entity type to add */ |
| 2261 | - __( 'Add a new %s and insert details manually', 'event_espresso' ), |
|
| 2261 | + __('Add a new %s and insert details manually', 'event_espresso'), |
|
| 2262 | 2262 | |
| 2263 | 2263 | // Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:48 |
| 2264 | - __( 'Add New', 'event_espresso' ), |
|
| 2264 | + __('Add New', 'event_espresso'), |
|
| 2265 | 2265 | |
| 2266 | 2266 | // Reference: packages/ui-components/src/Stepper/buttons/Next.tsx:8 |
| 2267 | - __( 'Next', 'event_espresso' ), |
|
| 2267 | + __('Next', 'event_espresso'), |
|
| 2268 | 2268 | |
| 2269 | 2269 | // Reference: packages/ui-components/src/Stepper/buttons/Previous.tsx:8 |
| 2270 | - __( 'Previous', 'event_espresso' ), |
|
| 2270 | + __('Previous', 'event_espresso'), |
|
| 2271 | 2271 | |
| 2272 | 2272 | // Reference: packages/ui-components/src/Steps/Steps.tsx:31 |
| 2273 | - __( 'Steps', 'event_espresso' ), |
|
| 2273 | + __('Steps', 'event_espresso'), |
|
| 2274 | 2274 | |
| 2275 | 2275 | // Reference: packages/ui-components/src/TabbableText/index.tsx:21 |
| 2276 | - __( 'click to edit…', 'event_espresso' ), |
|
| 2276 | + __('click to edit…', 'event_espresso'), |
|
| 2277 | 2277 | |
| 2278 | 2278 | // Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:14 |
| 2279 | - __( 'The Website\'s Time Zone', 'event_espresso' ), |
|
| 2279 | + __('The Website\'s Time Zone', 'event_espresso'), |
|
| 2280 | 2280 | |
| 2281 | 2281 | // Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:19 |
| 2282 | - __( 'UTC (Greenwich Mean Time)', 'event_espresso' ), |
|
| 2282 | + __('UTC (Greenwich Mean Time)', 'event_espresso'), |
|
| 2283 | 2283 | |
| 2284 | 2284 | // Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:9 |
| 2285 | - __( 'Your Local Time Zone', 'event_espresso' ), |
|
| 2285 | + __('Your Local Time Zone', 'event_espresso'), |
|
| 2286 | 2286 | |
| 2287 | 2287 | // Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:25 |
| 2288 | - __( 'click for timezone information', 'event_espresso' ), |
|
| 2288 | + __('click for timezone information', 'event_espresso'), |
|
| 2289 | 2289 | |
| 2290 | 2290 | // Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:30 |
| 2291 | - __( 'This Date Converted To:', 'event_espresso' ), |
|
| 2291 | + __('This Date Converted To:', 'event_espresso'), |
|
| 2292 | 2292 | |
| 2293 | 2293 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:120 |
| 2294 | - __( 'Add New Venue', 'event_espresso' ), |
|
| 2294 | + __('Add New Venue', 'event_espresso'), |
|
| 2295 | 2295 | |
| 2296 | 2296 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:36 |
| 2297 | - __( '~ no venue ~', 'event_espresso' ), |
|
| 2297 | + __('~ no venue ~', 'event_espresso'), |
|
| 2298 | 2298 | |
| 2299 | 2299 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:43 |
| 2300 | - __( 'assign venue…', 'event_espresso' ), |
|
| 2300 | + __('assign venue…', 'event_espresso'), |
|
| 2301 | 2301 | |
| 2302 | 2302 | // Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:44 |
| 2303 | - __( 'click to select a venue…', 'event_espresso' ), |
|
| 2303 | + __('click to select a venue…', 'event_espresso'), |
|
| 2304 | 2304 | |
| 2305 | 2305 | // Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:51 |
| 2306 | - __( 'select all', 'event_espresso' ), |
|
| 2306 | + __('select all', 'event_espresso'), |
|
| 2307 | 2307 | |
| 2308 | 2308 | // Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:54 |
| 2309 | - __( 'apply', 'event_espresso' ) |
|
| 2309 | + __('apply', 'event_espresso') |
|
| 2310 | 2310 | ); |
| 2311 | 2311 | /* THIS IS THE END OF THE GENERATED FILE */ |
@@ -14,252 +14,252 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * class constructor |
|
| 19 | - * |
|
| 20 | - * @access public |
|
| 21 | - * @param EE_Checkout $checkout |
|
| 22 | - */ |
|
| 23 | - public function __construct(EE_Checkout $checkout) |
|
| 24 | - { |
|
| 25 | - $this->request = EED_Single_Page_Checkout::getRequest(); |
|
| 26 | - $this->_slug = 'finalize_registration'; |
|
| 27 | - $this->_name = esc_html__('Finalize Registration', 'event_espresso'); |
|
| 28 | - $this->_submit_button_text = $this->_name; |
|
| 29 | - $this->_template = ''; |
|
| 30 | - $this->checkout = $checkout; |
|
| 31 | - } |
|
| 17 | + /** |
|
| 18 | + * class constructor |
|
| 19 | + * |
|
| 20 | + * @access public |
|
| 21 | + * @param EE_Checkout $checkout |
|
| 22 | + */ |
|
| 23 | + public function __construct(EE_Checkout $checkout) |
|
| 24 | + { |
|
| 25 | + $this->request = EED_Single_Page_Checkout::getRequest(); |
|
| 26 | + $this->_slug = 'finalize_registration'; |
|
| 27 | + $this->_name = esc_html__('Finalize Registration', 'event_espresso'); |
|
| 28 | + $this->_submit_button_text = $this->_name; |
|
| 29 | + $this->_template = ''; |
|
| 30 | + $this->checkout = $checkout; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function translate_js_strings() |
|
| 35 | - { |
|
| 36 | - } |
|
| 34 | + public function translate_js_strings() |
|
| 35 | + { |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - public function enqueue_styles_and_scripts() |
|
| 40 | - { |
|
| 41 | - } |
|
| 39 | + public function enqueue_styles_and_scripts() |
|
| 40 | + { |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @return boolean |
|
| 46 | - */ |
|
| 47 | - public function initialize_reg_step() |
|
| 48 | - { |
|
| 49 | - // there's actually no reg form to process if this is the final step |
|
| 50 | - if ($this->is_current_step()) { |
|
| 51 | - $this->checkout->step = $this->slug(); |
|
| 52 | - $this->checkout->action = 'process_reg_step'; |
|
| 53 | - $this->checkout->generate_reg_form = false; |
|
| 54 | - $this->request->setRequestParam('step', $this->checkout->step); |
|
| 55 | - $this->request->setRequestParam('action', $this->checkout->action); |
|
| 56 | - } |
|
| 57 | - return true; |
|
| 58 | - } |
|
| 44 | + /** |
|
| 45 | + * @return boolean |
|
| 46 | + */ |
|
| 47 | + public function initialize_reg_step() |
|
| 48 | + { |
|
| 49 | + // there's actually no reg form to process if this is the final step |
|
| 50 | + if ($this->is_current_step()) { |
|
| 51 | + $this->checkout->step = $this->slug(); |
|
| 52 | + $this->checkout->action = 'process_reg_step'; |
|
| 53 | + $this->checkout->generate_reg_form = false; |
|
| 54 | + $this->request->setRequestParam('step', $this->checkout->step); |
|
| 55 | + $this->request->setRequestParam('action', $this->checkout->action); |
|
| 56 | + } |
|
| 57 | + return true; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 64 | - public function generate_reg_form() |
|
| 65 | - { |
|
| 66 | - // create empty form so that things don't break |
|
| 67 | - $this->reg_form = new EE_Form_Section_Proper(); |
|
| 68 | - return ''; |
|
| 69 | - } |
|
| 61 | + /** |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | + public function generate_reg_form() |
|
| 65 | + { |
|
| 66 | + // create empty form so that things don't break |
|
| 67 | + $this->reg_form = new EE_Form_Section_Proper(); |
|
| 68 | + return ''; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @return boolean |
|
| 74 | - * @throws RuntimeException |
|
| 75 | - * @throws EE_Error |
|
| 76 | - * @throws ReflectionException |
|
| 77 | - */ |
|
| 78 | - public function process_reg_step() |
|
| 79 | - { |
|
| 80 | - // ensure all data gets refreshed from the db |
|
| 81 | - $this->checkout->refresh_all_entities(true); |
|
| 82 | - // ensures that all details and statuses for transaction, registration, and payments are updated |
|
| 83 | - $txn_update_params = $this->_finalize_transaction(); |
|
| 84 | - // maybe send messages |
|
| 85 | - $this->_set_notification_triggers(); |
|
| 86 | - // send messages |
|
| 87 | - /** @type EE_Registration_Processor $registration_processor */ |
|
| 88 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 89 | - $registration_processor->trigger_registration_update_notifications( |
|
| 90 | - $this->checkout->transaction->primary_registration(), |
|
| 91 | - $txn_update_params |
|
| 92 | - ); |
|
| 93 | - // set a hook point |
|
| 94 | - do_action( |
|
| 95 | - 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', |
|
| 96 | - $this->checkout, |
|
| 97 | - $txn_update_params |
|
| 98 | - ); |
|
| 99 | - // check if transaction has a primary registrant and that it has a related Attendee object |
|
| 100 | - if (! $this->_validate_primary_registrant()) { |
|
| 101 | - return false; |
|
| 102 | - } |
|
| 103 | - // you don't have to go home but you can't stay here ! |
|
| 104 | - $this->checkout->redirect = true; |
|
| 105 | - $this->checkout->continue_reg = true; |
|
| 106 | - $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 107 | - if ( |
|
| 108 | - ! ( |
|
| 109 | - $this->checkout->payment_method instanceof EE_Payment_Method |
|
| 110 | - && $this->checkout->payment_method->is_off_site() |
|
| 111 | - ) |
|
| 112 | - ) { |
|
| 113 | - // mark this reg step as completed |
|
| 114 | - $this->set_completed(); |
|
| 115 | - } |
|
| 116 | - $this->checkout->set_exit_spco(); |
|
| 117 | - return true; |
|
| 118 | - } |
|
| 72 | + /** |
|
| 73 | + * @return boolean |
|
| 74 | + * @throws RuntimeException |
|
| 75 | + * @throws EE_Error |
|
| 76 | + * @throws ReflectionException |
|
| 77 | + */ |
|
| 78 | + public function process_reg_step() |
|
| 79 | + { |
|
| 80 | + // ensure all data gets refreshed from the db |
|
| 81 | + $this->checkout->refresh_all_entities(true); |
|
| 82 | + // ensures that all details and statuses for transaction, registration, and payments are updated |
|
| 83 | + $txn_update_params = $this->_finalize_transaction(); |
|
| 84 | + // maybe send messages |
|
| 85 | + $this->_set_notification_triggers(); |
|
| 86 | + // send messages |
|
| 87 | + /** @type EE_Registration_Processor $registration_processor */ |
|
| 88 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 89 | + $registration_processor->trigger_registration_update_notifications( |
|
| 90 | + $this->checkout->transaction->primary_registration(), |
|
| 91 | + $txn_update_params |
|
| 92 | + ); |
|
| 93 | + // set a hook point |
|
| 94 | + do_action( |
|
| 95 | + 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', |
|
| 96 | + $this->checkout, |
|
| 97 | + $txn_update_params |
|
| 98 | + ); |
|
| 99 | + // check if transaction has a primary registrant and that it has a related Attendee object |
|
| 100 | + if (! $this->_validate_primary_registrant()) { |
|
| 101 | + return false; |
|
| 102 | + } |
|
| 103 | + // you don't have to go home but you can't stay here ! |
|
| 104 | + $this->checkout->redirect = true; |
|
| 105 | + $this->checkout->continue_reg = true; |
|
| 106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 107 | + if ( |
|
| 108 | + ! ( |
|
| 109 | + $this->checkout->payment_method instanceof EE_Payment_Method |
|
| 110 | + && $this->checkout->payment_method->is_off_site() |
|
| 111 | + ) |
|
| 112 | + ) { |
|
| 113 | + // mark this reg step as completed |
|
| 114 | + $this->set_completed(); |
|
| 115 | + } |
|
| 116 | + $this->checkout->set_exit_spco(); |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * _finalize_transaction |
|
| 123 | - * ensures that all details and statuses for transaction, registration, and payments are updated |
|
| 124 | - * |
|
| 125 | - * @return array |
|
| 126 | - * @throws RuntimeException |
|
| 127 | - * @throws EE_Error |
|
| 128 | - * @throws ReflectionException |
|
| 129 | - */ |
|
| 130 | - protected function _finalize_transaction() |
|
| 131 | - { |
|
| 132 | - /** @type EE_Transaction_Processor $transaction_processor */ |
|
| 133 | - $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 134 | - // set revisit flag in txn processor |
|
| 135 | - $transaction_processor->set_revisit($this->checkout->revisit); |
|
| 136 | - // at this point we'll consider a TXN to not have been abandoned |
|
| 137 | - $this->checkout->transaction->toggle_abandoned_transaction_status(); |
|
| 138 | - if ($this->checkout->cart instanceof EE_Cart) { |
|
| 139 | - // save TXN data to the cart |
|
| 140 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
|
| 141 | - $this->checkout->transaction->ID() |
|
| 142 | - ); |
|
| 143 | - } |
|
| 144 | - // maybe update status, but don't save transaction just yet |
|
| 145 | - $this->checkout->transaction->update_status_based_on_total_paid(false); |
|
| 146 | - // this will result in the base session properties getting saved to the TXN_Session_data field |
|
| 147 | - $session_data = EE_Registry::instance()->SSN->get_session_data(null, true); |
|
| 148 | - // anonymize the last part of the IP address, now that the transaction is complete (we won't be using the IP address |
|
| 149 | - // for spam or bot detection now) |
|
| 150 | - if (function_exists('wp_privacy_anonymize_ip') && isset($session_data['ip_address'])) { |
|
| 151 | - $session_data['ip_address'] = wp_privacy_anonymize_ip($session_data['ip_address']); |
|
| 152 | - } |
|
| 153 | - $this->checkout->transaction->set_txn_session_data($session_data); |
|
| 154 | - // update the TXN if payment conditions have changed, but do NOT trigger notifications, |
|
| 155 | - // because we will do that in process_reg_step() after setting some more triggers |
|
| 156 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
| 157 | - $this->checkout->transaction, |
|
| 158 | - $this->checkout->payment instanceof EE_Payment ? $this->checkout->payment : null, |
|
| 159 | - $this->checkout->reg_cache_where_params, |
|
| 160 | - false |
|
| 161 | - ); |
|
| 162 | - } |
|
| 121 | + /** |
|
| 122 | + * _finalize_transaction |
|
| 123 | + * ensures that all details and statuses for transaction, registration, and payments are updated |
|
| 124 | + * |
|
| 125 | + * @return array |
|
| 126 | + * @throws RuntimeException |
|
| 127 | + * @throws EE_Error |
|
| 128 | + * @throws ReflectionException |
|
| 129 | + */ |
|
| 130 | + protected function _finalize_transaction() |
|
| 131 | + { |
|
| 132 | + /** @type EE_Transaction_Processor $transaction_processor */ |
|
| 133 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 134 | + // set revisit flag in txn processor |
|
| 135 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
| 136 | + // at this point we'll consider a TXN to not have been abandoned |
|
| 137 | + $this->checkout->transaction->toggle_abandoned_transaction_status(); |
|
| 138 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
| 139 | + // save TXN data to the cart |
|
| 140 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
|
| 141 | + $this->checkout->transaction->ID() |
|
| 142 | + ); |
|
| 143 | + } |
|
| 144 | + // maybe update status, but don't save transaction just yet |
|
| 145 | + $this->checkout->transaction->update_status_based_on_total_paid(false); |
|
| 146 | + // this will result in the base session properties getting saved to the TXN_Session_data field |
|
| 147 | + $session_data = EE_Registry::instance()->SSN->get_session_data(null, true); |
|
| 148 | + // anonymize the last part of the IP address, now that the transaction is complete (we won't be using the IP address |
|
| 149 | + // for spam or bot detection now) |
|
| 150 | + if (function_exists('wp_privacy_anonymize_ip') && isset($session_data['ip_address'])) { |
|
| 151 | + $session_data['ip_address'] = wp_privacy_anonymize_ip($session_data['ip_address']); |
|
| 152 | + } |
|
| 153 | + $this->checkout->transaction->set_txn_session_data($session_data); |
|
| 154 | + // update the TXN if payment conditions have changed, but do NOT trigger notifications, |
|
| 155 | + // because we will do that in process_reg_step() after setting some more triggers |
|
| 156 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
| 157 | + $this->checkout->transaction, |
|
| 158 | + $this->checkout->payment instanceof EE_Payment ? $this->checkout->payment : null, |
|
| 159 | + $this->checkout->reg_cache_where_params, |
|
| 160 | + false |
|
| 161 | + ); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * If request is not a revisit, and an Off-Site gateway using IPNs has NOT been selected... |
|
| 167 | - * OR |
|
| 168 | - * if it IS a revisit and the TXN and/or one or more REG statuses have changed... |
|
| 169 | - * then trigger notifications |
|
| 170 | - * |
|
| 171 | - * @return void |
|
| 172 | - * @throws EE_Error |
|
| 173 | - * @throws ReflectionException |
|
| 174 | - */ |
|
| 175 | - protected function _set_notification_triggers() |
|
| 176 | - { |
|
| 165 | + /** |
|
| 166 | + * If request is not a revisit, and an Off-Site gateway using IPNs has NOT been selected... |
|
| 167 | + * OR |
|
| 168 | + * if it IS a revisit and the TXN and/or one or more REG statuses have changed... |
|
| 169 | + * then trigger notifications |
|
| 170 | + * |
|
| 171 | + * @return void |
|
| 172 | + * @throws EE_Error |
|
| 173 | + * @throws ReflectionException |
|
| 174 | + */ |
|
| 175 | + protected function _set_notification_triggers() |
|
| 176 | + { |
|
| 177 | 177 | |
| 178 | - if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
| 179 | - // let's start with the assumption that we need to trigger notifications |
|
| 180 | - // then toggle this to false for conditions where we know we don't need to |
|
| 181 | - $deliver_notifications = true; |
|
| 182 | - if ( |
|
| 178 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
| 179 | + // let's start with the assumption that we need to trigger notifications |
|
| 180 | + // then toggle this to false for conditions where we know we don't need to |
|
| 181 | + $deliver_notifications = true; |
|
| 182 | + if ( |
|
| 183 | 183 | // if SPCO revisit |
| 184 | - filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) |
|
| 185 | - // and TXN or REG statuses have NOT changed due to a payment |
|
| 186 | - && ! ( |
|
| 187 | - $this->checkout->transaction->txn_status_updated() |
|
| 188 | - || $this->checkout->any_reg_status_updated() |
|
| 189 | - ) |
|
| 190 | - ) { |
|
| 191 | - $deliver_notifications = false; |
|
| 192 | - } |
|
| 193 | - if ($this->checkout->payment_method->is_off_site()) { |
|
| 194 | - /** @var EE_Gateway $gateway */ |
|
| 195 | - $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
| 196 | - // and the gateway uses a separate request to process the IPN |
|
| 197 | - /** @var RequestInterface $request */ |
|
| 198 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
| 199 | - if ( |
|
| 200 | - $gateway instanceof EE_Offsite_Gateway |
|
| 201 | - && $gateway->handle_IPN_in_this_request($request->requestParams(), true) |
|
| 202 | - ) { |
|
| 203 | - // IPN request will handle triggering notifications |
|
| 204 | - $deliver_notifications = false; |
|
| 205 | - // no really... don't send any notices in this request |
|
| 206 | - remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
| 207 | - add_filter( |
|
| 208 | - 'FHEE__EED_Messages___maybe_registration__deliver_notifications', |
|
| 209 | - '__return_false', |
|
| 210 | - 15 |
|
| 211 | - ); |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - if ($deliver_notifications) { |
|
| 215 | - // send out notifications |
|
| 216 | - add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 217 | - } |
|
| 218 | - } |
|
| 219 | - } |
|
| 184 | + filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) |
|
| 185 | + // and TXN or REG statuses have NOT changed due to a payment |
|
| 186 | + && ! ( |
|
| 187 | + $this->checkout->transaction->txn_status_updated() |
|
| 188 | + || $this->checkout->any_reg_status_updated() |
|
| 189 | + ) |
|
| 190 | + ) { |
|
| 191 | + $deliver_notifications = false; |
|
| 192 | + } |
|
| 193 | + if ($this->checkout->payment_method->is_off_site()) { |
|
| 194 | + /** @var EE_Gateway $gateway */ |
|
| 195 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
| 196 | + // and the gateway uses a separate request to process the IPN |
|
| 197 | + /** @var RequestInterface $request */ |
|
| 198 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
| 199 | + if ( |
|
| 200 | + $gateway instanceof EE_Offsite_Gateway |
|
| 201 | + && $gateway->handle_IPN_in_this_request($request->requestParams(), true) |
|
| 202 | + ) { |
|
| 203 | + // IPN request will handle triggering notifications |
|
| 204 | + $deliver_notifications = false; |
|
| 205 | + // no really... don't send any notices in this request |
|
| 206 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
| 207 | + add_filter( |
|
| 208 | + 'FHEE__EED_Messages___maybe_registration__deliver_notifications', |
|
| 209 | + '__return_false', |
|
| 210 | + 15 |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + if ($deliver_notifications) { |
|
| 215 | + // send out notifications |
|
| 216 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * check if transaction has a primary registrant and that it has a related Attendee object |
|
| 224 | - * |
|
| 225 | - * @return boolean |
|
| 226 | - * @throws EE_Error |
|
| 227 | - * @throws ReflectionException |
|
| 228 | - */ |
|
| 229 | - protected function _validate_primary_registrant() |
|
| 230 | - { |
|
| 231 | - if (! $this->checkout->transaction_has_primary_registrant()) { |
|
| 232 | - EE_Error::add_error( |
|
| 233 | - esc_html__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
|
| 234 | - __FILE__, |
|
| 235 | - __FUNCTION__, |
|
| 236 | - __LINE__ |
|
| 237 | - ); |
|
| 238 | - $this->checkout->redirect = false; |
|
| 239 | - $this->checkout->continue_reg = false; |
|
| 240 | - return false; |
|
| 241 | - } |
|
| 242 | - // setup URL for redirect |
|
| 243 | - $this->checkout->redirect_url = add_query_arg( |
|
| 244 | - ['e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()], |
|
| 245 | - $this->checkout->thank_you_page_url |
|
| 246 | - ); |
|
| 247 | - return true; |
|
| 248 | - } |
|
| 222 | + /** |
|
| 223 | + * check if transaction has a primary registrant and that it has a related Attendee object |
|
| 224 | + * |
|
| 225 | + * @return boolean |
|
| 226 | + * @throws EE_Error |
|
| 227 | + * @throws ReflectionException |
|
| 228 | + */ |
|
| 229 | + protected function _validate_primary_registrant() |
|
| 230 | + { |
|
| 231 | + if (! $this->checkout->transaction_has_primary_registrant()) { |
|
| 232 | + EE_Error::add_error( |
|
| 233 | + esc_html__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
|
| 234 | + __FILE__, |
|
| 235 | + __FUNCTION__, |
|
| 236 | + __LINE__ |
|
| 237 | + ); |
|
| 238 | + $this->checkout->redirect = false; |
|
| 239 | + $this->checkout->continue_reg = false; |
|
| 240 | + return false; |
|
| 241 | + } |
|
| 242 | + // setup URL for redirect |
|
| 243 | + $this->checkout->redirect_url = add_query_arg( |
|
| 244 | + ['e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()], |
|
| 245 | + $this->checkout->thank_you_page_url |
|
| 246 | + ); |
|
| 247 | + return true; |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * @return void |
|
| 253 | - */ |
|
| 254 | - public function update_reg_step() |
|
| 255 | - { |
|
| 256 | - EE_Error::doing_it_wrong( |
|
| 257 | - __CLASS__ . '::' . __FILE__, |
|
| 258 | - esc_html__( |
|
| 259 | - 'Can not call update_reg_step() on the Finalize Registration reg step.', |
|
| 260 | - 'event_espresso' |
|
| 261 | - ), |
|
| 262 | - '4.6.0' |
|
| 263 | - ); |
|
| 264 | - } |
|
| 251 | + /** |
|
| 252 | + * @return void |
|
| 253 | + */ |
|
| 254 | + public function update_reg_step() |
|
| 255 | + { |
|
| 256 | + EE_Error::doing_it_wrong( |
|
| 257 | + __CLASS__ . '::' . __FILE__, |
|
| 258 | + esc_html__( |
|
| 259 | + 'Can not call update_reg_step() on the Finalize Registration reg step.', |
|
| 260 | + 'event_espresso' |
|
| 261 | + ), |
|
| 262 | + '4.6.0' |
|
| 263 | + ); |
|
| 264 | + } |
|
| 265 | 265 | } |
@@ -23,1376 +23,1376 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class EED_Core_Rest_Api extends EED_Module |
| 25 | 25 | { |
| 26 | - const ee_api_namespace = Domain::API_NAMESPACE; |
|
| 27 | - |
|
| 28 | - const ee_api_namespace_for_regex = 'ee\/v([^/]*)\/'; |
|
| 29 | - |
|
| 30 | - const saved_routes_option_names = 'ee_core_routes'; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * string used in _links response bodies to make them globally unique. |
|
| 34 | - * |
|
| 35 | - * @see http://v2.wp-api.org/extending/linking/ |
|
| 36 | - */ |
|
| 37 | - const ee_api_link_namespace = 'https://api.eventespresso.com/'; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var CalculatedModelFields |
|
| 41 | - */ |
|
| 42 | - protected static $_field_calculator; |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @return EED_Core_Rest_Api|EED_Module |
|
| 47 | - */ |
|
| 48 | - public static function instance() |
|
| 49 | - { |
|
| 50 | - return parent::get_instance(EED_Core_Rest_Api::class); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
| 56 | - * |
|
| 57 | - * @access public |
|
| 58 | - * @return void |
|
| 59 | - */ |
|
| 60 | - public static function set_hooks() |
|
| 61 | - { |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
| 67 | - * |
|
| 68 | - * @access public |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - public static function set_hooks_admin() |
|
| 72 | - { |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - public static function set_hooks_both() |
|
| 77 | - { |
|
| 78 | - add_action('rest_api_init', ['EED_Core_Rest_Api', 'set_hooks_rest_api'], 5); |
|
| 79 | - add_action('rest_api_init', ['EED_Core_Rest_Api', 'register_routes'], 10); |
|
| 80 | - add_filter('rest_route_data', ['EED_Core_Rest_Api', 'hide_old_endpoints'], 10, 2); |
|
| 81 | - add_filter( |
|
| 82 | - 'rest_index', |
|
| 83 | - ['EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filterEeMetadataIntoIndex'] |
|
| 84 | - ); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @since 5.0.0.p |
|
| 90 | - */ |
|
| 91 | - public static function loadCalculatedModelFields() |
|
| 92 | - { |
|
| 93 | - EED_Core_Rest_Api::$_field_calculator = LoaderFactory::getLoader()->load( |
|
| 94 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' |
|
| 95 | - ); |
|
| 96 | - EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change(); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * sets up hooks which only need to be included as part of REST API requests; |
|
| 102 | - * other requests like to the frontend or admin etc don't need them |
|
| 103 | - * |
|
| 104 | - * @throws EE_Error |
|
| 105 | - */ |
|
| 106 | - public static function set_hooks_rest_api() |
|
| 107 | - { |
|
| 108 | - // set hooks which account for changes made to the API |
|
| 109 | - EED_Core_Rest_Api::_set_hooks_for_changes(); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * public wrapper of _set_hooks_for_changes. |
|
| 115 | - * Loads all the hooks which make requests to old versions of the API |
|
| 116 | - * appear the same as they always did |
|
| 117 | - * |
|
| 118 | - * @throws EE_Error |
|
| 119 | - */ |
|
| 120 | - public static function set_hooks_for_changes() |
|
| 121 | - { |
|
| 122 | - EED_Core_Rest_Api::_set_hooks_for_changes(); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Loads all the hooks which make requests to old versions of the API |
|
| 128 | - * appear the same as they always did |
|
| 129 | - * |
|
| 130 | - * @throws EE_Error |
|
| 131 | - */ |
|
| 132 | - protected static function _set_hooks_for_changes() |
|
| 133 | - { |
|
| 134 | - $folder_contents = EEH_File::get_contents_of_folders([EE_LIBRARIES . 'rest_api/changes'], false); |
|
| 135 | - foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
| 136 | - // ignore the base parent class |
|
| 137 | - // and legacy named classes |
|
| 138 | - if ( |
|
| 139 | - $classname_in_namespace === 'ChangesInBase' |
|
| 140 | - || strpos($classname_in_namespace, 'Changes_In_') === 0 |
|
| 141 | - ) { |
|
| 142 | - continue; |
|
| 143 | - } |
|
| 144 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
| 145 | - if (class_exists($full_classname)) { |
|
| 146 | - $instance_of_class = new $full_classname(); |
|
| 147 | - if ($instance_of_class instanceof ChangesInBase) { |
|
| 148 | - $instance_of_class->setHooks(); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Filters the WP routes to add our EE-related ones. This takes a bit of time |
|
| 157 | - * so we actually prefer to only do it when an EE plugin is activated or upgraded |
|
| 158 | - * |
|
| 159 | - * @throws EE_Error |
|
| 160 | - * @throws ReflectionException |
|
| 161 | - */ |
|
| 162 | - public static function register_routes() |
|
| 163 | - { |
|
| 164 | - foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_routes) { |
|
| 165 | - foreach ($relative_routes as $relative_route => $data_for_multiple_endpoints) { |
|
| 166 | - /** |
|
| 167 | - * @var array $data_for_multiple_endpoints numerically indexed array |
|
| 168 | - * but can also contain route options like { |
|
| 169 | - * @type array $schema { |
|
| 170 | - * @type callable $schema_callback |
|
| 171 | - * @type array $callback_args arguments that will be passed to the callback, after the |
|
| 172 | - * WP_REST_Request of course |
|
| 173 | - * } |
|
| 174 | - * } |
|
| 175 | - */ |
|
| 176 | - // when registering routes, register all the endpoints' data at the same time |
|
| 177 | - $multiple_endpoint_args = []; |
|
| 178 | - foreach ($data_for_multiple_endpoints as $endpoint_key => $data_for_single_endpoint) { |
|
| 179 | - /** |
|
| 180 | - * @var array $data_for_single_endpoint { |
|
| 181 | - * @type callable $callback |
|
| 182 | - * @type string methods |
|
| 183 | - * @type array args |
|
| 184 | - * @type array _links |
|
| 185 | - * @type array $callback_args arguments that will be passed to the callback, after the |
|
| 186 | - * WP_REST_Request of course |
|
| 187 | - * } |
|
| 188 | - */ |
|
| 189 | - // skip route options |
|
| 190 | - if (! is_numeric($endpoint_key)) { |
|
| 191 | - continue; |
|
| 192 | - } |
|
| 193 | - if (! isset($data_for_single_endpoint['callback'], $data_for_single_endpoint['methods'])) { |
|
| 194 | - throw new EE_Error( |
|
| 195 | - esc_html__( |
|
| 196 | - // @codingStandardsIgnoreStart |
|
| 197 | - 'Endpoint configuration data needs to have entries "callback" (callable) and "methods" (comma-separated list of accepts HTTP methods).', |
|
| 198 | - // @codingStandardsIgnoreEnd |
|
| 199 | - 'event_espresso' |
|
| 200 | - ) |
|
| 201 | - ); |
|
| 202 | - } |
|
| 203 | - $callback = $data_for_single_endpoint['callback']; |
|
| 204 | - $single_endpoint_args = [ |
|
| 205 | - 'methods' => $data_for_single_endpoint['methods'], |
|
| 206 | - 'args' => isset($data_for_single_endpoint['args']) ? $data_for_single_endpoint['args'] |
|
| 207 | - : [], |
|
| 208 | - ]; |
|
| 209 | - if (isset($data_for_single_endpoint['_links'])) { |
|
| 210 | - $single_endpoint_args['_links'] = $data_for_single_endpoint['_links']; |
|
| 211 | - } |
|
| 212 | - if (isset($data_for_single_endpoint['callback_args'])) { |
|
| 213 | - $callback_args = $data_for_single_endpoint['callback_args']; |
|
| 214 | - $single_endpoint_args['callback'] = static function (WP_REST_Request $request) use ( |
|
| 215 | - $callback, |
|
| 216 | - $callback_args |
|
| 217 | - ) { |
|
| 218 | - array_unshift($callback_args, $request); |
|
| 219 | - return call_user_func_array( |
|
| 220 | - $callback, |
|
| 221 | - $callback_args |
|
| 222 | - ); |
|
| 223 | - }; |
|
| 224 | - } else { |
|
| 225 | - $single_endpoint_args['callback'] = $data_for_single_endpoint['callback']; |
|
| 226 | - } |
|
| 227 | - // As of WordPress 5.5, if a permission_callback is not provided, |
|
| 228 | - // the REST API will issue a _doing_it_wrong notice. |
|
| 229 | - // Since the EE REST API defers capabilities to the db model system, |
|
| 230 | - // we will just use the generic WP callback for public endpoints |
|
| 231 | - if (! isset($single_endpoint_args['permission_callback'])) { |
|
| 232 | - $single_endpoint_args['permission_callback'] = '__return_true'; |
|
| 233 | - } |
|
| 234 | - $multiple_endpoint_args[] = $single_endpoint_args; |
|
| 235 | - } |
|
| 236 | - if (isset($data_for_multiple_endpoints['schema'])) { |
|
| 237 | - $schema_route_data = $data_for_multiple_endpoints['schema']; |
|
| 238 | - $schema_callback = $schema_route_data['schema_callback']; |
|
| 239 | - $callback_args = $schema_route_data['callback_args']; |
|
| 240 | - $multiple_endpoint_args['schema'] = static function () use ($schema_callback, $callback_args) { |
|
| 241 | - return call_user_func_array( |
|
| 242 | - $schema_callback, |
|
| 243 | - $callback_args |
|
| 244 | - ); |
|
| 245 | - }; |
|
| 246 | - } |
|
| 247 | - register_rest_route( |
|
| 248 | - $namespace, |
|
| 249 | - $relative_route, |
|
| 250 | - $multiple_endpoint_args |
|
| 251 | - ); |
|
| 252 | - } |
|
| 253 | - } |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * Checks if there was a version change or something that merits invalidating the cached |
|
| 259 | - * route data. If so, invalidates the cached route data so that it gets refreshed |
|
| 260 | - * next time the WP API is used |
|
| 261 | - */ |
|
| 262 | - public static function invalidate_cached_route_data_on_version_change() |
|
| 263 | - { |
|
| 264 | - if (EE_System::instance()->detect_req_type() !== EE_System::req_type_normal) { |
|
| 265 | - EED_Core_Rest_Api::invalidate_cached_route_data(); |
|
| 266 | - } |
|
| 267 | - foreach (EE_Registry::instance()->addons as $addon) { |
|
| 268 | - if ($addon instanceof EE_Addon && $addon->detect_req_type() !== EE_System::req_type_normal) { |
|
| 269 | - EED_Core_Rest_Api::invalidate_cached_route_data(); |
|
| 270 | - } |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * Removes the cached route data so it will get refreshed next time the WP API is used |
|
| 277 | - */ |
|
| 278 | - public static function invalidate_cached_route_data() |
|
| 279 | - { |
|
| 280 | - // delete the saved EE REST API routes |
|
| 281 | - foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) { |
|
| 282 | - delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version); |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * Gets the EE route data |
|
| 289 | - * |
|
| 290 | - * @return array top-level key is the namespace, next-level key is the route and its value is array{ |
|
| 291 | - * @throws EE_Error |
|
| 292 | - * @throws ReflectionException |
|
| 293 | - * @type string|array $callback |
|
| 294 | - * @type string $methods |
|
| 295 | - * @type boolean $hidden_endpoint |
|
| 296 | - * } |
|
| 297 | - */ |
|
| 298 | - public static function get_ee_route_data() |
|
| 299 | - { |
|
| 300 | - $ee_routes = []; |
|
| 301 | - foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoints) { |
|
| 302 | - $ee_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = EED_Core_Rest_Api::_get_ee_route_data_for_version( |
|
| 303 | - $version, |
|
| 304 | - $hidden_endpoints |
|
| 305 | - ); |
|
| 306 | - } |
|
| 307 | - return $ee_routes; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - |
|
| 311 | - /** |
|
| 312 | - * Gets the EE route data from the wp options if it exists already, |
|
| 313 | - * otherwise re-generates it and saves it to the option |
|
| 314 | - * |
|
| 315 | - * @param string $version |
|
| 316 | - * @param boolean $hidden_endpoints |
|
| 317 | - * @return array |
|
| 318 | - * @throws EE_Error |
|
| 319 | - * @throws ReflectionException |
|
| 320 | - */ |
|
| 321 | - protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) |
|
| 322 | - { |
|
| 323 | - $ee_routes = get_option(EED_Core_Rest_Api::saved_routes_option_names . $version, null); |
|
| 324 | - if (! $ee_routes || EED_Core_Rest_Api::debugMode()) { |
|
| 325 | - $ee_routes = EED_Core_Rest_Api::_save_ee_route_data_for_version($version, $hidden_endpoints); |
|
| 326 | - } |
|
| 327 | - return $ee_routes; |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - |
|
| 331 | - /** |
|
| 332 | - * Saves the EE REST API route data to a wp option and returns it |
|
| 333 | - * |
|
| 334 | - * @param string $version |
|
| 335 | - * @param boolean $hidden_endpoints |
|
| 336 | - * @return mixed|null |
|
| 337 | - * @throws EE_Error |
|
| 338 | - * @throws ReflectionException |
|
| 339 | - */ |
|
| 340 | - protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) |
|
| 341 | - { |
|
| 342 | - $instance = EED_Core_Rest_Api::instance(); |
|
| 343 | - $routes = apply_filters( |
|
| 344 | - 'EED_Core_Rest_Api__save_ee_route_data_for_version__routes', |
|
| 345 | - array_replace_recursive( |
|
| 346 | - $instance->_get_config_route_data_for_version($version, $hidden_endpoints), |
|
| 347 | - $instance->_get_meta_route_data_for_version($version, $hidden_endpoints), |
|
| 348 | - $instance->_get_model_route_data_for_version($version, $hidden_endpoints), |
|
| 349 | - $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints) |
|
| 350 | - ) |
|
| 351 | - ); |
|
| 352 | - $option_name = EED_Core_Rest_Api::saved_routes_option_names . $version; |
|
| 353 | - if (get_option($option_name)) { |
|
| 354 | - update_option($option_name, $routes, true); |
|
| 355 | - } else { |
|
| 356 | - add_option($option_name, $routes, null, 'no'); |
|
| 357 | - } |
|
| 358 | - return $routes; |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - |
|
| 362 | - /** |
|
| 363 | - * Calculates all the EE routes and saves it to a WordPress option so we don't |
|
| 364 | - * need to calculate it on every request |
|
| 365 | - * |
|
| 366 | - * @return void |
|
| 367 | - * @deprecated since version 4.9.1 |
|
| 368 | - */ |
|
| 369 | - public static function save_ee_routes() |
|
| 370 | - { |
|
| 371 | - if (DbStatus::isOnline()) { |
|
| 372 | - $instance = EED_Core_Rest_Api::instance(); |
|
| 373 | - $routes = apply_filters( |
|
| 374 | - 'EED_Core_Rest_Api__save_ee_routes__routes', |
|
| 375 | - array_replace_recursive( |
|
| 376 | - $instance->_register_config_routes(), |
|
| 377 | - $instance->_register_meta_routes(), |
|
| 378 | - $instance->_register_model_routes(), |
|
| 379 | - $instance->_register_rpc_routes() |
|
| 380 | - ) |
|
| 381 | - ); |
|
| 382 | - update_option(EED_Core_Rest_Api::saved_routes_option_names, $routes, true); |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * Gets all the route information relating to EE models |
|
| 389 | - * |
|
| 390 | - * @return array @see get_ee_route_data |
|
| 391 | - * @deprecated since version 4.9.1 |
|
| 392 | - */ |
|
| 393 | - protected function _register_model_routes() |
|
| 394 | - { |
|
| 395 | - $model_routes = []; |
|
| 396 | - foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 397 | - $model_routes[ EED_Core_Rest_Api::ee_api_namespace |
|
| 398 | - . $version ] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
| 399 | - } |
|
| 400 | - return $model_routes; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * Decides whether or not to add write endpoints for this model. |
|
| 406 | - * Currently, this defaults to exclude all global tables and models |
|
| 407 | - * which would allow inserting WP core data (we don't want to duplicate |
|
| 408 | - * what WP API does, as it's unnecessary, extra work, and potentially extra bugs) |
|
| 409 | - * |
|
| 410 | - * @param EEM_Base $model |
|
| 411 | - * @return bool |
|
| 412 | - */ |
|
| 413 | - public static function should_have_write_endpoints(EEM_Base $model): bool |
|
| 414 | - { |
|
| 415 | - if ($model->is_wp_core_model()) { |
|
| 416 | - return false; |
|
| 417 | - } |
|
| 418 | - foreach ($model->get_tables() as $table) { |
|
| 419 | - if ($table->is_global()) { |
|
| 420 | - return false; |
|
| 421 | - } |
|
| 422 | - } |
|
| 423 | - return true; |
|
| 424 | - } |
|
| 425 | - |
|
| 426 | - |
|
| 427 | - /** |
|
| 428 | - * Gets the names of all models which should have plural routes (eg `ee/v4.8.36/events`) |
|
| 429 | - * in this versioned namespace of EE4 |
|
| 430 | - * |
|
| 431 | - * @param $version |
|
| 432 | - * @return array keys are model names (eg 'Event') and values ar either classnames (eg 'EEM_Event') |
|
| 433 | - */ |
|
| 434 | - public static function model_names_with_plural_routes($version): array |
|
| 435 | - { |
|
| 436 | - $model_version_info = new ModelVersionInfo($version); |
|
| 437 | - $models_to_register = $model_version_info->modelsForRequestedVersion(); |
|
| 438 | - // let's not bother having endpoints for extra metas |
|
| 439 | - unset( |
|
| 440 | - $models_to_register['Extra_Meta'], |
|
| 441 | - $models_to_register['Extra_Join'], |
|
| 442 | - $models_to_register['Post_Meta'] |
|
| 443 | - ); |
|
| 444 | - return (array) apply_filters( |
|
| 445 | - 'FHEE__EED_Core_REST_API___register_model_routes', |
|
| 446 | - $models_to_register |
|
| 447 | - ); |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - |
|
| 451 | - /** |
|
| 452 | - * Gets the route data for EE models in the specified version |
|
| 453 | - * |
|
| 454 | - * @param string $version |
|
| 455 | - * @param boolean $hidden_endpoint |
|
| 456 | - * @return array |
|
| 457 | - * @throws EE_Error |
|
| 458 | - * @throws ReflectionException |
|
| 459 | - */ |
|
| 460 | - protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) |
|
| 461 | - { |
|
| 462 | - $model_routes = []; |
|
| 463 | - $model_version_info = new ModelVersionInfo($version); |
|
| 464 | - foreach (EED_Core_Rest_Api::model_names_with_plural_routes($version) as $model_name => $model_classname) { |
|
| 465 | - $model = EE_Registry::instance()->load_model($model_name); |
|
| 466 | - // if this isn't a valid model then let's skip iterate to the next item in the loop. |
|
| 467 | - if (! $model instanceof EEM_Base) { |
|
| 468 | - continue; |
|
| 469 | - } |
|
| 470 | - // yes we could just register one route for ALL models, but then they wouldn't show up in the index |
|
| 471 | - $plural_model_route = EED_Core_Rest_Api::get_collection_route($model); |
|
| 472 | - $singular_model_route = EED_Core_Rest_Api::get_entity_route($model, '(?P<id>[^\/]+)'); |
|
| 473 | - $model_routes[ $plural_model_route ] = [ |
|
| 474 | - [ |
|
| 475 | - 'callback' => [ |
|
| 476 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 477 | - 'handleRequestGetAll', |
|
| 478 | - ], |
|
| 479 | - 'callback_args' => [$version, $model_name], |
|
| 480 | - 'methods' => WP_REST_Server::READABLE, |
|
| 481 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 482 | - 'args' => $this->_get_read_query_params($model, $version), |
|
| 483 | - '_links' => [ |
|
| 484 | - 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route), |
|
| 485 | - ], |
|
| 486 | - ], |
|
| 487 | - 'schema' => [ |
|
| 488 | - 'schema_callback' => [ |
|
| 489 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 490 | - 'handleSchemaRequest', |
|
| 491 | - ], |
|
| 492 | - 'callback_args' => [$version, $model_name], |
|
| 493 | - ], |
|
| 494 | - ]; |
|
| 495 | - $model_routes[ $singular_model_route ] = [ |
|
| 496 | - [ |
|
| 497 | - 'callback' => [ |
|
| 498 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 499 | - 'handleRequestGetOne', |
|
| 500 | - ], |
|
| 501 | - 'callback_args' => [$version, $model_name], |
|
| 502 | - 'methods' => WP_REST_Server::READABLE, |
|
| 503 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 504 | - 'args' => $this->_get_response_selection_query_params($model, $version, true), |
|
| 505 | - ], |
|
| 506 | - ]; |
|
| 507 | - if ( |
|
| 508 | - apply_filters( |
|
| 509 | - 'FHEE__EED_Core_Rest_Api___get_model_route_data_for_version__add_write_endpoints', |
|
| 510 | - EED_Core_Rest_Api::should_have_write_endpoints($model), |
|
| 511 | - $model |
|
| 512 | - ) |
|
| 513 | - ) { |
|
| 514 | - $model_routes[ $plural_model_route ][] = [ |
|
| 515 | - 'callback' => [ |
|
| 516 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 517 | - 'handleRequestInsert', |
|
| 518 | - ], |
|
| 519 | - 'callback_args' => [$version, $model_name], |
|
| 520 | - 'methods' => WP_REST_Server::CREATABLE, |
|
| 521 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 522 | - 'args' => $this->_get_write_params($model_name, $model_version_info, true), |
|
| 523 | - ]; |
|
| 524 | - $model_routes[ $singular_model_route ] = array_merge( |
|
| 525 | - $model_routes[ $singular_model_route ], |
|
| 526 | - [ |
|
| 527 | - [ |
|
| 528 | - 'callback' => [ |
|
| 529 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 530 | - 'handleRequestUpdate', |
|
| 531 | - ], |
|
| 532 | - 'callback_args' => [$version, $model_name], |
|
| 533 | - 'methods' => WP_REST_Server::EDITABLE, |
|
| 534 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 535 | - 'args' => $this->_get_write_params($model_name, $model_version_info), |
|
| 536 | - ], |
|
| 537 | - [ |
|
| 538 | - 'callback' => [ |
|
| 539 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 540 | - 'handleRequestDelete', |
|
| 541 | - ], |
|
| 542 | - 'callback_args' => [$version, $model_name], |
|
| 543 | - 'methods' => WP_REST_Server::DELETABLE, |
|
| 544 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 545 | - 'args' => $this->_get_delete_query_params($model, $version), |
|
| 546 | - ], |
|
| 547 | - ] |
|
| 548 | - ); |
|
| 549 | - } |
|
| 550 | - foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 551 | - $related_route = EED_Core_Rest_Api::get_relation_route_via( |
|
| 552 | - $model, |
|
| 553 | - '(?P<id>[^\/]+)', |
|
| 554 | - $relation_obj |
|
| 555 | - ); |
|
| 556 | - $model_routes[ $related_route ] = [ |
|
| 557 | - [ |
|
| 558 | - 'callback' => [ |
|
| 559 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 560 | - 'handleRequestGetRelated', |
|
| 561 | - ], |
|
| 562 | - 'callback_args' => [$version, $model_name, $relation_name], |
|
| 563 | - 'methods' => WP_REST_Server::READABLE, |
|
| 564 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 565 | - 'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version), |
|
| 566 | - ], |
|
| 567 | - ]; |
|
| 568 | - |
|
| 569 | - $related_write_route = $related_route . '/' . '(?P<related_id>[^\/]+)'; |
|
| 570 | - $model_routes[ $related_write_route ] = [ |
|
| 571 | - [ |
|
| 572 | - 'callback' => [ |
|
| 573 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 574 | - 'handleRequestAddRelation', |
|
| 575 | - ], |
|
| 576 | - 'callback_args' => [$version, $model_name, $relation_name], |
|
| 577 | - 'methods' => WP_REST_Server::EDITABLE, |
|
| 578 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 579 | - 'args' => $this->_get_add_relation_query_params( |
|
| 580 | - $model, |
|
| 581 | - $relation_obj->get_other_model(), |
|
| 582 | - $version |
|
| 583 | - ), |
|
| 584 | - ], |
|
| 585 | - [ |
|
| 586 | - 'callback' => [ |
|
| 587 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 588 | - 'handleRequestRemoveRelation', |
|
| 589 | - ], |
|
| 590 | - 'callback_args' => [$version, $model_name, $relation_name], |
|
| 591 | - 'methods' => WP_REST_Server::DELETABLE, |
|
| 592 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 593 | - 'args' => [], |
|
| 594 | - ], |
|
| 595 | - ]; |
|
| 596 | - } |
|
| 597 | - } |
|
| 598 | - return $model_routes; |
|
| 599 | - } |
|
| 600 | - |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * Gets the relative URI to a model's REST API plural route, after the EE4 versioned namespace, |
|
| 604 | - * excluding the preceding slash. |
|
| 605 | - * Eg you pass get_plural_route_to('Event') = 'events' |
|
| 606 | - * |
|
| 607 | - * @param EEM_Base $model |
|
| 608 | - * @return string |
|
| 609 | - */ |
|
| 610 | - public static function get_collection_route(EEM_Base $model) |
|
| 611 | - { |
|
| 612 | - return EEH_Inflector::pluralize_and_lower($model->get_this_model_name()); |
|
| 613 | - } |
|
| 614 | - |
|
| 615 | - |
|
| 616 | - /** |
|
| 617 | - * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace, |
|
| 618 | - * excluding the preceding slash. |
|
| 619 | - * Eg you pass get_plural_route_to('Event', 12) = 'events/12' |
|
| 620 | - * |
|
| 621 | - * @param EEM_Base $model eg Event or Venue |
|
| 622 | - * @param string $id |
|
| 623 | - * @return string |
|
| 624 | - */ |
|
| 625 | - public static function get_entity_route($model, $id) |
|
| 626 | - { |
|
| 627 | - return EED_Core_Rest_Api::get_collection_route($model) . '/' . $id; |
|
| 628 | - } |
|
| 629 | - |
|
| 630 | - |
|
| 631 | - /** |
|
| 632 | - * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace, |
|
| 633 | - * excluding the preceding slash. |
|
| 634 | - * Eg you pass get_plural_route_to('Event', 12) = 'events/12' |
|
| 635 | - * |
|
| 636 | - * @param EEM_Base $model eg Event or Venue |
|
| 637 | - * @param string $id |
|
| 638 | - * @param EE_Model_Relation_Base $relation_obj |
|
| 639 | - * @return string |
|
| 640 | - */ |
|
| 641 | - public static function get_relation_route_via(EEM_Base $model, $id, EE_Model_Relation_Base $relation_obj) |
|
| 642 | - { |
|
| 643 | - $related_model_name_endpoint_part = ModelRead::getRelatedEntityName( |
|
| 644 | - $relation_obj->get_other_model()->get_this_model_name(), |
|
| 645 | - $relation_obj |
|
| 646 | - ); |
|
| 647 | - return EED_Core_Rest_Api::get_entity_route($model, $id) . '/' . $related_model_name_endpoint_part; |
|
| 648 | - } |
|
| 649 | - |
|
| 650 | - |
|
| 651 | - /** |
|
| 652 | - * Adds onto the $relative_route the EE4 REST API versioned namespace. |
|
| 653 | - * Eg if given '4.8.36' and 'events', will return 'ee/v4.8.36/events' |
|
| 654 | - * |
|
| 655 | - * @param string $relative_route |
|
| 656 | - * @param string $version |
|
| 657 | - * @return string |
|
| 658 | - */ |
|
| 659 | - public static function get_versioned_route_to($relative_route, $version = '4.8.36') |
|
| 660 | - { |
|
| 661 | - return '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' . $relative_route; |
|
| 662 | - } |
|
| 663 | - |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * Adds all the RPC-style routes (remote procedure call-like routes, ie |
|
| 667 | - * routes that don't conform to the traditional REST CRUD-style). |
|
| 668 | - * |
|
| 669 | - * @deprecated since 4.9.1 |
|
| 670 | - */ |
|
| 671 | - protected function _register_rpc_routes() |
|
| 672 | - { |
|
| 673 | - $routes = []; |
|
| 674 | - foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 675 | - $routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( |
|
| 676 | - $version, |
|
| 677 | - $hidden_endpoint |
|
| 678 | - ); |
|
| 679 | - } |
|
| 680 | - return $routes; |
|
| 681 | - } |
|
| 682 | - |
|
| 683 | - |
|
| 684 | - /** |
|
| 685 | - * @param string $version |
|
| 686 | - * @param boolean $hidden_endpoint |
|
| 687 | - * @return array |
|
| 688 | - */ |
|
| 689 | - protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) |
|
| 690 | - { |
|
| 691 | - $this_versions_routes = []; |
|
| 692 | - // checkin endpoint |
|
| 693 | - $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = [ |
|
| 694 | - [ |
|
| 695 | - 'callback' => [ |
|
| 696 | - 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
|
| 697 | - 'handleRequestToggleCheckin', |
|
| 698 | - ], |
|
| 699 | - 'methods' => WP_REST_Server::CREATABLE, |
|
| 700 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 701 | - 'args' => [ |
|
| 702 | - 'force' => [ |
|
| 703 | - 'required' => false, |
|
| 704 | - 'default' => false, |
|
| 705 | - 'description' => esc_html__( |
|
| 706 | - // @codingStandardsIgnoreStart |
|
| 707 | - 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', |
|
| 708 | - // @codingStandardsIgnoreEnd |
|
| 709 | - 'event_espresso' |
|
| 710 | - ), |
|
| 711 | - ], |
|
| 712 | - ], |
|
| 713 | - 'callback_args' => [$version], |
|
| 714 | - ], |
|
| 715 | - ]; |
|
| 716 | - return apply_filters( |
|
| 717 | - 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
|
| 718 | - $this_versions_routes, |
|
| 719 | - $version, |
|
| 720 | - $hidden_endpoint |
|
| 721 | - ); |
|
| 722 | - } |
|
| 723 | - |
|
| 724 | - |
|
| 725 | - /** |
|
| 726 | - * Gets the query params that can be used when request one or many |
|
| 727 | - * |
|
| 728 | - * @param EEM_Base $model |
|
| 729 | - * @param string $version |
|
| 730 | - * @return array |
|
| 731 | - */ |
|
| 732 | - protected function _get_response_selection_query_params(EEM_Base $model, $version, $single_only = false) |
|
| 733 | - { |
|
| 734 | - EED_Core_Rest_Api::loadCalculatedModelFields(); |
|
| 735 | - $query_params = [ |
|
| 736 | - 'include' => [ |
|
| 737 | - 'required' => false, |
|
| 738 | - 'default' => '*', |
|
| 739 | - 'type' => SchemaType::STRING, |
|
| 740 | - ], |
|
| 741 | - 'calculate' => [ |
|
| 742 | - 'required' => false, |
|
| 743 | - 'default' => '', |
|
| 744 | - 'enum' => EED_Core_Rest_Api::$_field_calculator->retrieveCalculatedFieldsForModel($model), |
|
| 745 | - 'type' => SchemaType::STRING, |
|
| 746 | - // because we accept a CSV list of the enumerated strings, WP core validation and sanitization |
|
| 747 | - // freaks out. We'll just validate this argument while handling the request |
|
| 748 | - 'validate_callback' => null, |
|
| 749 | - 'sanitize_callback' => null, |
|
| 750 | - ], |
|
| 751 | - 'password' => [ |
|
| 752 | - 'required' => false, |
|
| 753 | - 'default' => '', |
|
| 754 | - 'type' => SchemaType::STRING, |
|
| 755 | - ], |
|
| 756 | - ]; |
|
| 757 | - return apply_filters( |
|
| 758 | - 'FHEE__EED_Core_Rest_Api___get_response_selection_query_params', |
|
| 759 | - $query_params, |
|
| 760 | - $model, |
|
| 761 | - $version |
|
| 762 | - ); |
|
| 763 | - } |
|
| 764 | - |
|
| 765 | - |
|
| 766 | - /** |
|
| 767 | - * Gets the parameters acceptable for delete requests |
|
| 768 | - * |
|
| 769 | - * @param EEM_Base $model |
|
| 770 | - * @param string $version |
|
| 771 | - * @return array |
|
| 772 | - */ |
|
| 773 | - protected function _get_delete_query_params(EEM_Base $model, $version) |
|
| 774 | - { |
|
| 775 | - $params_for_delete = [ |
|
| 776 | - 'allow_blocking' => [ |
|
| 777 | - 'required' => false, |
|
| 778 | - 'default' => true, |
|
| 779 | - 'type' => SchemaType::BOOLEAN, |
|
| 780 | - ], |
|
| 781 | - ]; |
|
| 782 | - $params_for_delete['force'] = [ |
|
| 783 | - 'required' => false, |
|
| 784 | - 'default' => false, |
|
| 785 | - 'type' => SchemaType::BOOLEAN, |
|
| 786 | - ]; |
|
| 787 | - return apply_filters( |
|
| 788 | - 'FHEE__EED_Core_Rest_Api___get_delete_query_params', |
|
| 789 | - $params_for_delete, |
|
| 790 | - $model, |
|
| 791 | - $version |
|
| 792 | - ); |
|
| 793 | - } |
|
| 794 | - |
|
| 795 | - |
|
| 796 | - /** |
|
| 797 | - * @param EEM_Base $source_model |
|
| 798 | - * @param EEM_Base $related_model |
|
| 799 | - * @param $version |
|
| 800 | - * @return array |
|
| 801 | - * @throws EE_Error |
|
| 802 | - * @since 5.0.0.p |
|
| 803 | - */ |
|
| 804 | - protected function _get_add_relation_query_params(EEM_Base $source_model, EEM_Base $related_model, $version) |
|
| 805 | - { |
|
| 806 | - // if they're related through a HABTM relation, check for any non-FKs |
|
| 807 | - $all_relation_settings = $source_model->relation_settings(); |
|
| 808 | - $relation_settings = $all_relation_settings[ $related_model->get_this_model_name() ]; |
|
| 809 | - $params = []; |
|
| 810 | - if ($relation_settings instanceof EE_HABTM_Relation && $relation_settings->hasNonKeyFields()) { |
|
| 811 | - foreach ($relation_settings->getNonKeyFields() as $field) { |
|
| 812 | - /* @var $field EE_Model_Field_Base */ |
|
| 813 | - $params[ $field->get_name() ] = [ |
|
| 814 | - 'required' => ! $field->is_nullable(), |
|
| 815 | - 'default' => ModelDataTranslator::prepareFieldValueForJson( |
|
| 816 | - $field, |
|
| 817 | - $field->get_default_value(), |
|
| 818 | - $version |
|
| 819 | - ), |
|
| 820 | - 'type' => $field->getSchemaType(), |
|
| 821 | - 'validate_callback' => null, |
|
| 822 | - 'sanitize_callback' => null, |
|
| 823 | - ]; |
|
| 824 | - } |
|
| 825 | - } |
|
| 826 | - return $params; |
|
| 827 | - } |
|
| 828 | - |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * Gets info about reading query params that are acceptable |
|
| 832 | - * |
|
| 833 | - * @param EEM_Base $model eg 'Event' or 'Venue' |
|
| 834 | - * @param string $version |
|
| 835 | - * @return array describing the args acceptable when querying this model |
|
| 836 | - * @throws EE_Error |
|
| 837 | - */ |
|
| 838 | - protected function _get_read_query_params(EEM_Base $model, $version) |
|
| 839 | - { |
|
| 840 | - $default_orderby = []; |
|
| 841 | - foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
| 842 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
| 843 | - } |
|
| 844 | - return array_merge( |
|
| 845 | - $this->_get_response_selection_query_params($model, $version), |
|
| 846 | - [ |
|
| 847 | - 'where' => [ |
|
| 848 | - 'required' => false, |
|
| 849 | - 'default' => [], |
|
| 850 | - 'type' => SchemaType::OBJECT, |
|
| 851 | - // because we accept an almost infinite list of possible where conditions, WP |
|
| 852 | - // core validation and sanitization freaks out. We'll just validate this argument |
|
| 853 | - // while handling the request |
|
| 854 | - 'validate_callback' => null, |
|
| 855 | - 'sanitize_callback' => null, |
|
| 856 | - ], |
|
| 857 | - 'limit' => [ |
|
| 858 | - 'required' => false, |
|
| 859 | - 'default' => EED_Core_Rest_Api::get_default_query_limit(), |
|
| 860 | - 'type' => [ |
|
| 861 | - SchemaType::ARRAY, |
|
| 862 | - SchemaType::STRING, |
|
| 863 | - SchemaType::INTEGER, |
|
| 864 | - ], |
|
| 865 | - // because we accept a variety of types, WP core validation and sanitization |
|
| 866 | - // freaks out. We'll just validate this argument while handling the request |
|
| 867 | - 'validate_callback' => null, |
|
| 868 | - 'sanitize_callback' => null, |
|
| 869 | - ], |
|
| 870 | - 'order_by' => [ |
|
| 871 | - 'required' => false, |
|
| 872 | - 'default' => $default_orderby, |
|
| 873 | - 'type' => [ |
|
| 874 | - SchemaType::OBJECT, |
|
| 875 | - SchemaType::STRING, |
|
| 876 | - ],// because we accept a variety of types, WP core validation and sanitization |
|
| 877 | - // freaks out. We'll just validate this argument while handling the request |
|
| 878 | - 'validate_callback' => null, |
|
| 879 | - 'sanitize_callback' => null, |
|
| 880 | - ], |
|
| 881 | - 'group_by' => [ |
|
| 882 | - 'required' => false, |
|
| 883 | - 'default' => null, |
|
| 884 | - 'type' => [ |
|
| 885 | - SchemaType::OBJECT, |
|
| 886 | - SchemaType::STRING, |
|
| 887 | - ], |
|
| 888 | - // because we accept an almost infinite list of possible groupings, |
|
| 889 | - // WP core validation and sanitization |
|
| 890 | - // freaks out. We'll just validate this argument while handling the request |
|
| 891 | - 'validate_callback' => null, |
|
| 892 | - 'sanitize_callback' => null, |
|
| 893 | - ], |
|
| 894 | - 'having' => [ |
|
| 895 | - 'required' => false, |
|
| 896 | - 'default' => null, |
|
| 897 | - 'type' => SchemaType::OBJECT, |
|
| 898 | - // because we accept an almost infinite list of possible where conditions, WP |
|
| 899 | - // core validation and sanitization freaks out. We'll just validate this argument |
|
| 900 | - // while handling the request |
|
| 901 | - 'validate_callback' => null, |
|
| 902 | - 'sanitize_callback' => null, |
|
| 903 | - ], |
|
| 904 | - 'caps' => [ |
|
| 905 | - 'required' => false, |
|
| 906 | - 'default' => EEM_Base::caps_read, |
|
| 907 | - 'type' => SchemaType::STRING, |
|
| 908 | - 'enum' => [ |
|
| 909 | - EEM_Base::caps_read, |
|
| 910 | - EEM_Base::caps_read_admin, |
|
| 911 | - EEM_Base::caps_edit, |
|
| 912 | - EEM_Base::caps_delete, |
|
| 913 | - ], |
|
| 914 | - ], |
|
| 915 | - ] |
|
| 916 | - ); |
|
| 917 | - } |
|
| 918 | - |
|
| 919 | - |
|
| 920 | - /** |
|
| 921 | - * Gets parameter information for a model regarding writing data |
|
| 922 | - * |
|
| 923 | - * @param string $model_name |
|
| 924 | - * @param ModelVersionInfo $model_version_info |
|
| 925 | - * @param boolean $create whether this is for request to create (in |
|
| 926 | - * which case we need all required params) or |
|
| 927 | - * just to update (in which case we don't |
|
| 928 | - * need those on every request) |
|
| 929 | - * @return array |
|
| 930 | - * @throws EE_Error |
|
| 931 | - * @throws ReflectionException |
|
| 932 | - */ |
|
| 933 | - protected function _get_write_params( |
|
| 934 | - $model_name, |
|
| 935 | - ModelVersionInfo $model_version_info, |
|
| 936 | - $create = false |
|
| 937 | - ) { |
|
| 938 | - $model = EE_Registry::instance()->load_model($model_name); |
|
| 939 | - $fields = $model_version_info->fieldsOnModelInThisVersion($model); |
|
| 940 | - |
|
| 941 | - // we do our own validation and sanitization within the controller |
|
| 942 | - $sanitize_callback = function_exists('rest_validate_value_from_schema') |
|
| 943 | - ? ['EED_Core_Rest_Api', 'default_sanitize_callback'] |
|
| 944 | - : null; |
|
| 945 | - $args_info = []; |
|
| 946 | - foreach ($fields as $field_name => $field_obj) { |
|
| 947 | - if ($field_obj->is_auto_increment()) { |
|
| 948 | - // totally ignore auto increment IDs |
|
| 949 | - continue; |
|
| 950 | - } |
|
| 951 | - $arg_info = $field_obj->getSchema(); |
|
| 952 | - $required = $create && ! $field_obj->is_nullable() && $field_obj->get_default_value() === null; |
|
| 953 | - $arg_info['required'] = $required; |
|
| 954 | - // remove the read-only flag. If it were read-only we wouldn't list it as an argument while writing, right? |
|
| 955 | - unset($arg_info['readonly']); |
|
| 956 | - $schema_properties = $field_obj->getSchemaProperties(); |
|
| 957 | - // if there's a "raw" form of this argument, use those properties instead |
|
| 958 | - if (isset($schema_properties['raw'])) { |
|
| 959 | - $arg_info = array_replace($arg_info, $schema_properties['raw']); |
|
| 960 | - } |
|
| 961 | - $arg_info['default'] = ModelDataTranslator::prepareFieldValueForJson( |
|
| 962 | - $field_obj, |
|
| 963 | - $field_obj->get_default_value(), |
|
| 964 | - $model_version_info->requestedVersion() |
|
| 965 | - ); |
|
| 966 | - $arg_info['sanitize_callback'] = $sanitize_callback; |
|
| 967 | - $args_info[ $field_name ] = $arg_info; |
|
| 968 | - if ($field_obj instanceof EE_Datetime_Field) { |
|
| 969 | - $gmt_arg_info = $arg_info; |
|
| 970 | - $gmt_arg_info['description'] = sprintf( |
|
| 971 | - esc_html__( |
|
| 972 | - '%1$s - the value for this field in UTC. Ignored if %2$s is provided.', |
|
| 973 | - 'event_espresso' |
|
| 974 | - ), |
|
| 975 | - $field_obj->get_nicename(), |
|
| 976 | - $field_name |
|
| 977 | - ); |
|
| 978 | - $args_info[ $field_name . '_gmt' ] = $gmt_arg_info; |
|
| 979 | - } |
|
| 980 | - } |
|
| 981 | - return $args_info; |
|
| 982 | - } |
|
| 983 | - |
|
| 984 | - |
|
| 985 | - /** |
|
| 986 | - * Replacement for WP API's 'rest_parse_request_arg'. |
|
| 987 | - * If the value is blank but not required, don't bother validating it. |
|
| 988 | - * Also, it uses our email validation instead of WP API's default. |
|
| 989 | - * |
|
| 990 | - * @param $value |
|
| 991 | - * @param WP_REST_Request $request |
|
| 992 | - * @param $param |
|
| 993 | - * @return bool|true|WP_Error |
|
| 994 | - * @throws InvalidArgumentException |
|
| 995 | - * @throws InvalidInterfaceException |
|
| 996 | - * @throws InvalidDataTypeException |
|
| 997 | - */ |
|
| 998 | - public static function default_sanitize_callback($value, WP_REST_Request $request, $param) |
|
| 999 | - { |
|
| 1000 | - $attributes = $request->get_attributes(); |
|
| 1001 | - if ( |
|
| 1002 | - ! isset($attributes['args'][ $param ]) |
|
| 1003 | - || ! is_array($attributes['args'][ $param ]) |
|
| 1004 | - ) { |
|
| 1005 | - $validation_result = true; |
|
| 1006 | - } else { |
|
| 1007 | - $args = $attributes['args'][ $param ]; |
|
| 1008 | - if ( |
|
| 1009 | - ( |
|
| 1010 | - $value === '' |
|
| 1011 | - || $value === null |
|
| 1012 | - ) |
|
| 1013 | - && (! isset($args['required']) |
|
| 1014 | - || $args['required'] === false |
|
| 1015 | - ) |
|
| 1016 | - ) { |
|
| 1017 | - // not required and not provided? that's cool |
|
| 1018 | - $validation_result = true; |
|
| 1019 | - } elseif ( |
|
| 1020 | - isset($args['format']) |
|
| 1021 | - && $args['format'] === 'email' |
|
| 1022 | - ) { |
|
| 1023 | - $validation_result = true; |
|
| 1024 | - if (! EED_Core_Rest_Api::_validate_email($value)) { |
|
| 1025 | - $validation_result = new WP_Error( |
|
| 1026 | - 'rest_invalid_param', |
|
| 1027 | - esc_html__( |
|
| 1028 | - 'The email address is not valid or does not exist.', |
|
| 1029 | - 'event_espresso' |
|
| 1030 | - ) |
|
| 1031 | - ); |
|
| 1032 | - } |
|
| 1033 | - } else { |
|
| 1034 | - $validation_result = rest_validate_value_from_schema($value, $args, $param); |
|
| 1035 | - } |
|
| 1036 | - } |
|
| 1037 | - if (is_wp_error($validation_result)) { |
|
| 1038 | - return $validation_result; |
|
| 1039 | - } |
|
| 1040 | - return rest_sanitize_request_arg($value, $request, $param); |
|
| 1041 | - } |
|
| 1042 | - |
|
| 1043 | - |
|
| 1044 | - /** |
|
| 1045 | - * Returns whether or not this email address is valid. Copied from EE_Email_Validation_Strategy::_validate_email() |
|
| 1046 | - * |
|
| 1047 | - * @param $email |
|
| 1048 | - * @return bool |
|
| 1049 | - * @throws InvalidArgumentException |
|
| 1050 | - * @throws InvalidInterfaceException |
|
| 1051 | - * @throws InvalidDataTypeException |
|
| 1052 | - */ |
|
| 1053 | - protected static function _validate_email($email) |
|
| 1054 | - { |
|
| 1055 | - try { |
|
| 1056 | - EmailAddressFactory::create($email); |
|
| 1057 | - return true; |
|
| 1058 | - } catch (EmailValidationException $e) { |
|
| 1059 | - return false; |
|
| 1060 | - } |
|
| 1061 | - } |
|
| 1062 | - |
|
| 1063 | - |
|
| 1064 | - /** |
|
| 1065 | - * Gets routes for the config |
|
| 1066 | - * |
|
| 1067 | - * @return array @see _register_model_routes |
|
| 1068 | - * @deprecated since version 4.9.1 |
|
| 1069 | - */ |
|
| 1070 | - protected function _register_config_routes() |
|
| 1071 | - { |
|
| 1072 | - $config_routes = []; |
|
| 1073 | - foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 1074 | - $config_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( |
|
| 1075 | - $version, |
|
| 1076 | - $hidden_endpoint |
|
| 1077 | - ); |
|
| 1078 | - } |
|
| 1079 | - return $config_routes; |
|
| 1080 | - } |
|
| 1081 | - |
|
| 1082 | - |
|
| 1083 | - /** |
|
| 1084 | - * Gets routes for the config for the specified version |
|
| 1085 | - * |
|
| 1086 | - * @param string $version |
|
| 1087 | - * @param boolean $hidden_endpoint |
|
| 1088 | - * @return array |
|
| 1089 | - */ |
|
| 1090 | - protected function _get_config_route_data_for_version($version, $hidden_endpoint) |
|
| 1091 | - { |
|
| 1092 | - return [ |
|
| 1093 | - 'config' => [ |
|
| 1094 | - [ |
|
| 1095 | - 'callback' => [ |
|
| 1096 | - 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
|
| 1097 | - 'handleRequest', |
|
| 1098 | - ], |
|
| 1099 | - 'methods' => WP_REST_Server::READABLE, |
|
| 1100 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 1101 | - 'callback_args' => [$version], |
|
| 1102 | - ], |
|
| 1103 | - ], |
|
| 1104 | - 'site_info' => [ |
|
| 1105 | - [ |
|
| 1106 | - 'callback' => [ |
|
| 1107 | - 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
|
| 1108 | - 'handleRequestSiteInfo', |
|
| 1109 | - ], |
|
| 1110 | - 'methods' => WP_REST_Server::READABLE, |
|
| 1111 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 1112 | - 'callback_args' => [$version], |
|
| 1113 | - ], |
|
| 1114 | - ], |
|
| 1115 | - ]; |
|
| 1116 | - } |
|
| 1117 | - |
|
| 1118 | - |
|
| 1119 | - /** |
|
| 1120 | - * Gets the meta info routes |
|
| 1121 | - * |
|
| 1122 | - * @return array @see _register_model_routes |
|
| 1123 | - * @deprecated since version 4.9.1 |
|
| 1124 | - */ |
|
| 1125 | - protected function _register_meta_routes() |
|
| 1126 | - { |
|
| 1127 | - $meta_routes = []; |
|
| 1128 | - foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 1129 | - $meta_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( |
|
| 1130 | - $version, |
|
| 1131 | - $hidden_endpoint |
|
| 1132 | - ); |
|
| 1133 | - } |
|
| 1134 | - return $meta_routes; |
|
| 1135 | - } |
|
| 1136 | - |
|
| 1137 | - |
|
| 1138 | - /** |
|
| 1139 | - * @param string $version |
|
| 1140 | - * @param boolean $hidden_endpoint |
|
| 1141 | - * @return array |
|
| 1142 | - */ |
|
| 1143 | - protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) |
|
| 1144 | - { |
|
| 1145 | - return [ |
|
| 1146 | - 'resources' => [ |
|
| 1147 | - [ |
|
| 1148 | - 'callback' => [ |
|
| 1149 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
|
| 1150 | - 'handleRequestModelsMeta', |
|
| 1151 | - ], |
|
| 1152 | - 'methods' => WP_REST_Server::READABLE, |
|
| 1153 | - 'hidden_endpoint' => $hidden_endpoint, |
|
| 1154 | - 'callback_args' => [$version], |
|
| 1155 | - ], |
|
| 1156 | - ], |
|
| 1157 | - ]; |
|
| 1158 | - } |
|
| 1159 | - |
|
| 1160 | - |
|
| 1161 | - /** |
|
| 1162 | - * Tries to hide old 4.6 endpoints from the |
|
| 1163 | - * |
|
| 1164 | - * @param array $route_data |
|
| 1165 | - * @return array |
|
| 1166 | - * @throws EE_Error |
|
| 1167 | - * @throws ReflectionException |
|
| 1168 | - */ |
|
| 1169 | - public static function hide_old_endpoints($route_data) |
|
| 1170 | - { |
|
| 1171 | - // allow API clients to override which endpoints get hidden, in case |
|
| 1172 | - // they want to discover particular endpoints |
|
| 1173 | - // also, we don't have access to the request so we have to just grab it from the superglobal |
|
| 1174 | - $force_show_ee_namespace = ltrim( |
|
| 1175 | - EED_Core_Rest_Api::getRequest()->getRequestParam('force_show_ee_namespace'), |
|
| 1176 | - '/' |
|
| 1177 | - ); |
|
| 1178 | - foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
| 1179 | - foreach ($relative_urls as $resource_name => $endpoints) { |
|
| 1180 | - foreach ($endpoints as $key => $endpoint) { |
|
| 1181 | - // skip schema and other route options |
|
| 1182 | - if (! is_numeric($key)) { |
|
| 1183 | - continue; |
|
| 1184 | - } |
|
| 1185 | - // by default, hide "hidden_endpoint"s, unless the request indicates |
|
| 1186 | - // to $force_show_ee_namespace, in which case only show that one |
|
| 1187 | - // namespace's endpoints (and hide all others) |
|
| 1188 | - if ( |
|
| 1189 | - ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace) |
|
| 1190 | - || ($endpoint['hidden_endpoint'] && $force_show_ee_namespace === '') |
|
| 1191 | - ) { |
|
| 1192 | - $full_route = '/' . ltrim($namespace, '/'); |
|
| 1193 | - $full_route .= '/' . ltrim($resource_name, '/'); |
|
| 1194 | - unset($route_data[ $full_route ]); |
|
| 1195 | - } |
|
| 1196 | - } |
|
| 1197 | - } |
|
| 1198 | - } |
|
| 1199 | - return $route_data; |
|
| 1200 | - } |
|
| 1201 | - |
|
| 1202 | - |
|
| 1203 | - /** |
|
| 1204 | - * Returns an array describing which versions of core support serving requests for. |
|
| 1205 | - * Keys are core versions' major and minor version, and values are the |
|
| 1206 | - * LOWEST requested version they can serve. Eg, 4.7 can serve requests for 4.6-like |
|
| 1207 | - * data by just removing a few models and fields from the responses. However, 4.15 might remove |
|
| 1208 | - * the answers table entirely, in which case it would be very difficult for |
|
| 1209 | - * it to serve 4.6-style responses. |
|
| 1210 | - * Versions of core that are missing from this array are unknowns. |
|
| 1211 | - * previous ver |
|
| 1212 | - * |
|
| 1213 | - * @return array |
|
| 1214 | - */ |
|
| 1215 | - public static function version_compatibilities() |
|
| 1216 | - { |
|
| 1217 | - return apply_filters( |
|
| 1218 | - 'FHEE__EED_Core_REST_API__version_compatibilities', |
|
| 1219 | - [ |
|
| 1220 | - '4.8.29' => '4.8.29', |
|
| 1221 | - '4.8.33' => '4.8.29', |
|
| 1222 | - '4.8.34' => '4.8.29', |
|
| 1223 | - '4.8.36' => '4.8.29', |
|
| 1224 | - ] |
|
| 1225 | - ); |
|
| 1226 | - } |
|
| 1227 | - |
|
| 1228 | - |
|
| 1229 | - /** |
|
| 1230 | - * Gets the latest API version served. Eg if there |
|
| 1231 | - * are two versions served of the API, 4.8.29 and 4.8.32, and |
|
| 1232 | - * we are on core version 4.8.34, it will return the string "4.8.32" |
|
| 1233 | - * |
|
| 1234 | - * @return string |
|
| 1235 | - */ |
|
| 1236 | - public static function latest_rest_api_version() |
|
| 1237 | - { |
|
| 1238 | - $versions_served = EED_Core_Rest_Api::versions_served(); |
|
| 1239 | - $versions_served_keys = array_keys($versions_served); |
|
| 1240 | - return end($versions_served_keys); |
|
| 1241 | - } |
|
| 1242 | - |
|
| 1243 | - |
|
| 1244 | - /** |
|
| 1245 | - * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of |
|
| 1246 | - * EE the API can serve requests for. Eg, if we are on 4.15 of core, and |
|
| 1247 | - * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ). |
|
| 1248 | - * We also indicate whether or not this version should be put in the index or not |
|
| 1249 | - * |
|
| 1250 | - * @return array keys are API version numbers (just major and minor numbers), and values |
|
| 1251 | - * are whether or not they should be hidden |
|
| 1252 | - */ |
|
| 1253 | - public static function versions_served() |
|
| 1254 | - { |
|
| 1255 | - $versions_served = []; |
|
| 1256 | - $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities(); |
|
| 1257 | - $lowest_compatible_version = end($possibly_served_versions); |
|
| 1258 | - reset($possibly_served_versions); |
|
| 1259 | - $versions_served_historically = array_keys($possibly_served_versions); |
|
| 1260 | - $latest_version = end($versions_served_historically); |
|
| 1261 | - reset($versions_served_historically); |
|
| 1262 | - // for each version of core we have ever served: |
|
| 1263 | - foreach ($versions_served_historically as $key_versioned_endpoint) { |
|
| 1264 | - // if it's not above the current core version, and it's compatible with the current version of core |
|
| 1265 | - |
|
| 1266 | - if ($key_versioned_endpoint === $latest_version) { |
|
| 1267 | - // don't hide the latest version in the index |
|
| 1268 | - $versions_served[ $key_versioned_endpoint ] = false; |
|
| 1269 | - } elseif ( |
|
| 1270 | - version_compare($key_versioned_endpoint, $lowest_compatible_version, '>=') |
|
| 1271 | - && version_compare($key_versioned_endpoint, EED_Core_Rest_Api::core_version(), '<') |
|
| 1272 | - ) { |
|
| 1273 | - // include, but hide, previous versions which are still supported |
|
| 1274 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
| 1275 | - } elseif ( |
|
| 1276 | - apply_filters( |
|
| 1277 | - 'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions', |
|
| 1278 | - false, |
|
| 1279 | - $possibly_served_versions |
|
| 1280 | - ) |
|
| 1281 | - ) { |
|
| 1282 | - // if a version is no longer supported, don't include it in index or list of versions served |
|
| 1283 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
| 1284 | - } |
|
| 1285 | - } |
|
| 1286 | - return $versions_served; |
|
| 1287 | - } |
|
| 1288 | - |
|
| 1289 | - |
|
| 1290 | - /** |
|
| 1291 | - * Gets the major and minor version of EE core's version string |
|
| 1292 | - * |
|
| 1293 | - * @return string |
|
| 1294 | - */ |
|
| 1295 | - public static function core_version() |
|
| 1296 | - { |
|
| 1297 | - return apply_filters( |
|
| 1298 | - 'FHEE__EED_Core_REST_API__core_version', |
|
| 1299 | - implode( |
|
| 1300 | - '.', |
|
| 1301 | - array_slice( |
|
| 1302 | - explode( |
|
| 1303 | - '.', |
|
| 1304 | - espresso_version() |
|
| 1305 | - ), |
|
| 1306 | - 0, |
|
| 1307 | - 3 |
|
| 1308 | - ) |
|
| 1309 | - ) |
|
| 1310 | - ); |
|
| 1311 | - } |
|
| 1312 | - |
|
| 1313 | - |
|
| 1314 | - /** |
|
| 1315 | - * Gets the default limit that should be used when querying for resources |
|
| 1316 | - * |
|
| 1317 | - * @return int |
|
| 1318 | - */ |
|
| 1319 | - public static function get_default_query_limit() |
|
| 1320 | - { |
|
| 1321 | - // we actually don't use a const because we want folks to always use |
|
| 1322 | - // this method, not the const directly |
|
| 1323 | - return apply_filters( |
|
| 1324 | - 'FHEE__EED_Core_Rest_Api__get_default_query_limit', |
|
| 1325 | - 100 |
|
| 1326 | - ); |
|
| 1327 | - } |
|
| 1328 | - |
|
| 1329 | - |
|
| 1330 | - /** |
|
| 1331 | - * @param string $version api version string (i.e. '4.8.36') |
|
| 1332 | - * @return array |
|
| 1333 | - */ |
|
| 1334 | - public static function getCollectionRoutesIndexedByModelName($version = '') |
|
| 1335 | - { |
|
| 1336 | - $version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version; |
|
| 1337 | - $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version); |
|
| 1338 | - $collection_routes = []; |
|
| 1339 | - foreach ($model_names as $model_name => $model_class_name) { |
|
| 1340 | - $collection_routes[ strtolower($model_name) ] = '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' |
|
| 1341 | - . EEH_Inflector::pluralize_and_lower($model_name); |
|
| 1342 | - } |
|
| 1343 | - return $collection_routes; |
|
| 1344 | - } |
|
| 1345 | - |
|
| 1346 | - |
|
| 1347 | - /** |
|
| 1348 | - * Returns an array of primary key names indexed by model names. |
|
| 1349 | - * |
|
| 1350 | - * @param string $version |
|
| 1351 | - * @return array |
|
| 1352 | - */ |
|
| 1353 | - public static function getPrimaryKeyNamesIndexedByModelName($version = '') |
|
| 1354 | - { |
|
| 1355 | - $version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version; |
|
| 1356 | - $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version); |
|
| 1357 | - $primary_key_items = []; |
|
| 1358 | - foreach ($model_names as $model_name => $model_class_name) { |
|
| 1359 | - $primary_keys = $model_class_name::instance()->get_combined_primary_key_fields(); |
|
| 1360 | - foreach ($primary_keys as $primary_key_name => $primary_key_field) { |
|
| 1361 | - if (count($primary_keys) > 1) { |
|
| 1362 | - $primary_key_items[ strtolower($model_name) ][] = $primary_key_name; |
|
| 1363 | - } else { |
|
| 1364 | - $primary_key_items[ strtolower($model_name) ] = $primary_key_name; |
|
| 1365 | - } |
|
| 1366 | - } |
|
| 1367 | - } |
|
| 1368 | - return $primary_key_items; |
|
| 1369 | - } |
|
| 1370 | - |
|
| 1371 | - |
|
| 1372 | - /** |
|
| 1373 | - * Determines the EE REST API debug mode is activated, or not. |
|
| 1374 | - * |
|
| 1375 | - * @return bool |
|
| 1376 | - * @since 4.9.76.p |
|
| 1377 | - */ |
|
| 1378 | - public static function debugMode() |
|
| 1379 | - { |
|
| 1380 | - static $debug_mode = null; // could be class prop |
|
| 1381 | - if ($debug_mode === null) { |
|
| 1382 | - $debug_mode = defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE; |
|
| 1383 | - } |
|
| 1384 | - return $debug_mode; |
|
| 1385 | - } |
|
| 1386 | - |
|
| 1387 | - |
|
| 1388 | - /** |
|
| 1389 | - * run - initial module setup |
|
| 1390 | - * |
|
| 1391 | - * @access public |
|
| 1392 | - * @param WP $WP |
|
| 1393 | - * @return void |
|
| 1394 | - */ |
|
| 1395 | - public function run($WP) |
|
| 1396 | - { |
|
| 1397 | - } |
|
| 26 | + const ee_api_namespace = Domain::API_NAMESPACE; |
|
| 27 | + |
|
| 28 | + const ee_api_namespace_for_regex = 'ee\/v([^/]*)\/'; |
|
| 29 | + |
|
| 30 | + const saved_routes_option_names = 'ee_core_routes'; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * string used in _links response bodies to make them globally unique. |
|
| 34 | + * |
|
| 35 | + * @see http://v2.wp-api.org/extending/linking/ |
|
| 36 | + */ |
|
| 37 | + const ee_api_link_namespace = 'https://api.eventespresso.com/'; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var CalculatedModelFields |
|
| 41 | + */ |
|
| 42 | + protected static $_field_calculator; |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @return EED_Core_Rest_Api|EED_Module |
|
| 47 | + */ |
|
| 48 | + public static function instance() |
|
| 49 | + { |
|
| 50 | + return parent::get_instance(EED_Core_Rest_Api::class); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
| 56 | + * |
|
| 57 | + * @access public |
|
| 58 | + * @return void |
|
| 59 | + */ |
|
| 60 | + public static function set_hooks() |
|
| 61 | + { |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
| 67 | + * |
|
| 68 | + * @access public |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + public static function set_hooks_admin() |
|
| 72 | + { |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + public static function set_hooks_both() |
|
| 77 | + { |
|
| 78 | + add_action('rest_api_init', ['EED_Core_Rest_Api', 'set_hooks_rest_api'], 5); |
|
| 79 | + add_action('rest_api_init', ['EED_Core_Rest_Api', 'register_routes'], 10); |
|
| 80 | + add_filter('rest_route_data', ['EED_Core_Rest_Api', 'hide_old_endpoints'], 10, 2); |
|
| 81 | + add_filter( |
|
| 82 | + 'rest_index', |
|
| 83 | + ['EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filterEeMetadataIntoIndex'] |
|
| 84 | + ); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @since 5.0.0.p |
|
| 90 | + */ |
|
| 91 | + public static function loadCalculatedModelFields() |
|
| 92 | + { |
|
| 93 | + EED_Core_Rest_Api::$_field_calculator = LoaderFactory::getLoader()->load( |
|
| 94 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' |
|
| 95 | + ); |
|
| 96 | + EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change(); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * sets up hooks which only need to be included as part of REST API requests; |
|
| 102 | + * other requests like to the frontend or admin etc don't need them |
|
| 103 | + * |
|
| 104 | + * @throws EE_Error |
|
| 105 | + */ |
|
| 106 | + public static function set_hooks_rest_api() |
|
| 107 | + { |
|
| 108 | + // set hooks which account for changes made to the API |
|
| 109 | + EED_Core_Rest_Api::_set_hooks_for_changes(); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * public wrapper of _set_hooks_for_changes. |
|
| 115 | + * Loads all the hooks which make requests to old versions of the API |
|
| 116 | + * appear the same as they always did |
|
| 117 | + * |
|
| 118 | + * @throws EE_Error |
|
| 119 | + */ |
|
| 120 | + public static function set_hooks_for_changes() |
|
| 121 | + { |
|
| 122 | + EED_Core_Rest_Api::_set_hooks_for_changes(); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Loads all the hooks which make requests to old versions of the API |
|
| 128 | + * appear the same as they always did |
|
| 129 | + * |
|
| 130 | + * @throws EE_Error |
|
| 131 | + */ |
|
| 132 | + protected static function _set_hooks_for_changes() |
|
| 133 | + { |
|
| 134 | + $folder_contents = EEH_File::get_contents_of_folders([EE_LIBRARIES . 'rest_api/changes'], false); |
|
| 135 | + foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
| 136 | + // ignore the base parent class |
|
| 137 | + // and legacy named classes |
|
| 138 | + if ( |
|
| 139 | + $classname_in_namespace === 'ChangesInBase' |
|
| 140 | + || strpos($classname_in_namespace, 'Changes_In_') === 0 |
|
| 141 | + ) { |
|
| 142 | + continue; |
|
| 143 | + } |
|
| 144 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
| 145 | + if (class_exists($full_classname)) { |
|
| 146 | + $instance_of_class = new $full_classname(); |
|
| 147 | + if ($instance_of_class instanceof ChangesInBase) { |
|
| 148 | + $instance_of_class->setHooks(); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Filters the WP routes to add our EE-related ones. This takes a bit of time |
|
| 157 | + * so we actually prefer to only do it when an EE plugin is activated or upgraded |
|
| 158 | + * |
|
| 159 | + * @throws EE_Error |
|
| 160 | + * @throws ReflectionException |
|
| 161 | + */ |
|
| 162 | + public static function register_routes() |
|
| 163 | + { |
|
| 164 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_routes) { |
|
| 165 | + foreach ($relative_routes as $relative_route => $data_for_multiple_endpoints) { |
|
| 166 | + /** |
|
| 167 | + * @var array $data_for_multiple_endpoints numerically indexed array |
|
| 168 | + * but can also contain route options like { |
|
| 169 | + * @type array $schema { |
|
| 170 | + * @type callable $schema_callback |
|
| 171 | + * @type array $callback_args arguments that will be passed to the callback, after the |
|
| 172 | + * WP_REST_Request of course |
|
| 173 | + * } |
|
| 174 | + * } |
|
| 175 | + */ |
|
| 176 | + // when registering routes, register all the endpoints' data at the same time |
|
| 177 | + $multiple_endpoint_args = []; |
|
| 178 | + foreach ($data_for_multiple_endpoints as $endpoint_key => $data_for_single_endpoint) { |
|
| 179 | + /** |
|
| 180 | + * @var array $data_for_single_endpoint { |
|
| 181 | + * @type callable $callback |
|
| 182 | + * @type string methods |
|
| 183 | + * @type array args |
|
| 184 | + * @type array _links |
|
| 185 | + * @type array $callback_args arguments that will be passed to the callback, after the |
|
| 186 | + * WP_REST_Request of course |
|
| 187 | + * } |
|
| 188 | + */ |
|
| 189 | + // skip route options |
|
| 190 | + if (! is_numeric($endpoint_key)) { |
|
| 191 | + continue; |
|
| 192 | + } |
|
| 193 | + if (! isset($data_for_single_endpoint['callback'], $data_for_single_endpoint['methods'])) { |
|
| 194 | + throw new EE_Error( |
|
| 195 | + esc_html__( |
|
| 196 | + // @codingStandardsIgnoreStart |
|
| 197 | + 'Endpoint configuration data needs to have entries "callback" (callable) and "methods" (comma-separated list of accepts HTTP methods).', |
|
| 198 | + // @codingStandardsIgnoreEnd |
|
| 199 | + 'event_espresso' |
|
| 200 | + ) |
|
| 201 | + ); |
|
| 202 | + } |
|
| 203 | + $callback = $data_for_single_endpoint['callback']; |
|
| 204 | + $single_endpoint_args = [ |
|
| 205 | + 'methods' => $data_for_single_endpoint['methods'], |
|
| 206 | + 'args' => isset($data_for_single_endpoint['args']) ? $data_for_single_endpoint['args'] |
|
| 207 | + : [], |
|
| 208 | + ]; |
|
| 209 | + if (isset($data_for_single_endpoint['_links'])) { |
|
| 210 | + $single_endpoint_args['_links'] = $data_for_single_endpoint['_links']; |
|
| 211 | + } |
|
| 212 | + if (isset($data_for_single_endpoint['callback_args'])) { |
|
| 213 | + $callback_args = $data_for_single_endpoint['callback_args']; |
|
| 214 | + $single_endpoint_args['callback'] = static function (WP_REST_Request $request) use ( |
|
| 215 | + $callback, |
|
| 216 | + $callback_args |
|
| 217 | + ) { |
|
| 218 | + array_unshift($callback_args, $request); |
|
| 219 | + return call_user_func_array( |
|
| 220 | + $callback, |
|
| 221 | + $callback_args |
|
| 222 | + ); |
|
| 223 | + }; |
|
| 224 | + } else { |
|
| 225 | + $single_endpoint_args['callback'] = $data_for_single_endpoint['callback']; |
|
| 226 | + } |
|
| 227 | + // As of WordPress 5.5, if a permission_callback is not provided, |
|
| 228 | + // the REST API will issue a _doing_it_wrong notice. |
|
| 229 | + // Since the EE REST API defers capabilities to the db model system, |
|
| 230 | + // we will just use the generic WP callback for public endpoints |
|
| 231 | + if (! isset($single_endpoint_args['permission_callback'])) { |
|
| 232 | + $single_endpoint_args['permission_callback'] = '__return_true'; |
|
| 233 | + } |
|
| 234 | + $multiple_endpoint_args[] = $single_endpoint_args; |
|
| 235 | + } |
|
| 236 | + if (isset($data_for_multiple_endpoints['schema'])) { |
|
| 237 | + $schema_route_data = $data_for_multiple_endpoints['schema']; |
|
| 238 | + $schema_callback = $schema_route_data['schema_callback']; |
|
| 239 | + $callback_args = $schema_route_data['callback_args']; |
|
| 240 | + $multiple_endpoint_args['schema'] = static function () use ($schema_callback, $callback_args) { |
|
| 241 | + return call_user_func_array( |
|
| 242 | + $schema_callback, |
|
| 243 | + $callback_args |
|
| 244 | + ); |
|
| 245 | + }; |
|
| 246 | + } |
|
| 247 | + register_rest_route( |
|
| 248 | + $namespace, |
|
| 249 | + $relative_route, |
|
| 250 | + $multiple_endpoint_args |
|
| 251 | + ); |
|
| 252 | + } |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * Checks if there was a version change or something that merits invalidating the cached |
|
| 259 | + * route data. If so, invalidates the cached route data so that it gets refreshed |
|
| 260 | + * next time the WP API is used |
|
| 261 | + */ |
|
| 262 | + public static function invalidate_cached_route_data_on_version_change() |
|
| 263 | + { |
|
| 264 | + if (EE_System::instance()->detect_req_type() !== EE_System::req_type_normal) { |
|
| 265 | + EED_Core_Rest_Api::invalidate_cached_route_data(); |
|
| 266 | + } |
|
| 267 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
| 268 | + if ($addon instanceof EE_Addon && $addon->detect_req_type() !== EE_System::req_type_normal) { |
|
| 269 | + EED_Core_Rest_Api::invalidate_cached_route_data(); |
|
| 270 | + } |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * Removes the cached route data so it will get refreshed next time the WP API is used |
|
| 277 | + */ |
|
| 278 | + public static function invalidate_cached_route_data() |
|
| 279 | + { |
|
| 280 | + // delete the saved EE REST API routes |
|
| 281 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) { |
|
| 282 | + delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version); |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * Gets the EE route data |
|
| 289 | + * |
|
| 290 | + * @return array top-level key is the namespace, next-level key is the route and its value is array{ |
|
| 291 | + * @throws EE_Error |
|
| 292 | + * @throws ReflectionException |
|
| 293 | + * @type string|array $callback |
|
| 294 | + * @type string $methods |
|
| 295 | + * @type boolean $hidden_endpoint |
|
| 296 | + * } |
|
| 297 | + */ |
|
| 298 | + public static function get_ee_route_data() |
|
| 299 | + { |
|
| 300 | + $ee_routes = []; |
|
| 301 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoints) { |
|
| 302 | + $ee_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = EED_Core_Rest_Api::_get_ee_route_data_for_version( |
|
| 303 | + $version, |
|
| 304 | + $hidden_endpoints |
|
| 305 | + ); |
|
| 306 | + } |
|
| 307 | + return $ee_routes; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + |
|
| 311 | + /** |
|
| 312 | + * Gets the EE route data from the wp options if it exists already, |
|
| 313 | + * otherwise re-generates it and saves it to the option |
|
| 314 | + * |
|
| 315 | + * @param string $version |
|
| 316 | + * @param boolean $hidden_endpoints |
|
| 317 | + * @return array |
|
| 318 | + * @throws EE_Error |
|
| 319 | + * @throws ReflectionException |
|
| 320 | + */ |
|
| 321 | + protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) |
|
| 322 | + { |
|
| 323 | + $ee_routes = get_option(EED_Core_Rest_Api::saved_routes_option_names . $version, null); |
|
| 324 | + if (! $ee_routes || EED_Core_Rest_Api::debugMode()) { |
|
| 325 | + $ee_routes = EED_Core_Rest_Api::_save_ee_route_data_for_version($version, $hidden_endpoints); |
|
| 326 | + } |
|
| 327 | + return $ee_routes; |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + |
|
| 331 | + /** |
|
| 332 | + * Saves the EE REST API route data to a wp option and returns it |
|
| 333 | + * |
|
| 334 | + * @param string $version |
|
| 335 | + * @param boolean $hidden_endpoints |
|
| 336 | + * @return mixed|null |
|
| 337 | + * @throws EE_Error |
|
| 338 | + * @throws ReflectionException |
|
| 339 | + */ |
|
| 340 | + protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) |
|
| 341 | + { |
|
| 342 | + $instance = EED_Core_Rest_Api::instance(); |
|
| 343 | + $routes = apply_filters( |
|
| 344 | + 'EED_Core_Rest_Api__save_ee_route_data_for_version__routes', |
|
| 345 | + array_replace_recursive( |
|
| 346 | + $instance->_get_config_route_data_for_version($version, $hidden_endpoints), |
|
| 347 | + $instance->_get_meta_route_data_for_version($version, $hidden_endpoints), |
|
| 348 | + $instance->_get_model_route_data_for_version($version, $hidden_endpoints), |
|
| 349 | + $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints) |
|
| 350 | + ) |
|
| 351 | + ); |
|
| 352 | + $option_name = EED_Core_Rest_Api::saved_routes_option_names . $version; |
|
| 353 | + if (get_option($option_name)) { |
|
| 354 | + update_option($option_name, $routes, true); |
|
| 355 | + } else { |
|
| 356 | + add_option($option_name, $routes, null, 'no'); |
|
| 357 | + } |
|
| 358 | + return $routes; |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + |
|
| 362 | + /** |
|
| 363 | + * Calculates all the EE routes and saves it to a WordPress option so we don't |
|
| 364 | + * need to calculate it on every request |
|
| 365 | + * |
|
| 366 | + * @return void |
|
| 367 | + * @deprecated since version 4.9.1 |
|
| 368 | + */ |
|
| 369 | + public static function save_ee_routes() |
|
| 370 | + { |
|
| 371 | + if (DbStatus::isOnline()) { |
|
| 372 | + $instance = EED_Core_Rest_Api::instance(); |
|
| 373 | + $routes = apply_filters( |
|
| 374 | + 'EED_Core_Rest_Api__save_ee_routes__routes', |
|
| 375 | + array_replace_recursive( |
|
| 376 | + $instance->_register_config_routes(), |
|
| 377 | + $instance->_register_meta_routes(), |
|
| 378 | + $instance->_register_model_routes(), |
|
| 379 | + $instance->_register_rpc_routes() |
|
| 380 | + ) |
|
| 381 | + ); |
|
| 382 | + update_option(EED_Core_Rest_Api::saved_routes_option_names, $routes, true); |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * Gets all the route information relating to EE models |
|
| 389 | + * |
|
| 390 | + * @return array @see get_ee_route_data |
|
| 391 | + * @deprecated since version 4.9.1 |
|
| 392 | + */ |
|
| 393 | + protected function _register_model_routes() |
|
| 394 | + { |
|
| 395 | + $model_routes = []; |
|
| 396 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 397 | + $model_routes[ EED_Core_Rest_Api::ee_api_namespace |
|
| 398 | + . $version ] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
| 399 | + } |
|
| 400 | + return $model_routes; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * Decides whether or not to add write endpoints for this model. |
|
| 406 | + * Currently, this defaults to exclude all global tables and models |
|
| 407 | + * which would allow inserting WP core data (we don't want to duplicate |
|
| 408 | + * what WP API does, as it's unnecessary, extra work, and potentially extra bugs) |
|
| 409 | + * |
|
| 410 | + * @param EEM_Base $model |
|
| 411 | + * @return bool |
|
| 412 | + */ |
|
| 413 | + public static function should_have_write_endpoints(EEM_Base $model): bool |
|
| 414 | + { |
|
| 415 | + if ($model->is_wp_core_model()) { |
|
| 416 | + return false; |
|
| 417 | + } |
|
| 418 | + foreach ($model->get_tables() as $table) { |
|
| 419 | + if ($table->is_global()) { |
|
| 420 | + return false; |
|
| 421 | + } |
|
| 422 | + } |
|
| 423 | + return true; |
|
| 424 | + } |
|
| 425 | + |
|
| 426 | + |
|
| 427 | + /** |
|
| 428 | + * Gets the names of all models which should have plural routes (eg `ee/v4.8.36/events`) |
|
| 429 | + * in this versioned namespace of EE4 |
|
| 430 | + * |
|
| 431 | + * @param $version |
|
| 432 | + * @return array keys are model names (eg 'Event') and values ar either classnames (eg 'EEM_Event') |
|
| 433 | + */ |
|
| 434 | + public static function model_names_with_plural_routes($version): array |
|
| 435 | + { |
|
| 436 | + $model_version_info = new ModelVersionInfo($version); |
|
| 437 | + $models_to_register = $model_version_info->modelsForRequestedVersion(); |
|
| 438 | + // let's not bother having endpoints for extra metas |
|
| 439 | + unset( |
|
| 440 | + $models_to_register['Extra_Meta'], |
|
| 441 | + $models_to_register['Extra_Join'], |
|
| 442 | + $models_to_register['Post_Meta'] |
|
| 443 | + ); |
|
| 444 | + return (array) apply_filters( |
|
| 445 | + 'FHEE__EED_Core_REST_API___register_model_routes', |
|
| 446 | + $models_to_register |
|
| 447 | + ); |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + |
|
| 451 | + /** |
|
| 452 | + * Gets the route data for EE models in the specified version |
|
| 453 | + * |
|
| 454 | + * @param string $version |
|
| 455 | + * @param boolean $hidden_endpoint |
|
| 456 | + * @return array |
|
| 457 | + * @throws EE_Error |
|
| 458 | + * @throws ReflectionException |
|
| 459 | + */ |
|
| 460 | + protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) |
|
| 461 | + { |
|
| 462 | + $model_routes = []; |
|
| 463 | + $model_version_info = new ModelVersionInfo($version); |
|
| 464 | + foreach (EED_Core_Rest_Api::model_names_with_plural_routes($version) as $model_name => $model_classname) { |
|
| 465 | + $model = EE_Registry::instance()->load_model($model_name); |
|
| 466 | + // if this isn't a valid model then let's skip iterate to the next item in the loop. |
|
| 467 | + if (! $model instanceof EEM_Base) { |
|
| 468 | + continue; |
|
| 469 | + } |
|
| 470 | + // yes we could just register one route for ALL models, but then they wouldn't show up in the index |
|
| 471 | + $plural_model_route = EED_Core_Rest_Api::get_collection_route($model); |
|
| 472 | + $singular_model_route = EED_Core_Rest_Api::get_entity_route($model, '(?P<id>[^\/]+)'); |
|
| 473 | + $model_routes[ $plural_model_route ] = [ |
|
| 474 | + [ |
|
| 475 | + 'callback' => [ |
|
| 476 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 477 | + 'handleRequestGetAll', |
|
| 478 | + ], |
|
| 479 | + 'callback_args' => [$version, $model_name], |
|
| 480 | + 'methods' => WP_REST_Server::READABLE, |
|
| 481 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 482 | + 'args' => $this->_get_read_query_params($model, $version), |
|
| 483 | + '_links' => [ |
|
| 484 | + 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route), |
|
| 485 | + ], |
|
| 486 | + ], |
|
| 487 | + 'schema' => [ |
|
| 488 | + 'schema_callback' => [ |
|
| 489 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 490 | + 'handleSchemaRequest', |
|
| 491 | + ], |
|
| 492 | + 'callback_args' => [$version, $model_name], |
|
| 493 | + ], |
|
| 494 | + ]; |
|
| 495 | + $model_routes[ $singular_model_route ] = [ |
|
| 496 | + [ |
|
| 497 | + 'callback' => [ |
|
| 498 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 499 | + 'handleRequestGetOne', |
|
| 500 | + ], |
|
| 501 | + 'callback_args' => [$version, $model_name], |
|
| 502 | + 'methods' => WP_REST_Server::READABLE, |
|
| 503 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 504 | + 'args' => $this->_get_response_selection_query_params($model, $version, true), |
|
| 505 | + ], |
|
| 506 | + ]; |
|
| 507 | + if ( |
|
| 508 | + apply_filters( |
|
| 509 | + 'FHEE__EED_Core_Rest_Api___get_model_route_data_for_version__add_write_endpoints', |
|
| 510 | + EED_Core_Rest_Api::should_have_write_endpoints($model), |
|
| 511 | + $model |
|
| 512 | + ) |
|
| 513 | + ) { |
|
| 514 | + $model_routes[ $plural_model_route ][] = [ |
|
| 515 | + 'callback' => [ |
|
| 516 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 517 | + 'handleRequestInsert', |
|
| 518 | + ], |
|
| 519 | + 'callback_args' => [$version, $model_name], |
|
| 520 | + 'methods' => WP_REST_Server::CREATABLE, |
|
| 521 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 522 | + 'args' => $this->_get_write_params($model_name, $model_version_info, true), |
|
| 523 | + ]; |
|
| 524 | + $model_routes[ $singular_model_route ] = array_merge( |
|
| 525 | + $model_routes[ $singular_model_route ], |
|
| 526 | + [ |
|
| 527 | + [ |
|
| 528 | + 'callback' => [ |
|
| 529 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 530 | + 'handleRequestUpdate', |
|
| 531 | + ], |
|
| 532 | + 'callback_args' => [$version, $model_name], |
|
| 533 | + 'methods' => WP_REST_Server::EDITABLE, |
|
| 534 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 535 | + 'args' => $this->_get_write_params($model_name, $model_version_info), |
|
| 536 | + ], |
|
| 537 | + [ |
|
| 538 | + 'callback' => [ |
|
| 539 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 540 | + 'handleRequestDelete', |
|
| 541 | + ], |
|
| 542 | + 'callback_args' => [$version, $model_name], |
|
| 543 | + 'methods' => WP_REST_Server::DELETABLE, |
|
| 544 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 545 | + 'args' => $this->_get_delete_query_params($model, $version), |
|
| 546 | + ], |
|
| 547 | + ] |
|
| 548 | + ); |
|
| 549 | + } |
|
| 550 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 551 | + $related_route = EED_Core_Rest_Api::get_relation_route_via( |
|
| 552 | + $model, |
|
| 553 | + '(?P<id>[^\/]+)', |
|
| 554 | + $relation_obj |
|
| 555 | + ); |
|
| 556 | + $model_routes[ $related_route ] = [ |
|
| 557 | + [ |
|
| 558 | + 'callback' => [ |
|
| 559 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 560 | + 'handleRequestGetRelated', |
|
| 561 | + ], |
|
| 562 | + 'callback_args' => [$version, $model_name, $relation_name], |
|
| 563 | + 'methods' => WP_REST_Server::READABLE, |
|
| 564 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 565 | + 'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version), |
|
| 566 | + ], |
|
| 567 | + ]; |
|
| 568 | + |
|
| 569 | + $related_write_route = $related_route . '/' . '(?P<related_id>[^\/]+)'; |
|
| 570 | + $model_routes[ $related_write_route ] = [ |
|
| 571 | + [ |
|
| 572 | + 'callback' => [ |
|
| 573 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 574 | + 'handleRequestAddRelation', |
|
| 575 | + ], |
|
| 576 | + 'callback_args' => [$version, $model_name, $relation_name], |
|
| 577 | + 'methods' => WP_REST_Server::EDITABLE, |
|
| 578 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 579 | + 'args' => $this->_get_add_relation_query_params( |
|
| 580 | + $model, |
|
| 581 | + $relation_obj->get_other_model(), |
|
| 582 | + $version |
|
| 583 | + ), |
|
| 584 | + ], |
|
| 585 | + [ |
|
| 586 | + 'callback' => [ |
|
| 587 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
|
| 588 | + 'handleRequestRemoveRelation', |
|
| 589 | + ], |
|
| 590 | + 'callback_args' => [$version, $model_name, $relation_name], |
|
| 591 | + 'methods' => WP_REST_Server::DELETABLE, |
|
| 592 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 593 | + 'args' => [], |
|
| 594 | + ], |
|
| 595 | + ]; |
|
| 596 | + } |
|
| 597 | + } |
|
| 598 | + return $model_routes; |
|
| 599 | + } |
|
| 600 | + |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * Gets the relative URI to a model's REST API plural route, after the EE4 versioned namespace, |
|
| 604 | + * excluding the preceding slash. |
|
| 605 | + * Eg you pass get_plural_route_to('Event') = 'events' |
|
| 606 | + * |
|
| 607 | + * @param EEM_Base $model |
|
| 608 | + * @return string |
|
| 609 | + */ |
|
| 610 | + public static function get_collection_route(EEM_Base $model) |
|
| 611 | + { |
|
| 612 | + return EEH_Inflector::pluralize_and_lower($model->get_this_model_name()); |
|
| 613 | + } |
|
| 614 | + |
|
| 615 | + |
|
| 616 | + /** |
|
| 617 | + * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace, |
|
| 618 | + * excluding the preceding slash. |
|
| 619 | + * Eg you pass get_plural_route_to('Event', 12) = 'events/12' |
|
| 620 | + * |
|
| 621 | + * @param EEM_Base $model eg Event or Venue |
|
| 622 | + * @param string $id |
|
| 623 | + * @return string |
|
| 624 | + */ |
|
| 625 | + public static function get_entity_route($model, $id) |
|
| 626 | + { |
|
| 627 | + return EED_Core_Rest_Api::get_collection_route($model) . '/' . $id; |
|
| 628 | + } |
|
| 629 | + |
|
| 630 | + |
|
| 631 | + /** |
|
| 632 | + * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace, |
|
| 633 | + * excluding the preceding slash. |
|
| 634 | + * Eg you pass get_plural_route_to('Event', 12) = 'events/12' |
|
| 635 | + * |
|
| 636 | + * @param EEM_Base $model eg Event or Venue |
|
| 637 | + * @param string $id |
|
| 638 | + * @param EE_Model_Relation_Base $relation_obj |
|
| 639 | + * @return string |
|
| 640 | + */ |
|
| 641 | + public static function get_relation_route_via(EEM_Base $model, $id, EE_Model_Relation_Base $relation_obj) |
|
| 642 | + { |
|
| 643 | + $related_model_name_endpoint_part = ModelRead::getRelatedEntityName( |
|
| 644 | + $relation_obj->get_other_model()->get_this_model_name(), |
|
| 645 | + $relation_obj |
|
| 646 | + ); |
|
| 647 | + return EED_Core_Rest_Api::get_entity_route($model, $id) . '/' . $related_model_name_endpoint_part; |
|
| 648 | + } |
|
| 649 | + |
|
| 650 | + |
|
| 651 | + /** |
|
| 652 | + * Adds onto the $relative_route the EE4 REST API versioned namespace. |
|
| 653 | + * Eg if given '4.8.36' and 'events', will return 'ee/v4.8.36/events' |
|
| 654 | + * |
|
| 655 | + * @param string $relative_route |
|
| 656 | + * @param string $version |
|
| 657 | + * @return string |
|
| 658 | + */ |
|
| 659 | + public static function get_versioned_route_to($relative_route, $version = '4.8.36') |
|
| 660 | + { |
|
| 661 | + return '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' . $relative_route; |
|
| 662 | + } |
|
| 663 | + |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * Adds all the RPC-style routes (remote procedure call-like routes, ie |
|
| 667 | + * routes that don't conform to the traditional REST CRUD-style). |
|
| 668 | + * |
|
| 669 | + * @deprecated since 4.9.1 |
|
| 670 | + */ |
|
| 671 | + protected function _register_rpc_routes() |
|
| 672 | + { |
|
| 673 | + $routes = []; |
|
| 674 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 675 | + $routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( |
|
| 676 | + $version, |
|
| 677 | + $hidden_endpoint |
|
| 678 | + ); |
|
| 679 | + } |
|
| 680 | + return $routes; |
|
| 681 | + } |
|
| 682 | + |
|
| 683 | + |
|
| 684 | + /** |
|
| 685 | + * @param string $version |
|
| 686 | + * @param boolean $hidden_endpoint |
|
| 687 | + * @return array |
|
| 688 | + */ |
|
| 689 | + protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) |
|
| 690 | + { |
|
| 691 | + $this_versions_routes = []; |
|
| 692 | + // checkin endpoint |
|
| 693 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = [ |
|
| 694 | + [ |
|
| 695 | + 'callback' => [ |
|
| 696 | + 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
|
| 697 | + 'handleRequestToggleCheckin', |
|
| 698 | + ], |
|
| 699 | + 'methods' => WP_REST_Server::CREATABLE, |
|
| 700 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 701 | + 'args' => [ |
|
| 702 | + 'force' => [ |
|
| 703 | + 'required' => false, |
|
| 704 | + 'default' => false, |
|
| 705 | + 'description' => esc_html__( |
|
| 706 | + // @codingStandardsIgnoreStart |
|
| 707 | + 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', |
|
| 708 | + // @codingStandardsIgnoreEnd |
|
| 709 | + 'event_espresso' |
|
| 710 | + ), |
|
| 711 | + ], |
|
| 712 | + ], |
|
| 713 | + 'callback_args' => [$version], |
|
| 714 | + ], |
|
| 715 | + ]; |
|
| 716 | + return apply_filters( |
|
| 717 | + 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
|
| 718 | + $this_versions_routes, |
|
| 719 | + $version, |
|
| 720 | + $hidden_endpoint |
|
| 721 | + ); |
|
| 722 | + } |
|
| 723 | + |
|
| 724 | + |
|
| 725 | + /** |
|
| 726 | + * Gets the query params that can be used when request one or many |
|
| 727 | + * |
|
| 728 | + * @param EEM_Base $model |
|
| 729 | + * @param string $version |
|
| 730 | + * @return array |
|
| 731 | + */ |
|
| 732 | + protected function _get_response_selection_query_params(EEM_Base $model, $version, $single_only = false) |
|
| 733 | + { |
|
| 734 | + EED_Core_Rest_Api::loadCalculatedModelFields(); |
|
| 735 | + $query_params = [ |
|
| 736 | + 'include' => [ |
|
| 737 | + 'required' => false, |
|
| 738 | + 'default' => '*', |
|
| 739 | + 'type' => SchemaType::STRING, |
|
| 740 | + ], |
|
| 741 | + 'calculate' => [ |
|
| 742 | + 'required' => false, |
|
| 743 | + 'default' => '', |
|
| 744 | + 'enum' => EED_Core_Rest_Api::$_field_calculator->retrieveCalculatedFieldsForModel($model), |
|
| 745 | + 'type' => SchemaType::STRING, |
|
| 746 | + // because we accept a CSV list of the enumerated strings, WP core validation and sanitization |
|
| 747 | + // freaks out. We'll just validate this argument while handling the request |
|
| 748 | + 'validate_callback' => null, |
|
| 749 | + 'sanitize_callback' => null, |
|
| 750 | + ], |
|
| 751 | + 'password' => [ |
|
| 752 | + 'required' => false, |
|
| 753 | + 'default' => '', |
|
| 754 | + 'type' => SchemaType::STRING, |
|
| 755 | + ], |
|
| 756 | + ]; |
|
| 757 | + return apply_filters( |
|
| 758 | + 'FHEE__EED_Core_Rest_Api___get_response_selection_query_params', |
|
| 759 | + $query_params, |
|
| 760 | + $model, |
|
| 761 | + $version |
|
| 762 | + ); |
|
| 763 | + } |
|
| 764 | + |
|
| 765 | + |
|
| 766 | + /** |
|
| 767 | + * Gets the parameters acceptable for delete requests |
|
| 768 | + * |
|
| 769 | + * @param EEM_Base $model |
|
| 770 | + * @param string $version |
|
| 771 | + * @return array |
|
| 772 | + */ |
|
| 773 | + protected function _get_delete_query_params(EEM_Base $model, $version) |
|
| 774 | + { |
|
| 775 | + $params_for_delete = [ |
|
| 776 | + 'allow_blocking' => [ |
|
| 777 | + 'required' => false, |
|
| 778 | + 'default' => true, |
|
| 779 | + 'type' => SchemaType::BOOLEAN, |
|
| 780 | + ], |
|
| 781 | + ]; |
|
| 782 | + $params_for_delete['force'] = [ |
|
| 783 | + 'required' => false, |
|
| 784 | + 'default' => false, |
|
| 785 | + 'type' => SchemaType::BOOLEAN, |
|
| 786 | + ]; |
|
| 787 | + return apply_filters( |
|
| 788 | + 'FHEE__EED_Core_Rest_Api___get_delete_query_params', |
|
| 789 | + $params_for_delete, |
|
| 790 | + $model, |
|
| 791 | + $version |
|
| 792 | + ); |
|
| 793 | + } |
|
| 794 | + |
|
| 795 | + |
|
| 796 | + /** |
|
| 797 | + * @param EEM_Base $source_model |
|
| 798 | + * @param EEM_Base $related_model |
|
| 799 | + * @param $version |
|
| 800 | + * @return array |
|
| 801 | + * @throws EE_Error |
|
| 802 | + * @since 5.0.0.p |
|
| 803 | + */ |
|
| 804 | + protected function _get_add_relation_query_params(EEM_Base $source_model, EEM_Base $related_model, $version) |
|
| 805 | + { |
|
| 806 | + // if they're related through a HABTM relation, check for any non-FKs |
|
| 807 | + $all_relation_settings = $source_model->relation_settings(); |
|
| 808 | + $relation_settings = $all_relation_settings[ $related_model->get_this_model_name() ]; |
|
| 809 | + $params = []; |
|
| 810 | + if ($relation_settings instanceof EE_HABTM_Relation && $relation_settings->hasNonKeyFields()) { |
|
| 811 | + foreach ($relation_settings->getNonKeyFields() as $field) { |
|
| 812 | + /* @var $field EE_Model_Field_Base */ |
|
| 813 | + $params[ $field->get_name() ] = [ |
|
| 814 | + 'required' => ! $field->is_nullable(), |
|
| 815 | + 'default' => ModelDataTranslator::prepareFieldValueForJson( |
|
| 816 | + $field, |
|
| 817 | + $field->get_default_value(), |
|
| 818 | + $version |
|
| 819 | + ), |
|
| 820 | + 'type' => $field->getSchemaType(), |
|
| 821 | + 'validate_callback' => null, |
|
| 822 | + 'sanitize_callback' => null, |
|
| 823 | + ]; |
|
| 824 | + } |
|
| 825 | + } |
|
| 826 | + return $params; |
|
| 827 | + } |
|
| 828 | + |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * Gets info about reading query params that are acceptable |
|
| 832 | + * |
|
| 833 | + * @param EEM_Base $model eg 'Event' or 'Venue' |
|
| 834 | + * @param string $version |
|
| 835 | + * @return array describing the args acceptable when querying this model |
|
| 836 | + * @throws EE_Error |
|
| 837 | + */ |
|
| 838 | + protected function _get_read_query_params(EEM_Base $model, $version) |
|
| 839 | + { |
|
| 840 | + $default_orderby = []; |
|
| 841 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
| 842 | + $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
| 843 | + } |
|
| 844 | + return array_merge( |
|
| 845 | + $this->_get_response_selection_query_params($model, $version), |
|
| 846 | + [ |
|
| 847 | + 'where' => [ |
|
| 848 | + 'required' => false, |
|
| 849 | + 'default' => [], |
|
| 850 | + 'type' => SchemaType::OBJECT, |
|
| 851 | + // because we accept an almost infinite list of possible where conditions, WP |
|
| 852 | + // core validation and sanitization freaks out. We'll just validate this argument |
|
| 853 | + // while handling the request |
|
| 854 | + 'validate_callback' => null, |
|
| 855 | + 'sanitize_callback' => null, |
|
| 856 | + ], |
|
| 857 | + 'limit' => [ |
|
| 858 | + 'required' => false, |
|
| 859 | + 'default' => EED_Core_Rest_Api::get_default_query_limit(), |
|
| 860 | + 'type' => [ |
|
| 861 | + SchemaType::ARRAY, |
|
| 862 | + SchemaType::STRING, |
|
| 863 | + SchemaType::INTEGER, |
|
| 864 | + ], |
|
| 865 | + // because we accept a variety of types, WP core validation and sanitization |
|
| 866 | + // freaks out. We'll just validate this argument while handling the request |
|
| 867 | + 'validate_callback' => null, |
|
| 868 | + 'sanitize_callback' => null, |
|
| 869 | + ], |
|
| 870 | + 'order_by' => [ |
|
| 871 | + 'required' => false, |
|
| 872 | + 'default' => $default_orderby, |
|
| 873 | + 'type' => [ |
|
| 874 | + SchemaType::OBJECT, |
|
| 875 | + SchemaType::STRING, |
|
| 876 | + ],// because we accept a variety of types, WP core validation and sanitization |
|
| 877 | + // freaks out. We'll just validate this argument while handling the request |
|
| 878 | + 'validate_callback' => null, |
|
| 879 | + 'sanitize_callback' => null, |
|
| 880 | + ], |
|
| 881 | + 'group_by' => [ |
|
| 882 | + 'required' => false, |
|
| 883 | + 'default' => null, |
|
| 884 | + 'type' => [ |
|
| 885 | + SchemaType::OBJECT, |
|
| 886 | + SchemaType::STRING, |
|
| 887 | + ], |
|
| 888 | + // because we accept an almost infinite list of possible groupings, |
|
| 889 | + // WP core validation and sanitization |
|
| 890 | + // freaks out. We'll just validate this argument while handling the request |
|
| 891 | + 'validate_callback' => null, |
|
| 892 | + 'sanitize_callback' => null, |
|
| 893 | + ], |
|
| 894 | + 'having' => [ |
|
| 895 | + 'required' => false, |
|
| 896 | + 'default' => null, |
|
| 897 | + 'type' => SchemaType::OBJECT, |
|
| 898 | + // because we accept an almost infinite list of possible where conditions, WP |
|
| 899 | + // core validation and sanitization freaks out. We'll just validate this argument |
|
| 900 | + // while handling the request |
|
| 901 | + 'validate_callback' => null, |
|
| 902 | + 'sanitize_callback' => null, |
|
| 903 | + ], |
|
| 904 | + 'caps' => [ |
|
| 905 | + 'required' => false, |
|
| 906 | + 'default' => EEM_Base::caps_read, |
|
| 907 | + 'type' => SchemaType::STRING, |
|
| 908 | + 'enum' => [ |
|
| 909 | + EEM_Base::caps_read, |
|
| 910 | + EEM_Base::caps_read_admin, |
|
| 911 | + EEM_Base::caps_edit, |
|
| 912 | + EEM_Base::caps_delete, |
|
| 913 | + ], |
|
| 914 | + ], |
|
| 915 | + ] |
|
| 916 | + ); |
|
| 917 | + } |
|
| 918 | + |
|
| 919 | + |
|
| 920 | + /** |
|
| 921 | + * Gets parameter information for a model regarding writing data |
|
| 922 | + * |
|
| 923 | + * @param string $model_name |
|
| 924 | + * @param ModelVersionInfo $model_version_info |
|
| 925 | + * @param boolean $create whether this is for request to create (in |
|
| 926 | + * which case we need all required params) or |
|
| 927 | + * just to update (in which case we don't |
|
| 928 | + * need those on every request) |
|
| 929 | + * @return array |
|
| 930 | + * @throws EE_Error |
|
| 931 | + * @throws ReflectionException |
|
| 932 | + */ |
|
| 933 | + protected function _get_write_params( |
|
| 934 | + $model_name, |
|
| 935 | + ModelVersionInfo $model_version_info, |
|
| 936 | + $create = false |
|
| 937 | + ) { |
|
| 938 | + $model = EE_Registry::instance()->load_model($model_name); |
|
| 939 | + $fields = $model_version_info->fieldsOnModelInThisVersion($model); |
|
| 940 | + |
|
| 941 | + // we do our own validation and sanitization within the controller |
|
| 942 | + $sanitize_callback = function_exists('rest_validate_value_from_schema') |
|
| 943 | + ? ['EED_Core_Rest_Api', 'default_sanitize_callback'] |
|
| 944 | + : null; |
|
| 945 | + $args_info = []; |
|
| 946 | + foreach ($fields as $field_name => $field_obj) { |
|
| 947 | + if ($field_obj->is_auto_increment()) { |
|
| 948 | + // totally ignore auto increment IDs |
|
| 949 | + continue; |
|
| 950 | + } |
|
| 951 | + $arg_info = $field_obj->getSchema(); |
|
| 952 | + $required = $create && ! $field_obj->is_nullable() && $field_obj->get_default_value() === null; |
|
| 953 | + $arg_info['required'] = $required; |
|
| 954 | + // remove the read-only flag. If it were read-only we wouldn't list it as an argument while writing, right? |
|
| 955 | + unset($arg_info['readonly']); |
|
| 956 | + $schema_properties = $field_obj->getSchemaProperties(); |
|
| 957 | + // if there's a "raw" form of this argument, use those properties instead |
|
| 958 | + if (isset($schema_properties['raw'])) { |
|
| 959 | + $arg_info = array_replace($arg_info, $schema_properties['raw']); |
|
| 960 | + } |
|
| 961 | + $arg_info['default'] = ModelDataTranslator::prepareFieldValueForJson( |
|
| 962 | + $field_obj, |
|
| 963 | + $field_obj->get_default_value(), |
|
| 964 | + $model_version_info->requestedVersion() |
|
| 965 | + ); |
|
| 966 | + $arg_info['sanitize_callback'] = $sanitize_callback; |
|
| 967 | + $args_info[ $field_name ] = $arg_info; |
|
| 968 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
| 969 | + $gmt_arg_info = $arg_info; |
|
| 970 | + $gmt_arg_info['description'] = sprintf( |
|
| 971 | + esc_html__( |
|
| 972 | + '%1$s - the value for this field in UTC. Ignored if %2$s is provided.', |
|
| 973 | + 'event_espresso' |
|
| 974 | + ), |
|
| 975 | + $field_obj->get_nicename(), |
|
| 976 | + $field_name |
|
| 977 | + ); |
|
| 978 | + $args_info[ $field_name . '_gmt' ] = $gmt_arg_info; |
|
| 979 | + } |
|
| 980 | + } |
|
| 981 | + return $args_info; |
|
| 982 | + } |
|
| 983 | + |
|
| 984 | + |
|
| 985 | + /** |
|
| 986 | + * Replacement for WP API's 'rest_parse_request_arg'. |
|
| 987 | + * If the value is blank but not required, don't bother validating it. |
|
| 988 | + * Also, it uses our email validation instead of WP API's default. |
|
| 989 | + * |
|
| 990 | + * @param $value |
|
| 991 | + * @param WP_REST_Request $request |
|
| 992 | + * @param $param |
|
| 993 | + * @return bool|true|WP_Error |
|
| 994 | + * @throws InvalidArgumentException |
|
| 995 | + * @throws InvalidInterfaceException |
|
| 996 | + * @throws InvalidDataTypeException |
|
| 997 | + */ |
|
| 998 | + public static function default_sanitize_callback($value, WP_REST_Request $request, $param) |
|
| 999 | + { |
|
| 1000 | + $attributes = $request->get_attributes(); |
|
| 1001 | + if ( |
|
| 1002 | + ! isset($attributes['args'][ $param ]) |
|
| 1003 | + || ! is_array($attributes['args'][ $param ]) |
|
| 1004 | + ) { |
|
| 1005 | + $validation_result = true; |
|
| 1006 | + } else { |
|
| 1007 | + $args = $attributes['args'][ $param ]; |
|
| 1008 | + if ( |
|
| 1009 | + ( |
|
| 1010 | + $value === '' |
|
| 1011 | + || $value === null |
|
| 1012 | + ) |
|
| 1013 | + && (! isset($args['required']) |
|
| 1014 | + || $args['required'] === false |
|
| 1015 | + ) |
|
| 1016 | + ) { |
|
| 1017 | + // not required and not provided? that's cool |
|
| 1018 | + $validation_result = true; |
|
| 1019 | + } elseif ( |
|
| 1020 | + isset($args['format']) |
|
| 1021 | + && $args['format'] === 'email' |
|
| 1022 | + ) { |
|
| 1023 | + $validation_result = true; |
|
| 1024 | + if (! EED_Core_Rest_Api::_validate_email($value)) { |
|
| 1025 | + $validation_result = new WP_Error( |
|
| 1026 | + 'rest_invalid_param', |
|
| 1027 | + esc_html__( |
|
| 1028 | + 'The email address is not valid or does not exist.', |
|
| 1029 | + 'event_espresso' |
|
| 1030 | + ) |
|
| 1031 | + ); |
|
| 1032 | + } |
|
| 1033 | + } else { |
|
| 1034 | + $validation_result = rest_validate_value_from_schema($value, $args, $param); |
|
| 1035 | + } |
|
| 1036 | + } |
|
| 1037 | + if (is_wp_error($validation_result)) { |
|
| 1038 | + return $validation_result; |
|
| 1039 | + } |
|
| 1040 | + return rest_sanitize_request_arg($value, $request, $param); |
|
| 1041 | + } |
|
| 1042 | + |
|
| 1043 | + |
|
| 1044 | + /** |
|
| 1045 | + * Returns whether or not this email address is valid. Copied from EE_Email_Validation_Strategy::_validate_email() |
|
| 1046 | + * |
|
| 1047 | + * @param $email |
|
| 1048 | + * @return bool |
|
| 1049 | + * @throws InvalidArgumentException |
|
| 1050 | + * @throws InvalidInterfaceException |
|
| 1051 | + * @throws InvalidDataTypeException |
|
| 1052 | + */ |
|
| 1053 | + protected static function _validate_email($email) |
|
| 1054 | + { |
|
| 1055 | + try { |
|
| 1056 | + EmailAddressFactory::create($email); |
|
| 1057 | + return true; |
|
| 1058 | + } catch (EmailValidationException $e) { |
|
| 1059 | + return false; |
|
| 1060 | + } |
|
| 1061 | + } |
|
| 1062 | + |
|
| 1063 | + |
|
| 1064 | + /** |
|
| 1065 | + * Gets routes for the config |
|
| 1066 | + * |
|
| 1067 | + * @return array @see _register_model_routes |
|
| 1068 | + * @deprecated since version 4.9.1 |
|
| 1069 | + */ |
|
| 1070 | + protected function _register_config_routes() |
|
| 1071 | + { |
|
| 1072 | + $config_routes = []; |
|
| 1073 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 1074 | + $config_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( |
|
| 1075 | + $version, |
|
| 1076 | + $hidden_endpoint |
|
| 1077 | + ); |
|
| 1078 | + } |
|
| 1079 | + return $config_routes; |
|
| 1080 | + } |
|
| 1081 | + |
|
| 1082 | + |
|
| 1083 | + /** |
|
| 1084 | + * Gets routes for the config for the specified version |
|
| 1085 | + * |
|
| 1086 | + * @param string $version |
|
| 1087 | + * @param boolean $hidden_endpoint |
|
| 1088 | + * @return array |
|
| 1089 | + */ |
|
| 1090 | + protected function _get_config_route_data_for_version($version, $hidden_endpoint) |
|
| 1091 | + { |
|
| 1092 | + return [ |
|
| 1093 | + 'config' => [ |
|
| 1094 | + [ |
|
| 1095 | + 'callback' => [ |
|
| 1096 | + 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
|
| 1097 | + 'handleRequest', |
|
| 1098 | + ], |
|
| 1099 | + 'methods' => WP_REST_Server::READABLE, |
|
| 1100 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 1101 | + 'callback_args' => [$version], |
|
| 1102 | + ], |
|
| 1103 | + ], |
|
| 1104 | + 'site_info' => [ |
|
| 1105 | + [ |
|
| 1106 | + 'callback' => [ |
|
| 1107 | + 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
|
| 1108 | + 'handleRequestSiteInfo', |
|
| 1109 | + ], |
|
| 1110 | + 'methods' => WP_REST_Server::READABLE, |
|
| 1111 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 1112 | + 'callback_args' => [$version], |
|
| 1113 | + ], |
|
| 1114 | + ], |
|
| 1115 | + ]; |
|
| 1116 | + } |
|
| 1117 | + |
|
| 1118 | + |
|
| 1119 | + /** |
|
| 1120 | + * Gets the meta info routes |
|
| 1121 | + * |
|
| 1122 | + * @return array @see _register_model_routes |
|
| 1123 | + * @deprecated since version 4.9.1 |
|
| 1124 | + */ |
|
| 1125 | + protected function _register_meta_routes() |
|
| 1126 | + { |
|
| 1127 | + $meta_routes = []; |
|
| 1128 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
|
| 1129 | + $meta_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( |
|
| 1130 | + $version, |
|
| 1131 | + $hidden_endpoint |
|
| 1132 | + ); |
|
| 1133 | + } |
|
| 1134 | + return $meta_routes; |
|
| 1135 | + } |
|
| 1136 | + |
|
| 1137 | + |
|
| 1138 | + /** |
|
| 1139 | + * @param string $version |
|
| 1140 | + * @param boolean $hidden_endpoint |
|
| 1141 | + * @return array |
|
| 1142 | + */ |
|
| 1143 | + protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) |
|
| 1144 | + { |
|
| 1145 | + return [ |
|
| 1146 | + 'resources' => [ |
|
| 1147 | + [ |
|
| 1148 | + 'callback' => [ |
|
| 1149 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
|
| 1150 | + 'handleRequestModelsMeta', |
|
| 1151 | + ], |
|
| 1152 | + 'methods' => WP_REST_Server::READABLE, |
|
| 1153 | + 'hidden_endpoint' => $hidden_endpoint, |
|
| 1154 | + 'callback_args' => [$version], |
|
| 1155 | + ], |
|
| 1156 | + ], |
|
| 1157 | + ]; |
|
| 1158 | + } |
|
| 1159 | + |
|
| 1160 | + |
|
| 1161 | + /** |
|
| 1162 | + * Tries to hide old 4.6 endpoints from the |
|
| 1163 | + * |
|
| 1164 | + * @param array $route_data |
|
| 1165 | + * @return array |
|
| 1166 | + * @throws EE_Error |
|
| 1167 | + * @throws ReflectionException |
|
| 1168 | + */ |
|
| 1169 | + public static function hide_old_endpoints($route_data) |
|
| 1170 | + { |
|
| 1171 | + // allow API clients to override which endpoints get hidden, in case |
|
| 1172 | + // they want to discover particular endpoints |
|
| 1173 | + // also, we don't have access to the request so we have to just grab it from the superglobal |
|
| 1174 | + $force_show_ee_namespace = ltrim( |
|
| 1175 | + EED_Core_Rest_Api::getRequest()->getRequestParam('force_show_ee_namespace'), |
|
| 1176 | + '/' |
|
| 1177 | + ); |
|
| 1178 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
| 1179 | + foreach ($relative_urls as $resource_name => $endpoints) { |
|
| 1180 | + foreach ($endpoints as $key => $endpoint) { |
|
| 1181 | + // skip schema and other route options |
|
| 1182 | + if (! is_numeric($key)) { |
|
| 1183 | + continue; |
|
| 1184 | + } |
|
| 1185 | + // by default, hide "hidden_endpoint"s, unless the request indicates |
|
| 1186 | + // to $force_show_ee_namespace, in which case only show that one |
|
| 1187 | + // namespace's endpoints (and hide all others) |
|
| 1188 | + if ( |
|
| 1189 | + ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace) |
|
| 1190 | + || ($endpoint['hidden_endpoint'] && $force_show_ee_namespace === '') |
|
| 1191 | + ) { |
|
| 1192 | + $full_route = '/' . ltrim($namespace, '/'); |
|
| 1193 | + $full_route .= '/' . ltrim($resource_name, '/'); |
|
| 1194 | + unset($route_data[ $full_route ]); |
|
| 1195 | + } |
|
| 1196 | + } |
|
| 1197 | + } |
|
| 1198 | + } |
|
| 1199 | + return $route_data; |
|
| 1200 | + } |
|
| 1201 | + |
|
| 1202 | + |
|
| 1203 | + /** |
|
| 1204 | + * Returns an array describing which versions of core support serving requests for. |
|
| 1205 | + * Keys are core versions' major and minor version, and values are the |
|
| 1206 | + * LOWEST requested version they can serve. Eg, 4.7 can serve requests for 4.6-like |
|
| 1207 | + * data by just removing a few models and fields from the responses. However, 4.15 might remove |
|
| 1208 | + * the answers table entirely, in which case it would be very difficult for |
|
| 1209 | + * it to serve 4.6-style responses. |
|
| 1210 | + * Versions of core that are missing from this array are unknowns. |
|
| 1211 | + * previous ver |
|
| 1212 | + * |
|
| 1213 | + * @return array |
|
| 1214 | + */ |
|
| 1215 | + public static function version_compatibilities() |
|
| 1216 | + { |
|
| 1217 | + return apply_filters( |
|
| 1218 | + 'FHEE__EED_Core_REST_API__version_compatibilities', |
|
| 1219 | + [ |
|
| 1220 | + '4.8.29' => '4.8.29', |
|
| 1221 | + '4.8.33' => '4.8.29', |
|
| 1222 | + '4.8.34' => '4.8.29', |
|
| 1223 | + '4.8.36' => '4.8.29', |
|
| 1224 | + ] |
|
| 1225 | + ); |
|
| 1226 | + } |
|
| 1227 | + |
|
| 1228 | + |
|
| 1229 | + /** |
|
| 1230 | + * Gets the latest API version served. Eg if there |
|
| 1231 | + * are two versions served of the API, 4.8.29 and 4.8.32, and |
|
| 1232 | + * we are on core version 4.8.34, it will return the string "4.8.32" |
|
| 1233 | + * |
|
| 1234 | + * @return string |
|
| 1235 | + */ |
|
| 1236 | + public static function latest_rest_api_version() |
|
| 1237 | + { |
|
| 1238 | + $versions_served = EED_Core_Rest_Api::versions_served(); |
|
| 1239 | + $versions_served_keys = array_keys($versions_served); |
|
| 1240 | + return end($versions_served_keys); |
|
| 1241 | + } |
|
| 1242 | + |
|
| 1243 | + |
|
| 1244 | + /** |
|
| 1245 | + * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of |
|
| 1246 | + * EE the API can serve requests for. Eg, if we are on 4.15 of core, and |
|
| 1247 | + * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ). |
|
| 1248 | + * We also indicate whether or not this version should be put in the index or not |
|
| 1249 | + * |
|
| 1250 | + * @return array keys are API version numbers (just major and minor numbers), and values |
|
| 1251 | + * are whether or not they should be hidden |
|
| 1252 | + */ |
|
| 1253 | + public static function versions_served() |
|
| 1254 | + { |
|
| 1255 | + $versions_served = []; |
|
| 1256 | + $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities(); |
|
| 1257 | + $lowest_compatible_version = end($possibly_served_versions); |
|
| 1258 | + reset($possibly_served_versions); |
|
| 1259 | + $versions_served_historically = array_keys($possibly_served_versions); |
|
| 1260 | + $latest_version = end($versions_served_historically); |
|
| 1261 | + reset($versions_served_historically); |
|
| 1262 | + // for each version of core we have ever served: |
|
| 1263 | + foreach ($versions_served_historically as $key_versioned_endpoint) { |
|
| 1264 | + // if it's not above the current core version, and it's compatible with the current version of core |
|
| 1265 | + |
|
| 1266 | + if ($key_versioned_endpoint === $latest_version) { |
|
| 1267 | + // don't hide the latest version in the index |
|
| 1268 | + $versions_served[ $key_versioned_endpoint ] = false; |
|
| 1269 | + } elseif ( |
|
| 1270 | + version_compare($key_versioned_endpoint, $lowest_compatible_version, '>=') |
|
| 1271 | + && version_compare($key_versioned_endpoint, EED_Core_Rest_Api::core_version(), '<') |
|
| 1272 | + ) { |
|
| 1273 | + // include, but hide, previous versions which are still supported |
|
| 1274 | + $versions_served[ $key_versioned_endpoint ] = true; |
|
| 1275 | + } elseif ( |
|
| 1276 | + apply_filters( |
|
| 1277 | + 'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions', |
|
| 1278 | + false, |
|
| 1279 | + $possibly_served_versions |
|
| 1280 | + ) |
|
| 1281 | + ) { |
|
| 1282 | + // if a version is no longer supported, don't include it in index or list of versions served |
|
| 1283 | + $versions_served[ $key_versioned_endpoint ] = true; |
|
| 1284 | + } |
|
| 1285 | + } |
|
| 1286 | + return $versions_served; |
|
| 1287 | + } |
|
| 1288 | + |
|
| 1289 | + |
|
| 1290 | + /** |
|
| 1291 | + * Gets the major and minor version of EE core's version string |
|
| 1292 | + * |
|
| 1293 | + * @return string |
|
| 1294 | + */ |
|
| 1295 | + public static function core_version() |
|
| 1296 | + { |
|
| 1297 | + return apply_filters( |
|
| 1298 | + 'FHEE__EED_Core_REST_API__core_version', |
|
| 1299 | + implode( |
|
| 1300 | + '.', |
|
| 1301 | + array_slice( |
|
| 1302 | + explode( |
|
| 1303 | + '.', |
|
| 1304 | + espresso_version() |
|
| 1305 | + ), |
|
| 1306 | + 0, |
|
| 1307 | + 3 |
|
| 1308 | + ) |
|
| 1309 | + ) |
|
| 1310 | + ); |
|
| 1311 | + } |
|
| 1312 | + |
|
| 1313 | + |
|
| 1314 | + /** |
|
| 1315 | + * Gets the default limit that should be used when querying for resources |
|
| 1316 | + * |
|
| 1317 | + * @return int |
|
| 1318 | + */ |
|
| 1319 | + public static function get_default_query_limit() |
|
| 1320 | + { |
|
| 1321 | + // we actually don't use a const because we want folks to always use |
|
| 1322 | + // this method, not the const directly |
|
| 1323 | + return apply_filters( |
|
| 1324 | + 'FHEE__EED_Core_Rest_Api__get_default_query_limit', |
|
| 1325 | + 100 |
|
| 1326 | + ); |
|
| 1327 | + } |
|
| 1328 | + |
|
| 1329 | + |
|
| 1330 | + /** |
|
| 1331 | + * @param string $version api version string (i.e. '4.8.36') |
|
| 1332 | + * @return array |
|
| 1333 | + */ |
|
| 1334 | + public static function getCollectionRoutesIndexedByModelName($version = '') |
|
| 1335 | + { |
|
| 1336 | + $version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version; |
|
| 1337 | + $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version); |
|
| 1338 | + $collection_routes = []; |
|
| 1339 | + foreach ($model_names as $model_name => $model_class_name) { |
|
| 1340 | + $collection_routes[ strtolower($model_name) ] = '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' |
|
| 1341 | + . EEH_Inflector::pluralize_and_lower($model_name); |
|
| 1342 | + } |
|
| 1343 | + return $collection_routes; |
|
| 1344 | + } |
|
| 1345 | + |
|
| 1346 | + |
|
| 1347 | + /** |
|
| 1348 | + * Returns an array of primary key names indexed by model names. |
|
| 1349 | + * |
|
| 1350 | + * @param string $version |
|
| 1351 | + * @return array |
|
| 1352 | + */ |
|
| 1353 | + public static function getPrimaryKeyNamesIndexedByModelName($version = '') |
|
| 1354 | + { |
|
| 1355 | + $version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version; |
|
| 1356 | + $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version); |
|
| 1357 | + $primary_key_items = []; |
|
| 1358 | + foreach ($model_names as $model_name => $model_class_name) { |
|
| 1359 | + $primary_keys = $model_class_name::instance()->get_combined_primary_key_fields(); |
|
| 1360 | + foreach ($primary_keys as $primary_key_name => $primary_key_field) { |
|
| 1361 | + if (count($primary_keys) > 1) { |
|
| 1362 | + $primary_key_items[ strtolower($model_name) ][] = $primary_key_name; |
|
| 1363 | + } else { |
|
| 1364 | + $primary_key_items[ strtolower($model_name) ] = $primary_key_name; |
|
| 1365 | + } |
|
| 1366 | + } |
|
| 1367 | + } |
|
| 1368 | + return $primary_key_items; |
|
| 1369 | + } |
|
| 1370 | + |
|
| 1371 | + |
|
| 1372 | + /** |
|
| 1373 | + * Determines the EE REST API debug mode is activated, or not. |
|
| 1374 | + * |
|
| 1375 | + * @return bool |
|
| 1376 | + * @since 4.9.76.p |
|
| 1377 | + */ |
|
| 1378 | + public static function debugMode() |
|
| 1379 | + { |
|
| 1380 | + static $debug_mode = null; // could be class prop |
|
| 1381 | + if ($debug_mode === null) { |
|
| 1382 | + $debug_mode = defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE; |
|
| 1383 | + } |
|
| 1384 | + return $debug_mode; |
|
| 1385 | + } |
|
| 1386 | + |
|
| 1387 | + |
|
| 1388 | + /** |
|
| 1389 | + * run - initial module setup |
|
| 1390 | + * |
|
| 1391 | + * @access public |
|
| 1392 | + * @param WP $WP |
|
| 1393 | + * @return void |
|
| 1394 | + */ |
|
| 1395 | + public function run($WP) |
|
| 1396 | + { |
|
| 1397 | + } |
|
| 1398 | 1398 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | protected static function _set_hooks_for_changes() |
| 133 | 133 | { |
| 134 | - $folder_contents = EEH_File::get_contents_of_folders([EE_LIBRARIES . 'rest_api/changes'], false); |
|
| 134 | + $folder_contents = EEH_File::get_contents_of_folders([EE_LIBRARIES.'rest_api/changes'], false); |
|
| 135 | 135 | foreach ($folder_contents as $classname_in_namespace => $filepath) { |
| 136 | 136 | // ignore the base parent class |
| 137 | 137 | // and legacy named classes |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | ) { |
| 142 | 142 | continue; |
| 143 | 143 | } |
| 144 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
| 144 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace; |
|
| 145 | 145 | if (class_exists($full_classname)) { |
| 146 | 146 | $instance_of_class = new $full_classname(); |
| 147 | 147 | if ($instance_of_class instanceof ChangesInBase) { |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | * } |
| 188 | 188 | */ |
| 189 | 189 | // skip route options |
| 190 | - if (! is_numeric($endpoint_key)) { |
|
| 190 | + if ( ! is_numeric($endpoint_key)) { |
|
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | - if (! isset($data_for_single_endpoint['callback'], $data_for_single_endpoint['methods'])) { |
|
| 193 | + if ( ! isset($data_for_single_endpoint['callback'], $data_for_single_endpoint['methods'])) { |
|
| 194 | 194 | throw new EE_Error( |
| 195 | 195 | esc_html__( |
| 196 | 196 | // @codingStandardsIgnoreStart |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | if (isset($data_for_single_endpoint['callback_args'])) { |
| 213 | 213 | $callback_args = $data_for_single_endpoint['callback_args']; |
| 214 | - $single_endpoint_args['callback'] = static function (WP_REST_Request $request) use ( |
|
| 214 | + $single_endpoint_args['callback'] = static function(WP_REST_Request $request) use ( |
|
| 215 | 215 | $callback, |
| 216 | 216 | $callback_args |
| 217 | 217 | ) { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | // the REST API will issue a _doing_it_wrong notice. |
| 229 | 229 | // Since the EE REST API defers capabilities to the db model system, |
| 230 | 230 | // we will just use the generic WP callback for public endpoints |
| 231 | - if (! isset($single_endpoint_args['permission_callback'])) { |
|
| 231 | + if ( ! isset($single_endpoint_args['permission_callback'])) { |
|
| 232 | 232 | $single_endpoint_args['permission_callback'] = '__return_true'; |
| 233 | 233 | } |
| 234 | 234 | $multiple_endpoint_args[] = $single_endpoint_args; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $schema_route_data = $data_for_multiple_endpoints['schema']; |
| 238 | 238 | $schema_callback = $schema_route_data['schema_callback']; |
| 239 | 239 | $callback_args = $schema_route_data['callback_args']; |
| 240 | - $multiple_endpoint_args['schema'] = static function () use ($schema_callback, $callback_args) { |
|
| 240 | + $multiple_endpoint_args['schema'] = static function() use ($schema_callback, $callback_args) { |
|
| 241 | 241 | return call_user_func_array( |
| 242 | 242 | $schema_callback, |
| 243 | 243 | $callback_args |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | { |
| 280 | 280 | // delete the saved EE REST API routes |
| 281 | 281 | foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) { |
| 282 | - delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version); |
|
| 282 | + delete_option(EED_Core_Rest_Api::saved_routes_option_names.$version); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | { |
| 300 | 300 | $ee_routes = []; |
| 301 | 301 | foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoints) { |
| 302 | - $ee_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = EED_Core_Rest_Api::_get_ee_route_data_for_version( |
|
| 302 | + $ee_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = EED_Core_Rest_Api::_get_ee_route_data_for_version( |
|
| 303 | 303 | $version, |
| 304 | 304 | $hidden_endpoints |
| 305 | 305 | ); |
@@ -320,8 +320,8 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) |
| 322 | 322 | { |
| 323 | - $ee_routes = get_option(EED_Core_Rest_Api::saved_routes_option_names . $version, null); |
|
| 324 | - if (! $ee_routes || EED_Core_Rest_Api::debugMode()) { |
|
| 323 | + $ee_routes = get_option(EED_Core_Rest_Api::saved_routes_option_names.$version, null); |
|
| 324 | + if ( ! $ee_routes || EED_Core_Rest_Api::debugMode()) { |
|
| 325 | 325 | $ee_routes = EED_Core_Rest_Api::_save_ee_route_data_for_version($version, $hidden_endpoints); |
| 326 | 326 | } |
| 327 | 327 | return $ee_routes; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints) |
| 350 | 350 | ) |
| 351 | 351 | ); |
| 352 | - $option_name = EED_Core_Rest_Api::saved_routes_option_names . $version; |
|
| 352 | + $option_name = EED_Core_Rest_Api::saved_routes_option_names.$version; |
|
| 353 | 353 | if (get_option($option_name)) { |
| 354 | 354 | update_option($option_name, $routes, true); |
| 355 | 355 | } else { |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | { |
| 395 | 395 | $model_routes = []; |
| 396 | 396 | foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
| 397 | - $model_routes[ EED_Core_Rest_Api::ee_api_namespace |
|
| 398 | - . $version ] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
| 397 | + $model_routes[EED_Core_Rest_Api::ee_api_namespace |
|
| 398 | + . $version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
| 399 | 399 | } |
| 400 | 400 | return $model_routes; |
| 401 | 401 | } |
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | foreach (EED_Core_Rest_Api::model_names_with_plural_routes($version) as $model_name => $model_classname) { |
| 465 | 465 | $model = EE_Registry::instance()->load_model($model_name); |
| 466 | 466 | // if this isn't a valid model then let's skip iterate to the next item in the loop. |
| 467 | - if (! $model instanceof EEM_Base) { |
|
| 467 | + if ( ! $model instanceof EEM_Base) { |
|
| 468 | 468 | continue; |
| 469 | 469 | } |
| 470 | 470 | // yes we could just register one route for ALL models, but then they wouldn't show up in the index |
| 471 | 471 | $plural_model_route = EED_Core_Rest_Api::get_collection_route($model); |
| 472 | 472 | $singular_model_route = EED_Core_Rest_Api::get_entity_route($model, '(?P<id>[^\/]+)'); |
| 473 | - $model_routes[ $plural_model_route ] = [ |
|
| 473 | + $model_routes[$plural_model_route] = [ |
|
| 474 | 474 | [ |
| 475 | 475 | 'callback' => [ |
| 476 | 476 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | 'hidden_endpoint' => $hidden_endpoint, |
| 482 | 482 | 'args' => $this->_get_read_query_params($model, $version), |
| 483 | 483 | '_links' => [ |
| 484 | - 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route), |
|
| 484 | + 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route), |
|
| 485 | 485 | ], |
| 486 | 486 | ], |
| 487 | 487 | 'schema' => [ |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | 'callback_args' => [$version, $model_name], |
| 493 | 493 | ], |
| 494 | 494 | ]; |
| 495 | - $model_routes[ $singular_model_route ] = [ |
|
| 495 | + $model_routes[$singular_model_route] = [ |
|
| 496 | 496 | [ |
| 497 | 497 | 'callback' => [ |
| 498 | 498 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | $model |
| 512 | 512 | ) |
| 513 | 513 | ) { |
| 514 | - $model_routes[ $plural_model_route ][] = [ |
|
| 514 | + $model_routes[$plural_model_route][] = [ |
|
| 515 | 515 | 'callback' => [ |
| 516 | 516 | 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
| 517 | 517 | 'handleRequestInsert', |
@@ -521,8 +521,8 @@ discard block |
||
| 521 | 521 | 'hidden_endpoint' => $hidden_endpoint, |
| 522 | 522 | 'args' => $this->_get_write_params($model_name, $model_version_info, true), |
| 523 | 523 | ]; |
| 524 | - $model_routes[ $singular_model_route ] = array_merge( |
|
| 525 | - $model_routes[ $singular_model_route ], |
|
| 524 | + $model_routes[$singular_model_route] = array_merge( |
|
| 525 | + $model_routes[$singular_model_route], |
|
| 526 | 526 | [ |
| 527 | 527 | [ |
| 528 | 528 | 'callback' => [ |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | '(?P<id>[^\/]+)', |
| 554 | 554 | $relation_obj |
| 555 | 555 | ); |
| 556 | - $model_routes[ $related_route ] = [ |
|
| 556 | + $model_routes[$related_route] = [ |
|
| 557 | 557 | [ |
| 558 | 558 | 'callback' => [ |
| 559 | 559 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -566,8 +566,8 @@ discard block |
||
| 566 | 566 | ], |
| 567 | 567 | ]; |
| 568 | 568 | |
| 569 | - $related_write_route = $related_route . '/' . '(?P<related_id>[^\/]+)'; |
|
| 570 | - $model_routes[ $related_write_route ] = [ |
|
| 569 | + $related_write_route = $related_route.'/'.'(?P<related_id>[^\/]+)'; |
|
| 570 | + $model_routes[$related_write_route] = [ |
|
| 571 | 571 | [ |
| 572 | 572 | 'callback' => [ |
| 573 | 573 | 'EventEspresso\core\libraries\rest_api\controllers\model\Write', |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | public static function get_entity_route($model, $id) |
| 626 | 626 | { |
| 627 | - return EED_Core_Rest_Api::get_collection_route($model) . '/' . $id; |
|
| 627 | + return EED_Core_Rest_Api::get_collection_route($model).'/'.$id; |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | $relation_obj->get_other_model()->get_this_model_name(), |
| 645 | 645 | $relation_obj |
| 646 | 646 | ); |
| 647 | - return EED_Core_Rest_Api::get_entity_route($model, $id) . '/' . $related_model_name_endpoint_part; |
|
| 647 | + return EED_Core_Rest_Api::get_entity_route($model, $id).'/'.$related_model_name_endpoint_part; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | */ |
| 659 | 659 | public static function get_versioned_route_to($relative_route, $version = '4.8.36') |
| 660 | 660 | { |
| 661 | - return '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' . $relative_route; |
|
| 661 | + return '/'.EED_Core_Rest_Api::ee_api_namespace.$version.'/'.$relative_route; |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | { |
| 673 | 673 | $routes = []; |
| 674 | 674 | foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
| 675 | - $routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( |
|
| 675 | + $routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version( |
|
| 676 | 676 | $version, |
| 677 | 677 | $hidden_endpoint |
| 678 | 678 | ); |
@@ -805,12 +805,12 @@ discard block |
||
| 805 | 805 | { |
| 806 | 806 | // if they're related through a HABTM relation, check for any non-FKs |
| 807 | 807 | $all_relation_settings = $source_model->relation_settings(); |
| 808 | - $relation_settings = $all_relation_settings[ $related_model->get_this_model_name() ]; |
|
| 808 | + $relation_settings = $all_relation_settings[$related_model->get_this_model_name()]; |
|
| 809 | 809 | $params = []; |
| 810 | 810 | if ($relation_settings instanceof EE_HABTM_Relation && $relation_settings->hasNonKeyFields()) { |
| 811 | 811 | foreach ($relation_settings->getNonKeyFields() as $field) { |
| 812 | 812 | /* @var $field EE_Model_Field_Base */ |
| 813 | - $params[ $field->get_name() ] = [ |
|
| 813 | + $params[$field->get_name()] = [ |
|
| 814 | 814 | 'required' => ! $field->is_nullable(), |
| 815 | 815 | 'default' => ModelDataTranslator::prepareFieldValueForJson( |
| 816 | 816 | $field, |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | { |
| 840 | 840 | $default_orderby = []; |
| 841 | 841 | foreach ($model->get_combined_primary_key_fields() as $key_field) { |
| 842 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
| 842 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
| 843 | 843 | } |
| 844 | 844 | return array_merge( |
| 845 | 845 | $this->_get_response_selection_query_params($model, $version), |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | 'type' => [ |
| 874 | 874 | SchemaType::OBJECT, |
| 875 | 875 | SchemaType::STRING, |
| 876 | - ],// because we accept a variety of types, WP core validation and sanitization |
|
| 876 | + ], // because we accept a variety of types, WP core validation and sanitization |
|
| 877 | 877 | // freaks out. We'll just validate this argument while handling the request |
| 878 | 878 | 'validate_callback' => null, |
| 879 | 879 | 'sanitize_callback' => null, |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | $model_version_info->requestedVersion() |
| 965 | 965 | ); |
| 966 | 966 | $arg_info['sanitize_callback'] = $sanitize_callback; |
| 967 | - $args_info[ $field_name ] = $arg_info; |
|
| 967 | + $args_info[$field_name] = $arg_info; |
|
| 968 | 968 | if ($field_obj instanceof EE_Datetime_Field) { |
| 969 | 969 | $gmt_arg_info = $arg_info; |
| 970 | 970 | $gmt_arg_info['description'] = sprintf( |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | $field_obj->get_nicename(), |
| 976 | 976 | $field_name |
| 977 | 977 | ); |
| 978 | - $args_info[ $field_name . '_gmt' ] = $gmt_arg_info; |
|
| 978 | + $args_info[$field_name.'_gmt'] = $gmt_arg_info; |
|
| 979 | 979 | } |
| 980 | 980 | } |
| 981 | 981 | return $args_info; |
@@ -999,18 +999,18 @@ discard block |
||
| 999 | 999 | { |
| 1000 | 1000 | $attributes = $request->get_attributes(); |
| 1001 | 1001 | if ( |
| 1002 | - ! isset($attributes['args'][ $param ]) |
|
| 1003 | - || ! is_array($attributes['args'][ $param ]) |
|
| 1002 | + ! isset($attributes['args'][$param]) |
|
| 1003 | + || ! is_array($attributes['args'][$param]) |
|
| 1004 | 1004 | ) { |
| 1005 | 1005 | $validation_result = true; |
| 1006 | 1006 | } else { |
| 1007 | - $args = $attributes['args'][ $param ]; |
|
| 1007 | + $args = $attributes['args'][$param]; |
|
| 1008 | 1008 | if ( |
| 1009 | 1009 | ( |
| 1010 | 1010 | $value === '' |
| 1011 | 1011 | || $value === null |
| 1012 | 1012 | ) |
| 1013 | - && (! isset($args['required']) |
|
| 1013 | + && ( ! isset($args['required']) |
|
| 1014 | 1014 | || $args['required'] === false |
| 1015 | 1015 | ) |
| 1016 | 1016 | ) { |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | && $args['format'] === 'email' |
| 1022 | 1022 | ) { |
| 1023 | 1023 | $validation_result = true; |
| 1024 | - if (! EED_Core_Rest_Api::_validate_email($value)) { |
|
| 1024 | + if ( ! EED_Core_Rest_Api::_validate_email($value)) { |
|
| 1025 | 1025 | $validation_result = new WP_Error( |
| 1026 | 1026 | 'rest_invalid_param', |
| 1027 | 1027 | esc_html__( |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | { |
| 1072 | 1072 | $config_routes = []; |
| 1073 | 1073 | foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
| 1074 | - $config_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( |
|
| 1074 | + $config_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version( |
|
| 1075 | 1075 | $version, |
| 1076 | 1076 | $hidden_endpoint |
| 1077 | 1077 | ); |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | { |
| 1127 | 1127 | $meta_routes = []; |
| 1128 | 1128 | foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) { |
| 1129 | - $meta_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( |
|
| 1129 | + $meta_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version( |
|
| 1130 | 1130 | $version, |
| 1131 | 1131 | $hidden_endpoint |
| 1132 | 1132 | ); |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | foreach ($relative_urls as $resource_name => $endpoints) { |
| 1180 | 1180 | foreach ($endpoints as $key => $endpoint) { |
| 1181 | 1181 | // skip schema and other route options |
| 1182 | - if (! is_numeric($key)) { |
|
| 1182 | + if ( ! is_numeric($key)) { |
|
| 1183 | 1183 | continue; |
| 1184 | 1184 | } |
| 1185 | 1185 | // by default, hide "hidden_endpoint"s, unless the request indicates |
@@ -1189,9 +1189,9 @@ discard block |
||
| 1189 | 1189 | ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace) |
| 1190 | 1190 | || ($endpoint['hidden_endpoint'] && $force_show_ee_namespace === '') |
| 1191 | 1191 | ) { |
| 1192 | - $full_route = '/' . ltrim($namespace, '/'); |
|
| 1193 | - $full_route .= '/' . ltrim($resource_name, '/'); |
|
| 1194 | - unset($route_data[ $full_route ]); |
|
| 1192 | + $full_route = '/'.ltrim($namespace, '/'); |
|
| 1193 | + $full_route .= '/'.ltrim($resource_name, '/'); |
|
| 1194 | + unset($route_data[$full_route]); |
|
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | 1197 | } |
@@ -1265,13 +1265,13 @@ discard block |
||
| 1265 | 1265 | |
| 1266 | 1266 | if ($key_versioned_endpoint === $latest_version) { |
| 1267 | 1267 | // don't hide the latest version in the index |
| 1268 | - $versions_served[ $key_versioned_endpoint ] = false; |
|
| 1268 | + $versions_served[$key_versioned_endpoint] = false; |
|
| 1269 | 1269 | } elseif ( |
| 1270 | 1270 | version_compare($key_versioned_endpoint, $lowest_compatible_version, '>=') |
| 1271 | 1271 | && version_compare($key_versioned_endpoint, EED_Core_Rest_Api::core_version(), '<') |
| 1272 | 1272 | ) { |
| 1273 | 1273 | // include, but hide, previous versions which are still supported |
| 1274 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
| 1274 | + $versions_served[$key_versioned_endpoint] = true; |
|
| 1275 | 1275 | } elseif ( |
| 1276 | 1276 | apply_filters( |
| 1277 | 1277 | 'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions', |
@@ -1280,7 +1280,7 @@ discard block |
||
| 1280 | 1280 | ) |
| 1281 | 1281 | ) { |
| 1282 | 1282 | // if a version is no longer supported, don't include it in index or list of versions served |
| 1283 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
| 1283 | + $versions_served[$key_versioned_endpoint] = true; |
|
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | 1286 | return $versions_served; |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version); |
| 1338 | 1338 | $collection_routes = []; |
| 1339 | 1339 | foreach ($model_names as $model_name => $model_class_name) { |
| 1340 | - $collection_routes[ strtolower($model_name) ] = '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' |
|
| 1340 | + $collection_routes[strtolower($model_name)] = '/'.EED_Core_Rest_Api::ee_api_namespace.$version.'/' |
|
| 1341 | 1341 | . EEH_Inflector::pluralize_and_lower($model_name); |
| 1342 | 1342 | } |
| 1343 | 1343 | return $collection_routes; |
@@ -1359,9 +1359,9 @@ discard block |
||
| 1359 | 1359 | $primary_keys = $model_class_name::instance()->get_combined_primary_key_fields(); |
| 1360 | 1360 | foreach ($primary_keys as $primary_key_name => $primary_key_field) { |
| 1361 | 1361 | if (count($primary_keys) > 1) { |
| 1362 | - $primary_key_items[ strtolower($model_name) ][] = $primary_key_name; |
|
| 1362 | + $primary_key_items[strtolower($model_name)][] = $primary_key_name; |
|
| 1363 | 1363 | } else { |
| 1364 | - $primary_key_items[ strtolower($model_name) ] = $primary_key_name; |
|
| 1364 | + $primary_key_items[strtolower($model_name)] = $primary_key_name; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | } |
| 1367 | 1367 | } |
@@ -24,2234 +24,2234 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class Registrations_Admin_Page extends EE_Admin_Page_CPT |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var EE_Registration |
|
| 29 | - */ |
|
| 30 | - private $_registration; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var EE_Event |
|
| 34 | - */ |
|
| 35 | - private $_reg_event; |
|
| 36 | - |
|
| 37 | - private array $session_data = []; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var array |
|
| 41 | - */ |
|
| 42 | - private static $_reg_status; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Form for displaying the custom questions for this registration. |
|
| 46 | - * This gets used a few times throughout the request so its best to cache it |
|
| 47 | - * |
|
| 48 | - * @var EE_Registration_Custom_Questions_Form |
|
| 49 | - */ |
|
| 50 | - protected $_reg_custom_questions_form; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @var EEM_Registration $registration_model |
|
| 54 | - */ |
|
| 55 | - private $registration_model; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @var EEM_Attendee $attendee_model |
|
| 59 | - */ |
|
| 60 | - private $attendee_model; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @var EEM_Event $event_model |
|
| 64 | - */ |
|
| 65 | - private $event_model; |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @var EEM_Status $status_model |
|
| 69 | - */ |
|
| 70 | - private $status_model; |
|
| 71 | - |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @param bool $routing |
|
| 75 | - * @throws InvalidArgumentException |
|
| 76 | - * @throws InvalidDataTypeException |
|
| 77 | - * @throws InvalidInterfaceException |
|
| 78 | - * @throws ReflectionException |
|
| 79 | - */ |
|
| 80 | - public function __construct($routing = true) |
|
| 81 | - { |
|
| 82 | - parent::__construct($routing); |
|
| 83 | - $this->cpt_editpost_route = 'edit_attendee'; |
|
| 84 | - add_action('wp_loaded', [$this, 'wp_loaded']); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @return EEM_Registration |
|
| 90 | - * @throws InvalidArgumentException |
|
| 91 | - * @throws InvalidDataTypeException |
|
| 92 | - * @throws InvalidInterfaceException |
|
| 93 | - * @since 4.10.2.p |
|
| 94 | - */ |
|
| 95 | - protected function getRegistrationModel() |
|
| 96 | - { |
|
| 97 | - if (! $this->registration_model instanceof EEM_Registration) { |
|
| 98 | - $this->registration_model = $this->loader->getShared('EEM_Registration'); |
|
| 99 | - } |
|
| 100 | - return $this->registration_model; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @return EEM_Attendee |
|
| 106 | - * @throws InvalidArgumentException |
|
| 107 | - * @throws InvalidDataTypeException |
|
| 108 | - * @throws InvalidInterfaceException |
|
| 109 | - * @since 4.10.2.p |
|
| 110 | - */ |
|
| 111 | - protected function getAttendeeModel() |
|
| 112 | - { |
|
| 113 | - if (! $this->attendee_model instanceof EEM_Attendee) { |
|
| 114 | - $this->attendee_model = $this->loader->getShared('EEM_Attendee'); |
|
| 115 | - } |
|
| 116 | - return $this->attendee_model; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @return EEM_Event |
|
| 122 | - * @throws InvalidArgumentException |
|
| 123 | - * @throws InvalidDataTypeException |
|
| 124 | - * @throws InvalidInterfaceException |
|
| 125 | - * @since 4.10.2.p |
|
| 126 | - */ |
|
| 127 | - protected function getEventModel() |
|
| 128 | - { |
|
| 129 | - if (! $this->event_model instanceof EEM_Event) { |
|
| 130 | - $this->event_model = $this->loader->getShared('EEM_Event'); |
|
| 131 | - } |
|
| 132 | - return $this->event_model; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * @return EEM_Status |
|
| 138 | - * @throws InvalidArgumentException |
|
| 139 | - * @throws InvalidDataTypeException |
|
| 140 | - * @throws InvalidInterfaceException |
|
| 141 | - * @since 4.10.2.p |
|
| 142 | - */ |
|
| 143 | - protected function getStatusModel() |
|
| 144 | - { |
|
| 145 | - if (! $this->status_model instanceof EEM_Status) { |
|
| 146 | - $this->status_model = $this->loader->getShared('EEM_Status'); |
|
| 147 | - } |
|
| 148 | - return $this->status_model; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - public function wp_loaded() |
|
| 153 | - { |
|
| 154 | - // when adding a new registration... |
|
| 155 | - $action = $this->request->getRequestParam('action'); |
|
| 156 | - if ($action === 'new_registration') { |
|
| 157 | - EE_System::do_not_cache(); |
|
| 158 | - if ($this->request->getRequestParam('processing_registration', 0, 'int') !== 1) { |
|
| 159 | - // and it's NOT the attendee information reg step |
|
| 160 | - // force cookie expiration by setting time to last week |
|
| 161 | - setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
| 162 | - // and update the global |
|
| 163 | - $_COOKIE['ee_registration_added'] = 0; |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - protected function _init_page_props() |
|
| 170 | - { |
|
| 171 | - $this->page_slug = REG_PG_SLUG; |
|
| 172 | - $this->_admin_base_url = REG_ADMIN_URL; |
|
| 173 | - $this->_admin_base_path = REG_ADMIN; |
|
| 174 | - $this->page_label = esc_html__('Registrations', 'event_espresso'); |
|
| 175 | - $this->_cpt_routes = [ |
|
| 176 | - 'add_new_attendee' => 'espresso_attendees', |
|
| 177 | - 'edit_attendee' => 'espresso_attendees', |
|
| 178 | - 'insert_attendee' => 'espresso_attendees', |
|
| 179 | - 'update_attendee' => 'espresso_attendees', |
|
| 180 | - ]; |
|
| 181 | - $this->_cpt_model_names = [ |
|
| 182 | - 'add_new_attendee' => 'EEM_Attendee', |
|
| 183 | - 'edit_attendee' => 'EEM_Attendee', |
|
| 184 | - ]; |
|
| 185 | - $this->_cpt_edit_routes = [ |
|
| 186 | - 'espresso_attendees' => 'edit_attendee', |
|
| 187 | - ]; |
|
| 188 | - $this->_pagenow_map = [ |
|
| 189 | - 'add_new_attendee' => 'post-new.php', |
|
| 190 | - 'edit_attendee' => 'post.php', |
|
| 191 | - 'trash' => 'post.php', |
|
| 192 | - ]; |
|
| 193 | - add_action('edit_form_after_title', [$this, 'after_title_form_fields'], 10); |
|
| 194 | - // add filters so that the comment urls don't take users to a confusing 404 page |
|
| 195 | - add_filter('get_comment_link', [$this, 'clear_comment_link'], 10, 2); |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * @param string $link The comment permalink with '#comment-$id' appended. |
|
| 201 | - * @param WP_Comment $comment The current comment object. |
|
| 202 | - * @return string |
|
| 203 | - */ |
|
| 204 | - public function clear_comment_link($link, WP_Comment $comment) |
|
| 205 | - { |
|
| 206 | - // gotta make sure this only happens on this route |
|
| 207 | - $post_type = get_post_type($comment->comment_post_ID); |
|
| 208 | - if ($post_type === EspressoPostType::ATTENDEES) { |
|
| 209 | - return '#commentsdiv'; |
|
| 210 | - } |
|
| 211 | - return $link; |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - |
|
| 215 | - protected function _ajax_hooks() |
|
| 216 | - { |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - |
|
| 220 | - protected function _define_page_props() |
|
| 221 | - { |
|
| 222 | - $this->_admin_page_title = $this->page_label; |
|
| 223 | - $this->_labels = [ |
|
| 224 | - 'buttons' => [ |
|
| 225 | - 'add-registrant' => esc_html__('Add New Registration', 'event_espresso'), |
|
| 226 | - 'add-attendee' => esc_html__('Add Contact', 'event_espresso'), |
|
| 227 | - 'edit' => esc_html__('Edit Contact', 'event_espresso'), |
|
| 228 | - 'csv_reg_report' => esc_html__('Registrations CSV Report', 'event_espresso'), |
|
| 229 | - 'contact_list_report' => esc_html__('Contact List Report', 'event_espresso'), |
|
| 230 | - 'contact_list_export' => esc_html__('Export Data', 'event_espresso'), |
|
| 231 | - ], |
|
| 232 | - 'publishbox' => [ |
|
| 233 | - 'add_new_attendee' => esc_html__('Add Contact Record', 'event_espresso'), |
|
| 234 | - 'edit_attendee' => esc_html__('Update Contact Record', 'event_espresso'), |
|
| 235 | - ], |
|
| 236 | - 'hide_add_button_on_cpt_route' => [ |
|
| 237 | - 'edit_attendee' => true, |
|
| 238 | - ], |
|
| 239 | - ]; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * grab url requests and route them |
|
| 245 | - * |
|
| 246 | - * @return void |
|
| 247 | - * @throws EE_Error |
|
| 248 | - */ |
|
| 249 | - public function _set_page_routes() |
|
| 250 | - { |
|
| 251 | - $this->_get_registration_status_array(); |
|
| 252 | - $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 253 | - $REG_ID = $this->request->getRequestParam('reg_status_change_form[REG_ID]', $REG_ID, 'int'); |
|
| 254 | - $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int'); |
|
| 255 | - $ATT_ID = $this->request->getRequestParam('post', $ATT_ID, 'int'); |
|
| 256 | - $this->_page_routes = [ |
|
| 257 | - 'default' => [ |
|
| 258 | - 'func' => [$this, '_registrations_overview_list_table'], |
|
| 259 | - 'capability' => 'ee_read_registrations', |
|
| 260 | - ], |
|
| 261 | - 'view_registration' => [ |
|
| 262 | - 'func' => [$this, '_registration_details'], |
|
| 263 | - 'capability' => 'ee_read_registration', |
|
| 264 | - 'obj_id' => $REG_ID, |
|
| 265 | - ], |
|
| 266 | - 'edit_registration' => [ |
|
| 267 | - 'func' => '_update_attendee_registration_form', |
|
| 268 | - 'noheader' => true, |
|
| 269 | - 'headers_sent_route' => 'view_registration', |
|
| 270 | - 'capability' => 'ee_edit_registration', |
|
| 271 | - 'obj_id' => $REG_ID, |
|
| 272 | - '_REG_ID' => $REG_ID, |
|
| 273 | - ], |
|
| 274 | - 'trash_registrations' => [ |
|
| 275 | - 'func' => '_trash_or_restore_registrations', |
|
| 276 | - 'args' => ['trash' => true], |
|
| 277 | - 'noheader' => true, |
|
| 278 | - 'capability' => 'ee_delete_registrations', |
|
| 279 | - ], |
|
| 280 | - 'restore_registrations' => [ |
|
| 281 | - 'func' => '_trash_or_restore_registrations', |
|
| 282 | - 'args' => ['trash' => false], |
|
| 283 | - 'noheader' => true, |
|
| 284 | - 'capability' => 'ee_delete_registrations', |
|
| 285 | - ], |
|
| 286 | - 'delete_registrations' => [ |
|
| 287 | - 'func' => '_delete_registrations', |
|
| 288 | - 'noheader' => true, |
|
| 289 | - 'capability' => 'ee_delete_registrations', |
|
| 290 | - ], |
|
| 291 | - 'new_registration' => [ |
|
| 292 | - 'func' => 'new_registration', |
|
| 293 | - 'capability' => 'ee_edit_registrations', |
|
| 294 | - ], |
|
| 295 | - 'process_reg_step' => [ |
|
| 296 | - 'func' => 'process_reg_step', |
|
| 297 | - 'noheader' => true, |
|
| 298 | - 'capability' => 'ee_edit_registrations', |
|
| 299 | - ], |
|
| 300 | - 'redirect_to_txn' => [ |
|
| 301 | - 'func' => 'redirect_to_txn', |
|
| 302 | - 'noheader' => true, |
|
| 303 | - 'capability' => 'ee_edit_registrations', |
|
| 304 | - ], |
|
| 305 | - 'change_reg_status' => [ |
|
| 306 | - 'func' => '_change_reg_status', |
|
| 307 | - 'noheader' => true, |
|
| 308 | - 'capability' => 'ee_edit_registration', |
|
| 309 | - 'obj_id' => $REG_ID, |
|
| 310 | - ], |
|
| 311 | - 'approve_registration' => [ |
|
| 312 | - 'func' => 'approve_registration', |
|
| 313 | - 'noheader' => true, |
|
| 314 | - 'capability' => 'ee_edit_registration', |
|
| 315 | - 'obj_id' => $REG_ID, |
|
| 316 | - ], |
|
| 317 | - 'approve_and_notify_registration' => [ |
|
| 318 | - 'func' => 'approve_registration', |
|
| 319 | - 'noheader' => true, |
|
| 320 | - 'args' => [true], |
|
| 321 | - 'capability' => 'ee_edit_registration', |
|
| 322 | - 'obj_id' => $REG_ID, |
|
| 323 | - ], |
|
| 324 | - 'approve_registrations' => [ |
|
| 325 | - 'func' => 'bulk_action_on_registrations', |
|
| 326 | - 'noheader' => true, |
|
| 327 | - 'capability' => 'ee_edit_registrations', |
|
| 328 | - 'args' => ['approve'], |
|
| 329 | - ], |
|
| 330 | - 'approve_and_notify_registrations' => [ |
|
| 331 | - 'func' => 'bulk_action_on_registrations', |
|
| 332 | - 'noheader' => true, |
|
| 333 | - 'capability' => 'ee_edit_registrations', |
|
| 334 | - 'args' => ['approve', true], |
|
| 335 | - ], |
|
| 336 | - 'decline_registration' => [ |
|
| 337 | - 'func' => 'decline_registration', |
|
| 338 | - 'noheader' => true, |
|
| 339 | - 'capability' => 'ee_edit_registration', |
|
| 340 | - 'obj_id' => $REG_ID, |
|
| 341 | - ], |
|
| 342 | - 'decline_and_notify_registration' => [ |
|
| 343 | - 'func' => 'decline_registration', |
|
| 344 | - 'noheader' => true, |
|
| 345 | - 'args' => [true], |
|
| 346 | - 'capability' => 'ee_edit_registration', |
|
| 347 | - 'obj_id' => $REG_ID, |
|
| 348 | - ], |
|
| 349 | - 'decline_registrations' => [ |
|
| 350 | - 'func' => 'bulk_action_on_registrations', |
|
| 351 | - 'noheader' => true, |
|
| 352 | - 'capability' => 'ee_edit_registrations', |
|
| 353 | - 'args' => ['decline'], |
|
| 354 | - ], |
|
| 355 | - 'decline_and_notify_registrations' => [ |
|
| 356 | - 'func' => 'bulk_action_on_registrations', |
|
| 357 | - 'noheader' => true, |
|
| 358 | - 'capability' => 'ee_edit_registrations', |
|
| 359 | - 'args' => ['decline', true], |
|
| 360 | - ], |
|
| 361 | - 'pending_registration' => [ |
|
| 362 | - 'func' => 'pending_registration', |
|
| 363 | - 'noheader' => true, |
|
| 364 | - 'capability' => 'ee_edit_registration', |
|
| 365 | - 'obj_id' => $REG_ID, |
|
| 366 | - ], |
|
| 367 | - 'pending_and_notify_registration' => [ |
|
| 368 | - 'func' => 'pending_registration', |
|
| 369 | - 'noheader' => true, |
|
| 370 | - 'args' => [true], |
|
| 371 | - 'capability' => 'ee_edit_registration', |
|
| 372 | - 'obj_id' => $REG_ID, |
|
| 373 | - ], |
|
| 374 | - 'pending_registrations' => [ |
|
| 375 | - 'func' => 'bulk_action_on_registrations', |
|
| 376 | - 'noheader' => true, |
|
| 377 | - 'capability' => 'ee_edit_registrations', |
|
| 378 | - 'args' => ['pending'], |
|
| 379 | - ], |
|
| 380 | - 'pending_and_notify_registrations' => [ |
|
| 381 | - 'func' => 'bulk_action_on_registrations', |
|
| 382 | - 'noheader' => true, |
|
| 383 | - 'capability' => 'ee_edit_registrations', |
|
| 384 | - 'args' => ['pending', true], |
|
| 385 | - ], |
|
| 386 | - 'no_approve_registration' => [ |
|
| 387 | - 'func' => 'not_approve_registration', |
|
| 388 | - 'noheader' => true, |
|
| 389 | - 'capability' => 'ee_edit_registration', |
|
| 390 | - 'obj_id' => $REG_ID, |
|
| 391 | - ], |
|
| 392 | - 'no_approve_and_notify_registration' => [ |
|
| 393 | - 'func' => 'not_approve_registration', |
|
| 394 | - 'noheader' => true, |
|
| 395 | - 'args' => [true], |
|
| 396 | - 'capability' => 'ee_edit_registration', |
|
| 397 | - 'obj_id' => $REG_ID, |
|
| 398 | - ], |
|
| 399 | - 'no_approve_registrations' => [ |
|
| 400 | - 'func' => 'bulk_action_on_registrations', |
|
| 401 | - 'noheader' => true, |
|
| 402 | - 'capability' => 'ee_edit_registrations', |
|
| 403 | - 'args' => ['not_approve'], |
|
| 404 | - ], |
|
| 405 | - 'no_approve_and_notify_registrations' => [ |
|
| 406 | - 'func' => 'bulk_action_on_registrations', |
|
| 407 | - 'noheader' => true, |
|
| 408 | - 'capability' => 'ee_edit_registrations', |
|
| 409 | - 'args' => ['not_approve', true], |
|
| 410 | - ], |
|
| 411 | - 'cancel_registration' => [ |
|
| 412 | - 'func' => 'cancel_registration', |
|
| 413 | - 'noheader' => true, |
|
| 414 | - 'capability' => 'ee_edit_registration', |
|
| 415 | - 'obj_id' => $REG_ID, |
|
| 416 | - ], |
|
| 417 | - 'cancel_and_notify_registration' => [ |
|
| 418 | - 'func' => 'cancel_registration', |
|
| 419 | - 'noheader' => true, |
|
| 420 | - 'args' => [true], |
|
| 421 | - 'capability' => 'ee_edit_registration', |
|
| 422 | - 'obj_id' => $REG_ID, |
|
| 423 | - ], |
|
| 424 | - 'cancel_registrations' => [ |
|
| 425 | - 'func' => 'bulk_action_on_registrations', |
|
| 426 | - 'noheader' => true, |
|
| 427 | - 'capability' => 'ee_edit_registrations', |
|
| 428 | - 'args' => ['cancel'], |
|
| 429 | - ], |
|
| 430 | - 'cancel_and_notify_registrations' => [ |
|
| 431 | - 'func' => 'bulk_action_on_registrations', |
|
| 432 | - 'noheader' => true, |
|
| 433 | - 'capability' => 'ee_edit_registrations', |
|
| 434 | - 'args' => ['cancel', true], |
|
| 435 | - ], |
|
| 436 | - 'wait_list_registration' => [ |
|
| 437 | - 'func' => 'wait_list_registration', |
|
| 438 | - 'noheader' => true, |
|
| 439 | - 'capability' => 'ee_edit_registration', |
|
| 440 | - 'obj_id' => $REG_ID, |
|
| 441 | - ], |
|
| 442 | - 'wait_list_and_notify_registration' => [ |
|
| 443 | - 'func' => 'wait_list_registration', |
|
| 444 | - 'noheader' => true, |
|
| 445 | - 'args' => [true], |
|
| 446 | - 'capability' => 'ee_edit_registration', |
|
| 447 | - 'obj_id' => $REG_ID, |
|
| 448 | - ], |
|
| 449 | - 'contact_list' => [ |
|
| 450 | - 'func' => '_attendee_contact_list_table', |
|
| 451 | - 'capability' => 'ee_read_contacts', |
|
| 452 | - ], |
|
| 453 | - 'add_new_attendee' => [ |
|
| 454 | - 'func' => '_create_new_cpt_item', |
|
| 455 | - 'args' => [ |
|
| 456 | - 'new_attendee' => true, |
|
| 457 | - 'capability' => 'ee_edit_contacts', |
|
| 458 | - ], |
|
| 459 | - ], |
|
| 460 | - 'edit_attendee' => [ |
|
| 461 | - 'func' => '_edit_cpt_item', |
|
| 462 | - 'capability' => 'ee_edit_contacts', |
|
| 463 | - 'obj_id' => $ATT_ID, |
|
| 464 | - ], |
|
| 465 | - 'duplicate_attendee' => [ |
|
| 466 | - 'func' => '_duplicate_attendee', |
|
| 467 | - 'noheader' => true, |
|
| 468 | - 'capability' => 'ee_edit_contacts', |
|
| 469 | - 'obj_id' => $ATT_ID, |
|
| 470 | - ], |
|
| 471 | - 'insert_attendee' => [ |
|
| 472 | - 'func' => '_insert_or_update_attendee', |
|
| 473 | - 'args' => [ |
|
| 474 | - 'new_attendee' => true, |
|
| 475 | - ], |
|
| 476 | - 'noheader' => true, |
|
| 477 | - 'capability' => 'ee_edit_contacts', |
|
| 478 | - ], |
|
| 479 | - 'update_attendee' => [ |
|
| 480 | - 'func' => '_insert_or_update_attendee', |
|
| 481 | - 'args' => [ |
|
| 482 | - 'new_attendee' => false, |
|
| 483 | - ], |
|
| 484 | - 'noheader' => true, |
|
| 485 | - 'capability' => 'ee_edit_contacts', |
|
| 486 | - 'obj_id' => $ATT_ID, |
|
| 487 | - ], |
|
| 488 | - 'trash_attendees' => [ |
|
| 489 | - 'func' => '_trash_or_restore_attendees', |
|
| 490 | - 'args' => [ |
|
| 491 | - 'trash' => 'true', |
|
| 492 | - ], |
|
| 493 | - 'noheader' => true, |
|
| 494 | - 'capability' => 'ee_delete_contacts', |
|
| 495 | - ], |
|
| 496 | - 'trash_attendee' => [ |
|
| 497 | - 'func' => '_trash_or_restore_attendees', |
|
| 498 | - 'args' => [ |
|
| 499 | - 'trash' => true, |
|
| 500 | - ], |
|
| 501 | - 'noheader' => true, |
|
| 502 | - 'capability' => 'ee_delete_contacts', |
|
| 503 | - 'obj_id' => $ATT_ID, |
|
| 504 | - ], |
|
| 505 | - 'restore_attendees' => [ |
|
| 506 | - 'func' => '_trash_or_restore_attendees', |
|
| 507 | - 'args' => [ |
|
| 508 | - 'trash' => false, |
|
| 509 | - ], |
|
| 510 | - 'noheader' => true, |
|
| 511 | - 'capability' => 'ee_delete_contacts', |
|
| 512 | - 'obj_id' => $ATT_ID, |
|
| 513 | - ], |
|
| 514 | - 'delete_attendee' => [ |
|
| 515 | - 'func' => [$this, 'deleteAttendees'], |
|
| 516 | - 'capability' => 'ee_delete_contacts', |
|
| 517 | - 'obj_id' => $ATT_ID, |
|
| 518 | - 'noheader' => true, |
|
| 519 | - ], |
|
| 520 | - 'delete_attendees' => [ |
|
| 521 | - 'func' => [$this, 'deleteAttendees'], |
|
| 522 | - 'capability' => 'ee_delete_contacts', |
|
| 523 | - 'noheader' => true, |
|
| 524 | - ], |
|
| 525 | - 'resend_registration' => [ |
|
| 526 | - 'func' => '_resend_registration', |
|
| 527 | - 'noheader' => true, |
|
| 528 | - 'capability' => 'ee_send_message', |
|
| 529 | - ], |
|
| 530 | - 'registrations_report' => [ |
|
| 531 | - 'func' => [$this, '_registrations_report'], |
|
| 532 | - 'noheader' => true, |
|
| 533 | - 'capability' => 'ee_read_registrations', |
|
| 534 | - ], |
|
| 535 | - 'contact_list_export' => [ |
|
| 536 | - 'func' => '_contact_list_export', |
|
| 537 | - 'noheader' => true, |
|
| 538 | - 'capability' => 'export', |
|
| 539 | - ], |
|
| 540 | - 'contact_list_report' => [ |
|
| 541 | - 'func' => '_contact_list_report', |
|
| 542 | - 'noheader' => true, |
|
| 543 | - 'capability' => 'ee_read_contacts', |
|
| 544 | - ], |
|
| 545 | - ]; |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - |
|
| 549 | - protected function _set_page_config() |
|
| 550 | - { |
|
| 551 | - $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 552 | - $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int'); |
|
| 553 | - $this->_page_config = [ |
|
| 554 | - 'default' => [ |
|
| 555 | - 'nav' => [ |
|
| 556 | - 'label' => esc_html__('Overview', 'event_espresso'), |
|
| 557 | - 'icon' => 'dashicons-list-view', |
|
| 558 | - 'order' => 5, |
|
| 559 | - ], |
|
| 560 | - 'help_tabs' => [ |
|
| 561 | - 'registrations_overview_help_tab' => [ |
|
| 562 | - 'title' => esc_html__('Registrations Overview', 'event_espresso'), |
|
| 563 | - 'filename' => 'registrations_overview', |
|
| 564 | - ], |
|
| 565 | - 'registrations_overview_table_column_headings_help_tab' => [ |
|
| 566 | - 'title' => esc_html__('Registrations Table Column Headings', 'event_espresso'), |
|
| 567 | - 'filename' => 'registrations_overview_table_column_headings', |
|
| 568 | - ], |
|
| 569 | - 'registrations_overview_filters_help_tab' => [ |
|
| 570 | - 'title' => esc_html__('Registration Filters', 'event_espresso'), |
|
| 571 | - 'filename' => 'registrations_overview_filters', |
|
| 572 | - ], |
|
| 573 | - 'registrations_overview_views_help_tab' => [ |
|
| 574 | - 'title' => esc_html__('Registration Views', 'event_espresso'), |
|
| 575 | - 'filename' => 'registrations_overview_views', |
|
| 576 | - ], |
|
| 577 | - 'registrations_regoverview_other_help_tab' => [ |
|
| 578 | - 'title' => esc_html__('Registrations Other', 'event_espresso'), |
|
| 579 | - 'filename' => 'registrations_overview_other', |
|
| 580 | - ], |
|
| 581 | - ], |
|
| 582 | - 'list_table' => 'EE_Registrations_List_Table', |
|
| 583 | - 'require_nonce' => false, |
|
| 584 | - ], |
|
| 585 | - 'view_registration' => [ |
|
| 586 | - 'nav' => [ |
|
| 587 | - 'label' => esc_html__('REG Details', 'event_espresso'), |
|
| 588 | - 'icon' => 'dashicons-clipboard', |
|
| 589 | - 'order' => 15, |
|
| 590 | - 'url' => $REG_ID |
|
| 591 | - ? add_query_arg(['_REG_ID' => $REG_ID], $this->_current_page_view_url) |
|
| 592 | - : $this->_admin_base_url, |
|
| 593 | - 'persistent' => false, |
|
| 594 | - ], |
|
| 595 | - 'help_tabs' => [ |
|
| 596 | - 'registrations_details_help_tab' => [ |
|
| 597 | - 'title' => esc_html__('Registration Details', 'event_espresso'), |
|
| 598 | - 'filename' => 'registrations_details', |
|
| 599 | - ], |
|
| 600 | - 'registrations_details_table_help_tab' => [ |
|
| 601 | - 'title' => esc_html__('Registration Details Table', 'event_espresso'), |
|
| 602 | - 'filename' => 'registrations_details_table', |
|
| 603 | - ], |
|
| 604 | - 'registrations_details_form_answers_help_tab' => [ |
|
| 605 | - 'title' => esc_html__('Registration Form Answers', 'event_espresso'), |
|
| 606 | - 'filename' => 'registrations_details_form_answers', |
|
| 607 | - ], |
|
| 608 | - 'registrations_details_registrant_details_help_tab' => [ |
|
| 609 | - 'title' => esc_html__('Contact Details', 'event_espresso'), |
|
| 610 | - 'filename' => 'registrations_details_registrant_details', |
|
| 611 | - ], |
|
| 612 | - ], |
|
| 613 | - 'metaboxes' => array_merge( |
|
| 614 | - $this->_default_espresso_metaboxes, |
|
| 615 | - ['_registration_details_metaboxes'] |
|
| 616 | - ), |
|
| 617 | - 'require_nonce' => false, |
|
| 618 | - ], |
|
| 619 | - 'new_registration' => [ |
|
| 620 | - 'nav' => [ |
|
| 621 | - 'label' => esc_html__('Add New Registration', 'event_espresso'), |
|
| 622 | - 'icon' => 'dashicons-plus-alt', |
|
| 623 | - 'url' => '#', |
|
| 624 | - 'order' => 15, |
|
| 625 | - 'persistent' => false, |
|
| 626 | - ], |
|
| 627 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
| 628 | - 'labels' => [ |
|
| 629 | - 'publishbox' => esc_html__('Save Registration', 'event_espresso'), |
|
| 630 | - ], |
|
| 631 | - 'require_nonce' => false, |
|
| 632 | - ], |
|
| 633 | - 'add_new_attendee' => [ |
|
| 634 | - 'nav' => [ |
|
| 635 | - 'label' => esc_html__('Add Contact', 'event_espresso'), |
|
| 636 | - 'icon' => 'dashicons-plus-alt', |
|
| 637 | - 'order' => 15, |
|
| 638 | - 'persistent' => false, |
|
| 639 | - ], |
|
| 640 | - 'metaboxes' => array_merge( |
|
| 641 | - $this->_default_espresso_metaboxes, |
|
| 642 | - ['_publish_post_box', 'attendee_editor_metaboxes'] |
|
| 643 | - ), |
|
| 644 | - 'require_nonce' => false, |
|
| 645 | - ], |
|
| 646 | - 'edit_attendee' => [ |
|
| 647 | - 'nav' => [ |
|
| 648 | - 'label' => esc_html__('Edit Contact', 'event_espresso'), |
|
| 649 | - 'icon' => 'dashicons-edit-large', |
|
| 650 | - 'order' => 15, |
|
| 651 | - 'persistent' => false, |
|
| 652 | - 'url' => $ATT_ID |
|
| 653 | - ? add_query_arg(['ATT_ID' => $ATT_ID], $this->_current_page_view_url) |
|
| 654 | - : $this->_admin_base_url, |
|
| 655 | - ], |
|
| 656 | - 'metaboxes' => array_merge( |
|
| 657 | - $this->_default_espresso_metaboxes, |
|
| 658 | - ['attendee_editor_metaboxes'] |
|
| 659 | - ), |
|
| 660 | - 'require_nonce' => false, |
|
| 661 | - ], |
|
| 662 | - 'contact_list' => [ |
|
| 663 | - 'nav' => [ |
|
| 664 | - 'label' => esc_html__('Contact List', 'event_espresso'), |
|
| 665 | - 'icon' => 'dashicons-id-alt', |
|
| 666 | - 'order' => 20, |
|
| 667 | - ], |
|
| 668 | - 'list_table' => 'EE_Attendee_Contact_List_Table', |
|
| 669 | - 'help_tabs' => [ |
|
| 670 | - 'registrations_contact_list_help_tab' => [ |
|
| 671 | - 'title' => esc_html__('Registrations Contact List', 'event_espresso'), |
|
| 672 | - 'filename' => 'registrations_contact_list', |
|
| 673 | - ], |
|
| 674 | - 'registrations_contact-list_table_column_headings_help_tab' => [ |
|
| 675 | - 'title' => esc_html__('Contact List Table Column Headings', 'event_espresso'), |
|
| 676 | - 'filename' => 'registrations_contact_list_table_column_headings', |
|
| 677 | - ], |
|
| 678 | - 'registrations_contact_list_views_help_tab' => [ |
|
| 679 | - 'title' => esc_html__('Contact List Views', 'event_espresso'), |
|
| 680 | - 'filename' => 'registrations_contact_list_views', |
|
| 681 | - ], |
|
| 682 | - 'registrations_contact_list_other_help_tab' => [ |
|
| 683 | - 'title' => esc_html__('Contact List Other', 'event_espresso'), |
|
| 684 | - 'filename' => 'registrations_contact_list_other', |
|
| 685 | - ], |
|
| 686 | - ], |
|
| 687 | - 'metaboxes' => [], |
|
| 688 | - 'require_nonce' => false, |
|
| 689 | - ], |
|
| 690 | - // override default cpt routes |
|
| 691 | - 'create_new' => '', |
|
| 692 | - 'edit' => '', |
|
| 693 | - ]; |
|
| 694 | - } |
|
| 695 | - |
|
| 696 | - |
|
| 697 | - /** |
|
| 698 | - * The below methods aren't used by this class currently |
|
| 699 | - */ |
|
| 700 | - protected function _add_screen_options() |
|
| 701 | - { |
|
| 702 | - } |
|
| 703 | - |
|
| 704 | - |
|
| 705 | - protected function _add_feature_pointers() |
|
| 706 | - { |
|
| 707 | - } |
|
| 708 | - |
|
| 709 | - |
|
| 710 | - public function admin_init() |
|
| 711 | - { |
|
| 712 | - EE_Registry::$i18n_js_strings['update_att_qstns'] = esc_html__( |
|
| 713 | - 'click "Update Registration Questions" to save your changes', |
|
| 714 | - 'event_espresso' |
|
| 715 | - ); |
|
| 716 | - } |
|
| 717 | - |
|
| 718 | - |
|
| 719 | - public function admin_notices() |
|
| 720 | - { |
|
| 721 | - } |
|
| 722 | - |
|
| 723 | - |
|
| 724 | - public function admin_footer_scripts() |
|
| 725 | - { |
|
| 726 | - } |
|
| 727 | - |
|
| 728 | - |
|
| 729 | - /** |
|
| 730 | - * get list of registration statuses |
|
| 731 | - * |
|
| 732 | - * @return void |
|
| 733 | - * @throws EE_Error |
|
| 734 | - * @throws ReflectionException |
|
| 735 | - */ |
|
| 736 | - private function _get_registration_status_array() |
|
| 737 | - { |
|
| 738 | - self::$_reg_status = EEM_Registration::reg_status_array([], true); |
|
| 739 | - } |
|
| 740 | - |
|
| 741 | - |
|
| 742 | - /** |
|
| 743 | - * @throws InvalidArgumentException |
|
| 744 | - * @throws InvalidDataTypeException |
|
| 745 | - * @throws InvalidInterfaceException |
|
| 746 | - * @since 4.10.2.p |
|
| 747 | - */ |
|
| 748 | - protected function _add_screen_options_default() |
|
| 749 | - { |
|
| 750 | - $this->_per_page_screen_option(); |
|
| 751 | - } |
|
| 752 | - |
|
| 753 | - |
|
| 754 | - /** |
|
| 755 | - * @throws InvalidArgumentException |
|
| 756 | - * @throws InvalidDataTypeException |
|
| 757 | - * @throws InvalidInterfaceException |
|
| 758 | - * @since 4.10.2.p |
|
| 759 | - */ |
|
| 760 | - protected function _add_screen_options_contact_list() |
|
| 761 | - { |
|
| 762 | - $page_title = $this->_admin_page_title; |
|
| 763 | - $this->_admin_page_title = esc_html__('Contacts', 'event_espresso'); |
|
| 764 | - $this->_per_page_screen_option(); |
|
| 765 | - $this->_admin_page_title = $page_title; |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - |
|
| 769 | - public function load_scripts_styles() |
|
| 770 | - { |
|
| 771 | - // style |
|
| 772 | - wp_register_style( |
|
| 773 | - 'espresso_reg', |
|
| 774 | - REG_ASSETS_URL . 'espresso_registrations_admin.css', |
|
| 775 | - ['ee-admin-css'], |
|
| 776 | - EVENT_ESPRESSO_VERSION |
|
| 777 | - ); |
|
| 778 | - wp_enqueue_style('espresso_reg'); |
|
| 779 | - // script |
|
| 780 | - wp_register_script( |
|
| 781 | - 'espresso_reg', |
|
| 782 | - REG_ASSETS_URL . 'espresso_registrations_admin.js', |
|
| 783 | - ['jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'], |
|
| 784 | - EVENT_ESPRESSO_VERSION, |
|
| 785 | - true |
|
| 786 | - ); |
|
| 787 | - wp_enqueue_script('espresso_reg'); |
|
| 788 | - } |
|
| 789 | - |
|
| 790 | - |
|
| 791 | - /** |
|
| 792 | - * @throws EE_Error |
|
| 793 | - * @throws InvalidArgumentException |
|
| 794 | - * @throws InvalidDataTypeException |
|
| 795 | - * @throws InvalidInterfaceException |
|
| 796 | - * @throws ReflectionException |
|
| 797 | - * @since 4.10.2.p |
|
| 798 | - */ |
|
| 799 | - public function load_scripts_styles_edit_attendee() |
|
| 800 | - { |
|
| 801 | - // stuff to only show up on our attendee edit details page. |
|
| 802 | - $attendee_details_translations = [ |
|
| 803 | - 'att_publish_text' => sprintf( |
|
| 804 | - /* translators: The date and time */ |
|
| 805 | - wp_strip_all_tags(__('Created on: %s', 'event_espresso')), |
|
| 806 | - '<b>' . $this->_cpt_model_obj->get_datetime('ATT_created') . '</b>' |
|
| 807 | - ), |
|
| 808 | - ]; |
|
| 809 | - wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
| 810 | - wp_enqueue_script('jquery-validate'); |
|
| 811 | - } |
|
| 812 | - |
|
| 813 | - |
|
| 814 | - /** |
|
| 815 | - * @throws EE_Error |
|
| 816 | - * @throws InvalidArgumentException |
|
| 817 | - * @throws InvalidDataTypeException |
|
| 818 | - * @throws InvalidInterfaceException |
|
| 819 | - * @throws ReflectionException |
|
| 820 | - * @since 4.10.2.p |
|
| 821 | - */ |
|
| 822 | - public function load_scripts_styles_view_registration() |
|
| 823 | - { |
|
| 824 | - $this->_set_registration_object(); |
|
| 825 | - // styles |
|
| 826 | - wp_enqueue_style('espresso-ui-theme'); |
|
| 827 | - // scripts |
|
| 828 | - $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
| 829 | - $this->_reg_custom_questions_form->wp_enqueue_scripts(); |
|
| 830 | - } |
|
| 831 | - |
|
| 832 | - |
|
| 833 | - public function load_scripts_styles_contact_list() |
|
| 834 | - { |
|
| 835 | - wp_dequeue_style('espresso_reg'); |
|
| 836 | - wp_register_style( |
|
| 837 | - 'espresso_att', |
|
| 838 | - REG_ASSETS_URL . 'espresso_attendees_admin.css', |
|
| 839 | - ['ee-admin-css'], |
|
| 840 | - EVENT_ESPRESSO_VERSION |
|
| 841 | - ); |
|
| 842 | - wp_enqueue_style('espresso_att'); |
|
| 843 | - } |
|
| 844 | - |
|
| 845 | - |
|
| 846 | - public function load_scripts_styles_new_registration() |
|
| 847 | - { |
|
| 848 | - wp_register_script( |
|
| 849 | - 'ee-spco-for-admin', |
|
| 850 | - REG_ASSETS_URL . 'spco_for_admin.js', |
|
| 851 | - ['underscore', 'jquery'], |
|
| 852 | - EVENT_ESPRESSO_VERSION, |
|
| 853 | - true |
|
| 854 | - ); |
|
| 855 | - wp_enqueue_script('ee-spco-for-admin'); |
|
| 856 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
| 857 | - EE_Form_Section_Proper::wp_enqueue_scripts(); |
|
| 858 | - EED_Ticket_Selector::load_tckt_slctr_assets(); |
|
| 859 | - EE_Datepicker_Input::enqueue_styles_and_scripts(); |
|
| 860 | - } |
|
| 861 | - |
|
| 862 | - |
|
| 863 | - public function AHEE__EE_Admin_Page__route_admin_request_resend_registration() |
|
| 864 | - { |
|
| 865 | - add_filter('FHEE_load_EE_messages', '__return_true'); |
|
| 866 | - } |
|
| 867 | - |
|
| 868 | - |
|
| 869 | - public function AHEE__EE_Admin_Page__route_admin_request_approve_registration() |
|
| 870 | - { |
|
| 871 | - add_filter('FHEE_load_EE_messages', '__return_true'); |
|
| 872 | - } |
|
| 873 | - |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * @throws EE_Error |
|
| 877 | - * @throws InvalidArgumentException |
|
| 878 | - * @throws InvalidDataTypeException |
|
| 879 | - * @throws InvalidInterfaceException |
|
| 880 | - * @throws ReflectionException |
|
| 881 | - * @since 4.10.2.p |
|
| 882 | - */ |
|
| 883 | - protected function _set_list_table_views_default() |
|
| 884 | - { |
|
| 885 | - // for notification related bulk actions we need to make sure only active messengers have an option. |
|
| 886 | - EED_Messages::set_autoloaders(); |
|
| 887 | - /** @type EE_Message_Resource_Manager $message_resource_manager */ |
|
| 888 | - $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
| 889 | - $active_mts = $message_resource_manager->list_of_active_message_types(); |
|
| 890 | - // key= bulk_action_slug, value= message type. |
|
| 891 | - $match_array = [ |
|
| 892 | - 'approve_registrations' => 'registration', |
|
| 893 | - 'decline_registrations' => 'declined_registration', |
|
| 894 | - 'pending_registrations' => 'pending_approval', |
|
| 895 | - 'no_approve_registrations' => 'not_approved_registration', |
|
| 896 | - 'cancel_registrations' => 'cancelled_registration', |
|
| 897 | - ]; |
|
| 898 | - $can_send = $this->capabilities->current_user_can( |
|
| 899 | - 'ee_send_message', |
|
| 900 | - 'batch_send_messages' |
|
| 901 | - ); |
|
| 902 | - /** setup reg status bulk actions **/ |
|
| 903 | - $def_reg_status_actions['approve_registrations'] = esc_html__('Approve Registrations', 'event_espresso'); |
|
| 904 | - if ($can_send && in_array($match_array['approve_registrations'], $active_mts, true)) { |
|
| 905 | - $def_reg_status_actions['approve_and_notify_registrations'] = esc_html__( |
|
| 906 | - 'Approve and Notify Registrations', |
|
| 907 | - 'event_espresso' |
|
| 908 | - ); |
|
| 909 | - } |
|
| 910 | - $def_reg_status_actions['decline_registrations'] = esc_html__('Decline Registrations', 'event_espresso'); |
|
| 911 | - if ($can_send && in_array($match_array['decline_registrations'], $active_mts, true)) { |
|
| 912 | - $def_reg_status_actions['decline_and_notify_registrations'] = esc_html__( |
|
| 913 | - 'Decline and Notify Registrations', |
|
| 914 | - 'event_espresso' |
|
| 915 | - ); |
|
| 916 | - } |
|
| 917 | - $def_reg_status_actions['pending_registrations'] = esc_html__( |
|
| 918 | - 'Set Registrations to Pending Payment', |
|
| 919 | - 'event_espresso' |
|
| 920 | - ); |
|
| 921 | - if ($can_send && in_array($match_array['pending_registrations'], $active_mts, true)) { |
|
| 922 | - $def_reg_status_actions['pending_and_notify_registrations'] = esc_html__( |
|
| 923 | - 'Set Registrations to Pending Payment and Notify', |
|
| 924 | - 'event_espresso' |
|
| 925 | - ); |
|
| 926 | - } |
|
| 927 | - $def_reg_status_actions['no_approve_registrations'] = esc_html__( |
|
| 928 | - 'Set Registrations to Awaiting Review', |
|
| 929 | - 'event_espresso' |
|
| 930 | - ); |
|
| 931 | - if ($can_send && in_array($match_array['no_approve_registrations'], $active_mts, true)) { |
|
| 932 | - $def_reg_status_actions['no_approve_and_notify_registrations'] = esc_html__( |
|
| 933 | - 'Set Registrations to Awaiting Review and Notify', |
|
| 934 | - 'event_espresso' |
|
| 935 | - ); |
|
| 936 | - } |
|
| 937 | - $def_reg_status_actions['cancel_registrations'] = esc_html__('Cancel Registrations', 'event_espresso'); |
|
| 938 | - if ($can_send && in_array($match_array['cancel_registrations'], $active_mts, true)) { |
|
| 939 | - $def_reg_status_actions['cancel_and_notify_registrations'] = esc_html__( |
|
| 940 | - 'Cancel Registrations and Notify', |
|
| 941 | - 'event_espresso' |
|
| 942 | - ); |
|
| 943 | - } |
|
| 944 | - $def_reg_status_actions = apply_filters( |
|
| 945 | - 'FHEE__Registrations_Admin_Page___set_list_table_views_default__def_reg_status_actions_array', |
|
| 946 | - $def_reg_status_actions, |
|
| 947 | - $active_mts, |
|
| 948 | - $can_send |
|
| 949 | - ); |
|
| 950 | - |
|
| 951 | - $current_time = current_time('timestamp'); |
|
| 952 | - $this->_views = [ |
|
| 953 | - 'all' => [ |
|
| 954 | - 'slug' => 'all', |
|
| 955 | - 'label' => esc_html__('View All Registrations', 'event_espresso'), |
|
| 956 | - 'count' => 0, |
|
| 957 | - 'bulk_action' => array_merge( |
|
| 958 | - $def_reg_status_actions, |
|
| 959 | - [ |
|
| 960 | - 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 961 | - ] |
|
| 962 | - ), |
|
| 963 | - ], |
|
| 964 | - 'today' => [ |
|
| 965 | - 'slug' => 'today', |
|
| 966 | - 'label' => sprintf( |
|
| 967 | - esc_html__('Today - %s', 'event_espresso'), |
|
| 968 | - date('M d, Y', $current_time) |
|
| 969 | - ), |
|
| 970 | - 'count' => 0, |
|
| 971 | - 'bulk_action' => array_merge( |
|
| 972 | - $def_reg_status_actions, |
|
| 973 | - [ |
|
| 974 | - 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 975 | - ] |
|
| 976 | - ), |
|
| 977 | - ], |
|
| 978 | - 'yesterday' => [ |
|
| 979 | - 'slug' => 'yesterday', |
|
| 980 | - 'label' => sprintf( |
|
| 981 | - esc_html__('Yesterday - %s', 'event_espresso'), |
|
| 982 | - date('M d, Y', $current_time - DAY_IN_SECONDS) |
|
| 983 | - ), |
|
| 984 | - 'count' => 0, |
|
| 985 | - 'bulk_action' => array_merge( |
|
| 986 | - $def_reg_status_actions, |
|
| 987 | - [ |
|
| 988 | - 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 989 | - ] |
|
| 990 | - ), |
|
| 991 | - ], |
|
| 992 | - 'month' => [ |
|
| 993 | - 'slug' => 'month', |
|
| 994 | - 'label' => esc_html__('This Month', 'event_espresso'), |
|
| 995 | - 'count' => 0, |
|
| 996 | - 'bulk_action' => array_merge( |
|
| 997 | - $def_reg_status_actions, |
|
| 998 | - [ |
|
| 999 | - 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 1000 | - ] |
|
| 1001 | - ), |
|
| 1002 | - ], |
|
| 1003 | - ]; |
|
| 1004 | - if ( |
|
| 1005 | - $this->capabilities->current_user_can( |
|
| 1006 | - 'ee_delete_registrations', |
|
| 1007 | - 'espresso_registrations_delete_registration' |
|
| 1008 | - ) |
|
| 1009 | - ) { |
|
| 1010 | - $this->_views['incomplete'] = [ |
|
| 1011 | - 'slug' => 'incomplete', |
|
| 1012 | - 'label' => esc_html__('Incomplete', 'event_espresso'), |
|
| 1013 | - 'count' => 0, |
|
| 1014 | - 'bulk_action' => [ |
|
| 1015 | - 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 1016 | - ], |
|
| 1017 | - ]; |
|
| 1018 | - $this->_views['trash'] = [ |
|
| 1019 | - 'slug' => 'trash', |
|
| 1020 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
| 1021 | - 'count' => 0, |
|
| 1022 | - 'bulk_action' => [ |
|
| 1023 | - 'restore_registrations' => esc_html__('Restore Registrations', 'event_espresso'), |
|
| 1024 | - 'delete_registrations' => esc_html__('Delete Registrations Permanently', 'event_espresso'), |
|
| 1025 | - ], |
|
| 1026 | - ]; |
|
| 1027 | - } |
|
| 1028 | - } |
|
| 1029 | - |
|
| 1030 | - |
|
| 1031 | - protected function _set_list_table_views_contact_list() |
|
| 1032 | - { |
|
| 1033 | - $this->_views = [ |
|
| 1034 | - 'in_use' => [ |
|
| 1035 | - 'slug' => 'in_use', |
|
| 1036 | - 'label' => esc_html__('In Use', 'event_espresso'), |
|
| 1037 | - 'count' => 0, |
|
| 1038 | - 'bulk_action' => [ |
|
| 1039 | - 'trash_attendees' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 1040 | - ], |
|
| 1041 | - ], |
|
| 1042 | - ]; |
|
| 1043 | - if ( |
|
| 1044 | - $this->capabilities->current_user_can( |
|
| 1045 | - 'ee_delete_contacts', |
|
| 1046 | - 'espresso_registrations_trash_attendees' |
|
| 1047 | - ) |
|
| 1048 | - ) { |
|
| 1049 | - $this->_views['trash'] = [ |
|
| 1050 | - 'slug' => 'trash', |
|
| 1051 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
| 1052 | - 'count' => 0, |
|
| 1053 | - 'bulk_action' => [ |
|
| 1054 | - 'restore_attendees' => esc_html__('Restore from Trash', 'event_espresso'), |
|
| 1055 | - 'delete_attendees' => esc_html__('Permanently Delete', 'event_espresso'), |
|
| 1056 | - ], |
|
| 1057 | - ]; |
|
| 1058 | - } |
|
| 1059 | - } |
|
| 1060 | - |
|
| 1061 | - |
|
| 1062 | - /** |
|
| 1063 | - * @return array |
|
| 1064 | - * @throws EE_Error |
|
| 1065 | - */ |
|
| 1066 | - protected function _registration_legend_items() |
|
| 1067 | - { |
|
| 1068 | - $fc_items = [ |
|
| 1069 | - 'star-icon' => [ |
|
| 1070 | - 'class' => 'dashicons dashicons-star-filled gold-icon', |
|
| 1071 | - 'desc' => esc_html__('This is the Primary Registrant', 'event_espresso'), |
|
| 1072 | - ], |
|
| 1073 | - 'view_details' => [ |
|
| 1074 | - 'class' => 'dashicons dashicons-clipboard', |
|
| 1075 | - 'desc' => esc_html__('View Registration Details', 'event_espresso'), |
|
| 1076 | - ], |
|
| 1077 | - 'edit_attendee' => [ |
|
| 1078 | - 'class' => 'dashicons dashicons-admin-users', |
|
| 1079 | - 'desc' => esc_html__('Edit Contact Details', 'event_espresso'), |
|
| 1080 | - ], |
|
| 1081 | - 'view_transaction' => [ |
|
| 1082 | - 'class' => 'dashicons dashicons-cart', |
|
| 1083 | - 'desc' => esc_html__('View Transaction Details', 'event_espresso'), |
|
| 1084 | - ], |
|
| 1085 | - 'view_invoice' => [ |
|
| 1086 | - 'class' => 'dashicons dashicons-media-spreadsheet', |
|
| 1087 | - 'desc' => esc_html__('View Transaction Invoice', 'event_espresso'), |
|
| 1088 | - ], |
|
| 1089 | - ]; |
|
| 1090 | - if ( |
|
| 1091 | - $this->capabilities->current_user_can( |
|
| 1092 | - 'ee_send_message', |
|
| 1093 | - 'espresso_registrations_resend_registration' |
|
| 1094 | - ) |
|
| 1095 | - ) { |
|
| 1096 | - $fc_items['resend_registration'] = [ |
|
| 1097 | - 'class' => 'dashicons dashicons-email-alt', |
|
| 1098 | - 'desc' => esc_html__('Resend Registration Details', 'event_espresso'), |
|
| 1099 | - ]; |
|
| 1100 | - } else { |
|
| 1101 | - $fc_items['blank'] = ['class' => 'blank', 'desc' => '']; |
|
| 1102 | - } |
|
| 1103 | - if ( |
|
| 1104 | - $this->capabilities->current_user_can( |
|
| 1105 | - 'ee_read_global_messages', |
|
| 1106 | - 'view_filtered_messages' |
|
| 1107 | - ) |
|
| 1108 | - ) { |
|
| 1109 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
| 1110 | - if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) { |
|
| 1111 | - $fc_items['view_related_messages'] = [ |
|
| 1112 | - 'class' => $related_for_icon['css_class'], |
|
| 1113 | - 'desc' => $related_for_icon['label'], |
|
| 1114 | - ]; |
|
| 1115 | - } |
|
| 1116 | - } |
|
| 1117 | - $sc_items = [ |
|
| 1118 | - 'approved_status' => [ |
|
| 1119 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::APPROVED, |
|
| 1120 | - 'desc' => EEH_Template::pretty_status( |
|
| 1121 | - RegStatus::APPROVED, |
|
| 1122 | - false, |
|
| 1123 | - 'sentence' |
|
| 1124 | - ), |
|
| 1125 | - ], |
|
| 1126 | - 'pending_status' => [ |
|
| 1127 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::PENDING_PAYMENT, |
|
| 1128 | - 'desc' => EEH_Template::pretty_status( |
|
| 1129 | - RegStatus::PENDING_PAYMENT, |
|
| 1130 | - false, |
|
| 1131 | - 'sentence' |
|
| 1132 | - ), |
|
| 1133 | - ], |
|
| 1134 | - 'wait_list' => [ |
|
| 1135 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::WAIT_LIST, |
|
| 1136 | - 'desc' => EEH_Template::pretty_status( |
|
| 1137 | - RegStatus::WAIT_LIST, |
|
| 1138 | - false, |
|
| 1139 | - 'sentence' |
|
| 1140 | - ), |
|
| 1141 | - ], |
|
| 1142 | - 'incomplete_status' => [ |
|
| 1143 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::INCOMPLETE, |
|
| 1144 | - 'desc' => EEH_Template::pretty_status( |
|
| 1145 | - RegStatus::INCOMPLETE, |
|
| 1146 | - false, |
|
| 1147 | - 'sentence' |
|
| 1148 | - ), |
|
| 1149 | - ], |
|
| 1150 | - 'not_approved' => [ |
|
| 1151 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::AWAITING_REVIEW, |
|
| 1152 | - 'desc' => EEH_Template::pretty_status( |
|
| 1153 | - RegStatus::AWAITING_REVIEW, |
|
| 1154 | - false, |
|
| 1155 | - 'sentence' |
|
| 1156 | - ), |
|
| 1157 | - ], |
|
| 1158 | - 'declined_status' => [ |
|
| 1159 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::DECLINED, |
|
| 1160 | - 'desc' => EEH_Template::pretty_status( |
|
| 1161 | - RegStatus::DECLINED, |
|
| 1162 | - false, |
|
| 1163 | - 'sentence' |
|
| 1164 | - ), |
|
| 1165 | - ], |
|
| 1166 | - 'cancelled_status' => [ |
|
| 1167 | - 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::CANCELLED, |
|
| 1168 | - 'desc' => EEH_Template::pretty_status( |
|
| 1169 | - RegStatus::CANCELLED, |
|
| 1170 | - false, |
|
| 1171 | - 'sentence' |
|
| 1172 | - ), |
|
| 1173 | - ], |
|
| 1174 | - ]; |
|
| 1175 | - return array_merge($fc_items, $sc_items); |
|
| 1176 | - } |
|
| 1177 | - |
|
| 1178 | - |
|
| 1179 | - |
|
| 1180 | - /*************************************** REGISTRATION OVERVIEW **************************************/ |
|
| 1181 | - |
|
| 1182 | - |
|
| 1183 | - /** |
|
| 1184 | - * @throws DomainException |
|
| 1185 | - * @throws EE_Error |
|
| 1186 | - * @throws InvalidArgumentException |
|
| 1187 | - * @throws InvalidDataTypeException |
|
| 1188 | - * @throws InvalidInterfaceException |
|
| 1189 | - */ |
|
| 1190 | - protected function _registrations_overview_list_table() |
|
| 1191 | - { |
|
| 1192 | - $this->appendAddNewRegistrationButtonToPageTitle(); |
|
| 1193 | - $header_text = ''; |
|
| 1194 | - $admin_page_header_decorators = [ |
|
| 1195 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader', |
|
| 1196 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader', |
|
| 1197 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader', |
|
| 1198 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader', |
|
| 1199 | - ]; |
|
| 1200 | - foreach ($admin_page_header_decorators as $admin_page_header_decorator) { |
|
| 1201 | - $filter_header_decorator = $this->loader->getNew($admin_page_header_decorator); |
|
| 1202 | - $header_text = $filter_header_decorator->getHeaderText($header_text); |
|
| 1203 | - } |
|
| 1204 | - $this->_template_args['before_list_table'] = $header_text; |
|
| 1205 | - $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
| 1206 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
| 1207 | - } |
|
| 1208 | - |
|
| 1209 | - |
|
| 1210 | - /** |
|
| 1211 | - * @throws EE_Error |
|
| 1212 | - * @throws InvalidArgumentException |
|
| 1213 | - * @throws InvalidDataTypeException |
|
| 1214 | - * @throws InvalidInterfaceException |
|
| 1215 | - */ |
|
| 1216 | - private function appendAddNewRegistrationButtonToPageTitle() |
|
| 1217 | - { |
|
| 1218 | - $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int'); |
|
| 1219 | - if ( |
|
| 1220 | - $EVT_ID |
|
| 1221 | - && $this->capabilities->current_user_can( |
|
| 1222 | - 'ee_edit_registrations', |
|
| 1223 | - 'espresso_registrations_new_registration', |
|
| 1224 | - $EVT_ID |
|
| 1225 | - ) |
|
| 1226 | - ) { |
|
| 1227 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
| 1228 | - 'new_registration', |
|
| 1229 | - 'add-registrant', |
|
| 1230 | - ['event_id' => $EVT_ID], |
|
| 1231 | - 'add-new-h2' |
|
| 1232 | - ); |
|
| 1233 | - } |
|
| 1234 | - } |
|
| 1235 | - |
|
| 1236 | - |
|
| 1237 | - /** |
|
| 1238 | - * This sets the _registration property for the registration details screen |
|
| 1239 | - * |
|
| 1240 | - * @return void |
|
| 1241 | - * @throws EE_Error |
|
| 1242 | - * @throws InvalidArgumentException |
|
| 1243 | - * @throws InvalidDataTypeException |
|
| 1244 | - * @throws InvalidInterfaceException |
|
| 1245 | - * @throws ReflectionException |
|
| 1246 | - */ |
|
| 1247 | - private function _set_registration_object() |
|
| 1248 | - { |
|
| 1249 | - // get out if we've already set the object |
|
| 1250 | - if ($this->_registration instanceof EE_Registration) { |
|
| 1251 | - return; |
|
| 1252 | - } |
|
| 1253 | - $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 1254 | - if ($this->_registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID)) { |
|
| 1255 | - return; |
|
| 1256 | - } |
|
| 1257 | - $error_msg = sprintf( |
|
| 1258 | - esc_html__( |
|
| 1259 | - 'An error occurred and the details for Registration ID #%s could not be retrieved.', |
|
| 1260 | - 'event_espresso' |
|
| 1261 | - ), |
|
| 1262 | - $REG_ID |
|
| 1263 | - ); |
|
| 1264 | - EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1265 | - $this->_registration = null; |
|
| 1266 | - } |
|
| 1267 | - |
|
| 1268 | - |
|
| 1269 | - /** |
|
| 1270 | - * Used to retrieve registrations for the list table. |
|
| 1271 | - * |
|
| 1272 | - * @param int $per_page |
|
| 1273 | - * @param bool $count |
|
| 1274 | - * @param bool $this_month |
|
| 1275 | - * @param bool $today |
|
| 1276 | - * @param bool $yesterday |
|
| 1277 | - * @return EE_Registration[]|int |
|
| 1278 | - * @throws EE_Error |
|
| 1279 | - * @throws ReflectionException |
|
| 1280 | - */ |
|
| 1281 | - public function get_registrations( |
|
| 1282 | - int $per_page = 10, |
|
| 1283 | - bool $count = false, |
|
| 1284 | - bool $this_month = false, |
|
| 1285 | - bool $today = false, |
|
| 1286 | - bool $yesterday = false |
|
| 1287 | - ) { |
|
| 1288 | - if ($this_month) { |
|
| 1289 | - $this->request->setRequestParam('status', 'month'); |
|
| 1290 | - } |
|
| 1291 | - if ($today) { |
|
| 1292 | - $this->request->setRequestParam('status', 'today'); |
|
| 1293 | - } |
|
| 1294 | - if ($yesterday) { |
|
| 1295 | - $this->request->setRequestParam('status', 'yesterday'); |
|
| 1296 | - } |
|
| 1297 | - $query_params = $this->_get_registration_query_parameters([], $per_page, $count); |
|
| 1298 | - /** |
|
| 1299 | - * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected |
|
| 1300 | - * |
|
| 1301 | - * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093 |
|
| 1302 | - * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
| 1303 | - * or if you have the development copy of EE you can view this at the path: |
|
| 1304 | - * /docs/G--Model-System/model-query-params.md |
|
| 1305 | - */ |
|
| 1306 | - $query_params['group_by'] = ''; |
|
| 1307 | - |
|
| 1308 | - return $count |
|
| 1309 | - ? $this->getRegistrationModel()->count($query_params) |
|
| 1310 | - /** @type EE_Registration[] */ |
|
| 1311 | - : $this->getRegistrationModel()->get_all($query_params); |
|
| 1312 | - } |
|
| 1313 | - |
|
| 1314 | - |
|
| 1315 | - /** |
|
| 1316 | - * Retrieves the query parameters to be used by the Registration model for getting registrations. |
|
| 1317 | - * Note: this listens to values on the request for some query parameters. |
|
| 1318 | - * |
|
| 1319 | - * @param array $request |
|
| 1320 | - * @param int $per_page |
|
| 1321 | - * @param bool $count |
|
| 1322 | - * @return array |
|
| 1323 | - * @throws EE_Error |
|
| 1324 | - * @throws InvalidArgumentException |
|
| 1325 | - * @throws InvalidDataTypeException |
|
| 1326 | - * @throws InvalidInterfaceException |
|
| 1327 | - */ |
|
| 1328 | - protected function _get_registration_query_parameters( |
|
| 1329 | - array $request = [], |
|
| 1330 | - int $per_page = 10, |
|
| 1331 | - bool $count = false |
|
| 1332 | - ): array { |
|
| 1333 | - /** @var QueryBuilder $list_table_query_builder */ |
|
| 1334 | - $list_table_query_builder = $this->loader->getNew(QueryBuilder::class, [null, null, $request]); |
|
| 1335 | - return $list_table_query_builder->getQueryParams($per_page, $count); |
|
| 1336 | - } |
|
| 1337 | - |
|
| 1338 | - |
|
| 1339 | - public function get_registration_status_array(): array |
|
| 1340 | - { |
|
| 1341 | - return self::$_reg_status; |
|
| 1342 | - } |
|
| 1343 | - |
|
| 1344 | - |
|
| 1345 | - |
|
| 1346 | - |
|
| 1347 | - /*************************************** REGISTRATION DETAILS ***************************************/ |
|
| 1348 | - /** |
|
| 1349 | - * generates HTML for the View Registration Details Admin page |
|
| 1350 | - * |
|
| 1351 | - * @return void |
|
| 1352 | - * @throws DomainException |
|
| 1353 | - * @throws EE_Error |
|
| 1354 | - * @throws InvalidArgumentException |
|
| 1355 | - * @throws InvalidDataTypeException |
|
| 1356 | - * @throws InvalidInterfaceException |
|
| 1357 | - * @throws EntityNotFoundException |
|
| 1358 | - * @throws ReflectionException |
|
| 1359 | - */ |
|
| 1360 | - protected function _registration_details() |
|
| 1361 | - { |
|
| 1362 | - $this->_template_args = []; |
|
| 1363 | - $this->_set_registration_object(); |
|
| 1364 | - if (is_object($this->_registration)) { |
|
| 1365 | - $transaction = $this->_registration->transaction() |
|
| 1366 | - ? $this->_registration->transaction() |
|
| 1367 | - : EE_Transaction::new_instance(); |
|
| 1368 | - $this->session_data = $transaction->session_data(); |
|
| 1369 | - $event_id = $this->_registration->event_ID(); |
|
| 1370 | - $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
|
| 1371 | - $this->_template_args['reg_nmbr']['label'] = esc_html__('Registration Number', 'event_espresso'); |
|
| 1372 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
| 1373 | - $this->_template_args['reg_datetime']['label'] = esc_html__('Date', 'event_espresso'); |
|
| 1374 | - $this->_template_args['grand_total'] = $transaction->total(); |
|
| 1375 | - $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
|
| 1376 | - // link back to overview |
|
| 1377 | - $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
|
| 1378 | - $this->_template_args['registration'] = $this->_registration; |
|
| 1379 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1380 | - [ |
|
| 1381 | - 'action' => 'default', |
|
| 1382 | - 'event_id' => $event_id, |
|
| 1383 | - ], |
|
| 1384 | - REG_ADMIN_URL |
|
| 1385 | - ); |
|
| 1386 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1387 | - [ |
|
| 1388 | - 'action' => 'default', |
|
| 1389 | - 'EVT_ID' => $event_id, |
|
| 1390 | - 'page' => 'espresso_transactions', |
|
| 1391 | - ], |
|
| 1392 | - admin_url('admin.php') |
|
| 1393 | - ); |
|
| 1394 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1395 | - [ |
|
| 1396 | - 'page' => 'espresso_events', |
|
| 1397 | - 'action' => 'edit', |
|
| 1398 | - 'post' => $event_id, |
|
| 1399 | - ], |
|
| 1400 | - admin_url('admin.php') |
|
| 1401 | - ); |
|
| 1402 | - // next and previous links |
|
| 1403 | - $next_reg = $this->_registration->next( |
|
| 1404 | - null, |
|
| 1405 | - [], |
|
| 1406 | - 'REG_ID' |
|
| 1407 | - ); |
|
| 1408 | - $this->_template_args['next_registration'] = $next_reg |
|
| 1409 | - ? $this->_next_link( |
|
| 1410 | - EE_Admin_Page::add_query_args_and_nonce( |
|
| 1411 | - [ |
|
| 1412 | - 'action' => 'view_registration', |
|
| 1413 | - '_REG_ID' => $next_reg['REG_ID'], |
|
| 1414 | - ], |
|
| 1415 | - REG_ADMIN_URL |
|
| 1416 | - ), |
|
| 1417 | - 'dashicons dashicons-arrow-right ee-icon-size-22' |
|
| 1418 | - ) |
|
| 1419 | - : ''; |
|
| 1420 | - $previous_reg = $this->_registration->previous( |
|
| 1421 | - null, |
|
| 1422 | - [], |
|
| 1423 | - 'REG_ID' |
|
| 1424 | - ); |
|
| 1425 | - $this->_template_args['previous_registration'] = $previous_reg |
|
| 1426 | - ? $this->_previous_link( |
|
| 1427 | - EE_Admin_Page::add_query_args_and_nonce( |
|
| 1428 | - [ |
|
| 1429 | - 'action' => 'view_registration', |
|
| 1430 | - '_REG_ID' => $previous_reg['REG_ID'], |
|
| 1431 | - ], |
|
| 1432 | - REG_ADMIN_URL |
|
| 1433 | - ), |
|
| 1434 | - 'dashicons dashicons-arrow-left ee-icon-size-22' |
|
| 1435 | - ) |
|
| 1436 | - : ''; |
|
| 1437 | - // grab header |
|
| 1438 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
| 1439 | - $this->_template_args['REG_ID'] = $this->_registration->ID(); |
|
| 1440 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( |
|
| 1441 | - $template_path, |
|
| 1442 | - $this->_template_args, |
|
| 1443 | - true |
|
| 1444 | - ); |
|
| 1445 | - } else { |
|
| 1446 | - $this->_template_args['admin_page_header'] = ''; |
|
| 1447 | - $this->_display_espresso_notices(); |
|
| 1448 | - } |
|
| 1449 | - // the details template wrapper |
|
| 1450 | - $this->display_admin_page_with_sidebar(); |
|
| 1451 | - } |
|
| 1452 | - |
|
| 1453 | - |
|
| 1454 | - /** |
|
| 1455 | - * @throws EE_Error |
|
| 1456 | - * @throws InvalidArgumentException |
|
| 1457 | - * @throws InvalidDataTypeException |
|
| 1458 | - * @throws InvalidInterfaceException |
|
| 1459 | - * @throws ReflectionException |
|
| 1460 | - * @since 4.10.2.p |
|
| 1461 | - */ |
|
| 1462 | - protected function _registration_details_metaboxes() |
|
| 1463 | - { |
|
| 1464 | - do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
| 1465 | - $this->_set_registration_object(); |
|
| 1466 | - $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
|
| 1467 | - $this->addMetaBox( |
|
| 1468 | - 'edit-reg-status-mbox', |
|
| 1469 | - esc_html__('Registration Status', 'event_espresso'), |
|
| 1470 | - [$this, 'set_reg_status_buttons_metabox'], |
|
| 1471 | - $this->_wp_page_slug |
|
| 1472 | - ); |
|
| 1473 | - $this->addMetaBox( |
|
| 1474 | - 'edit-reg-details-mbox', |
|
| 1475 | - '<span>' . esc_html__('Registration Details', 'event_espresso') |
|
| 1476 | - . ' <span class="dashicons dashicons-clipboard"></span></span>', |
|
| 1477 | - [$this, '_reg_details_meta_box'], |
|
| 1478 | - $this->_wp_page_slug |
|
| 1479 | - ); |
|
| 1480 | - if ( |
|
| 1481 | - $attendee instanceof EE_Attendee |
|
| 1482 | - && $this->capabilities->current_user_can( |
|
| 1483 | - 'ee_read_registration', |
|
| 1484 | - 'edit-reg-questions-mbox', |
|
| 1485 | - $this->_registration->ID() |
|
| 1486 | - ) |
|
| 1487 | - ) { |
|
| 1488 | - $this->addMetaBox( |
|
| 1489 | - 'edit-reg-questions-mbox', |
|
| 1490 | - esc_html__('Registration Form Answers', 'event_espresso'), |
|
| 1491 | - [$this, '_reg_questions_meta_box'], |
|
| 1492 | - $this->_wp_page_slug |
|
| 1493 | - ); |
|
| 1494 | - } |
|
| 1495 | - $this->addMetaBox( |
|
| 1496 | - 'edit-reg-registrant-mbox', |
|
| 1497 | - esc_html__('Contact Details', 'event_espresso'), |
|
| 1498 | - [$this, '_reg_registrant_side_meta_box'], |
|
| 1499 | - $this->_wp_page_slug, |
|
| 1500 | - 'side' |
|
| 1501 | - ); |
|
| 1502 | - if ($this->_registration->group_size() > 1) { |
|
| 1503 | - $this->addMetaBox( |
|
| 1504 | - 'edit-reg-attendees-mbox', |
|
| 1505 | - esc_html__('Other Registrations in this Transaction', 'event_espresso'), |
|
| 1506 | - [$this, '_reg_attendees_meta_box'], |
|
| 1507 | - $this->_wp_page_slug |
|
| 1508 | - ); |
|
| 1509 | - } |
|
| 1510 | - } |
|
| 1511 | - |
|
| 1512 | - |
|
| 1513 | - /** |
|
| 1514 | - * set_reg_status_buttons_metabox |
|
| 1515 | - * |
|
| 1516 | - * @return void |
|
| 1517 | - * @throws EE_Error |
|
| 1518 | - * @throws EntityNotFoundException |
|
| 1519 | - * @throws InvalidArgumentException |
|
| 1520 | - * @throws InvalidDataTypeException |
|
| 1521 | - * @throws InvalidInterfaceException |
|
| 1522 | - * @throws ReflectionException |
|
| 1523 | - */ |
|
| 1524 | - public function set_reg_status_buttons_metabox() |
|
| 1525 | - { |
|
| 1526 | - $this->_set_registration_object(); |
|
| 1527 | - $change_reg_status_form = $this->_generate_reg_status_change_form(); |
|
| 1528 | - $output = $change_reg_status_form->form_open( |
|
| 1529 | - self::add_query_args_and_nonce( |
|
| 1530 | - [ |
|
| 1531 | - 'action' => 'change_reg_status', |
|
| 1532 | - ], |
|
| 1533 | - REG_ADMIN_URL |
|
| 1534 | - ) |
|
| 1535 | - ); |
|
| 1536 | - $output .= $change_reg_status_form->get_html(); |
|
| 1537 | - $output .= $change_reg_status_form->form_close(); |
|
| 1538 | - echo wp_kses($output, AllowedTags::getWithFormTags()); |
|
| 1539 | - } |
|
| 1540 | - |
|
| 1541 | - |
|
| 1542 | - /** |
|
| 1543 | - * @return EE_Form_Section_Proper |
|
| 1544 | - * @throws EE_Error |
|
| 1545 | - * @throws InvalidArgumentException |
|
| 1546 | - * @throws InvalidDataTypeException |
|
| 1547 | - * @throws InvalidInterfaceException |
|
| 1548 | - * @throws EntityNotFoundException |
|
| 1549 | - * @throws ReflectionException |
|
| 1550 | - */ |
|
| 1551 | - protected function _generate_reg_status_change_form() |
|
| 1552 | - { |
|
| 1553 | - $reg_status_change_form_array = [ |
|
| 1554 | - 'name' => 'reg_status_change_form', |
|
| 1555 | - 'html_id' => 'reg-status-change-form', |
|
| 1556 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
| 1557 | - 'subsections' => [ |
|
| 1558 | - 'return' => new EE_Hidden_Input( |
|
| 1559 | - [ |
|
| 1560 | - 'name' => 'return', |
|
| 1561 | - 'default' => 'view_registration', |
|
| 1562 | - ] |
|
| 1563 | - ), |
|
| 1564 | - 'REG_ID' => new EE_Hidden_Input( |
|
| 1565 | - [ |
|
| 1566 | - 'name' => 'REG_ID', |
|
| 1567 | - 'default' => $this->_registration->ID(), |
|
| 1568 | - ] |
|
| 1569 | - ), |
|
| 1570 | - ], |
|
| 1571 | - ]; |
|
| 1572 | - if ( |
|
| 1573 | - $this->capabilities->current_user_can( |
|
| 1574 | - 'ee_edit_registration', |
|
| 1575 | - 'toggle_registration_status', |
|
| 1576 | - $this->_registration->ID() |
|
| 1577 | - ) |
|
| 1578 | - ) { |
|
| 1579 | - $reg_status_change_form_array['subsections']['reg_status'] = new EE_Select_Input( |
|
| 1580 | - $this->_get_reg_statuses(), |
|
| 1581 | - [ |
|
| 1582 | - 'html_label_text' => esc_html__('Change Registration Status to', 'event_espresso'), |
|
| 1583 | - 'default' => $this->_registration->status_ID(), |
|
| 1584 | - 'html_class' => 'ee-input-width--small', |
|
| 1585 | - ] |
|
| 1586 | - ); |
|
| 1587 | - $reg_status_change_form_array['subsections']['send_notifications'] = new EE_Yes_No_Input( |
|
| 1588 | - [ |
|
| 1589 | - 'html_label_text' => esc_html__('Send Related Messages', 'event_espresso'), |
|
| 1590 | - 'default' => false, |
|
| 1591 | - 'html_help_text' => esc_html__( |
|
| 1592 | - 'If set to "Yes", then the related messages will be sent to the registrant.', |
|
| 1593 | - 'event_espresso' |
|
| 1594 | - ), |
|
| 1595 | - ] |
|
| 1596 | - ); |
|
| 1597 | - $reg_status_change_form_array['subsections']['submit'] = new EE_Submit_Input( |
|
| 1598 | - [ |
|
| 1599 | - 'html_class' => 'button--primary', |
|
| 1600 | - 'html_label_text' => ' ', |
|
| 1601 | - 'default' => esc_html__('Update Registration Status', 'event_espresso'), |
|
| 1602 | - ] |
|
| 1603 | - ); |
|
| 1604 | - } |
|
| 1605 | - return new EE_Form_Section_Proper($reg_status_change_form_array); |
|
| 1606 | - } |
|
| 1607 | - |
|
| 1608 | - |
|
| 1609 | - /** |
|
| 1610 | - * Returns an array of all the buttons for the various statuses and switch status actions |
|
| 1611 | - * |
|
| 1612 | - * @return array |
|
| 1613 | - * @throws EE_Error |
|
| 1614 | - * @throws InvalidArgumentException |
|
| 1615 | - * @throws InvalidDataTypeException |
|
| 1616 | - * @throws InvalidInterfaceException |
|
| 1617 | - * @throws EntityNotFoundException |
|
| 1618 | - * @throws ReflectionException |
|
| 1619 | - */ |
|
| 1620 | - protected function _get_reg_statuses() |
|
| 1621 | - { |
|
| 1622 | - $reg_status_array = $this->getRegistrationModel()->reg_status_array(); |
|
| 1623 | - unset($reg_status_array[ RegStatus::INCOMPLETE ]); |
|
| 1624 | - // get current reg status |
|
| 1625 | - $current_status = $this->_registration->status_ID(); |
|
| 1626 | - // is registration for free event? This will determine whether to display the pending payment option |
|
| 1627 | - if ( |
|
| 1628 | - $current_status !== RegStatus::PENDING_PAYMENT |
|
| 1629 | - && EEH_Money::compare_floats($this->_registration->ticket()->price(), 0.00) |
|
| 1630 | - ) { |
|
| 1631 | - unset($reg_status_array[ RegStatus::PENDING_PAYMENT ]); |
|
| 1632 | - } |
|
| 1633 | - return $this->getStatusModel()->localized_status($reg_status_array, false, 'sentence'); |
|
| 1634 | - } |
|
| 1635 | - |
|
| 1636 | - |
|
| 1637 | - /** |
|
| 1638 | - * This method is used when using _REG_ID from request which may or may not be an array of reg_ids. |
|
| 1639 | - * |
|
| 1640 | - * @param bool $status REG status given for changing registrations to. |
|
| 1641 | - * @param bool $notify Whether to send messages notifications or not. |
|
| 1642 | - * @return array (array with reg_id(s) updated and whether update was successful. |
|
| 1643 | - * @throws DomainException |
|
| 1644 | - * @throws EE_Error |
|
| 1645 | - * @throws EntityNotFoundException |
|
| 1646 | - * @throws InvalidArgumentException |
|
| 1647 | - * @throws InvalidDataTypeException |
|
| 1648 | - * @throws InvalidInterfaceException |
|
| 1649 | - * @throws ReflectionException |
|
| 1650 | - * @throws RuntimeException |
|
| 1651 | - */ |
|
| 1652 | - protected function _set_registration_status_from_request($status = false, $notify = false) |
|
| 1653 | - { |
|
| 1654 | - $REG_IDs = $this->request->requestParamIsSet('reg_status_change_form') |
|
| 1655 | - ? $this->request->getRequestParam('reg_status_change_form[REG_ID]', [], 'int', true) |
|
| 1656 | - : $this->request->getRequestParam('_REG_ID', [], 'int', true); |
|
| 1657 | - // sanitize $REG_IDs |
|
| 1658 | - $REG_IDs = array_map('absint', $REG_IDs); |
|
| 1659 | - // and remove empty entries |
|
| 1660 | - $REG_IDs = array_filter($REG_IDs); |
|
| 1661 | - |
|
| 1662 | - $result = $this->_set_registration_status($REG_IDs, $status, $notify); |
|
| 1663 | - |
|
| 1664 | - /** |
|
| 1665 | - * Set and filter $_req_data['_REG_ID'] for any potential future messages notifications. |
|
| 1666 | - * Currently this value is used downstream by the _process_resend_registration method. |
|
| 1667 | - * |
|
| 1668 | - * @param int|array $registration_ids The registration ids that have had their status changed successfully. |
|
| 1669 | - * @param bool $status The status registrations were changed to. |
|
| 1670 | - * @param bool $success If the status was changed successfully for all registrations. |
|
| 1671 | - * @param Registrations_Admin_Page $admin_page |
|
| 1672 | - */ |
|
| 1673 | - $REG_ID = apply_filters( |
|
| 1674 | - 'FHEE__Registrations_Admin_Page___set_registration_status_from_request__REG_IDs', |
|
| 1675 | - $result['REG_ID'], |
|
| 1676 | - $status, |
|
| 1677 | - $result['success'], |
|
| 1678 | - $this |
|
| 1679 | - ); |
|
| 1680 | - $this->request->setRequestParam('_REG_ID', $REG_ID); |
|
| 1681 | - |
|
| 1682 | - // notify? |
|
| 1683 | - if ( |
|
| 1684 | - $notify |
|
| 1685 | - && $result['success'] |
|
| 1686 | - && ! empty($REG_ID) |
|
| 1687 | - && $this->capabilities->current_user_can( |
|
| 1688 | - 'ee_send_message', |
|
| 1689 | - 'espresso_registrations_resend_registration' |
|
| 1690 | - ) |
|
| 1691 | - ) { |
|
| 1692 | - $this->_process_resend_registration(); |
|
| 1693 | - } |
|
| 1694 | - return $result; |
|
| 1695 | - } |
|
| 1696 | - |
|
| 1697 | - |
|
| 1698 | - /** |
|
| 1699 | - * Set the registration status for the given reg_id (which may or may not be an array, it gets typecast to an |
|
| 1700 | - * array). Note, this method does NOT take care of possible notifications. That is required by calling code. |
|
| 1701 | - * |
|
| 1702 | - * @param array $REG_IDs |
|
| 1703 | - * @param string $status |
|
| 1704 | - * @param bool $notify Used to indicate whether notification was requested or not. This determines the context |
|
| 1705 | - * slug sent with setting the registration status. |
|
| 1706 | - * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as |
|
| 1707 | - * @throws EE_Error |
|
| 1708 | - * @throws InvalidArgumentException |
|
| 1709 | - * @throws InvalidDataTypeException |
|
| 1710 | - * @throws InvalidInterfaceException |
|
| 1711 | - * @throws ReflectionException |
|
| 1712 | - * @throws RuntimeException |
|
| 1713 | - * @throws EntityNotFoundException |
|
| 1714 | - * @throws DomainException |
|
| 1715 | - */ |
|
| 1716 | - protected function _set_registration_status($REG_IDs = [], $status = '', $notify = false) |
|
| 1717 | - { |
|
| 1718 | - $success = false; |
|
| 1719 | - // typecast $REG_IDs |
|
| 1720 | - $REG_IDs = (array) $REG_IDs; |
|
| 1721 | - if (! empty($REG_IDs)) { |
|
| 1722 | - $success = true; |
|
| 1723 | - // set default status if none is passed |
|
| 1724 | - $status = $status ?: RegStatus::PENDING_PAYMENT; |
|
| 1725 | - $status_context = $notify |
|
| 1726 | - ? Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY |
|
| 1727 | - : Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN; |
|
| 1728 | - // loop through REG_ID's and change status |
|
| 1729 | - foreach ($REG_IDs as $REG_ID) { |
|
| 1730 | - $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID); |
|
| 1731 | - if ($registration instanceof EE_Registration) { |
|
| 1732 | - $registration->set_status( |
|
| 1733 | - $status, |
|
| 1734 | - false, |
|
| 1735 | - new Context( |
|
| 1736 | - $status_context, |
|
| 1737 | - esc_html__( |
|
| 1738 | - 'Manually triggered status change on a Registration Admin Page route.', |
|
| 1739 | - 'event_espresso' |
|
| 1740 | - ) |
|
| 1741 | - ) |
|
| 1742 | - ); |
|
| 1743 | - $result = $registration->save(); |
|
| 1744 | - // verifying explicit fails because update *may* just return 0 for 0 rows affected |
|
| 1745 | - $success = $result !== false ? $success : false; |
|
| 1746 | - } |
|
| 1747 | - } |
|
| 1748 | - } |
|
| 1749 | - |
|
| 1750 | - // return $success and processed registrations |
|
| 1751 | - return ['REG_ID' => $REG_IDs, 'success' => $success]; |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - |
|
| 1755 | - /** |
|
| 1756 | - * Common logic for setting up success message and redirecting to appropriate route |
|
| 1757 | - * |
|
| 1758 | - * @param string $STS_ID status id for the registration changed to |
|
| 1759 | - * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
|
| 1760 | - * @return void |
|
| 1761 | - * @throws DomainException |
|
| 1762 | - * @throws EE_Error |
|
| 1763 | - * @throws EntityNotFoundException |
|
| 1764 | - * @throws InvalidArgumentException |
|
| 1765 | - * @throws InvalidDataTypeException |
|
| 1766 | - * @throws InvalidInterfaceException |
|
| 1767 | - * @throws ReflectionException |
|
| 1768 | - * @throws RuntimeException |
|
| 1769 | - */ |
|
| 1770 | - protected function _reg_status_change_return($STS_ID, $notify = false) |
|
| 1771 | - { |
|
| 1772 | - $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) |
|
| 1773 | - : ['success' => false]; |
|
| 1774 | - $success = isset($result['success']) && $result['success']; |
|
| 1775 | - // setup success message |
|
| 1776 | - if ($success) { |
|
| 1777 | - if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) { |
|
| 1778 | - $msg = sprintf( |
|
| 1779 | - esc_html__('Registration status has been set to %s', 'event_espresso'), |
|
| 1780 | - EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
| 1781 | - ); |
|
| 1782 | - } else { |
|
| 1783 | - $msg = sprintf( |
|
| 1784 | - esc_html__('Registrations have been set to %s.', 'event_espresso'), |
|
| 1785 | - EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
| 1786 | - ); |
|
| 1787 | - } |
|
| 1788 | - EE_Error::add_success($msg); |
|
| 1789 | - } else { |
|
| 1790 | - EE_Error::add_error( |
|
| 1791 | - esc_html__( |
|
| 1792 | - 'Something went wrong, and the status was not changed', |
|
| 1793 | - 'event_espresso' |
|
| 1794 | - ), |
|
| 1795 | - __FILE__, |
|
| 1796 | - __LINE__, |
|
| 1797 | - __FUNCTION__ |
|
| 1798 | - ); |
|
| 1799 | - } |
|
| 1800 | - $return = $this->request->getRequestParam('return'); |
|
| 1801 | - $route = $return === 'view_registration' |
|
| 1802 | - ? ['action' => 'view_registration', '_REG_ID' => reset($result['REG_ID'])] |
|
| 1803 | - : ['action' => 'default']; |
|
| 1804 | - $route = $this->mergeExistingRequestParamsWithRedirectArgs($route); |
|
| 1805 | - $this->_redirect_after_action($success, '', '', $route, true); |
|
| 1806 | - } |
|
| 1807 | - |
|
| 1808 | - |
|
| 1809 | - /** |
|
| 1810 | - * incoming reg status change from reg details page. |
|
| 1811 | - * |
|
| 1812 | - * @return void |
|
| 1813 | - * @throws EE_Error |
|
| 1814 | - * @throws EntityNotFoundException |
|
| 1815 | - * @throws InvalidArgumentException |
|
| 1816 | - * @throws InvalidDataTypeException |
|
| 1817 | - * @throws InvalidInterfaceException |
|
| 1818 | - * @throws ReflectionException |
|
| 1819 | - * @throws RuntimeException |
|
| 1820 | - * @throws DomainException |
|
| 1821 | - */ |
|
| 1822 | - protected function _change_reg_status() |
|
| 1823 | - { |
|
| 1824 | - $this->request->setRequestParam('return', 'view_registration'); |
|
| 1825 | - // set notify based on whether the send notifications toggle is set or not |
|
| 1826 | - $notify = $this->request->getRequestParam('reg_status_change_form[send_notifications]', false, 'bool'); |
|
| 1827 | - $reg_status = $this->request->getRequestParam('reg_status_change_form[reg_status]', ''); |
|
| 1828 | - $this->request->setRequestParam('reg_status_change_form[reg_status]', $reg_status); |
|
| 1829 | - switch ($reg_status) { |
|
| 1830 | - case RegStatus::APPROVED: |
|
| 1831 | - case EEH_Template::pretty_status(RegStatus::APPROVED, false, 'sentence'): |
|
| 1832 | - $this->approve_registration($notify); |
|
| 1833 | - break; |
|
| 1834 | - case RegStatus::PENDING_PAYMENT: |
|
| 1835 | - case EEH_Template::pretty_status(RegStatus::PENDING_PAYMENT, false, 'sentence'): |
|
| 1836 | - $this->pending_registration($notify); |
|
| 1837 | - break; |
|
| 1838 | - case RegStatus::AWAITING_REVIEW: |
|
| 1839 | - case EEH_Template::pretty_status(RegStatus::AWAITING_REVIEW, false, 'sentence'): |
|
| 1840 | - $this->not_approve_registration($notify); |
|
| 1841 | - break; |
|
| 1842 | - case RegStatus::DECLINED: |
|
| 1843 | - case EEH_Template::pretty_status(RegStatus::DECLINED, false, 'sentence'): |
|
| 1844 | - $this->decline_registration($notify); |
|
| 1845 | - break; |
|
| 1846 | - case RegStatus::CANCELLED: |
|
| 1847 | - case EEH_Template::pretty_status(RegStatus::CANCELLED, false, 'sentence'): |
|
| 1848 | - $this->cancel_registration($notify); |
|
| 1849 | - break; |
|
| 1850 | - case RegStatus::WAIT_LIST: |
|
| 1851 | - case EEH_Template::pretty_status(RegStatus::WAIT_LIST, false, 'sentence'): |
|
| 1852 | - $this->wait_list_registration($notify); |
|
| 1853 | - break; |
|
| 1854 | - case RegStatus::INCOMPLETE: |
|
| 1855 | - default: |
|
| 1856 | - $this->request->unSetRequestParam('return'); |
|
| 1857 | - $this->_reg_status_change_return(''); |
|
| 1858 | - break; |
|
| 1859 | - } |
|
| 1860 | - } |
|
| 1861 | - |
|
| 1862 | - |
|
| 1863 | - /** |
|
| 1864 | - * Callback for bulk action routes. |
|
| 1865 | - * Note: although we could just register the singular route callbacks for each bulk action route as well, this |
|
| 1866 | - * method was chosen so there is one central place all the registration status bulk actions are going through. |
|
| 1867 | - * Potentially, this provides an easier place to locate logic that is specific to these bulk actions (as opposed to |
|
| 1868 | - * when an action is happening on just a single registration). |
|
| 1869 | - * |
|
| 1870 | - * @param $action |
|
| 1871 | - * @param bool $notify |
|
| 1872 | - */ |
|
| 1873 | - protected function bulk_action_on_registrations($action, $notify = false) |
|
| 1874 | - { |
|
| 1875 | - do_action( |
|
| 1876 | - 'AHEE__Registrations_Admin_Page__bulk_action_on_registrations__before_execution', |
|
| 1877 | - $this, |
|
| 1878 | - $action, |
|
| 1879 | - $notify |
|
| 1880 | - ); |
|
| 1881 | - $method = $action . '_registration'; |
|
| 1882 | - if (method_exists($this, $method)) { |
|
| 1883 | - $this->$method($notify); |
|
| 1884 | - } |
|
| 1885 | - } |
|
| 1886 | - |
|
| 1887 | - |
|
| 1888 | - /** |
|
| 1889 | - * approve_registration |
|
| 1890 | - * |
|
| 1891 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
| 1892 | - * @return void |
|
| 1893 | - * @throws EE_Error |
|
| 1894 | - * @throws EntityNotFoundException |
|
| 1895 | - * @throws InvalidArgumentException |
|
| 1896 | - * @throws InvalidDataTypeException |
|
| 1897 | - * @throws InvalidInterfaceException |
|
| 1898 | - * @throws ReflectionException |
|
| 1899 | - * @throws RuntimeException |
|
| 1900 | - * @throws DomainException |
|
| 1901 | - */ |
|
| 1902 | - protected function approve_registration($notify = false) |
|
| 1903 | - { |
|
| 1904 | - $this->_reg_status_change_return(RegStatus::APPROVED, $notify); |
|
| 1905 | - } |
|
| 1906 | - |
|
| 1907 | - |
|
| 1908 | - /** |
|
| 1909 | - * decline_registration |
|
| 1910 | - * |
|
| 1911 | - * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1912 | - * @return void |
|
| 1913 | - * @throws EE_Error |
|
| 1914 | - * @throws EntityNotFoundException |
|
| 1915 | - * @throws InvalidArgumentException |
|
| 1916 | - * @throws InvalidDataTypeException |
|
| 1917 | - * @throws InvalidInterfaceException |
|
| 1918 | - * @throws ReflectionException |
|
| 1919 | - * @throws RuntimeException |
|
| 1920 | - * @throws DomainException |
|
| 1921 | - */ |
|
| 1922 | - protected function decline_registration($notify = false) |
|
| 1923 | - { |
|
| 1924 | - $this->_reg_status_change_return(RegStatus::DECLINED, $notify); |
|
| 1925 | - } |
|
| 1926 | - |
|
| 1927 | - |
|
| 1928 | - /** |
|
| 1929 | - * cancel_registration |
|
| 1930 | - * |
|
| 1931 | - * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1932 | - * @return void |
|
| 1933 | - * @throws EE_Error |
|
| 1934 | - * @throws EntityNotFoundException |
|
| 1935 | - * @throws InvalidArgumentException |
|
| 1936 | - * @throws InvalidDataTypeException |
|
| 1937 | - * @throws InvalidInterfaceException |
|
| 1938 | - * @throws ReflectionException |
|
| 1939 | - * @throws RuntimeException |
|
| 1940 | - * @throws DomainException |
|
| 1941 | - */ |
|
| 1942 | - protected function cancel_registration($notify = false) |
|
| 1943 | - { |
|
| 1944 | - $this->_reg_status_change_return(RegStatus::CANCELLED, $notify); |
|
| 1945 | - } |
|
| 1946 | - |
|
| 1947 | - |
|
| 1948 | - /** |
|
| 1949 | - * not_approve_registration |
|
| 1950 | - * |
|
| 1951 | - * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1952 | - * @return void |
|
| 1953 | - * @throws EE_Error |
|
| 1954 | - * @throws EntityNotFoundException |
|
| 1955 | - * @throws InvalidArgumentException |
|
| 1956 | - * @throws InvalidDataTypeException |
|
| 1957 | - * @throws InvalidInterfaceException |
|
| 1958 | - * @throws ReflectionException |
|
| 1959 | - * @throws RuntimeException |
|
| 1960 | - * @throws DomainException |
|
| 1961 | - */ |
|
| 1962 | - protected function not_approve_registration($notify = false) |
|
| 1963 | - { |
|
| 1964 | - $this->_reg_status_change_return(RegStatus::AWAITING_REVIEW, $notify); |
|
| 1965 | - } |
|
| 1966 | - |
|
| 1967 | - |
|
| 1968 | - /** |
|
| 1969 | - * decline_registration |
|
| 1970 | - * |
|
| 1971 | - * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1972 | - * @return void |
|
| 1973 | - * @throws EE_Error |
|
| 1974 | - * @throws EntityNotFoundException |
|
| 1975 | - * @throws InvalidArgumentException |
|
| 1976 | - * @throws InvalidDataTypeException |
|
| 1977 | - * @throws InvalidInterfaceException |
|
| 1978 | - * @throws ReflectionException |
|
| 1979 | - * @throws RuntimeException |
|
| 1980 | - * @throws DomainException |
|
| 1981 | - */ |
|
| 1982 | - protected function pending_registration($notify = false) |
|
| 1983 | - { |
|
| 1984 | - $this->_reg_status_change_return(RegStatus::PENDING_PAYMENT, $notify); |
|
| 1985 | - } |
|
| 1986 | - |
|
| 1987 | - |
|
| 1988 | - /** |
|
| 1989 | - * waitlist_registration |
|
| 1990 | - * |
|
| 1991 | - * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1992 | - * @return void |
|
| 1993 | - * @throws EE_Error |
|
| 1994 | - * @throws EntityNotFoundException |
|
| 1995 | - * @throws InvalidArgumentException |
|
| 1996 | - * @throws InvalidDataTypeException |
|
| 1997 | - * @throws InvalidInterfaceException |
|
| 1998 | - * @throws ReflectionException |
|
| 1999 | - * @throws RuntimeException |
|
| 2000 | - * @throws DomainException |
|
| 2001 | - */ |
|
| 2002 | - protected function wait_list_registration($notify = false) |
|
| 2003 | - { |
|
| 2004 | - $this->_reg_status_change_return(RegStatus::WAIT_LIST, $notify); |
|
| 2005 | - } |
|
| 2006 | - |
|
| 2007 | - |
|
| 2008 | - /** |
|
| 2009 | - * generates HTML for the Registration main meta box |
|
| 2010 | - * |
|
| 2011 | - * @return void |
|
| 2012 | - * @throws DomainException |
|
| 2013 | - * @throws EE_Error |
|
| 2014 | - * @throws InvalidArgumentException |
|
| 2015 | - * @throws InvalidDataTypeException |
|
| 2016 | - * @throws InvalidInterfaceException |
|
| 2017 | - * @throws ReflectionException |
|
| 2018 | - * @throws EntityNotFoundException |
|
| 2019 | - */ |
|
| 2020 | - public function _reg_details_meta_box() |
|
| 2021 | - { |
|
| 2022 | - EEH_Autoloader::register_line_item_display_autoloaders(); |
|
| 2023 | - EEH_Autoloader::register_line_item_filter_autoloaders(); |
|
| 2024 | - EE_Registry::instance()->load_helper('Line_Item'); |
|
| 2025 | - $transaction = $this->_registration->transaction() |
|
| 2026 | - ? $this->_registration->transaction() |
|
| 2027 | - : EE_Transaction::new_instance(); |
|
| 2028 | - $this->session_data = $transaction->session_data(); |
|
| 2029 | - $filters = new EE_Line_Item_Filter_Collection(); |
|
| 2030 | - $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
| 2031 | - $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
| 2032 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
|
| 2033 | - $filters, |
|
| 2034 | - $transaction->total_line_item() |
|
| 2035 | - ); |
|
| 2036 | - $filtered_line_item_tree = $line_item_filter_processor->process(); |
|
| 2037 | - $line_item_display = new EE_Line_Item_Display( |
|
| 2038 | - 'reg_admin_table', |
|
| 2039 | - 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' |
|
| 2040 | - ); |
|
| 2041 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( |
|
| 2042 | - $filtered_line_item_tree, |
|
| 2043 | - ['EE_Registration' => $this->_registration] |
|
| 2044 | - ); |
|
| 2045 | - $attendee = $this->_registration->attendee(); |
|
| 2046 | - if ( |
|
| 2047 | - $this->capabilities->current_user_can( |
|
| 2048 | - 'ee_read_transaction', |
|
| 2049 | - 'espresso_transactions_view_transaction' |
|
| 2050 | - ) |
|
| 2051 | - ) { |
|
| 2052 | - $this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link( |
|
| 2053 | - EE_Admin_Page::add_query_args_and_nonce( |
|
| 2054 | - [ |
|
| 2055 | - 'action' => 'view_transaction', |
|
| 2056 | - 'TXN_ID' => $transaction->ID(), |
|
| 2057 | - ], |
|
| 2058 | - TXN_ADMIN_URL |
|
| 2059 | - ), |
|
| 2060 | - esc_html__(' View Transaction', 'event_espresso'), |
|
| 2061 | - 'button button--secondary right', |
|
| 2062 | - 'dashicons dashicons-cart' |
|
| 2063 | - ); |
|
| 2064 | - } else { |
|
| 2065 | - $this->_template_args['view_transaction_button'] = ''; |
|
| 2066 | - } |
|
| 2067 | - if ( |
|
| 2068 | - $attendee instanceof EE_Attendee |
|
| 2069 | - && $this->capabilities->current_user_can( |
|
| 2070 | - 'ee_send_message', |
|
| 2071 | - 'espresso_registrations_resend_registration' |
|
| 2072 | - ) |
|
| 2073 | - ) { |
|
| 2074 | - $this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link( |
|
| 2075 | - EE_Admin_Page::add_query_args_and_nonce( |
|
| 2076 | - [ |
|
| 2077 | - 'action' => 'resend_registration', |
|
| 2078 | - '_REG_ID' => $this->_registration->ID(), |
|
| 2079 | - 'redirect_to' => 'view_registration', |
|
| 2080 | - ], |
|
| 2081 | - REG_ADMIN_URL |
|
| 2082 | - ), |
|
| 2083 | - esc_html__(' Resend Registration', 'event_espresso'), |
|
| 2084 | - 'button button--secondary right', |
|
| 2085 | - 'dashicons dashicons-email-alt' |
|
| 2086 | - ); |
|
| 2087 | - } else { |
|
| 2088 | - $this->_template_args['resend_registration_button'] = ''; |
|
| 2089 | - } |
|
| 2090 | - $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
|
| 2091 | - $payment = $transaction->get_first_related('Payment'); |
|
| 2092 | - $payment = ! $payment instanceof EE_Payment |
|
| 2093 | - ? EE_Payment::new_instance() |
|
| 2094 | - : $payment; |
|
| 2095 | - $payment_method = $payment->get_first_related('Payment_Method'); |
|
| 2096 | - $payment_method = ! $payment_method instanceof EE_Payment_Method |
|
| 2097 | - ? EE_Payment_Method::new_instance() |
|
| 2098 | - : $payment_method; |
|
| 2099 | - $reg_details = [ |
|
| 2100 | - 'payment_method' => $payment_method->name(), |
|
| 2101 | - 'response_msg' => $payment->gateway_response(), |
|
| 2102 | - 'registration_id' => $this->_registration->get('REG_code'), |
|
| 2103 | - 'registration_session' => $this->_registration->session_ID(), |
|
| 2104 | - 'ip_address' => $this->session_data['ip_address'] ?? '', |
|
| 2105 | - 'user_agent' => $this->session_data['user_agent'] ?? '', |
|
| 2106 | - ]; |
|
| 2107 | - if (isset($reg_details['registration_id'])) { |
|
| 2108 | - $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
|
| 2109 | - $this->_template_args['reg_details']['registration_id']['label'] = esc_html__( |
|
| 2110 | - 'Registration ID', |
|
| 2111 | - 'event_espresso' |
|
| 2112 | - ); |
|
| 2113 | - $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
|
| 2114 | - } |
|
| 2115 | - if (isset($reg_details['payment_method'])) { |
|
| 2116 | - $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
|
| 2117 | - $this->_template_args['reg_details']['payment_method']['label'] = esc_html__( |
|
| 2118 | - 'Most Recent Payment Method', |
|
| 2119 | - 'event_espresso' |
|
| 2120 | - ); |
|
| 2121 | - $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
|
| 2122 | - $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
|
| 2123 | - $this->_template_args['reg_details']['response_msg']['label'] = esc_html__( |
|
| 2124 | - 'Payment method response', |
|
| 2125 | - 'event_espresso' |
|
| 2126 | - ); |
|
| 2127 | - $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
|
| 2128 | - } |
|
| 2129 | - $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
|
| 2130 | - $this->_template_args['reg_details']['registration_session']['label'] = esc_html__( |
|
| 2131 | - 'Registration Session', |
|
| 2132 | - 'event_espresso' |
|
| 2133 | - ); |
|
| 2134 | - $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
|
| 2135 | - $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
|
| 2136 | - $this->_template_args['reg_details']['ip_address']['label'] = esc_html__( |
|
| 2137 | - 'Registration placed from IP', |
|
| 2138 | - 'event_espresso' |
|
| 2139 | - ); |
|
| 2140 | - $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
|
| 2141 | - $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
|
| 2142 | - $this->_template_args['reg_details']['user_agent']['label'] = esc_html__( |
|
| 2143 | - 'Registrant User Agent', |
|
| 2144 | - 'event_espresso' |
|
| 2145 | - ); |
|
| 2146 | - $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
|
| 2147 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 2148 | - [ |
|
| 2149 | - 'action' => 'default', |
|
| 2150 | - 'event_id' => $this->_registration->event_ID(), |
|
| 2151 | - ], |
|
| 2152 | - REG_ADMIN_URL |
|
| 2153 | - ); |
|
| 2154 | - |
|
| 2155 | - $this->_template_args['REG_ID'] = $this->_registration->ID(); |
|
| 2156 | - $this->_template_args['event_id'] = $this->_registration->event_ID(); |
|
| 2157 | - |
|
| 2158 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
| 2159 | - EEH_Template::display_template($template_path, $this->_template_args); // already escaped |
|
| 2160 | - } |
|
| 2161 | - |
|
| 2162 | - |
|
| 2163 | - /** |
|
| 2164 | - * generates HTML for the Registration Questions meta box. |
|
| 2165 | - * If pre-4.8.32.rc.000 hooks are used, uses old methods (with its filters), |
|
| 2166 | - * otherwise uses new forms system |
|
| 2167 | - * |
|
| 2168 | - * @return void |
|
| 2169 | - * @throws DomainException |
|
| 2170 | - * @throws EE_Error |
|
| 2171 | - * @throws InvalidArgumentException |
|
| 2172 | - * @throws InvalidDataTypeException |
|
| 2173 | - * @throws InvalidInterfaceException |
|
| 2174 | - * @throws ReflectionException |
|
| 2175 | - */ |
|
| 2176 | - public function _reg_questions_meta_box() |
|
| 2177 | - { |
|
| 2178 | - // allow someone to override this method entirely |
|
| 2179 | - if ( |
|
| 2180 | - apply_filters( |
|
| 2181 | - 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', |
|
| 2182 | - true, |
|
| 2183 | - $this, |
|
| 2184 | - $this->_registration |
|
| 2185 | - ) |
|
| 2186 | - ) { |
|
| 2187 | - $form = $this->_get_reg_custom_questions_form( |
|
| 2188 | - $this->_registration->ID() |
|
| 2189 | - ); |
|
| 2190 | - |
|
| 2191 | - $this->_template_args['att_questions'] = count($form->subforms()) > 0 |
|
| 2192 | - ? $form->get_html_and_js() |
|
| 2193 | - : ''; |
|
| 2194 | - |
|
| 2195 | - $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
|
| 2196 | - $this->_template_args['REG_ID'] = $this->_registration->ID(); |
|
| 2197 | - $template_path = |
|
| 2198 | - REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
| 2199 | - EEH_Template::display_template($template_path, $this->_template_args); |
|
| 2200 | - } |
|
| 2201 | - } |
|
| 2202 | - |
|
| 2203 | - |
|
| 2204 | - /** |
|
| 2205 | - * form_before_question_group |
|
| 2206 | - * |
|
| 2207 | - * @param string $output |
|
| 2208 | - * @return string |
|
| 2209 | - * @deprecated as of 4.8.32.rc.000 |
|
| 2210 | - */ |
|
| 2211 | - public function form_before_question_group($output) |
|
| 2212 | - { |
|
| 2213 | - EE_Error::doing_it_wrong( |
|
| 2214 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 2215 | - esc_html__( |
|
| 2216 | - 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2217 | - 'event_espresso' |
|
| 2218 | - ), |
|
| 2219 | - '4.8.32.rc.000' |
|
| 2220 | - ); |
|
| 2221 | - return ' |
|
| 27 | + /** |
|
| 28 | + * @var EE_Registration |
|
| 29 | + */ |
|
| 30 | + private $_registration; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var EE_Event |
|
| 34 | + */ |
|
| 35 | + private $_reg_event; |
|
| 36 | + |
|
| 37 | + private array $session_data = []; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var array |
|
| 41 | + */ |
|
| 42 | + private static $_reg_status; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Form for displaying the custom questions for this registration. |
|
| 46 | + * This gets used a few times throughout the request so its best to cache it |
|
| 47 | + * |
|
| 48 | + * @var EE_Registration_Custom_Questions_Form |
|
| 49 | + */ |
|
| 50 | + protected $_reg_custom_questions_form; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @var EEM_Registration $registration_model |
|
| 54 | + */ |
|
| 55 | + private $registration_model; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @var EEM_Attendee $attendee_model |
|
| 59 | + */ |
|
| 60 | + private $attendee_model; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @var EEM_Event $event_model |
|
| 64 | + */ |
|
| 65 | + private $event_model; |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @var EEM_Status $status_model |
|
| 69 | + */ |
|
| 70 | + private $status_model; |
|
| 71 | + |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @param bool $routing |
|
| 75 | + * @throws InvalidArgumentException |
|
| 76 | + * @throws InvalidDataTypeException |
|
| 77 | + * @throws InvalidInterfaceException |
|
| 78 | + * @throws ReflectionException |
|
| 79 | + */ |
|
| 80 | + public function __construct($routing = true) |
|
| 81 | + { |
|
| 82 | + parent::__construct($routing); |
|
| 83 | + $this->cpt_editpost_route = 'edit_attendee'; |
|
| 84 | + add_action('wp_loaded', [$this, 'wp_loaded']); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @return EEM_Registration |
|
| 90 | + * @throws InvalidArgumentException |
|
| 91 | + * @throws InvalidDataTypeException |
|
| 92 | + * @throws InvalidInterfaceException |
|
| 93 | + * @since 4.10.2.p |
|
| 94 | + */ |
|
| 95 | + protected function getRegistrationModel() |
|
| 96 | + { |
|
| 97 | + if (! $this->registration_model instanceof EEM_Registration) { |
|
| 98 | + $this->registration_model = $this->loader->getShared('EEM_Registration'); |
|
| 99 | + } |
|
| 100 | + return $this->registration_model; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @return EEM_Attendee |
|
| 106 | + * @throws InvalidArgumentException |
|
| 107 | + * @throws InvalidDataTypeException |
|
| 108 | + * @throws InvalidInterfaceException |
|
| 109 | + * @since 4.10.2.p |
|
| 110 | + */ |
|
| 111 | + protected function getAttendeeModel() |
|
| 112 | + { |
|
| 113 | + if (! $this->attendee_model instanceof EEM_Attendee) { |
|
| 114 | + $this->attendee_model = $this->loader->getShared('EEM_Attendee'); |
|
| 115 | + } |
|
| 116 | + return $this->attendee_model; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @return EEM_Event |
|
| 122 | + * @throws InvalidArgumentException |
|
| 123 | + * @throws InvalidDataTypeException |
|
| 124 | + * @throws InvalidInterfaceException |
|
| 125 | + * @since 4.10.2.p |
|
| 126 | + */ |
|
| 127 | + protected function getEventModel() |
|
| 128 | + { |
|
| 129 | + if (! $this->event_model instanceof EEM_Event) { |
|
| 130 | + $this->event_model = $this->loader->getShared('EEM_Event'); |
|
| 131 | + } |
|
| 132 | + return $this->event_model; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @return EEM_Status |
|
| 138 | + * @throws InvalidArgumentException |
|
| 139 | + * @throws InvalidDataTypeException |
|
| 140 | + * @throws InvalidInterfaceException |
|
| 141 | + * @since 4.10.2.p |
|
| 142 | + */ |
|
| 143 | + protected function getStatusModel() |
|
| 144 | + { |
|
| 145 | + if (! $this->status_model instanceof EEM_Status) { |
|
| 146 | + $this->status_model = $this->loader->getShared('EEM_Status'); |
|
| 147 | + } |
|
| 148 | + return $this->status_model; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + public function wp_loaded() |
|
| 153 | + { |
|
| 154 | + // when adding a new registration... |
|
| 155 | + $action = $this->request->getRequestParam('action'); |
|
| 156 | + if ($action === 'new_registration') { |
|
| 157 | + EE_System::do_not_cache(); |
|
| 158 | + if ($this->request->getRequestParam('processing_registration', 0, 'int') !== 1) { |
|
| 159 | + // and it's NOT the attendee information reg step |
|
| 160 | + // force cookie expiration by setting time to last week |
|
| 161 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
| 162 | + // and update the global |
|
| 163 | + $_COOKIE['ee_registration_added'] = 0; |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + protected function _init_page_props() |
|
| 170 | + { |
|
| 171 | + $this->page_slug = REG_PG_SLUG; |
|
| 172 | + $this->_admin_base_url = REG_ADMIN_URL; |
|
| 173 | + $this->_admin_base_path = REG_ADMIN; |
|
| 174 | + $this->page_label = esc_html__('Registrations', 'event_espresso'); |
|
| 175 | + $this->_cpt_routes = [ |
|
| 176 | + 'add_new_attendee' => 'espresso_attendees', |
|
| 177 | + 'edit_attendee' => 'espresso_attendees', |
|
| 178 | + 'insert_attendee' => 'espresso_attendees', |
|
| 179 | + 'update_attendee' => 'espresso_attendees', |
|
| 180 | + ]; |
|
| 181 | + $this->_cpt_model_names = [ |
|
| 182 | + 'add_new_attendee' => 'EEM_Attendee', |
|
| 183 | + 'edit_attendee' => 'EEM_Attendee', |
|
| 184 | + ]; |
|
| 185 | + $this->_cpt_edit_routes = [ |
|
| 186 | + 'espresso_attendees' => 'edit_attendee', |
|
| 187 | + ]; |
|
| 188 | + $this->_pagenow_map = [ |
|
| 189 | + 'add_new_attendee' => 'post-new.php', |
|
| 190 | + 'edit_attendee' => 'post.php', |
|
| 191 | + 'trash' => 'post.php', |
|
| 192 | + ]; |
|
| 193 | + add_action('edit_form_after_title', [$this, 'after_title_form_fields'], 10); |
|
| 194 | + // add filters so that the comment urls don't take users to a confusing 404 page |
|
| 195 | + add_filter('get_comment_link', [$this, 'clear_comment_link'], 10, 2); |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * @param string $link The comment permalink with '#comment-$id' appended. |
|
| 201 | + * @param WP_Comment $comment The current comment object. |
|
| 202 | + * @return string |
|
| 203 | + */ |
|
| 204 | + public function clear_comment_link($link, WP_Comment $comment) |
|
| 205 | + { |
|
| 206 | + // gotta make sure this only happens on this route |
|
| 207 | + $post_type = get_post_type($comment->comment_post_ID); |
|
| 208 | + if ($post_type === EspressoPostType::ATTENDEES) { |
|
| 209 | + return '#commentsdiv'; |
|
| 210 | + } |
|
| 211 | + return $link; |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + |
|
| 215 | + protected function _ajax_hooks() |
|
| 216 | + { |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + |
|
| 220 | + protected function _define_page_props() |
|
| 221 | + { |
|
| 222 | + $this->_admin_page_title = $this->page_label; |
|
| 223 | + $this->_labels = [ |
|
| 224 | + 'buttons' => [ |
|
| 225 | + 'add-registrant' => esc_html__('Add New Registration', 'event_espresso'), |
|
| 226 | + 'add-attendee' => esc_html__('Add Contact', 'event_espresso'), |
|
| 227 | + 'edit' => esc_html__('Edit Contact', 'event_espresso'), |
|
| 228 | + 'csv_reg_report' => esc_html__('Registrations CSV Report', 'event_espresso'), |
|
| 229 | + 'contact_list_report' => esc_html__('Contact List Report', 'event_espresso'), |
|
| 230 | + 'contact_list_export' => esc_html__('Export Data', 'event_espresso'), |
|
| 231 | + ], |
|
| 232 | + 'publishbox' => [ |
|
| 233 | + 'add_new_attendee' => esc_html__('Add Contact Record', 'event_espresso'), |
|
| 234 | + 'edit_attendee' => esc_html__('Update Contact Record', 'event_espresso'), |
|
| 235 | + ], |
|
| 236 | + 'hide_add_button_on_cpt_route' => [ |
|
| 237 | + 'edit_attendee' => true, |
|
| 238 | + ], |
|
| 239 | + ]; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * grab url requests and route them |
|
| 245 | + * |
|
| 246 | + * @return void |
|
| 247 | + * @throws EE_Error |
|
| 248 | + */ |
|
| 249 | + public function _set_page_routes() |
|
| 250 | + { |
|
| 251 | + $this->_get_registration_status_array(); |
|
| 252 | + $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 253 | + $REG_ID = $this->request->getRequestParam('reg_status_change_form[REG_ID]', $REG_ID, 'int'); |
|
| 254 | + $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int'); |
|
| 255 | + $ATT_ID = $this->request->getRequestParam('post', $ATT_ID, 'int'); |
|
| 256 | + $this->_page_routes = [ |
|
| 257 | + 'default' => [ |
|
| 258 | + 'func' => [$this, '_registrations_overview_list_table'], |
|
| 259 | + 'capability' => 'ee_read_registrations', |
|
| 260 | + ], |
|
| 261 | + 'view_registration' => [ |
|
| 262 | + 'func' => [$this, '_registration_details'], |
|
| 263 | + 'capability' => 'ee_read_registration', |
|
| 264 | + 'obj_id' => $REG_ID, |
|
| 265 | + ], |
|
| 266 | + 'edit_registration' => [ |
|
| 267 | + 'func' => '_update_attendee_registration_form', |
|
| 268 | + 'noheader' => true, |
|
| 269 | + 'headers_sent_route' => 'view_registration', |
|
| 270 | + 'capability' => 'ee_edit_registration', |
|
| 271 | + 'obj_id' => $REG_ID, |
|
| 272 | + '_REG_ID' => $REG_ID, |
|
| 273 | + ], |
|
| 274 | + 'trash_registrations' => [ |
|
| 275 | + 'func' => '_trash_or_restore_registrations', |
|
| 276 | + 'args' => ['trash' => true], |
|
| 277 | + 'noheader' => true, |
|
| 278 | + 'capability' => 'ee_delete_registrations', |
|
| 279 | + ], |
|
| 280 | + 'restore_registrations' => [ |
|
| 281 | + 'func' => '_trash_or_restore_registrations', |
|
| 282 | + 'args' => ['trash' => false], |
|
| 283 | + 'noheader' => true, |
|
| 284 | + 'capability' => 'ee_delete_registrations', |
|
| 285 | + ], |
|
| 286 | + 'delete_registrations' => [ |
|
| 287 | + 'func' => '_delete_registrations', |
|
| 288 | + 'noheader' => true, |
|
| 289 | + 'capability' => 'ee_delete_registrations', |
|
| 290 | + ], |
|
| 291 | + 'new_registration' => [ |
|
| 292 | + 'func' => 'new_registration', |
|
| 293 | + 'capability' => 'ee_edit_registrations', |
|
| 294 | + ], |
|
| 295 | + 'process_reg_step' => [ |
|
| 296 | + 'func' => 'process_reg_step', |
|
| 297 | + 'noheader' => true, |
|
| 298 | + 'capability' => 'ee_edit_registrations', |
|
| 299 | + ], |
|
| 300 | + 'redirect_to_txn' => [ |
|
| 301 | + 'func' => 'redirect_to_txn', |
|
| 302 | + 'noheader' => true, |
|
| 303 | + 'capability' => 'ee_edit_registrations', |
|
| 304 | + ], |
|
| 305 | + 'change_reg_status' => [ |
|
| 306 | + 'func' => '_change_reg_status', |
|
| 307 | + 'noheader' => true, |
|
| 308 | + 'capability' => 'ee_edit_registration', |
|
| 309 | + 'obj_id' => $REG_ID, |
|
| 310 | + ], |
|
| 311 | + 'approve_registration' => [ |
|
| 312 | + 'func' => 'approve_registration', |
|
| 313 | + 'noheader' => true, |
|
| 314 | + 'capability' => 'ee_edit_registration', |
|
| 315 | + 'obj_id' => $REG_ID, |
|
| 316 | + ], |
|
| 317 | + 'approve_and_notify_registration' => [ |
|
| 318 | + 'func' => 'approve_registration', |
|
| 319 | + 'noheader' => true, |
|
| 320 | + 'args' => [true], |
|
| 321 | + 'capability' => 'ee_edit_registration', |
|
| 322 | + 'obj_id' => $REG_ID, |
|
| 323 | + ], |
|
| 324 | + 'approve_registrations' => [ |
|
| 325 | + 'func' => 'bulk_action_on_registrations', |
|
| 326 | + 'noheader' => true, |
|
| 327 | + 'capability' => 'ee_edit_registrations', |
|
| 328 | + 'args' => ['approve'], |
|
| 329 | + ], |
|
| 330 | + 'approve_and_notify_registrations' => [ |
|
| 331 | + 'func' => 'bulk_action_on_registrations', |
|
| 332 | + 'noheader' => true, |
|
| 333 | + 'capability' => 'ee_edit_registrations', |
|
| 334 | + 'args' => ['approve', true], |
|
| 335 | + ], |
|
| 336 | + 'decline_registration' => [ |
|
| 337 | + 'func' => 'decline_registration', |
|
| 338 | + 'noheader' => true, |
|
| 339 | + 'capability' => 'ee_edit_registration', |
|
| 340 | + 'obj_id' => $REG_ID, |
|
| 341 | + ], |
|
| 342 | + 'decline_and_notify_registration' => [ |
|
| 343 | + 'func' => 'decline_registration', |
|
| 344 | + 'noheader' => true, |
|
| 345 | + 'args' => [true], |
|
| 346 | + 'capability' => 'ee_edit_registration', |
|
| 347 | + 'obj_id' => $REG_ID, |
|
| 348 | + ], |
|
| 349 | + 'decline_registrations' => [ |
|
| 350 | + 'func' => 'bulk_action_on_registrations', |
|
| 351 | + 'noheader' => true, |
|
| 352 | + 'capability' => 'ee_edit_registrations', |
|
| 353 | + 'args' => ['decline'], |
|
| 354 | + ], |
|
| 355 | + 'decline_and_notify_registrations' => [ |
|
| 356 | + 'func' => 'bulk_action_on_registrations', |
|
| 357 | + 'noheader' => true, |
|
| 358 | + 'capability' => 'ee_edit_registrations', |
|
| 359 | + 'args' => ['decline', true], |
|
| 360 | + ], |
|
| 361 | + 'pending_registration' => [ |
|
| 362 | + 'func' => 'pending_registration', |
|
| 363 | + 'noheader' => true, |
|
| 364 | + 'capability' => 'ee_edit_registration', |
|
| 365 | + 'obj_id' => $REG_ID, |
|
| 366 | + ], |
|
| 367 | + 'pending_and_notify_registration' => [ |
|
| 368 | + 'func' => 'pending_registration', |
|
| 369 | + 'noheader' => true, |
|
| 370 | + 'args' => [true], |
|
| 371 | + 'capability' => 'ee_edit_registration', |
|
| 372 | + 'obj_id' => $REG_ID, |
|
| 373 | + ], |
|
| 374 | + 'pending_registrations' => [ |
|
| 375 | + 'func' => 'bulk_action_on_registrations', |
|
| 376 | + 'noheader' => true, |
|
| 377 | + 'capability' => 'ee_edit_registrations', |
|
| 378 | + 'args' => ['pending'], |
|
| 379 | + ], |
|
| 380 | + 'pending_and_notify_registrations' => [ |
|
| 381 | + 'func' => 'bulk_action_on_registrations', |
|
| 382 | + 'noheader' => true, |
|
| 383 | + 'capability' => 'ee_edit_registrations', |
|
| 384 | + 'args' => ['pending', true], |
|
| 385 | + ], |
|
| 386 | + 'no_approve_registration' => [ |
|
| 387 | + 'func' => 'not_approve_registration', |
|
| 388 | + 'noheader' => true, |
|
| 389 | + 'capability' => 'ee_edit_registration', |
|
| 390 | + 'obj_id' => $REG_ID, |
|
| 391 | + ], |
|
| 392 | + 'no_approve_and_notify_registration' => [ |
|
| 393 | + 'func' => 'not_approve_registration', |
|
| 394 | + 'noheader' => true, |
|
| 395 | + 'args' => [true], |
|
| 396 | + 'capability' => 'ee_edit_registration', |
|
| 397 | + 'obj_id' => $REG_ID, |
|
| 398 | + ], |
|
| 399 | + 'no_approve_registrations' => [ |
|
| 400 | + 'func' => 'bulk_action_on_registrations', |
|
| 401 | + 'noheader' => true, |
|
| 402 | + 'capability' => 'ee_edit_registrations', |
|
| 403 | + 'args' => ['not_approve'], |
|
| 404 | + ], |
|
| 405 | + 'no_approve_and_notify_registrations' => [ |
|
| 406 | + 'func' => 'bulk_action_on_registrations', |
|
| 407 | + 'noheader' => true, |
|
| 408 | + 'capability' => 'ee_edit_registrations', |
|
| 409 | + 'args' => ['not_approve', true], |
|
| 410 | + ], |
|
| 411 | + 'cancel_registration' => [ |
|
| 412 | + 'func' => 'cancel_registration', |
|
| 413 | + 'noheader' => true, |
|
| 414 | + 'capability' => 'ee_edit_registration', |
|
| 415 | + 'obj_id' => $REG_ID, |
|
| 416 | + ], |
|
| 417 | + 'cancel_and_notify_registration' => [ |
|
| 418 | + 'func' => 'cancel_registration', |
|
| 419 | + 'noheader' => true, |
|
| 420 | + 'args' => [true], |
|
| 421 | + 'capability' => 'ee_edit_registration', |
|
| 422 | + 'obj_id' => $REG_ID, |
|
| 423 | + ], |
|
| 424 | + 'cancel_registrations' => [ |
|
| 425 | + 'func' => 'bulk_action_on_registrations', |
|
| 426 | + 'noheader' => true, |
|
| 427 | + 'capability' => 'ee_edit_registrations', |
|
| 428 | + 'args' => ['cancel'], |
|
| 429 | + ], |
|
| 430 | + 'cancel_and_notify_registrations' => [ |
|
| 431 | + 'func' => 'bulk_action_on_registrations', |
|
| 432 | + 'noheader' => true, |
|
| 433 | + 'capability' => 'ee_edit_registrations', |
|
| 434 | + 'args' => ['cancel', true], |
|
| 435 | + ], |
|
| 436 | + 'wait_list_registration' => [ |
|
| 437 | + 'func' => 'wait_list_registration', |
|
| 438 | + 'noheader' => true, |
|
| 439 | + 'capability' => 'ee_edit_registration', |
|
| 440 | + 'obj_id' => $REG_ID, |
|
| 441 | + ], |
|
| 442 | + 'wait_list_and_notify_registration' => [ |
|
| 443 | + 'func' => 'wait_list_registration', |
|
| 444 | + 'noheader' => true, |
|
| 445 | + 'args' => [true], |
|
| 446 | + 'capability' => 'ee_edit_registration', |
|
| 447 | + 'obj_id' => $REG_ID, |
|
| 448 | + ], |
|
| 449 | + 'contact_list' => [ |
|
| 450 | + 'func' => '_attendee_contact_list_table', |
|
| 451 | + 'capability' => 'ee_read_contacts', |
|
| 452 | + ], |
|
| 453 | + 'add_new_attendee' => [ |
|
| 454 | + 'func' => '_create_new_cpt_item', |
|
| 455 | + 'args' => [ |
|
| 456 | + 'new_attendee' => true, |
|
| 457 | + 'capability' => 'ee_edit_contacts', |
|
| 458 | + ], |
|
| 459 | + ], |
|
| 460 | + 'edit_attendee' => [ |
|
| 461 | + 'func' => '_edit_cpt_item', |
|
| 462 | + 'capability' => 'ee_edit_contacts', |
|
| 463 | + 'obj_id' => $ATT_ID, |
|
| 464 | + ], |
|
| 465 | + 'duplicate_attendee' => [ |
|
| 466 | + 'func' => '_duplicate_attendee', |
|
| 467 | + 'noheader' => true, |
|
| 468 | + 'capability' => 'ee_edit_contacts', |
|
| 469 | + 'obj_id' => $ATT_ID, |
|
| 470 | + ], |
|
| 471 | + 'insert_attendee' => [ |
|
| 472 | + 'func' => '_insert_or_update_attendee', |
|
| 473 | + 'args' => [ |
|
| 474 | + 'new_attendee' => true, |
|
| 475 | + ], |
|
| 476 | + 'noheader' => true, |
|
| 477 | + 'capability' => 'ee_edit_contacts', |
|
| 478 | + ], |
|
| 479 | + 'update_attendee' => [ |
|
| 480 | + 'func' => '_insert_or_update_attendee', |
|
| 481 | + 'args' => [ |
|
| 482 | + 'new_attendee' => false, |
|
| 483 | + ], |
|
| 484 | + 'noheader' => true, |
|
| 485 | + 'capability' => 'ee_edit_contacts', |
|
| 486 | + 'obj_id' => $ATT_ID, |
|
| 487 | + ], |
|
| 488 | + 'trash_attendees' => [ |
|
| 489 | + 'func' => '_trash_or_restore_attendees', |
|
| 490 | + 'args' => [ |
|
| 491 | + 'trash' => 'true', |
|
| 492 | + ], |
|
| 493 | + 'noheader' => true, |
|
| 494 | + 'capability' => 'ee_delete_contacts', |
|
| 495 | + ], |
|
| 496 | + 'trash_attendee' => [ |
|
| 497 | + 'func' => '_trash_or_restore_attendees', |
|
| 498 | + 'args' => [ |
|
| 499 | + 'trash' => true, |
|
| 500 | + ], |
|
| 501 | + 'noheader' => true, |
|
| 502 | + 'capability' => 'ee_delete_contacts', |
|
| 503 | + 'obj_id' => $ATT_ID, |
|
| 504 | + ], |
|
| 505 | + 'restore_attendees' => [ |
|
| 506 | + 'func' => '_trash_or_restore_attendees', |
|
| 507 | + 'args' => [ |
|
| 508 | + 'trash' => false, |
|
| 509 | + ], |
|
| 510 | + 'noheader' => true, |
|
| 511 | + 'capability' => 'ee_delete_contacts', |
|
| 512 | + 'obj_id' => $ATT_ID, |
|
| 513 | + ], |
|
| 514 | + 'delete_attendee' => [ |
|
| 515 | + 'func' => [$this, 'deleteAttendees'], |
|
| 516 | + 'capability' => 'ee_delete_contacts', |
|
| 517 | + 'obj_id' => $ATT_ID, |
|
| 518 | + 'noheader' => true, |
|
| 519 | + ], |
|
| 520 | + 'delete_attendees' => [ |
|
| 521 | + 'func' => [$this, 'deleteAttendees'], |
|
| 522 | + 'capability' => 'ee_delete_contacts', |
|
| 523 | + 'noheader' => true, |
|
| 524 | + ], |
|
| 525 | + 'resend_registration' => [ |
|
| 526 | + 'func' => '_resend_registration', |
|
| 527 | + 'noheader' => true, |
|
| 528 | + 'capability' => 'ee_send_message', |
|
| 529 | + ], |
|
| 530 | + 'registrations_report' => [ |
|
| 531 | + 'func' => [$this, '_registrations_report'], |
|
| 532 | + 'noheader' => true, |
|
| 533 | + 'capability' => 'ee_read_registrations', |
|
| 534 | + ], |
|
| 535 | + 'contact_list_export' => [ |
|
| 536 | + 'func' => '_contact_list_export', |
|
| 537 | + 'noheader' => true, |
|
| 538 | + 'capability' => 'export', |
|
| 539 | + ], |
|
| 540 | + 'contact_list_report' => [ |
|
| 541 | + 'func' => '_contact_list_report', |
|
| 542 | + 'noheader' => true, |
|
| 543 | + 'capability' => 'ee_read_contacts', |
|
| 544 | + ], |
|
| 545 | + ]; |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + |
|
| 549 | + protected function _set_page_config() |
|
| 550 | + { |
|
| 551 | + $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 552 | + $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int'); |
|
| 553 | + $this->_page_config = [ |
|
| 554 | + 'default' => [ |
|
| 555 | + 'nav' => [ |
|
| 556 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
| 557 | + 'icon' => 'dashicons-list-view', |
|
| 558 | + 'order' => 5, |
|
| 559 | + ], |
|
| 560 | + 'help_tabs' => [ |
|
| 561 | + 'registrations_overview_help_tab' => [ |
|
| 562 | + 'title' => esc_html__('Registrations Overview', 'event_espresso'), |
|
| 563 | + 'filename' => 'registrations_overview', |
|
| 564 | + ], |
|
| 565 | + 'registrations_overview_table_column_headings_help_tab' => [ |
|
| 566 | + 'title' => esc_html__('Registrations Table Column Headings', 'event_espresso'), |
|
| 567 | + 'filename' => 'registrations_overview_table_column_headings', |
|
| 568 | + ], |
|
| 569 | + 'registrations_overview_filters_help_tab' => [ |
|
| 570 | + 'title' => esc_html__('Registration Filters', 'event_espresso'), |
|
| 571 | + 'filename' => 'registrations_overview_filters', |
|
| 572 | + ], |
|
| 573 | + 'registrations_overview_views_help_tab' => [ |
|
| 574 | + 'title' => esc_html__('Registration Views', 'event_espresso'), |
|
| 575 | + 'filename' => 'registrations_overview_views', |
|
| 576 | + ], |
|
| 577 | + 'registrations_regoverview_other_help_tab' => [ |
|
| 578 | + 'title' => esc_html__('Registrations Other', 'event_espresso'), |
|
| 579 | + 'filename' => 'registrations_overview_other', |
|
| 580 | + ], |
|
| 581 | + ], |
|
| 582 | + 'list_table' => 'EE_Registrations_List_Table', |
|
| 583 | + 'require_nonce' => false, |
|
| 584 | + ], |
|
| 585 | + 'view_registration' => [ |
|
| 586 | + 'nav' => [ |
|
| 587 | + 'label' => esc_html__('REG Details', 'event_espresso'), |
|
| 588 | + 'icon' => 'dashicons-clipboard', |
|
| 589 | + 'order' => 15, |
|
| 590 | + 'url' => $REG_ID |
|
| 591 | + ? add_query_arg(['_REG_ID' => $REG_ID], $this->_current_page_view_url) |
|
| 592 | + : $this->_admin_base_url, |
|
| 593 | + 'persistent' => false, |
|
| 594 | + ], |
|
| 595 | + 'help_tabs' => [ |
|
| 596 | + 'registrations_details_help_tab' => [ |
|
| 597 | + 'title' => esc_html__('Registration Details', 'event_espresso'), |
|
| 598 | + 'filename' => 'registrations_details', |
|
| 599 | + ], |
|
| 600 | + 'registrations_details_table_help_tab' => [ |
|
| 601 | + 'title' => esc_html__('Registration Details Table', 'event_espresso'), |
|
| 602 | + 'filename' => 'registrations_details_table', |
|
| 603 | + ], |
|
| 604 | + 'registrations_details_form_answers_help_tab' => [ |
|
| 605 | + 'title' => esc_html__('Registration Form Answers', 'event_espresso'), |
|
| 606 | + 'filename' => 'registrations_details_form_answers', |
|
| 607 | + ], |
|
| 608 | + 'registrations_details_registrant_details_help_tab' => [ |
|
| 609 | + 'title' => esc_html__('Contact Details', 'event_espresso'), |
|
| 610 | + 'filename' => 'registrations_details_registrant_details', |
|
| 611 | + ], |
|
| 612 | + ], |
|
| 613 | + 'metaboxes' => array_merge( |
|
| 614 | + $this->_default_espresso_metaboxes, |
|
| 615 | + ['_registration_details_metaboxes'] |
|
| 616 | + ), |
|
| 617 | + 'require_nonce' => false, |
|
| 618 | + ], |
|
| 619 | + 'new_registration' => [ |
|
| 620 | + 'nav' => [ |
|
| 621 | + 'label' => esc_html__('Add New Registration', 'event_espresso'), |
|
| 622 | + 'icon' => 'dashicons-plus-alt', |
|
| 623 | + 'url' => '#', |
|
| 624 | + 'order' => 15, |
|
| 625 | + 'persistent' => false, |
|
| 626 | + ], |
|
| 627 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
| 628 | + 'labels' => [ |
|
| 629 | + 'publishbox' => esc_html__('Save Registration', 'event_espresso'), |
|
| 630 | + ], |
|
| 631 | + 'require_nonce' => false, |
|
| 632 | + ], |
|
| 633 | + 'add_new_attendee' => [ |
|
| 634 | + 'nav' => [ |
|
| 635 | + 'label' => esc_html__('Add Contact', 'event_espresso'), |
|
| 636 | + 'icon' => 'dashicons-plus-alt', |
|
| 637 | + 'order' => 15, |
|
| 638 | + 'persistent' => false, |
|
| 639 | + ], |
|
| 640 | + 'metaboxes' => array_merge( |
|
| 641 | + $this->_default_espresso_metaboxes, |
|
| 642 | + ['_publish_post_box', 'attendee_editor_metaboxes'] |
|
| 643 | + ), |
|
| 644 | + 'require_nonce' => false, |
|
| 645 | + ], |
|
| 646 | + 'edit_attendee' => [ |
|
| 647 | + 'nav' => [ |
|
| 648 | + 'label' => esc_html__('Edit Contact', 'event_espresso'), |
|
| 649 | + 'icon' => 'dashicons-edit-large', |
|
| 650 | + 'order' => 15, |
|
| 651 | + 'persistent' => false, |
|
| 652 | + 'url' => $ATT_ID |
|
| 653 | + ? add_query_arg(['ATT_ID' => $ATT_ID], $this->_current_page_view_url) |
|
| 654 | + : $this->_admin_base_url, |
|
| 655 | + ], |
|
| 656 | + 'metaboxes' => array_merge( |
|
| 657 | + $this->_default_espresso_metaboxes, |
|
| 658 | + ['attendee_editor_metaboxes'] |
|
| 659 | + ), |
|
| 660 | + 'require_nonce' => false, |
|
| 661 | + ], |
|
| 662 | + 'contact_list' => [ |
|
| 663 | + 'nav' => [ |
|
| 664 | + 'label' => esc_html__('Contact List', 'event_espresso'), |
|
| 665 | + 'icon' => 'dashicons-id-alt', |
|
| 666 | + 'order' => 20, |
|
| 667 | + ], |
|
| 668 | + 'list_table' => 'EE_Attendee_Contact_List_Table', |
|
| 669 | + 'help_tabs' => [ |
|
| 670 | + 'registrations_contact_list_help_tab' => [ |
|
| 671 | + 'title' => esc_html__('Registrations Contact List', 'event_espresso'), |
|
| 672 | + 'filename' => 'registrations_contact_list', |
|
| 673 | + ], |
|
| 674 | + 'registrations_contact-list_table_column_headings_help_tab' => [ |
|
| 675 | + 'title' => esc_html__('Contact List Table Column Headings', 'event_espresso'), |
|
| 676 | + 'filename' => 'registrations_contact_list_table_column_headings', |
|
| 677 | + ], |
|
| 678 | + 'registrations_contact_list_views_help_tab' => [ |
|
| 679 | + 'title' => esc_html__('Contact List Views', 'event_espresso'), |
|
| 680 | + 'filename' => 'registrations_contact_list_views', |
|
| 681 | + ], |
|
| 682 | + 'registrations_contact_list_other_help_tab' => [ |
|
| 683 | + 'title' => esc_html__('Contact List Other', 'event_espresso'), |
|
| 684 | + 'filename' => 'registrations_contact_list_other', |
|
| 685 | + ], |
|
| 686 | + ], |
|
| 687 | + 'metaboxes' => [], |
|
| 688 | + 'require_nonce' => false, |
|
| 689 | + ], |
|
| 690 | + // override default cpt routes |
|
| 691 | + 'create_new' => '', |
|
| 692 | + 'edit' => '', |
|
| 693 | + ]; |
|
| 694 | + } |
|
| 695 | + |
|
| 696 | + |
|
| 697 | + /** |
|
| 698 | + * The below methods aren't used by this class currently |
|
| 699 | + */ |
|
| 700 | + protected function _add_screen_options() |
|
| 701 | + { |
|
| 702 | + } |
|
| 703 | + |
|
| 704 | + |
|
| 705 | + protected function _add_feature_pointers() |
|
| 706 | + { |
|
| 707 | + } |
|
| 708 | + |
|
| 709 | + |
|
| 710 | + public function admin_init() |
|
| 711 | + { |
|
| 712 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = esc_html__( |
|
| 713 | + 'click "Update Registration Questions" to save your changes', |
|
| 714 | + 'event_espresso' |
|
| 715 | + ); |
|
| 716 | + } |
|
| 717 | + |
|
| 718 | + |
|
| 719 | + public function admin_notices() |
|
| 720 | + { |
|
| 721 | + } |
|
| 722 | + |
|
| 723 | + |
|
| 724 | + public function admin_footer_scripts() |
|
| 725 | + { |
|
| 726 | + } |
|
| 727 | + |
|
| 728 | + |
|
| 729 | + /** |
|
| 730 | + * get list of registration statuses |
|
| 731 | + * |
|
| 732 | + * @return void |
|
| 733 | + * @throws EE_Error |
|
| 734 | + * @throws ReflectionException |
|
| 735 | + */ |
|
| 736 | + private function _get_registration_status_array() |
|
| 737 | + { |
|
| 738 | + self::$_reg_status = EEM_Registration::reg_status_array([], true); |
|
| 739 | + } |
|
| 740 | + |
|
| 741 | + |
|
| 742 | + /** |
|
| 743 | + * @throws InvalidArgumentException |
|
| 744 | + * @throws InvalidDataTypeException |
|
| 745 | + * @throws InvalidInterfaceException |
|
| 746 | + * @since 4.10.2.p |
|
| 747 | + */ |
|
| 748 | + protected function _add_screen_options_default() |
|
| 749 | + { |
|
| 750 | + $this->_per_page_screen_option(); |
|
| 751 | + } |
|
| 752 | + |
|
| 753 | + |
|
| 754 | + /** |
|
| 755 | + * @throws InvalidArgumentException |
|
| 756 | + * @throws InvalidDataTypeException |
|
| 757 | + * @throws InvalidInterfaceException |
|
| 758 | + * @since 4.10.2.p |
|
| 759 | + */ |
|
| 760 | + protected function _add_screen_options_contact_list() |
|
| 761 | + { |
|
| 762 | + $page_title = $this->_admin_page_title; |
|
| 763 | + $this->_admin_page_title = esc_html__('Contacts', 'event_espresso'); |
|
| 764 | + $this->_per_page_screen_option(); |
|
| 765 | + $this->_admin_page_title = $page_title; |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + |
|
| 769 | + public function load_scripts_styles() |
|
| 770 | + { |
|
| 771 | + // style |
|
| 772 | + wp_register_style( |
|
| 773 | + 'espresso_reg', |
|
| 774 | + REG_ASSETS_URL . 'espresso_registrations_admin.css', |
|
| 775 | + ['ee-admin-css'], |
|
| 776 | + EVENT_ESPRESSO_VERSION |
|
| 777 | + ); |
|
| 778 | + wp_enqueue_style('espresso_reg'); |
|
| 779 | + // script |
|
| 780 | + wp_register_script( |
|
| 781 | + 'espresso_reg', |
|
| 782 | + REG_ASSETS_URL . 'espresso_registrations_admin.js', |
|
| 783 | + ['jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'], |
|
| 784 | + EVENT_ESPRESSO_VERSION, |
|
| 785 | + true |
|
| 786 | + ); |
|
| 787 | + wp_enqueue_script('espresso_reg'); |
|
| 788 | + } |
|
| 789 | + |
|
| 790 | + |
|
| 791 | + /** |
|
| 792 | + * @throws EE_Error |
|
| 793 | + * @throws InvalidArgumentException |
|
| 794 | + * @throws InvalidDataTypeException |
|
| 795 | + * @throws InvalidInterfaceException |
|
| 796 | + * @throws ReflectionException |
|
| 797 | + * @since 4.10.2.p |
|
| 798 | + */ |
|
| 799 | + public function load_scripts_styles_edit_attendee() |
|
| 800 | + { |
|
| 801 | + // stuff to only show up on our attendee edit details page. |
|
| 802 | + $attendee_details_translations = [ |
|
| 803 | + 'att_publish_text' => sprintf( |
|
| 804 | + /* translators: The date and time */ |
|
| 805 | + wp_strip_all_tags(__('Created on: %s', 'event_espresso')), |
|
| 806 | + '<b>' . $this->_cpt_model_obj->get_datetime('ATT_created') . '</b>' |
|
| 807 | + ), |
|
| 808 | + ]; |
|
| 809 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
| 810 | + wp_enqueue_script('jquery-validate'); |
|
| 811 | + } |
|
| 812 | + |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * @throws EE_Error |
|
| 816 | + * @throws InvalidArgumentException |
|
| 817 | + * @throws InvalidDataTypeException |
|
| 818 | + * @throws InvalidInterfaceException |
|
| 819 | + * @throws ReflectionException |
|
| 820 | + * @since 4.10.2.p |
|
| 821 | + */ |
|
| 822 | + public function load_scripts_styles_view_registration() |
|
| 823 | + { |
|
| 824 | + $this->_set_registration_object(); |
|
| 825 | + // styles |
|
| 826 | + wp_enqueue_style('espresso-ui-theme'); |
|
| 827 | + // scripts |
|
| 828 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
| 829 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(); |
|
| 830 | + } |
|
| 831 | + |
|
| 832 | + |
|
| 833 | + public function load_scripts_styles_contact_list() |
|
| 834 | + { |
|
| 835 | + wp_dequeue_style('espresso_reg'); |
|
| 836 | + wp_register_style( |
|
| 837 | + 'espresso_att', |
|
| 838 | + REG_ASSETS_URL . 'espresso_attendees_admin.css', |
|
| 839 | + ['ee-admin-css'], |
|
| 840 | + EVENT_ESPRESSO_VERSION |
|
| 841 | + ); |
|
| 842 | + wp_enqueue_style('espresso_att'); |
|
| 843 | + } |
|
| 844 | + |
|
| 845 | + |
|
| 846 | + public function load_scripts_styles_new_registration() |
|
| 847 | + { |
|
| 848 | + wp_register_script( |
|
| 849 | + 'ee-spco-for-admin', |
|
| 850 | + REG_ASSETS_URL . 'spco_for_admin.js', |
|
| 851 | + ['underscore', 'jquery'], |
|
| 852 | + EVENT_ESPRESSO_VERSION, |
|
| 853 | + true |
|
| 854 | + ); |
|
| 855 | + wp_enqueue_script('ee-spco-for-admin'); |
|
| 856 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
| 857 | + EE_Form_Section_Proper::wp_enqueue_scripts(); |
|
| 858 | + EED_Ticket_Selector::load_tckt_slctr_assets(); |
|
| 859 | + EE_Datepicker_Input::enqueue_styles_and_scripts(); |
|
| 860 | + } |
|
| 861 | + |
|
| 862 | + |
|
| 863 | + public function AHEE__EE_Admin_Page__route_admin_request_resend_registration() |
|
| 864 | + { |
|
| 865 | + add_filter('FHEE_load_EE_messages', '__return_true'); |
|
| 866 | + } |
|
| 867 | + |
|
| 868 | + |
|
| 869 | + public function AHEE__EE_Admin_Page__route_admin_request_approve_registration() |
|
| 870 | + { |
|
| 871 | + add_filter('FHEE_load_EE_messages', '__return_true'); |
|
| 872 | + } |
|
| 873 | + |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * @throws EE_Error |
|
| 877 | + * @throws InvalidArgumentException |
|
| 878 | + * @throws InvalidDataTypeException |
|
| 879 | + * @throws InvalidInterfaceException |
|
| 880 | + * @throws ReflectionException |
|
| 881 | + * @since 4.10.2.p |
|
| 882 | + */ |
|
| 883 | + protected function _set_list_table_views_default() |
|
| 884 | + { |
|
| 885 | + // for notification related bulk actions we need to make sure only active messengers have an option. |
|
| 886 | + EED_Messages::set_autoloaders(); |
|
| 887 | + /** @type EE_Message_Resource_Manager $message_resource_manager */ |
|
| 888 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
| 889 | + $active_mts = $message_resource_manager->list_of_active_message_types(); |
|
| 890 | + // key= bulk_action_slug, value= message type. |
|
| 891 | + $match_array = [ |
|
| 892 | + 'approve_registrations' => 'registration', |
|
| 893 | + 'decline_registrations' => 'declined_registration', |
|
| 894 | + 'pending_registrations' => 'pending_approval', |
|
| 895 | + 'no_approve_registrations' => 'not_approved_registration', |
|
| 896 | + 'cancel_registrations' => 'cancelled_registration', |
|
| 897 | + ]; |
|
| 898 | + $can_send = $this->capabilities->current_user_can( |
|
| 899 | + 'ee_send_message', |
|
| 900 | + 'batch_send_messages' |
|
| 901 | + ); |
|
| 902 | + /** setup reg status bulk actions **/ |
|
| 903 | + $def_reg_status_actions['approve_registrations'] = esc_html__('Approve Registrations', 'event_espresso'); |
|
| 904 | + if ($can_send && in_array($match_array['approve_registrations'], $active_mts, true)) { |
|
| 905 | + $def_reg_status_actions['approve_and_notify_registrations'] = esc_html__( |
|
| 906 | + 'Approve and Notify Registrations', |
|
| 907 | + 'event_espresso' |
|
| 908 | + ); |
|
| 909 | + } |
|
| 910 | + $def_reg_status_actions['decline_registrations'] = esc_html__('Decline Registrations', 'event_espresso'); |
|
| 911 | + if ($can_send && in_array($match_array['decline_registrations'], $active_mts, true)) { |
|
| 912 | + $def_reg_status_actions['decline_and_notify_registrations'] = esc_html__( |
|
| 913 | + 'Decline and Notify Registrations', |
|
| 914 | + 'event_espresso' |
|
| 915 | + ); |
|
| 916 | + } |
|
| 917 | + $def_reg_status_actions['pending_registrations'] = esc_html__( |
|
| 918 | + 'Set Registrations to Pending Payment', |
|
| 919 | + 'event_espresso' |
|
| 920 | + ); |
|
| 921 | + if ($can_send && in_array($match_array['pending_registrations'], $active_mts, true)) { |
|
| 922 | + $def_reg_status_actions['pending_and_notify_registrations'] = esc_html__( |
|
| 923 | + 'Set Registrations to Pending Payment and Notify', |
|
| 924 | + 'event_espresso' |
|
| 925 | + ); |
|
| 926 | + } |
|
| 927 | + $def_reg_status_actions['no_approve_registrations'] = esc_html__( |
|
| 928 | + 'Set Registrations to Awaiting Review', |
|
| 929 | + 'event_espresso' |
|
| 930 | + ); |
|
| 931 | + if ($can_send && in_array($match_array['no_approve_registrations'], $active_mts, true)) { |
|
| 932 | + $def_reg_status_actions['no_approve_and_notify_registrations'] = esc_html__( |
|
| 933 | + 'Set Registrations to Awaiting Review and Notify', |
|
| 934 | + 'event_espresso' |
|
| 935 | + ); |
|
| 936 | + } |
|
| 937 | + $def_reg_status_actions['cancel_registrations'] = esc_html__('Cancel Registrations', 'event_espresso'); |
|
| 938 | + if ($can_send && in_array($match_array['cancel_registrations'], $active_mts, true)) { |
|
| 939 | + $def_reg_status_actions['cancel_and_notify_registrations'] = esc_html__( |
|
| 940 | + 'Cancel Registrations and Notify', |
|
| 941 | + 'event_espresso' |
|
| 942 | + ); |
|
| 943 | + } |
|
| 944 | + $def_reg_status_actions = apply_filters( |
|
| 945 | + 'FHEE__Registrations_Admin_Page___set_list_table_views_default__def_reg_status_actions_array', |
|
| 946 | + $def_reg_status_actions, |
|
| 947 | + $active_mts, |
|
| 948 | + $can_send |
|
| 949 | + ); |
|
| 950 | + |
|
| 951 | + $current_time = current_time('timestamp'); |
|
| 952 | + $this->_views = [ |
|
| 953 | + 'all' => [ |
|
| 954 | + 'slug' => 'all', |
|
| 955 | + 'label' => esc_html__('View All Registrations', 'event_espresso'), |
|
| 956 | + 'count' => 0, |
|
| 957 | + 'bulk_action' => array_merge( |
|
| 958 | + $def_reg_status_actions, |
|
| 959 | + [ |
|
| 960 | + 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 961 | + ] |
|
| 962 | + ), |
|
| 963 | + ], |
|
| 964 | + 'today' => [ |
|
| 965 | + 'slug' => 'today', |
|
| 966 | + 'label' => sprintf( |
|
| 967 | + esc_html__('Today - %s', 'event_espresso'), |
|
| 968 | + date('M d, Y', $current_time) |
|
| 969 | + ), |
|
| 970 | + 'count' => 0, |
|
| 971 | + 'bulk_action' => array_merge( |
|
| 972 | + $def_reg_status_actions, |
|
| 973 | + [ |
|
| 974 | + 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 975 | + ] |
|
| 976 | + ), |
|
| 977 | + ], |
|
| 978 | + 'yesterday' => [ |
|
| 979 | + 'slug' => 'yesterday', |
|
| 980 | + 'label' => sprintf( |
|
| 981 | + esc_html__('Yesterday - %s', 'event_espresso'), |
|
| 982 | + date('M d, Y', $current_time - DAY_IN_SECONDS) |
|
| 983 | + ), |
|
| 984 | + 'count' => 0, |
|
| 985 | + 'bulk_action' => array_merge( |
|
| 986 | + $def_reg_status_actions, |
|
| 987 | + [ |
|
| 988 | + 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 989 | + ] |
|
| 990 | + ), |
|
| 991 | + ], |
|
| 992 | + 'month' => [ |
|
| 993 | + 'slug' => 'month', |
|
| 994 | + 'label' => esc_html__('This Month', 'event_espresso'), |
|
| 995 | + 'count' => 0, |
|
| 996 | + 'bulk_action' => array_merge( |
|
| 997 | + $def_reg_status_actions, |
|
| 998 | + [ |
|
| 999 | + 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 1000 | + ] |
|
| 1001 | + ), |
|
| 1002 | + ], |
|
| 1003 | + ]; |
|
| 1004 | + if ( |
|
| 1005 | + $this->capabilities->current_user_can( |
|
| 1006 | + 'ee_delete_registrations', |
|
| 1007 | + 'espresso_registrations_delete_registration' |
|
| 1008 | + ) |
|
| 1009 | + ) { |
|
| 1010 | + $this->_views['incomplete'] = [ |
|
| 1011 | + 'slug' => 'incomplete', |
|
| 1012 | + 'label' => esc_html__('Incomplete', 'event_espresso'), |
|
| 1013 | + 'count' => 0, |
|
| 1014 | + 'bulk_action' => [ |
|
| 1015 | + 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
|
| 1016 | + ], |
|
| 1017 | + ]; |
|
| 1018 | + $this->_views['trash'] = [ |
|
| 1019 | + 'slug' => 'trash', |
|
| 1020 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
| 1021 | + 'count' => 0, |
|
| 1022 | + 'bulk_action' => [ |
|
| 1023 | + 'restore_registrations' => esc_html__('Restore Registrations', 'event_espresso'), |
|
| 1024 | + 'delete_registrations' => esc_html__('Delete Registrations Permanently', 'event_espresso'), |
|
| 1025 | + ], |
|
| 1026 | + ]; |
|
| 1027 | + } |
|
| 1028 | + } |
|
| 1029 | + |
|
| 1030 | + |
|
| 1031 | + protected function _set_list_table_views_contact_list() |
|
| 1032 | + { |
|
| 1033 | + $this->_views = [ |
|
| 1034 | + 'in_use' => [ |
|
| 1035 | + 'slug' => 'in_use', |
|
| 1036 | + 'label' => esc_html__('In Use', 'event_espresso'), |
|
| 1037 | + 'count' => 0, |
|
| 1038 | + 'bulk_action' => [ |
|
| 1039 | + 'trash_attendees' => esc_html__('Move to Trash', 'event_espresso'), |
|
| 1040 | + ], |
|
| 1041 | + ], |
|
| 1042 | + ]; |
|
| 1043 | + if ( |
|
| 1044 | + $this->capabilities->current_user_can( |
|
| 1045 | + 'ee_delete_contacts', |
|
| 1046 | + 'espresso_registrations_trash_attendees' |
|
| 1047 | + ) |
|
| 1048 | + ) { |
|
| 1049 | + $this->_views['trash'] = [ |
|
| 1050 | + 'slug' => 'trash', |
|
| 1051 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
| 1052 | + 'count' => 0, |
|
| 1053 | + 'bulk_action' => [ |
|
| 1054 | + 'restore_attendees' => esc_html__('Restore from Trash', 'event_espresso'), |
|
| 1055 | + 'delete_attendees' => esc_html__('Permanently Delete', 'event_espresso'), |
|
| 1056 | + ], |
|
| 1057 | + ]; |
|
| 1058 | + } |
|
| 1059 | + } |
|
| 1060 | + |
|
| 1061 | + |
|
| 1062 | + /** |
|
| 1063 | + * @return array |
|
| 1064 | + * @throws EE_Error |
|
| 1065 | + */ |
|
| 1066 | + protected function _registration_legend_items() |
|
| 1067 | + { |
|
| 1068 | + $fc_items = [ |
|
| 1069 | + 'star-icon' => [ |
|
| 1070 | + 'class' => 'dashicons dashicons-star-filled gold-icon', |
|
| 1071 | + 'desc' => esc_html__('This is the Primary Registrant', 'event_espresso'), |
|
| 1072 | + ], |
|
| 1073 | + 'view_details' => [ |
|
| 1074 | + 'class' => 'dashicons dashicons-clipboard', |
|
| 1075 | + 'desc' => esc_html__('View Registration Details', 'event_espresso'), |
|
| 1076 | + ], |
|
| 1077 | + 'edit_attendee' => [ |
|
| 1078 | + 'class' => 'dashicons dashicons-admin-users', |
|
| 1079 | + 'desc' => esc_html__('Edit Contact Details', 'event_espresso'), |
|
| 1080 | + ], |
|
| 1081 | + 'view_transaction' => [ |
|
| 1082 | + 'class' => 'dashicons dashicons-cart', |
|
| 1083 | + 'desc' => esc_html__('View Transaction Details', 'event_espresso'), |
|
| 1084 | + ], |
|
| 1085 | + 'view_invoice' => [ |
|
| 1086 | + 'class' => 'dashicons dashicons-media-spreadsheet', |
|
| 1087 | + 'desc' => esc_html__('View Transaction Invoice', 'event_espresso'), |
|
| 1088 | + ], |
|
| 1089 | + ]; |
|
| 1090 | + if ( |
|
| 1091 | + $this->capabilities->current_user_can( |
|
| 1092 | + 'ee_send_message', |
|
| 1093 | + 'espresso_registrations_resend_registration' |
|
| 1094 | + ) |
|
| 1095 | + ) { |
|
| 1096 | + $fc_items['resend_registration'] = [ |
|
| 1097 | + 'class' => 'dashicons dashicons-email-alt', |
|
| 1098 | + 'desc' => esc_html__('Resend Registration Details', 'event_espresso'), |
|
| 1099 | + ]; |
|
| 1100 | + } else { |
|
| 1101 | + $fc_items['blank'] = ['class' => 'blank', 'desc' => '']; |
|
| 1102 | + } |
|
| 1103 | + if ( |
|
| 1104 | + $this->capabilities->current_user_can( |
|
| 1105 | + 'ee_read_global_messages', |
|
| 1106 | + 'view_filtered_messages' |
|
| 1107 | + ) |
|
| 1108 | + ) { |
|
| 1109 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
| 1110 | + if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) { |
|
| 1111 | + $fc_items['view_related_messages'] = [ |
|
| 1112 | + 'class' => $related_for_icon['css_class'], |
|
| 1113 | + 'desc' => $related_for_icon['label'], |
|
| 1114 | + ]; |
|
| 1115 | + } |
|
| 1116 | + } |
|
| 1117 | + $sc_items = [ |
|
| 1118 | + 'approved_status' => [ |
|
| 1119 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::APPROVED, |
|
| 1120 | + 'desc' => EEH_Template::pretty_status( |
|
| 1121 | + RegStatus::APPROVED, |
|
| 1122 | + false, |
|
| 1123 | + 'sentence' |
|
| 1124 | + ), |
|
| 1125 | + ], |
|
| 1126 | + 'pending_status' => [ |
|
| 1127 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::PENDING_PAYMENT, |
|
| 1128 | + 'desc' => EEH_Template::pretty_status( |
|
| 1129 | + RegStatus::PENDING_PAYMENT, |
|
| 1130 | + false, |
|
| 1131 | + 'sentence' |
|
| 1132 | + ), |
|
| 1133 | + ], |
|
| 1134 | + 'wait_list' => [ |
|
| 1135 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::WAIT_LIST, |
|
| 1136 | + 'desc' => EEH_Template::pretty_status( |
|
| 1137 | + RegStatus::WAIT_LIST, |
|
| 1138 | + false, |
|
| 1139 | + 'sentence' |
|
| 1140 | + ), |
|
| 1141 | + ], |
|
| 1142 | + 'incomplete_status' => [ |
|
| 1143 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::INCOMPLETE, |
|
| 1144 | + 'desc' => EEH_Template::pretty_status( |
|
| 1145 | + RegStatus::INCOMPLETE, |
|
| 1146 | + false, |
|
| 1147 | + 'sentence' |
|
| 1148 | + ), |
|
| 1149 | + ], |
|
| 1150 | + 'not_approved' => [ |
|
| 1151 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::AWAITING_REVIEW, |
|
| 1152 | + 'desc' => EEH_Template::pretty_status( |
|
| 1153 | + RegStatus::AWAITING_REVIEW, |
|
| 1154 | + false, |
|
| 1155 | + 'sentence' |
|
| 1156 | + ), |
|
| 1157 | + ], |
|
| 1158 | + 'declined_status' => [ |
|
| 1159 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::DECLINED, |
|
| 1160 | + 'desc' => EEH_Template::pretty_status( |
|
| 1161 | + RegStatus::DECLINED, |
|
| 1162 | + false, |
|
| 1163 | + 'sentence' |
|
| 1164 | + ), |
|
| 1165 | + ], |
|
| 1166 | + 'cancelled_status' => [ |
|
| 1167 | + 'class' => 'ee-status-legend ee-status-bg--' . RegStatus::CANCELLED, |
|
| 1168 | + 'desc' => EEH_Template::pretty_status( |
|
| 1169 | + RegStatus::CANCELLED, |
|
| 1170 | + false, |
|
| 1171 | + 'sentence' |
|
| 1172 | + ), |
|
| 1173 | + ], |
|
| 1174 | + ]; |
|
| 1175 | + return array_merge($fc_items, $sc_items); |
|
| 1176 | + } |
|
| 1177 | + |
|
| 1178 | + |
|
| 1179 | + |
|
| 1180 | + /*************************************** REGISTRATION OVERVIEW **************************************/ |
|
| 1181 | + |
|
| 1182 | + |
|
| 1183 | + /** |
|
| 1184 | + * @throws DomainException |
|
| 1185 | + * @throws EE_Error |
|
| 1186 | + * @throws InvalidArgumentException |
|
| 1187 | + * @throws InvalidDataTypeException |
|
| 1188 | + * @throws InvalidInterfaceException |
|
| 1189 | + */ |
|
| 1190 | + protected function _registrations_overview_list_table() |
|
| 1191 | + { |
|
| 1192 | + $this->appendAddNewRegistrationButtonToPageTitle(); |
|
| 1193 | + $header_text = ''; |
|
| 1194 | + $admin_page_header_decorators = [ |
|
| 1195 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader', |
|
| 1196 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader', |
|
| 1197 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader', |
|
| 1198 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader', |
|
| 1199 | + ]; |
|
| 1200 | + foreach ($admin_page_header_decorators as $admin_page_header_decorator) { |
|
| 1201 | + $filter_header_decorator = $this->loader->getNew($admin_page_header_decorator); |
|
| 1202 | + $header_text = $filter_header_decorator->getHeaderText($header_text); |
|
| 1203 | + } |
|
| 1204 | + $this->_template_args['before_list_table'] = $header_text; |
|
| 1205 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
| 1206 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
| 1207 | + } |
|
| 1208 | + |
|
| 1209 | + |
|
| 1210 | + /** |
|
| 1211 | + * @throws EE_Error |
|
| 1212 | + * @throws InvalidArgumentException |
|
| 1213 | + * @throws InvalidDataTypeException |
|
| 1214 | + * @throws InvalidInterfaceException |
|
| 1215 | + */ |
|
| 1216 | + private function appendAddNewRegistrationButtonToPageTitle() |
|
| 1217 | + { |
|
| 1218 | + $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int'); |
|
| 1219 | + if ( |
|
| 1220 | + $EVT_ID |
|
| 1221 | + && $this->capabilities->current_user_can( |
|
| 1222 | + 'ee_edit_registrations', |
|
| 1223 | + 'espresso_registrations_new_registration', |
|
| 1224 | + $EVT_ID |
|
| 1225 | + ) |
|
| 1226 | + ) { |
|
| 1227 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
| 1228 | + 'new_registration', |
|
| 1229 | + 'add-registrant', |
|
| 1230 | + ['event_id' => $EVT_ID], |
|
| 1231 | + 'add-new-h2' |
|
| 1232 | + ); |
|
| 1233 | + } |
|
| 1234 | + } |
|
| 1235 | + |
|
| 1236 | + |
|
| 1237 | + /** |
|
| 1238 | + * This sets the _registration property for the registration details screen |
|
| 1239 | + * |
|
| 1240 | + * @return void |
|
| 1241 | + * @throws EE_Error |
|
| 1242 | + * @throws InvalidArgumentException |
|
| 1243 | + * @throws InvalidDataTypeException |
|
| 1244 | + * @throws InvalidInterfaceException |
|
| 1245 | + * @throws ReflectionException |
|
| 1246 | + */ |
|
| 1247 | + private function _set_registration_object() |
|
| 1248 | + { |
|
| 1249 | + // get out if we've already set the object |
|
| 1250 | + if ($this->_registration instanceof EE_Registration) { |
|
| 1251 | + return; |
|
| 1252 | + } |
|
| 1253 | + $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 1254 | + if ($this->_registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID)) { |
|
| 1255 | + return; |
|
| 1256 | + } |
|
| 1257 | + $error_msg = sprintf( |
|
| 1258 | + esc_html__( |
|
| 1259 | + 'An error occurred and the details for Registration ID #%s could not be retrieved.', |
|
| 1260 | + 'event_espresso' |
|
| 1261 | + ), |
|
| 1262 | + $REG_ID |
|
| 1263 | + ); |
|
| 1264 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1265 | + $this->_registration = null; |
|
| 1266 | + } |
|
| 1267 | + |
|
| 1268 | + |
|
| 1269 | + /** |
|
| 1270 | + * Used to retrieve registrations for the list table. |
|
| 1271 | + * |
|
| 1272 | + * @param int $per_page |
|
| 1273 | + * @param bool $count |
|
| 1274 | + * @param bool $this_month |
|
| 1275 | + * @param bool $today |
|
| 1276 | + * @param bool $yesterday |
|
| 1277 | + * @return EE_Registration[]|int |
|
| 1278 | + * @throws EE_Error |
|
| 1279 | + * @throws ReflectionException |
|
| 1280 | + */ |
|
| 1281 | + public function get_registrations( |
|
| 1282 | + int $per_page = 10, |
|
| 1283 | + bool $count = false, |
|
| 1284 | + bool $this_month = false, |
|
| 1285 | + bool $today = false, |
|
| 1286 | + bool $yesterday = false |
|
| 1287 | + ) { |
|
| 1288 | + if ($this_month) { |
|
| 1289 | + $this->request->setRequestParam('status', 'month'); |
|
| 1290 | + } |
|
| 1291 | + if ($today) { |
|
| 1292 | + $this->request->setRequestParam('status', 'today'); |
|
| 1293 | + } |
|
| 1294 | + if ($yesterday) { |
|
| 1295 | + $this->request->setRequestParam('status', 'yesterday'); |
|
| 1296 | + } |
|
| 1297 | + $query_params = $this->_get_registration_query_parameters([], $per_page, $count); |
|
| 1298 | + /** |
|
| 1299 | + * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected |
|
| 1300 | + * |
|
| 1301 | + * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093 |
|
| 1302 | + * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
| 1303 | + * or if you have the development copy of EE you can view this at the path: |
|
| 1304 | + * /docs/G--Model-System/model-query-params.md |
|
| 1305 | + */ |
|
| 1306 | + $query_params['group_by'] = ''; |
|
| 1307 | + |
|
| 1308 | + return $count |
|
| 1309 | + ? $this->getRegistrationModel()->count($query_params) |
|
| 1310 | + /** @type EE_Registration[] */ |
|
| 1311 | + : $this->getRegistrationModel()->get_all($query_params); |
|
| 1312 | + } |
|
| 1313 | + |
|
| 1314 | + |
|
| 1315 | + /** |
|
| 1316 | + * Retrieves the query parameters to be used by the Registration model for getting registrations. |
|
| 1317 | + * Note: this listens to values on the request for some query parameters. |
|
| 1318 | + * |
|
| 1319 | + * @param array $request |
|
| 1320 | + * @param int $per_page |
|
| 1321 | + * @param bool $count |
|
| 1322 | + * @return array |
|
| 1323 | + * @throws EE_Error |
|
| 1324 | + * @throws InvalidArgumentException |
|
| 1325 | + * @throws InvalidDataTypeException |
|
| 1326 | + * @throws InvalidInterfaceException |
|
| 1327 | + */ |
|
| 1328 | + protected function _get_registration_query_parameters( |
|
| 1329 | + array $request = [], |
|
| 1330 | + int $per_page = 10, |
|
| 1331 | + bool $count = false |
|
| 1332 | + ): array { |
|
| 1333 | + /** @var QueryBuilder $list_table_query_builder */ |
|
| 1334 | + $list_table_query_builder = $this->loader->getNew(QueryBuilder::class, [null, null, $request]); |
|
| 1335 | + return $list_table_query_builder->getQueryParams($per_page, $count); |
|
| 1336 | + } |
|
| 1337 | + |
|
| 1338 | + |
|
| 1339 | + public function get_registration_status_array(): array |
|
| 1340 | + { |
|
| 1341 | + return self::$_reg_status; |
|
| 1342 | + } |
|
| 1343 | + |
|
| 1344 | + |
|
| 1345 | + |
|
| 1346 | + |
|
| 1347 | + /*************************************** REGISTRATION DETAILS ***************************************/ |
|
| 1348 | + /** |
|
| 1349 | + * generates HTML for the View Registration Details Admin page |
|
| 1350 | + * |
|
| 1351 | + * @return void |
|
| 1352 | + * @throws DomainException |
|
| 1353 | + * @throws EE_Error |
|
| 1354 | + * @throws InvalidArgumentException |
|
| 1355 | + * @throws InvalidDataTypeException |
|
| 1356 | + * @throws InvalidInterfaceException |
|
| 1357 | + * @throws EntityNotFoundException |
|
| 1358 | + * @throws ReflectionException |
|
| 1359 | + */ |
|
| 1360 | + protected function _registration_details() |
|
| 1361 | + { |
|
| 1362 | + $this->_template_args = []; |
|
| 1363 | + $this->_set_registration_object(); |
|
| 1364 | + if (is_object($this->_registration)) { |
|
| 1365 | + $transaction = $this->_registration->transaction() |
|
| 1366 | + ? $this->_registration->transaction() |
|
| 1367 | + : EE_Transaction::new_instance(); |
|
| 1368 | + $this->session_data = $transaction->session_data(); |
|
| 1369 | + $event_id = $this->_registration->event_ID(); |
|
| 1370 | + $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
|
| 1371 | + $this->_template_args['reg_nmbr']['label'] = esc_html__('Registration Number', 'event_espresso'); |
|
| 1372 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
| 1373 | + $this->_template_args['reg_datetime']['label'] = esc_html__('Date', 'event_espresso'); |
|
| 1374 | + $this->_template_args['grand_total'] = $transaction->total(); |
|
| 1375 | + $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
|
| 1376 | + // link back to overview |
|
| 1377 | + $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
|
| 1378 | + $this->_template_args['registration'] = $this->_registration; |
|
| 1379 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1380 | + [ |
|
| 1381 | + 'action' => 'default', |
|
| 1382 | + 'event_id' => $event_id, |
|
| 1383 | + ], |
|
| 1384 | + REG_ADMIN_URL |
|
| 1385 | + ); |
|
| 1386 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1387 | + [ |
|
| 1388 | + 'action' => 'default', |
|
| 1389 | + 'EVT_ID' => $event_id, |
|
| 1390 | + 'page' => 'espresso_transactions', |
|
| 1391 | + ], |
|
| 1392 | + admin_url('admin.php') |
|
| 1393 | + ); |
|
| 1394 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1395 | + [ |
|
| 1396 | + 'page' => 'espresso_events', |
|
| 1397 | + 'action' => 'edit', |
|
| 1398 | + 'post' => $event_id, |
|
| 1399 | + ], |
|
| 1400 | + admin_url('admin.php') |
|
| 1401 | + ); |
|
| 1402 | + // next and previous links |
|
| 1403 | + $next_reg = $this->_registration->next( |
|
| 1404 | + null, |
|
| 1405 | + [], |
|
| 1406 | + 'REG_ID' |
|
| 1407 | + ); |
|
| 1408 | + $this->_template_args['next_registration'] = $next_reg |
|
| 1409 | + ? $this->_next_link( |
|
| 1410 | + EE_Admin_Page::add_query_args_and_nonce( |
|
| 1411 | + [ |
|
| 1412 | + 'action' => 'view_registration', |
|
| 1413 | + '_REG_ID' => $next_reg['REG_ID'], |
|
| 1414 | + ], |
|
| 1415 | + REG_ADMIN_URL |
|
| 1416 | + ), |
|
| 1417 | + 'dashicons dashicons-arrow-right ee-icon-size-22' |
|
| 1418 | + ) |
|
| 1419 | + : ''; |
|
| 1420 | + $previous_reg = $this->_registration->previous( |
|
| 1421 | + null, |
|
| 1422 | + [], |
|
| 1423 | + 'REG_ID' |
|
| 1424 | + ); |
|
| 1425 | + $this->_template_args['previous_registration'] = $previous_reg |
|
| 1426 | + ? $this->_previous_link( |
|
| 1427 | + EE_Admin_Page::add_query_args_and_nonce( |
|
| 1428 | + [ |
|
| 1429 | + 'action' => 'view_registration', |
|
| 1430 | + '_REG_ID' => $previous_reg['REG_ID'], |
|
| 1431 | + ], |
|
| 1432 | + REG_ADMIN_URL |
|
| 1433 | + ), |
|
| 1434 | + 'dashicons dashicons-arrow-left ee-icon-size-22' |
|
| 1435 | + ) |
|
| 1436 | + : ''; |
|
| 1437 | + // grab header |
|
| 1438 | + $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
| 1439 | + $this->_template_args['REG_ID'] = $this->_registration->ID(); |
|
| 1440 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template( |
|
| 1441 | + $template_path, |
|
| 1442 | + $this->_template_args, |
|
| 1443 | + true |
|
| 1444 | + ); |
|
| 1445 | + } else { |
|
| 1446 | + $this->_template_args['admin_page_header'] = ''; |
|
| 1447 | + $this->_display_espresso_notices(); |
|
| 1448 | + } |
|
| 1449 | + // the details template wrapper |
|
| 1450 | + $this->display_admin_page_with_sidebar(); |
|
| 1451 | + } |
|
| 1452 | + |
|
| 1453 | + |
|
| 1454 | + /** |
|
| 1455 | + * @throws EE_Error |
|
| 1456 | + * @throws InvalidArgumentException |
|
| 1457 | + * @throws InvalidDataTypeException |
|
| 1458 | + * @throws InvalidInterfaceException |
|
| 1459 | + * @throws ReflectionException |
|
| 1460 | + * @since 4.10.2.p |
|
| 1461 | + */ |
|
| 1462 | + protected function _registration_details_metaboxes() |
|
| 1463 | + { |
|
| 1464 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
| 1465 | + $this->_set_registration_object(); |
|
| 1466 | + $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
|
| 1467 | + $this->addMetaBox( |
|
| 1468 | + 'edit-reg-status-mbox', |
|
| 1469 | + esc_html__('Registration Status', 'event_espresso'), |
|
| 1470 | + [$this, 'set_reg_status_buttons_metabox'], |
|
| 1471 | + $this->_wp_page_slug |
|
| 1472 | + ); |
|
| 1473 | + $this->addMetaBox( |
|
| 1474 | + 'edit-reg-details-mbox', |
|
| 1475 | + '<span>' . esc_html__('Registration Details', 'event_espresso') |
|
| 1476 | + . ' <span class="dashicons dashicons-clipboard"></span></span>', |
|
| 1477 | + [$this, '_reg_details_meta_box'], |
|
| 1478 | + $this->_wp_page_slug |
|
| 1479 | + ); |
|
| 1480 | + if ( |
|
| 1481 | + $attendee instanceof EE_Attendee |
|
| 1482 | + && $this->capabilities->current_user_can( |
|
| 1483 | + 'ee_read_registration', |
|
| 1484 | + 'edit-reg-questions-mbox', |
|
| 1485 | + $this->_registration->ID() |
|
| 1486 | + ) |
|
| 1487 | + ) { |
|
| 1488 | + $this->addMetaBox( |
|
| 1489 | + 'edit-reg-questions-mbox', |
|
| 1490 | + esc_html__('Registration Form Answers', 'event_espresso'), |
|
| 1491 | + [$this, '_reg_questions_meta_box'], |
|
| 1492 | + $this->_wp_page_slug |
|
| 1493 | + ); |
|
| 1494 | + } |
|
| 1495 | + $this->addMetaBox( |
|
| 1496 | + 'edit-reg-registrant-mbox', |
|
| 1497 | + esc_html__('Contact Details', 'event_espresso'), |
|
| 1498 | + [$this, '_reg_registrant_side_meta_box'], |
|
| 1499 | + $this->_wp_page_slug, |
|
| 1500 | + 'side' |
|
| 1501 | + ); |
|
| 1502 | + if ($this->_registration->group_size() > 1) { |
|
| 1503 | + $this->addMetaBox( |
|
| 1504 | + 'edit-reg-attendees-mbox', |
|
| 1505 | + esc_html__('Other Registrations in this Transaction', 'event_espresso'), |
|
| 1506 | + [$this, '_reg_attendees_meta_box'], |
|
| 1507 | + $this->_wp_page_slug |
|
| 1508 | + ); |
|
| 1509 | + } |
|
| 1510 | + } |
|
| 1511 | + |
|
| 1512 | + |
|
| 1513 | + /** |
|
| 1514 | + * set_reg_status_buttons_metabox |
|
| 1515 | + * |
|
| 1516 | + * @return void |
|
| 1517 | + * @throws EE_Error |
|
| 1518 | + * @throws EntityNotFoundException |
|
| 1519 | + * @throws InvalidArgumentException |
|
| 1520 | + * @throws InvalidDataTypeException |
|
| 1521 | + * @throws InvalidInterfaceException |
|
| 1522 | + * @throws ReflectionException |
|
| 1523 | + */ |
|
| 1524 | + public function set_reg_status_buttons_metabox() |
|
| 1525 | + { |
|
| 1526 | + $this->_set_registration_object(); |
|
| 1527 | + $change_reg_status_form = $this->_generate_reg_status_change_form(); |
|
| 1528 | + $output = $change_reg_status_form->form_open( |
|
| 1529 | + self::add_query_args_and_nonce( |
|
| 1530 | + [ |
|
| 1531 | + 'action' => 'change_reg_status', |
|
| 1532 | + ], |
|
| 1533 | + REG_ADMIN_URL |
|
| 1534 | + ) |
|
| 1535 | + ); |
|
| 1536 | + $output .= $change_reg_status_form->get_html(); |
|
| 1537 | + $output .= $change_reg_status_form->form_close(); |
|
| 1538 | + echo wp_kses($output, AllowedTags::getWithFormTags()); |
|
| 1539 | + } |
|
| 1540 | + |
|
| 1541 | + |
|
| 1542 | + /** |
|
| 1543 | + * @return EE_Form_Section_Proper |
|
| 1544 | + * @throws EE_Error |
|
| 1545 | + * @throws InvalidArgumentException |
|
| 1546 | + * @throws InvalidDataTypeException |
|
| 1547 | + * @throws InvalidInterfaceException |
|
| 1548 | + * @throws EntityNotFoundException |
|
| 1549 | + * @throws ReflectionException |
|
| 1550 | + */ |
|
| 1551 | + protected function _generate_reg_status_change_form() |
|
| 1552 | + { |
|
| 1553 | + $reg_status_change_form_array = [ |
|
| 1554 | + 'name' => 'reg_status_change_form', |
|
| 1555 | + 'html_id' => 'reg-status-change-form', |
|
| 1556 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
| 1557 | + 'subsections' => [ |
|
| 1558 | + 'return' => new EE_Hidden_Input( |
|
| 1559 | + [ |
|
| 1560 | + 'name' => 'return', |
|
| 1561 | + 'default' => 'view_registration', |
|
| 1562 | + ] |
|
| 1563 | + ), |
|
| 1564 | + 'REG_ID' => new EE_Hidden_Input( |
|
| 1565 | + [ |
|
| 1566 | + 'name' => 'REG_ID', |
|
| 1567 | + 'default' => $this->_registration->ID(), |
|
| 1568 | + ] |
|
| 1569 | + ), |
|
| 1570 | + ], |
|
| 1571 | + ]; |
|
| 1572 | + if ( |
|
| 1573 | + $this->capabilities->current_user_can( |
|
| 1574 | + 'ee_edit_registration', |
|
| 1575 | + 'toggle_registration_status', |
|
| 1576 | + $this->_registration->ID() |
|
| 1577 | + ) |
|
| 1578 | + ) { |
|
| 1579 | + $reg_status_change_form_array['subsections']['reg_status'] = new EE_Select_Input( |
|
| 1580 | + $this->_get_reg_statuses(), |
|
| 1581 | + [ |
|
| 1582 | + 'html_label_text' => esc_html__('Change Registration Status to', 'event_espresso'), |
|
| 1583 | + 'default' => $this->_registration->status_ID(), |
|
| 1584 | + 'html_class' => 'ee-input-width--small', |
|
| 1585 | + ] |
|
| 1586 | + ); |
|
| 1587 | + $reg_status_change_form_array['subsections']['send_notifications'] = new EE_Yes_No_Input( |
|
| 1588 | + [ |
|
| 1589 | + 'html_label_text' => esc_html__('Send Related Messages', 'event_espresso'), |
|
| 1590 | + 'default' => false, |
|
| 1591 | + 'html_help_text' => esc_html__( |
|
| 1592 | + 'If set to "Yes", then the related messages will be sent to the registrant.', |
|
| 1593 | + 'event_espresso' |
|
| 1594 | + ), |
|
| 1595 | + ] |
|
| 1596 | + ); |
|
| 1597 | + $reg_status_change_form_array['subsections']['submit'] = new EE_Submit_Input( |
|
| 1598 | + [ |
|
| 1599 | + 'html_class' => 'button--primary', |
|
| 1600 | + 'html_label_text' => ' ', |
|
| 1601 | + 'default' => esc_html__('Update Registration Status', 'event_espresso'), |
|
| 1602 | + ] |
|
| 1603 | + ); |
|
| 1604 | + } |
|
| 1605 | + return new EE_Form_Section_Proper($reg_status_change_form_array); |
|
| 1606 | + } |
|
| 1607 | + |
|
| 1608 | + |
|
| 1609 | + /** |
|
| 1610 | + * Returns an array of all the buttons for the various statuses and switch status actions |
|
| 1611 | + * |
|
| 1612 | + * @return array |
|
| 1613 | + * @throws EE_Error |
|
| 1614 | + * @throws InvalidArgumentException |
|
| 1615 | + * @throws InvalidDataTypeException |
|
| 1616 | + * @throws InvalidInterfaceException |
|
| 1617 | + * @throws EntityNotFoundException |
|
| 1618 | + * @throws ReflectionException |
|
| 1619 | + */ |
|
| 1620 | + protected function _get_reg_statuses() |
|
| 1621 | + { |
|
| 1622 | + $reg_status_array = $this->getRegistrationModel()->reg_status_array(); |
|
| 1623 | + unset($reg_status_array[ RegStatus::INCOMPLETE ]); |
|
| 1624 | + // get current reg status |
|
| 1625 | + $current_status = $this->_registration->status_ID(); |
|
| 1626 | + // is registration for free event? This will determine whether to display the pending payment option |
|
| 1627 | + if ( |
|
| 1628 | + $current_status !== RegStatus::PENDING_PAYMENT |
|
| 1629 | + && EEH_Money::compare_floats($this->_registration->ticket()->price(), 0.00) |
|
| 1630 | + ) { |
|
| 1631 | + unset($reg_status_array[ RegStatus::PENDING_PAYMENT ]); |
|
| 1632 | + } |
|
| 1633 | + return $this->getStatusModel()->localized_status($reg_status_array, false, 'sentence'); |
|
| 1634 | + } |
|
| 1635 | + |
|
| 1636 | + |
|
| 1637 | + /** |
|
| 1638 | + * This method is used when using _REG_ID from request which may or may not be an array of reg_ids. |
|
| 1639 | + * |
|
| 1640 | + * @param bool $status REG status given for changing registrations to. |
|
| 1641 | + * @param bool $notify Whether to send messages notifications or not. |
|
| 1642 | + * @return array (array with reg_id(s) updated and whether update was successful. |
|
| 1643 | + * @throws DomainException |
|
| 1644 | + * @throws EE_Error |
|
| 1645 | + * @throws EntityNotFoundException |
|
| 1646 | + * @throws InvalidArgumentException |
|
| 1647 | + * @throws InvalidDataTypeException |
|
| 1648 | + * @throws InvalidInterfaceException |
|
| 1649 | + * @throws ReflectionException |
|
| 1650 | + * @throws RuntimeException |
|
| 1651 | + */ |
|
| 1652 | + protected function _set_registration_status_from_request($status = false, $notify = false) |
|
| 1653 | + { |
|
| 1654 | + $REG_IDs = $this->request->requestParamIsSet('reg_status_change_form') |
|
| 1655 | + ? $this->request->getRequestParam('reg_status_change_form[REG_ID]', [], 'int', true) |
|
| 1656 | + : $this->request->getRequestParam('_REG_ID', [], 'int', true); |
|
| 1657 | + // sanitize $REG_IDs |
|
| 1658 | + $REG_IDs = array_map('absint', $REG_IDs); |
|
| 1659 | + // and remove empty entries |
|
| 1660 | + $REG_IDs = array_filter($REG_IDs); |
|
| 1661 | + |
|
| 1662 | + $result = $this->_set_registration_status($REG_IDs, $status, $notify); |
|
| 1663 | + |
|
| 1664 | + /** |
|
| 1665 | + * Set and filter $_req_data['_REG_ID'] for any potential future messages notifications. |
|
| 1666 | + * Currently this value is used downstream by the _process_resend_registration method. |
|
| 1667 | + * |
|
| 1668 | + * @param int|array $registration_ids The registration ids that have had their status changed successfully. |
|
| 1669 | + * @param bool $status The status registrations were changed to. |
|
| 1670 | + * @param bool $success If the status was changed successfully for all registrations. |
|
| 1671 | + * @param Registrations_Admin_Page $admin_page |
|
| 1672 | + */ |
|
| 1673 | + $REG_ID = apply_filters( |
|
| 1674 | + 'FHEE__Registrations_Admin_Page___set_registration_status_from_request__REG_IDs', |
|
| 1675 | + $result['REG_ID'], |
|
| 1676 | + $status, |
|
| 1677 | + $result['success'], |
|
| 1678 | + $this |
|
| 1679 | + ); |
|
| 1680 | + $this->request->setRequestParam('_REG_ID', $REG_ID); |
|
| 1681 | + |
|
| 1682 | + // notify? |
|
| 1683 | + if ( |
|
| 1684 | + $notify |
|
| 1685 | + && $result['success'] |
|
| 1686 | + && ! empty($REG_ID) |
|
| 1687 | + && $this->capabilities->current_user_can( |
|
| 1688 | + 'ee_send_message', |
|
| 1689 | + 'espresso_registrations_resend_registration' |
|
| 1690 | + ) |
|
| 1691 | + ) { |
|
| 1692 | + $this->_process_resend_registration(); |
|
| 1693 | + } |
|
| 1694 | + return $result; |
|
| 1695 | + } |
|
| 1696 | + |
|
| 1697 | + |
|
| 1698 | + /** |
|
| 1699 | + * Set the registration status for the given reg_id (which may or may not be an array, it gets typecast to an |
|
| 1700 | + * array). Note, this method does NOT take care of possible notifications. That is required by calling code. |
|
| 1701 | + * |
|
| 1702 | + * @param array $REG_IDs |
|
| 1703 | + * @param string $status |
|
| 1704 | + * @param bool $notify Used to indicate whether notification was requested or not. This determines the context |
|
| 1705 | + * slug sent with setting the registration status. |
|
| 1706 | + * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as |
|
| 1707 | + * @throws EE_Error |
|
| 1708 | + * @throws InvalidArgumentException |
|
| 1709 | + * @throws InvalidDataTypeException |
|
| 1710 | + * @throws InvalidInterfaceException |
|
| 1711 | + * @throws ReflectionException |
|
| 1712 | + * @throws RuntimeException |
|
| 1713 | + * @throws EntityNotFoundException |
|
| 1714 | + * @throws DomainException |
|
| 1715 | + */ |
|
| 1716 | + protected function _set_registration_status($REG_IDs = [], $status = '', $notify = false) |
|
| 1717 | + { |
|
| 1718 | + $success = false; |
|
| 1719 | + // typecast $REG_IDs |
|
| 1720 | + $REG_IDs = (array) $REG_IDs; |
|
| 1721 | + if (! empty($REG_IDs)) { |
|
| 1722 | + $success = true; |
|
| 1723 | + // set default status if none is passed |
|
| 1724 | + $status = $status ?: RegStatus::PENDING_PAYMENT; |
|
| 1725 | + $status_context = $notify |
|
| 1726 | + ? Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY |
|
| 1727 | + : Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN; |
|
| 1728 | + // loop through REG_ID's and change status |
|
| 1729 | + foreach ($REG_IDs as $REG_ID) { |
|
| 1730 | + $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID); |
|
| 1731 | + if ($registration instanceof EE_Registration) { |
|
| 1732 | + $registration->set_status( |
|
| 1733 | + $status, |
|
| 1734 | + false, |
|
| 1735 | + new Context( |
|
| 1736 | + $status_context, |
|
| 1737 | + esc_html__( |
|
| 1738 | + 'Manually triggered status change on a Registration Admin Page route.', |
|
| 1739 | + 'event_espresso' |
|
| 1740 | + ) |
|
| 1741 | + ) |
|
| 1742 | + ); |
|
| 1743 | + $result = $registration->save(); |
|
| 1744 | + // verifying explicit fails because update *may* just return 0 for 0 rows affected |
|
| 1745 | + $success = $result !== false ? $success : false; |
|
| 1746 | + } |
|
| 1747 | + } |
|
| 1748 | + } |
|
| 1749 | + |
|
| 1750 | + // return $success and processed registrations |
|
| 1751 | + return ['REG_ID' => $REG_IDs, 'success' => $success]; |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + |
|
| 1755 | + /** |
|
| 1756 | + * Common logic for setting up success message and redirecting to appropriate route |
|
| 1757 | + * |
|
| 1758 | + * @param string $STS_ID status id for the registration changed to |
|
| 1759 | + * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
|
| 1760 | + * @return void |
|
| 1761 | + * @throws DomainException |
|
| 1762 | + * @throws EE_Error |
|
| 1763 | + * @throws EntityNotFoundException |
|
| 1764 | + * @throws InvalidArgumentException |
|
| 1765 | + * @throws InvalidDataTypeException |
|
| 1766 | + * @throws InvalidInterfaceException |
|
| 1767 | + * @throws ReflectionException |
|
| 1768 | + * @throws RuntimeException |
|
| 1769 | + */ |
|
| 1770 | + protected function _reg_status_change_return($STS_ID, $notify = false) |
|
| 1771 | + { |
|
| 1772 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) |
|
| 1773 | + : ['success' => false]; |
|
| 1774 | + $success = isset($result['success']) && $result['success']; |
|
| 1775 | + // setup success message |
|
| 1776 | + if ($success) { |
|
| 1777 | + if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) { |
|
| 1778 | + $msg = sprintf( |
|
| 1779 | + esc_html__('Registration status has been set to %s', 'event_espresso'), |
|
| 1780 | + EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
| 1781 | + ); |
|
| 1782 | + } else { |
|
| 1783 | + $msg = sprintf( |
|
| 1784 | + esc_html__('Registrations have been set to %s.', 'event_espresso'), |
|
| 1785 | + EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
| 1786 | + ); |
|
| 1787 | + } |
|
| 1788 | + EE_Error::add_success($msg); |
|
| 1789 | + } else { |
|
| 1790 | + EE_Error::add_error( |
|
| 1791 | + esc_html__( |
|
| 1792 | + 'Something went wrong, and the status was not changed', |
|
| 1793 | + 'event_espresso' |
|
| 1794 | + ), |
|
| 1795 | + __FILE__, |
|
| 1796 | + __LINE__, |
|
| 1797 | + __FUNCTION__ |
|
| 1798 | + ); |
|
| 1799 | + } |
|
| 1800 | + $return = $this->request->getRequestParam('return'); |
|
| 1801 | + $route = $return === 'view_registration' |
|
| 1802 | + ? ['action' => 'view_registration', '_REG_ID' => reset($result['REG_ID'])] |
|
| 1803 | + : ['action' => 'default']; |
|
| 1804 | + $route = $this->mergeExistingRequestParamsWithRedirectArgs($route); |
|
| 1805 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
| 1806 | + } |
|
| 1807 | + |
|
| 1808 | + |
|
| 1809 | + /** |
|
| 1810 | + * incoming reg status change from reg details page. |
|
| 1811 | + * |
|
| 1812 | + * @return void |
|
| 1813 | + * @throws EE_Error |
|
| 1814 | + * @throws EntityNotFoundException |
|
| 1815 | + * @throws InvalidArgumentException |
|
| 1816 | + * @throws InvalidDataTypeException |
|
| 1817 | + * @throws InvalidInterfaceException |
|
| 1818 | + * @throws ReflectionException |
|
| 1819 | + * @throws RuntimeException |
|
| 1820 | + * @throws DomainException |
|
| 1821 | + */ |
|
| 1822 | + protected function _change_reg_status() |
|
| 1823 | + { |
|
| 1824 | + $this->request->setRequestParam('return', 'view_registration'); |
|
| 1825 | + // set notify based on whether the send notifications toggle is set or not |
|
| 1826 | + $notify = $this->request->getRequestParam('reg_status_change_form[send_notifications]', false, 'bool'); |
|
| 1827 | + $reg_status = $this->request->getRequestParam('reg_status_change_form[reg_status]', ''); |
|
| 1828 | + $this->request->setRequestParam('reg_status_change_form[reg_status]', $reg_status); |
|
| 1829 | + switch ($reg_status) { |
|
| 1830 | + case RegStatus::APPROVED: |
|
| 1831 | + case EEH_Template::pretty_status(RegStatus::APPROVED, false, 'sentence'): |
|
| 1832 | + $this->approve_registration($notify); |
|
| 1833 | + break; |
|
| 1834 | + case RegStatus::PENDING_PAYMENT: |
|
| 1835 | + case EEH_Template::pretty_status(RegStatus::PENDING_PAYMENT, false, 'sentence'): |
|
| 1836 | + $this->pending_registration($notify); |
|
| 1837 | + break; |
|
| 1838 | + case RegStatus::AWAITING_REVIEW: |
|
| 1839 | + case EEH_Template::pretty_status(RegStatus::AWAITING_REVIEW, false, 'sentence'): |
|
| 1840 | + $this->not_approve_registration($notify); |
|
| 1841 | + break; |
|
| 1842 | + case RegStatus::DECLINED: |
|
| 1843 | + case EEH_Template::pretty_status(RegStatus::DECLINED, false, 'sentence'): |
|
| 1844 | + $this->decline_registration($notify); |
|
| 1845 | + break; |
|
| 1846 | + case RegStatus::CANCELLED: |
|
| 1847 | + case EEH_Template::pretty_status(RegStatus::CANCELLED, false, 'sentence'): |
|
| 1848 | + $this->cancel_registration($notify); |
|
| 1849 | + break; |
|
| 1850 | + case RegStatus::WAIT_LIST: |
|
| 1851 | + case EEH_Template::pretty_status(RegStatus::WAIT_LIST, false, 'sentence'): |
|
| 1852 | + $this->wait_list_registration($notify); |
|
| 1853 | + break; |
|
| 1854 | + case RegStatus::INCOMPLETE: |
|
| 1855 | + default: |
|
| 1856 | + $this->request->unSetRequestParam('return'); |
|
| 1857 | + $this->_reg_status_change_return(''); |
|
| 1858 | + break; |
|
| 1859 | + } |
|
| 1860 | + } |
|
| 1861 | + |
|
| 1862 | + |
|
| 1863 | + /** |
|
| 1864 | + * Callback for bulk action routes. |
|
| 1865 | + * Note: although we could just register the singular route callbacks for each bulk action route as well, this |
|
| 1866 | + * method was chosen so there is one central place all the registration status bulk actions are going through. |
|
| 1867 | + * Potentially, this provides an easier place to locate logic that is specific to these bulk actions (as opposed to |
|
| 1868 | + * when an action is happening on just a single registration). |
|
| 1869 | + * |
|
| 1870 | + * @param $action |
|
| 1871 | + * @param bool $notify |
|
| 1872 | + */ |
|
| 1873 | + protected function bulk_action_on_registrations($action, $notify = false) |
|
| 1874 | + { |
|
| 1875 | + do_action( |
|
| 1876 | + 'AHEE__Registrations_Admin_Page__bulk_action_on_registrations__before_execution', |
|
| 1877 | + $this, |
|
| 1878 | + $action, |
|
| 1879 | + $notify |
|
| 1880 | + ); |
|
| 1881 | + $method = $action . '_registration'; |
|
| 1882 | + if (method_exists($this, $method)) { |
|
| 1883 | + $this->$method($notify); |
|
| 1884 | + } |
|
| 1885 | + } |
|
| 1886 | + |
|
| 1887 | + |
|
| 1888 | + /** |
|
| 1889 | + * approve_registration |
|
| 1890 | + * |
|
| 1891 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
| 1892 | + * @return void |
|
| 1893 | + * @throws EE_Error |
|
| 1894 | + * @throws EntityNotFoundException |
|
| 1895 | + * @throws InvalidArgumentException |
|
| 1896 | + * @throws InvalidDataTypeException |
|
| 1897 | + * @throws InvalidInterfaceException |
|
| 1898 | + * @throws ReflectionException |
|
| 1899 | + * @throws RuntimeException |
|
| 1900 | + * @throws DomainException |
|
| 1901 | + */ |
|
| 1902 | + protected function approve_registration($notify = false) |
|
| 1903 | + { |
|
| 1904 | + $this->_reg_status_change_return(RegStatus::APPROVED, $notify); |
|
| 1905 | + } |
|
| 1906 | + |
|
| 1907 | + |
|
| 1908 | + /** |
|
| 1909 | + * decline_registration |
|
| 1910 | + * |
|
| 1911 | + * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1912 | + * @return void |
|
| 1913 | + * @throws EE_Error |
|
| 1914 | + * @throws EntityNotFoundException |
|
| 1915 | + * @throws InvalidArgumentException |
|
| 1916 | + * @throws InvalidDataTypeException |
|
| 1917 | + * @throws InvalidInterfaceException |
|
| 1918 | + * @throws ReflectionException |
|
| 1919 | + * @throws RuntimeException |
|
| 1920 | + * @throws DomainException |
|
| 1921 | + */ |
|
| 1922 | + protected function decline_registration($notify = false) |
|
| 1923 | + { |
|
| 1924 | + $this->_reg_status_change_return(RegStatus::DECLINED, $notify); |
|
| 1925 | + } |
|
| 1926 | + |
|
| 1927 | + |
|
| 1928 | + /** |
|
| 1929 | + * cancel_registration |
|
| 1930 | + * |
|
| 1931 | + * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1932 | + * @return void |
|
| 1933 | + * @throws EE_Error |
|
| 1934 | + * @throws EntityNotFoundException |
|
| 1935 | + * @throws InvalidArgumentException |
|
| 1936 | + * @throws InvalidDataTypeException |
|
| 1937 | + * @throws InvalidInterfaceException |
|
| 1938 | + * @throws ReflectionException |
|
| 1939 | + * @throws RuntimeException |
|
| 1940 | + * @throws DomainException |
|
| 1941 | + */ |
|
| 1942 | + protected function cancel_registration($notify = false) |
|
| 1943 | + { |
|
| 1944 | + $this->_reg_status_change_return(RegStatus::CANCELLED, $notify); |
|
| 1945 | + } |
|
| 1946 | + |
|
| 1947 | + |
|
| 1948 | + /** |
|
| 1949 | + * not_approve_registration |
|
| 1950 | + * |
|
| 1951 | + * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1952 | + * @return void |
|
| 1953 | + * @throws EE_Error |
|
| 1954 | + * @throws EntityNotFoundException |
|
| 1955 | + * @throws InvalidArgumentException |
|
| 1956 | + * @throws InvalidDataTypeException |
|
| 1957 | + * @throws InvalidInterfaceException |
|
| 1958 | + * @throws ReflectionException |
|
| 1959 | + * @throws RuntimeException |
|
| 1960 | + * @throws DomainException |
|
| 1961 | + */ |
|
| 1962 | + protected function not_approve_registration($notify = false) |
|
| 1963 | + { |
|
| 1964 | + $this->_reg_status_change_return(RegStatus::AWAITING_REVIEW, $notify); |
|
| 1965 | + } |
|
| 1966 | + |
|
| 1967 | + |
|
| 1968 | + /** |
|
| 1969 | + * decline_registration |
|
| 1970 | + * |
|
| 1971 | + * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1972 | + * @return void |
|
| 1973 | + * @throws EE_Error |
|
| 1974 | + * @throws EntityNotFoundException |
|
| 1975 | + * @throws InvalidArgumentException |
|
| 1976 | + * @throws InvalidDataTypeException |
|
| 1977 | + * @throws InvalidInterfaceException |
|
| 1978 | + * @throws ReflectionException |
|
| 1979 | + * @throws RuntimeException |
|
| 1980 | + * @throws DomainException |
|
| 1981 | + */ |
|
| 1982 | + protected function pending_registration($notify = false) |
|
| 1983 | + { |
|
| 1984 | + $this->_reg_status_change_return(RegStatus::PENDING_PAYMENT, $notify); |
|
| 1985 | + } |
|
| 1986 | + |
|
| 1987 | + |
|
| 1988 | + /** |
|
| 1989 | + * waitlist_registration |
|
| 1990 | + * |
|
| 1991 | + * @param bool $notify whether or not to notify the registrant about their status change. |
|
| 1992 | + * @return void |
|
| 1993 | + * @throws EE_Error |
|
| 1994 | + * @throws EntityNotFoundException |
|
| 1995 | + * @throws InvalidArgumentException |
|
| 1996 | + * @throws InvalidDataTypeException |
|
| 1997 | + * @throws InvalidInterfaceException |
|
| 1998 | + * @throws ReflectionException |
|
| 1999 | + * @throws RuntimeException |
|
| 2000 | + * @throws DomainException |
|
| 2001 | + */ |
|
| 2002 | + protected function wait_list_registration($notify = false) |
|
| 2003 | + { |
|
| 2004 | + $this->_reg_status_change_return(RegStatus::WAIT_LIST, $notify); |
|
| 2005 | + } |
|
| 2006 | + |
|
| 2007 | + |
|
| 2008 | + /** |
|
| 2009 | + * generates HTML for the Registration main meta box |
|
| 2010 | + * |
|
| 2011 | + * @return void |
|
| 2012 | + * @throws DomainException |
|
| 2013 | + * @throws EE_Error |
|
| 2014 | + * @throws InvalidArgumentException |
|
| 2015 | + * @throws InvalidDataTypeException |
|
| 2016 | + * @throws InvalidInterfaceException |
|
| 2017 | + * @throws ReflectionException |
|
| 2018 | + * @throws EntityNotFoundException |
|
| 2019 | + */ |
|
| 2020 | + public function _reg_details_meta_box() |
|
| 2021 | + { |
|
| 2022 | + EEH_Autoloader::register_line_item_display_autoloaders(); |
|
| 2023 | + EEH_Autoloader::register_line_item_filter_autoloaders(); |
|
| 2024 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 2025 | + $transaction = $this->_registration->transaction() |
|
| 2026 | + ? $this->_registration->transaction() |
|
| 2027 | + : EE_Transaction::new_instance(); |
|
| 2028 | + $this->session_data = $transaction->session_data(); |
|
| 2029 | + $filters = new EE_Line_Item_Filter_Collection(); |
|
| 2030 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
| 2031 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
| 2032 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
|
| 2033 | + $filters, |
|
| 2034 | + $transaction->total_line_item() |
|
| 2035 | + ); |
|
| 2036 | + $filtered_line_item_tree = $line_item_filter_processor->process(); |
|
| 2037 | + $line_item_display = new EE_Line_Item_Display( |
|
| 2038 | + 'reg_admin_table', |
|
| 2039 | + 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' |
|
| 2040 | + ); |
|
| 2041 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item( |
|
| 2042 | + $filtered_line_item_tree, |
|
| 2043 | + ['EE_Registration' => $this->_registration] |
|
| 2044 | + ); |
|
| 2045 | + $attendee = $this->_registration->attendee(); |
|
| 2046 | + if ( |
|
| 2047 | + $this->capabilities->current_user_can( |
|
| 2048 | + 'ee_read_transaction', |
|
| 2049 | + 'espresso_transactions_view_transaction' |
|
| 2050 | + ) |
|
| 2051 | + ) { |
|
| 2052 | + $this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link( |
|
| 2053 | + EE_Admin_Page::add_query_args_and_nonce( |
|
| 2054 | + [ |
|
| 2055 | + 'action' => 'view_transaction', |
|
| 2056 | + 'TXN_ID' => $transaction->ID(), |
|
| 2057 | + ], |
|
| 2058 | + TXN_ADMIN_URL |
|
| 2059 | + ), |
|
| 2060 | + esc_html__(' View Transaction', 'event_espresso'), |
|
| 2061 | + 'button button--secondary right', |
|
| 2062 | + 'dashicons dashicons-cart' |
|
| 2063 | + ); |
|
| 2064 | + } else { |
|
| 2065 | + $this->_template_args['view_transaction_button'] = ''; |
|
| 2066 | + } |
|
| 2067 | + if ( |
|
| 2068 | + $attendee instanceof EE_Attendee |
|
| 2069 | + && $this->capabilities->current_user_can( |
|
| 2070 | + 'ee_send_message', |
|
| 2071 | + 'espresso_registrations_resend_registration' |
|
| 2072 | + ) |
|
| 2073 | + ) { |
|
| 2074 | + $this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link( |
|
| 2075 | + EE_Admin_Page::add_query_args_and_nonce( |
|
| 2076 | + [ |
|
| 2077 | + 'action' => 'resend_registration', |
|
| 2078 | + '_REG_ID' => $this->_registration->ID(), |
|
| 2079 | + 'redirect_to' => 'view_registration', |
|
| 2080 | + ], |
|
| 2081 | + REG_ADMIN_URL |
|
| 2082 | + ), |
|
| 2083 | + esc_html__(' Resend Registration', 'event_espresso'), |
|
| 2084 | + 'button button--secondary right', |
|
| 2085 | + 'dashicons dashicons-email-alt' |
|
| 2086 | + ); |
|
| 2087 | + } else { |
|
| 2088 | + $this->_template_args['resend_registration_button'] = ''; |
|
| 2089 | + } |
|
| 2090 | + $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
|
| 2091 | + $payment = $transaction->get_first_related('Payment'); |
|
| 2092 | + $payment = ! $payment instanceof EE_Payment |
|
| 2093 | + ? EE_Payment::new_instance() |
|
| 2094 | + : $payment; |
|
| 2095 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
| 2096 | + $payment_method = ! $payment_method instanceof EE_Payment_Method |
|
| 2097 | + ? EE_Payment_Method::new_instance() |
|
| 2098 | + : $payment_method; |
|
| 2099 | + $reg_details = [ |
|
| 2100 | + 'payment_method' => $payment_method->name(), |
|
| 2101 | + 'response_msg' => $payment->gateway_response(), |
|
| 2102 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
| 2103 | + 'registration_session' => $this->_registration->session_ID(), |
|
| 2104 | + 'ip_address' => $this->session_data['ip_address'] ?? '', |
|
| 2105 | + 'user_agent' => $this->session_data['user_agent'] ?? '', |
|
| 2106 | + ]; |
|
| 2107 | + if (isset($reg_details['registration_id'])) { |
|
| 2108 | + $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
|
| 2109 | + $this->_template_args['reg_details']['registration_id']['label'] = esc_html__( |
|
| 2110 | + 'Registration ID', |
|
| 2111 | + 'event_espresso' |
|
| 2112 | + ); |
|
| 2113 | + $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
|
| 2114 | + } |
|
| 2115 | + if (isset($reg_details['payment_method'])) { |
|
| 2116 | + $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
|
| 2117 | + $this->_template_args['reg_details']['payment_method']['label'] = esc_html__( |
|
| 2118 | + 'Most Recent Payment Method', |
|
| 2119 | + 'event_espresso' |
|
| 2120 | + ); |
|
| 2121 | + $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
|
| 2122 | + $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
|
| 2123 | + $this->_template_args['reg_details']['response_msg']['label'] = esc_html__( |
|
| 2124 | + 'Payment method response', |
|
| 2125 | + 'event_espresso' |
|
| 2126 | + ); |
|
| 2127 | + $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
|
| 2128 | + } |
|
| 2129 | + $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
|
| 2130 | + $this->_template_args['reg_details']['registration_session']['label'] = esc_html__( |
|
| 2131 | + 'Registration Session', |
|
| 2132 | + 'event_espresso' |
|
| 2133 | + ); |
|
| 2134 | + $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
|
| 2135 | + $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
|
| 2136 | + $this->_template_args['reg_details']['ip_address']['label'] = esc_html__( |
|
| 2137 | + 'Registration placed from IP', |
|
| 2138 | + 'event_espresso' |
|
| 2139 | + ); |
|
| 2140 | + $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
|
| 2141 | + $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
|
| 2142 | + $this->_template_args['reg_details']['user_agent']['label'] = esc_html__( |
|
| 2143 | + 'Registrant User Agent', |
|
| 2144 | + 'event_espresso' |
|
| 2145 | + ); |
|
| 2146 | + $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
|
| 2147 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 2148 | + [ |
|
| 2149 | + 'action' => 'default', |
|
| 2150 | + 'event_id' => $this->_registration->event_ID(), |
|
| 2151 | + ], |
|
| 2152 | + REG_ADMIN_URL |
|
| 2153 | + ); |
|
| 2154 | + |
|
| 2155 | + $this->_template_args['REG_ID'] = $this->_registration->ID(); |
|
| 2156 | + $this->_template_args['event_id'] = $this->_registration->event_ID(); |
|
| 2157 | + |
|
| 2158 | + $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
| 2159 | + EEH_Template::display_template($template_path, $this->_template_args); // already escaped |
|
| 2160 | + } |
|
| 2161 | + |
|
| 2162 | + |
|
| 2163 | + /** |
|
| 2164 | + * generates HTML for the Registration Questions meta box. |
|
| 2165 | + * If pre-4.8.32.rc.000 hooks are used, uses old methods (with its filters), |
|
| 2166 | + * otherwise uses new forms system |
|
| 2167 | + * |
|
| 2168 | + * @return void |
|
| 2169 | + * @throws DomainException |
|
| 2170 | + * @throws EE_Error |
|
| 2171 | + * @throws InvalidArgumentException |
|
| 2172 | + * @throws InvalidDataTypeException |
|
| 2173 | + * @throws InvalidInterfaceException |
|
| 2174 | + * @throws ReflectionException |
|
| 2175 | + */ |
|
| 2176 | + public function _reg_questions_meta_box() |
|
| 2177 | + { |
|
| 2178 | + // allow someone to override this method entirely |
|
| 2179 | + if ( |
|
| 2180 | + apply_filters( |
|
| 2181 | + 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', |
|
| 2182 | + true, |
|
| 2183 | + $this, |
|
| 2184 | + $this->_registration |
|
| 2185 | + ) |
|
| 2186 | + ) { |
|
| 2187 | + $form = $this->_get_reg_custom_questions_form( |
|
| 2188 | + $this->_registration->ID() |
|
| 2189 | + ); |
|
| 2190 | + |
|
| 2191 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 |
|
| 2192 | + ? $form->get_html_and_js() |
|
| 2193 | + : ''; |
|
| 2194 | + |
|
| 2195 | + $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
|
| 2196 | + $this->_template_args['REG_ID'] = $this->_registration->ID(); |
|
| 2197 | + $template_path = |
|
| 2198 | + REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
| 2199 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
| 2200 | + } |
|
| 2201 | + } |
|
| 2202 | + |
|
| 2203 | + |
|
| 2204 | + /** |
|
| 2205 | + * form_before_question_group |
|
| 2206 | + * |
|
| 2207 | + * @param string $output |
|
| 2208 | + * @return string |
|
| 2209 | + * @deprecated as of 4.8.32.rc.000 |
|
| 2210 | + */ |
|
| 2211 | + public function form_before_question_group($output) |
|
| 2212 | + { |
|
| 2213 | + EE_Error::doing_it_wrong( |
|
| 2214 | + __CLASS__ . '::' . __FUNCTION__, |
|
| 2215 | + esc_html__( |
|
| 2216 | + 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2217 | + 'event_espresso' |
|
| 2218 | + ), |
|
| 2219 | + '4.8.32.rc.000' |
|
| 2220 | + ); |
|
| 2221 | + return ' |
|
| 2222 | 2222 | <table class="form-table ee-width-100"> |
| 2223 | 2223 | <tbody> |
| 2224 | 2224 | '; |
| 2225 | - } |
|
| 2226 | - |
|
| 2227 | - |
|
| 2228 | - /** |
|
| 2229 | - * form_after_question_group |
|
| 2230 | - * |
|
| 2231 | - * @param string $output |
|
| 2232 | - * @return string |
|
| 2233 | - * @deprecated as of 4.8.32.rc.000 |
|
| 2234 | - */ |
|
| 2235 | - public function form_after_question_group($output) |
|
| 2236 | - { |
|
| 2237 | - EE_Error::doing_it_wrong( |
|
| 2238 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 2239 | - esc_html__( |
|
| 2240 | - 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2241 | - 'event_espresso' |
|
| 2242 | - ), |
|
| 2243 | - '4.8.32.rc.000' |
|
| 2244 | - ); |
|
| 2245 | - return ' |
|
| 2225 | + } |
|
| 2226 | + |
|
| 2227 | + |
|
| 2228 | + /** |
|
| 2229 | + * form_after_question_group |
|
| 2230 | + * |
|
| 2231 | + * @param string $output |
|
| 2232 | + * @return string |
|
| 2233 | + * @deprecated as of 4.8.32.rc.000 |
|
| 2234 | + */ |
|
| 2235 | + public function form_after_question_group($output) |
|
| 2236 | + { |
|
| 2237 | + EE_Error::doing_it_wrong( |
|
| 2238 | + __CLASS__ . '::' . __FUNCTION__, |
|
| 2239 | + esc_html__( |
|
| 2240 | + 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2241 | + 'event_espresso' |
|
| 2242 | + ), |
|
| 2243 | + '4.8.32.rc.000' |
|
| 2244 | + ); |
|
| 2245 | + return ' |
|
| 2246 | 2246 | <tr class="hide-if-no-js"> |
| 2247 | 2247 | <th> </th> |
| 2248 | 2248 | <td class="reg-admin-edit-attendee-question-td"> |
| 2249 | 2249 | <a class="reg-admin-edit-attendee-question-lnk" href="#" aria-label="' |
| 2250 | - . esc_attr__('click to edit question', 'event_espresso') |
|
| 2251 | - . '"> |
|
| 2250 | + . esc_attr__('click to edit question', 'event_espresso') |
|
| 2251 | + . '"> |
|
| 2252 | 2252 | <span class="reg-admin-edit-question-group-spn lt-grey-txt">' |
| 2253 | - . esc_html__('edit the above question group', 'event_espresso') |
|
| 2254 | - . '</span> |
|
| 2253 | + . esc_html__('edit the above question group', 'event_espresso') |
|
| 2254 | + . '</span> |
|
| 2255 | 2255 | <div class="dashicons dashicons-edit"></div> |
| 2256 | 2256 | </a> |
| 2257 | 2257 | </td> |
@@ -2259,644 +2259,644 @@ discard block |
||
| 2259 | 2259 | </tbody> |
| 2260 | 2260 | </table> |
| 2261 | 2261 | '; |
| 2262 | - } |
|
| 2263 | - |
|
| 2264 | - |
|
| 2265 | - /** |
|
| 2266 | - * form_form_field_label_wrap |
|
| 2267 | - * |
|
| 2268 | - * @param string $label |
|
| 2269 | - * @return string |
|
| 2270 | - * @deprecated as of 4.8.32.rc.000 |
|
| 2271 | - */ |
|
| 2272 | - public function form_form_field_label_wrap($label) |
|
| 2273 | - { |
|
| 2274 | - EE_Error::doing_it_wrong( |
|
| 2275 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 2276 | - esc_html__( |
|
| 2277 | - 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2278 | - 'event_espresso' |
|
| 2279 | - ), |
|
| 2280 | - '4.8.32.rc.000' |
|
| 2281 | - ); |
|
| 2282 | - return ' |
|
| 2262 | + } |
|
| 2263 | + |
|
| 2264 | + |
|
| 2265 | + /** |
|
| 2266 | + * form_form_field_label_wrap |
|
| 2267 | + * |
|
| 2268 | + * @param string $label |
|
| 2269 | + * @return string |
|
| 2270 | + * @deprecated as of 4.8.32.rc.000 |
|
| 2271 | + */ |
|
| 2272 | + public function form_form_field_label_wrap($label) |
|
| 2273 | + { |
|
| 2274 | + EE_Error::doing_it_wrong( |
|
| 2275 | + __CLASS__ . '::' . __FUNCTION__, |
|
| 2276 | + esc_html__( |
|
| 2277 | + 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2278 | + 'event_espresso' |
|
| 2279 | + ), |
|
| 2280 | + '4.8.32.rc.000' |
|
| 2281 | + ); |
|
| 2282 | + return ' |
|
| 2283 | 2283 | <tr> |
| 2284 | 2284 | <th> |
| 2285 | 2285 | ' . $label . ' |
| 2286 | 2286 | </th>'; |
| 2287 | - } |
|
| 2288 | - |
|
| 2289 | - |
|
| 2290 | - /** |
|
| 2291 | - * form_form_field_input__wrap |
|
| 2292 | - * |
|
| 2293 | - * @param string $input |
|
| 2294 | - * @return string |
|
| 2295 | - * @deprecated as of 4.8.32.rc.000 |
|
| 2296 | - */ |
|
| 2297 | - public function form_form_field_input__wrap($input) |
|
| 2298 | - { |
|
| 2299 | - EE_Error::doing_it_wrong( |
|
| 2300 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 2301 | - esc_html__( |
|
| 2302 | - 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2303 | - 'event_espresso' |
|
| 2304 | - ), |
|
| 2305 | - '4.8.32.rc.000' |
|
| 2306 | - ); |
|
| 2307 | - return ' |
|
| 2287 | + } |
|
| 2288 | + |
|
| 2289 | + |
|
| 2290 | + /** |
|
| 2291 | + * form_form_field_input__wrap |
|
| 2292 | + * |
|
| 2293 | + * @param string $input |
|
| 2294 | + * @return string |
|
| 2295 | + * @deprecated as of 4.8.32.rc.000 |
|
| 2296 | + */ |
|
| 2297 | + public function form_form_field_input__wrap($input) |
|
| 2298 | + { |
|
| 2299 | + EE_Error::doing_it_wrong( |
|
| 2300 | + __CLASS__ . '::' . __FUNCTION__, |
|
| 2301 | + esc_html__( |
|
| 2302 | + 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.', |
|
| 2303 | + 'event_espresso' |
|
| 2304 | + ), |
|
| 2305 | + '4.8.32.rc.000' |
|
| 2306 | + ); |
|
| 2307 | + return ' |
|
| 2308 | 2308 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
| 2309 | 2309 | ' . $input . ' |
| 2310 | 2310 | </td> |
| 2311 | 2311 | </tr>'; |
| 2312 | - } |
|
| 2313 | - |
|
| 2314 | - |
|
| 2315 | - /** |
|
| 2316 | - * Updates the registration's custom questions according to the form info, if the form is submitted. |
|
| 2317 | - * If it's not a post, the "view_registrations" route will be called next on the SAME request |
|
| 2318 | - * to display the page |
|
| 2319 | - * |
|
| 2320 | - * @return void |
|
| 2321 | - * @throws EE_Error |
|
| 2322 | - * @throws InvalidArgumentException |
|
| 2323 | - * @throws InvalidDataTypeException |
|
| 2324 | - * @throws InvalidInterfaceException |
|
| 2325 | - * @throws ReflectionException |
|
| 2326 | - */ |
|
| 2327 | - protected function _update_attendee_registration_form() |
|
| 2328 | - { |
|
| 2329 | - do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
| 2330 | - if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
| 2331 | - $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 2332 | - $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
| 2333 | - if ($success) { |
|
| 2334 | - $what = esc_html__('Registration Form', 'event_espresso'); |
|
| 2335 | - $route = $REG_ID |
|
| 2336 | - ? ['action' => 'view_registration', '_REG_ID' => $REG_ID] |
|
| 2337 | - : ['action' => 'default']; |
|
| 2338 | - $this->_redirect_after_action(true, $what, esc_html__('updated', 'event_espresso'), $route); |
|
| 2339 | - } |
|
| 2340 | - } |
|
| 2341 | - } |
|
| 2342 | - |
|
| 2343 | - |
|
| 2344 | - /** |
|
| 2345 | - * Gets the form for saving registrations custom questions (if done |
|
| 2346 | - * previously retrieves the cached form object, which may have validation errors in it) |
|
| 2347 | - * |
|
| 2348 | - * @param int $REG_ID |
|
| 2349 | - * @return EE_Registration_Custom_Questions_Form |
|
| 2350 | - * @throws EE_Error |
|
| 2351 | - * @throws InvalidArgumentException |
|
| 2352 | - * @throws InvalidDataTypeException |
|
| 2353 | - * @throws InvalidInterfaceException |
|
| 2354 | - * @throws ReflectionException |
|
| 2355 | - */ |
|
| 2356 | - protected function _get_reg_custom_questions_form($REG_ID) |
|
| 2357 | - { |
|
| 2358 | - if (! $this->_reg_custom_questions_form) { |
|
| 2359 | - require_once(REG_ADMIN . 'form_sections/EE_Registration_Custom_Questions_Form.form.php'); |
|
| 2360 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( |
|
| 2361 | - $this->getRegistrationModel()->get_one_by_ID($REG_ID) |
|
| 2362 | - ); |
|
| 2363 | - $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
| 2364 | - } |
|
| 2365 | - return $this->_reg_custom_questions_form; |
|
| 2366 | - } |
|
| 2367 | - |
|
| 2368 | - |
|
| 2369 | - /** |
|
| 2370 | - * Saves |
|
| 2371 | - * |
|
| 2372 | - * @param bool $REG_ID |
|
| 2373 | - * @return bool |
|
| 2374 | - * @throws EE_Error |
|
| 2375 | - * @throws InvalidArgumentException |
|
| 2376 | - * @throws InvalidDataTypeException |
|
| 2377 | - * @throws InvalidInterfaceException |
|
| 2378 | - * @throws ReflectionException |
|
| 2379 | - */ |
|
| 2380 | - private function _save_reg_custom_questions_form($REG_ID = 0) |
|
| 2381 | - { |
|
| 2382 | - if (! $REG_ID) { |
|
| 2383 | - EE_Error::add_error( |
|
| 2384 | - esc_html__( |
|
| 2385 | - 'An error occurred. No registration ID was received.', |
|
| 2386 | - 'event_espresso' |
|
| 2387 | - ), |
|
| 2388 | - __FILE__, |
|
| 2389 | - __FUNCTION__, |
|
| 2390 | - __LINE__ |
|
| 2391 | - ); |
|
| 2392 | - } |
|
| 2393 | - $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
| 2394 | - $form->receive_form_submission($this->request->requestParams()); |
|
| 2395 | - $success = false; |
|
| 2396 | - if ($form->is_valid()) { |
|
| 2397 | - foreach ($form->subforms() as $question_group_form) { |
|
| 2398 | - foreach ($question_group_form->inputs() as $question_id => $input) { |
|
| 2399 | - $where_conditions = [ |
|
| 2400 | - 'QST_ID' => $question_id, |
|
| 2401 | - 'REG_ID' => $REG_ID, |
|
| 2402 | - ]; |
|
| 2403 | - $possibly_new_values = [ |
|
| 2404 | - 'ANS_value' => $input->normalized_value(), |
|
| 2405 | - ]; |
|
| 2406 | - $answer = EEM_Answer::instance()->get_one([$where_conditions]); |
|
| 2407 | - if ($answer instanceof EE_Answer) { |
|
| 2408 | - $success = $answer->save($possibly_new_values); |
|
| 2409 | - } else { |
|
| 2410 | - // insert it then |
|
| 2411 | - $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
| 2412 | - $answer = EE_Answer::new_instance($cols_n_vals); |
|
| 2413 | - $success = $answer->save(); |
|
| 2414 | - } |
|
| 2415 | - } |
|
| 2416 | - } |
|
| 2417 | - } else { |
|
| 2418 | - EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
| 2419 | - } |
|
| 2420 | - return $success; |
|
| 2421 | - } |
|
| 2422 | - |
|
| 2423 | - |
|
| 2424 | - /** |
|
| 2425 | - * generates HTML for the Registration main meta box |
|
| 2426 | - * |
|
| 2427 | - * @return void |
|
| 2428 | - * @throws DomainException |
|
| 2429 | - * @throws EE_Error |
|
| 2430 | - * @throws InvalidArgumentException |
|
| 2431 | - * @throws InvalidDataTypeException |
|
| 2432 | - * @throws InvalidInterfaceException |
|
| 2433 | - * @throws ReflectionException |
|
| 2434 | - */ |
|
| 2435 | - public function _reg_attendees_meta_box() |
|
| 2436 | - { |
|
| 2437 | - $REG = $this->getRegistrationModel(); |
|
| 2438 | - // get all other registrations on this transaction, and cache |
|
| 2439 | - // the attendees for them so we don't have to run another query using force_join |
|
| 2440 | - $registrations = $REG->get_all( |
|
| 2441 | - [ |
|
| 2442 | - [ |
|
| 2443 | - 'TXN_ID' => $this->_registration->transaction_ID(), |
|
| 2444 | - 'REG_ID' => ['!=', $this->_registration->ID()], |
|
| 2445 | - ], |
|
| 2446 | - 'force_join' => ['Attendee'], |
|
| 2447 | - 'default_where_conditions' => 'other_models_only', |
|
| 2448 | - ] |
|
| 2449 | - ); |
|
| 2450 | - $this->_template_args['attendees'] = []; |
|
| 2451 | - $this->_template_args['attendee_notice'] = ''; |
|
| 2452 | - if ( |
|
| 2453 | - empty($registrations) |
|
| 2454 | - || (is_array($registrations) |
|
| 2455 | - && ! EEH_Array::get_one_item_from_array($registrations)) |
|
| 2456 | - ) { |
|
| 2457 | - EE_Error::add_error( |
|
| 2458 | - esc_html__( |
|
| 2459 | - 'There are no records attached to this registration. Something may have gone wrong with the registration', |
|
| 2460 | - 'event_espresso' |
|
| 2461 | - ), |
|
| 2462 | - __FILE__, |
|
| 2463 | - __FUNCTION__, |
|
| 2464 | - __LINE__ |
|
| 2465 | - ); |
|
| 2466 | - $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
|
| 2467 | - } else { |
|
| 2468 | - $att_nmbr = 1; |
|
| 2469 | - foreach ($registrations as $registration) { |
|
| 2470 | - /* @var $registration EE_Registration */ |
|
| 2471 | - $attendee = $registration->attendee() |
|
| 2472 | - ? $registration->attendee() |
|
| 2473 | - : $this->getAttendeeModel()->create_default_object(); |
|
| 2474 | - $this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID(); |
|
| 2475 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname(); |
|
| 2476 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname(); |
|
| 2477 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email(); |
|
| 2478 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price(); |
|
| 2479 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( |
|
| 2480 | - ', ', |
|
| 2481 | - $attendee->full_address_as_array() |
|
| 2482 | - ); |
|
| 2483 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( |
|
| 2484 | - [ |
|
| 2485 | - 'action' => 'edit_attendee', |
|
| 2486 | - 'post' => $attendee->ID(), |
|
| 2487 | - ], |
|
| 2488 | - REG_ADMIN_URL |
|
| 2489 | - ); |
|
| 2490 | - $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = |
|
| 2491 | - $registration->event_obj() instanceof EE_Event |
|
| 2492 | - ? $registration->event_obj()->name() |
|
| 2493 | - : ''; |
|
| 2494 | - $att_nmbr++; |
|
| 2495 | - } |
|
| 2496 | - $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
|
| 2497 | - } |
|
| 2498 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
| 2499 | - EEH_Template::display_template($template_path, $this->_template_args); |
|
| 2500 | - } |
|
| 2501 | - |
|
| 2502 | - |
|
| 2503 | - /** |
|
| 2504 | - * generates HTML for the Edit Registration side meta box |
|
| 2505 | - * |
|
| 2506 | - * @return void |
|
| 2507 | - * @throws DomainException |
|
| 2508 | - * @throws EE_Error |
|
| 2509 | - * @throws InvalidArgumentException |
|
| 2510 | - * @throws InvalidDataTypeException |
|
| 2511 | - * @throws InvalidInterfaceException |
|
| 2512 | - * @throws ReflectionException |
|
| 2513 | - */ |
|
| 2514 | - public function _reg_registrant_side_meta_box() |
|
| 2515 | - { |
|
| 2516 | - /*@var $attendee EE_Attendee */ |
|
| 2517 | - $att_check = $this->_registration->attendee(); |
|
| 2518 | - $attendee = $att_check instanceof EE_Attendee |
|
| 2519 | - ? $att_check |
|
| 2520 | - : $this->getAttendeeModel()->create_default_object(); |
|
| 2521 | - // now let's determine if this is not the primary registration. If it isn't then we set the |
|
| 2522 | - // primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the |
|
| 2523 | - // primary registration object (that way we know if we need to show create button or not) |
|
| 2524 | - if (! $this->_registration->is_primary_registrant()) { |
|
| 2525 | - $primary_registration = $this->_registration->get_primary_registration(); |
|
| 2526 | - $primary_attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() |
|
| 2527 | - : null; |
|
| 2528 | - if (! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
| 2529 | - // in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own |
|
| 2530 | - // custom attendee object so let's not worry about the primary reg. |
|
| 2531 | - $primary_registration = null; |
|
| 2532 | - } |
|
| 2533 | - } else { |
|
| 2534 | - $primary_registration = null; |
|
| 2535 | - } |
|
| 2536 | - $this->_template_args['ATT_ID'] = $attendee->ID(); |
|
| 2537 | - $this->_template_args['fname'] = $attendee->fname(); |
|
| 2538 | - $this->_template_args['lname'] = $attendee->lname(); |
|
| 2539 | - $this->_template_args['email'] = $attendee->email(); |
|
| 2540 | - $this->_template_args['phone'] = $attendee->phone(); |
|
| 2541 | - $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
| 2542 | - // edit link |
|
| 2543 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 2544 | - [ |
|
| 2545 | - 'action' => 'edit_attendee', |
|
| 2546 | - 'post' => $attendee->ID(), |
|
| 2547 | - ], |
|
| 2548 | - REG_ADMIN_URL |
|
| 2549 | - ); |
|
| 2550 | - $this->_template_args['att_edit_title'] = esc_html__('View details for this contact.', 'event_espresso'); |
|
| 2551 | - $this->_template_args['att_edit_label'] = esc_html__('View/Edit Contact', 'event_espresso'); |
|
| 2552 | - // create link |
|
| 2553 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration |
|
| 2554 | - ? EE_Admin_Page::add_query_args_and_nonce( |
|
| 2555 | - [ |
|
| 2556 | - 'action' => 'duplicate_attendee', |
|
| 2557 | - '_REG_ID' => $this->_registration->ID(), |
|
| 2558 | - ], |
|
| 2559 | - REG_ADMIN_URL |
|
| 2560 | - ) : ''; |
|
| 2561 | - $this->_template_args['create_label'] = esc_html__('Create Contact', 'event_espresso'); |
|
| 2562 | - $this->_template_args['att_check'] = $att_check; |
|
| 2563 | - $template_path = |
|
| 2564 | - REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
| 2565 | - EEH_Template::display_template($template_path, $this->_template_args); |
|
| 2566 | - } |
|
| 2567 | - |
|
| 2568 | - |
|
| 2569 | - /** |
|
| 2570 | - * trash or restore registrations |
|
| 2571 | - * |
|
| 2572 | - * @param boolean $trash whether to archive or restore |
|
| 2573 | - * @return void |
|
| 2574 | - * @throws DomainException |
|
| 2575 | - * @throws EE_Error |
|
| 2576 | - * @throws EntityNotFoundException |
|
| 2577 | - * @throws InvalidArgumentException |
|
| 2578 | - * @throws InvalidDataTypeException |
|
| 2579 | - * @throws InvalidInterfaceException |
|
| 2580 | - * @throws ReflectionException |
|
| 2581 | - * @throws RuntimeException |
|
| 2582 | - * @throws UnexpectedEntityException |
|
| 2583 | - */ |
|
| 2584 | - protected function _trash_or_restore_registrations(bool $trash = true) |
|
| 2585 | - { |
|
| 2586 | - // if empty _REG_ID then get out because there's nothing to do |
|
| 2587 | - $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true); |
|
| 2588 | - if (empty($REG_IDs)) { |
|
| 2589 | - EE_Error::add_error( |
|
| 2590 | - sprintf( |
|
| 2591 | - esc_html__( |
|
| 2592 | - 'In order to %1$s registrations you must select which ones you wish to %1$s by clicking the checkboxes.', |
|
| 2593 | - 'event_espresso' |
|
| 2594 | - ), |
|
| 2595 | - $trash ? 'trash' : 'restore' |
|
| 2596 | - ), |
|
| 2597 | - __FILE__, |
|
| 2598 | - __LINE__, |
|
| 2599 | - __FUNCTION__ |
|
| 2600 | - ); |
|
| 2601 | - $this->_redirect_after_action(false, '', '', [], true); |
|
| 2602 | - } |
|
| 2603 | - $success = 0; |
|
| 2604 | - $overwrite_msgs = false; |
|
| 2605 | - // Checkboxes |
|
| 2606 | - $reg_count = count($REG_IDs); |
|
| 2607 | - // cycle thru checkboxes |
|
| 2608 | - foreach ($REG_IDs as $REG_ID) { |
|
| 2609 | - /** @var EE_Registration $REG */ |
|
| 2610 | - $REG = $this->getRegistrationModel()->get_one_by_ID($REG_ID); |
|
| 2611 | - if ($trash) { |
|
| 2612 | - $payments = $REG->registration_payments(); |
|
| 2613 | - if (! empty($payments)) { |
|
| 2614 | - $name = $REG->attendee() instanceof EE_Attendee |
|
| 2615 | - ? $REG->attendee()->full_name() |
|
| 2616 | - : esc_html__('Unknown Attendee', 'event_espresso'); |
|
| 2617 | - $overwrite_msgs = true; |
|
| 2618 | - EE_Error::add_error( |
|
| 2619 | - sprintf( |
|
| 2620 | - esc_html__( |
|
| 2621 | - 'The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', |
|
| 2622 | - 'event_espresso' |
|
| 2623 | - ), |
|
| 2624 | - $name |
|
| 2625 | - ), |
|
| 2626 | - __FILE__, |
|
| 2627 | - __FUNCTION__, |
|
| 2628 | - __LINE__ |
|
| 2629 | - ); |
|
| 2630 | - // can't trash this registration because it has payments. |
|
| 2631 | - continue; |
|
| 2632 | - } |
|
| 2633 | - } |
|
| 2634 | - $updated = $trash ? $REG->delete() : $REG->restore(); |
|
| 2635 | - if ($updated) { |
|
| 2636 | - $success++; |
|
| 2637 | - } |
|
| 2638 | - } |
|
| 2639 | - $this->_redirect_after_action( |
|
| 2640 | - $success === $reg_count, // were ALL registrations affected? |
|
| 2641 | - $success > 1 |
|
| 2642 | - ? esc_html__('Registrations', 'event_espresso') |
|
| 2643 | - : esc_html__('Registration', 'event_espresso'), |
|
| 2644 | - $trash |
|
| 2645 | - ? esc_html__('moved to the trash', 'event_espresso') |
|
| 2646 | - : esc_html__('restored', 'event_espresso'), |
|
| 2647 | - $this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']), |
|
| 2648 | - $overwrite_msgs |
|
| 2649 | - ); |
|
| 2650 | - } |
|
| 2651 | - |
|
| 2652 | - |
|
| 2653 | - /** |
|
| 2654 | - * This is used to permanently delete registrations. Note, this will handle not only deleting permanently the |
|
| 2655 | - * registration but also. |
|
| 2656 | - * 1. Removing relations to EE_Attendee |
|
| 2657 | - * 2. Deleting permanently the related transaction, but ONLY if all related registrations to the transaction are |
|
| 2658 | - * ALSO trashed. |
|
| 2659 | - * 3. Deleting permanently any related Line items but only if the above conditions are met. |
|
| 2660 | - * 4. Removing relationships between all tickets and the related registrations |
|
| 2661 | - * 5. Deleting permanently any related Answers (and the answers for other related registrations that were deleted.) |
|
| 2662 | - * 6. Deleting permanently any related Check-ins. |
|
| 2663 | - * |
|
| 2664 | - * @return void |
|
| 2665 | - * @throws EE_Error |
|
| 2666 | - * @throws InvalidArgumentException |
|
| 2667 | - * @throws InvalidDataTypeException |
|
| 2668 | - * @throws InvalidInterfaceException |
|
| 2669 | - * @throws ReflectionException |
|
| 2670 | - */ |
|
| 2671 | - protected function _delete_registrations() |
|
| 2672 | - { |
|
| 2673 | - $REG_MDL = $this->getRegistrationModel(); |
|
| 2674 | - $success = 0; |
|
| 2675 | - // Checkboxes |
|
| 2676 | - $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true); |
|
| 2677 | - |
|
| 2678 | - if (! empty($REG_IDs)) { |
|
| 2679 | - // if array has more than one element than success message should be plural |
|
| 2680 | - $success = count($REG_IDs) > 1 ? 2 : 1; |
|
| 2681 | - // cycle thru checkboxes |
|
| 2682 | - foreach ($REG_IDs as $REG_ID) { |
|
| 2683 | - $REG = $REG_MDL->get_one_by_ID($REG_ID); |
|
| 2684 | - if (! $REG instanceof EE_Registration) { |
|
| 2685 | - continue; |
|
| 2686 | - } |
|
| 2687 | - $deleted = $this->_delete_registration($REG); |
|
| 2688 | - if (! $deleted) { |
|
| 2689 | - $success = 0; |
|
| 2690 | - } |
|
| 2691 | - } |
|
| 2692 | - } |
|
| 2693 | - |
|
| 2694 | - $what = $success > 1 |
|
| 2695 | - ? esc_html__('Registrations', 'event_espresso') |
|
| 2696 | - : esc_html__('Registration', 'event_espresso'); |
|
| 2697 | - $action_desc = esc_html__('permanently deleted.', 'event_espresso'); |
|
| 2698 | - $this->_redirect_after_action( |
|
| 2699 | - $success, |
|
| 2700 | - $what, |
|
| 2701 | - $action_desc, |
|
| 2702 | - $this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']), |
|
| 2703 | - true |
|
| 2704 | - ); |
|
| 2705 | - } |
|
| 2706 | - |
|
| 2707 | - |
|
| 2708 | - /** |
|
| 2709 | - * handles the permanent deletion of a registration. See comments with _delete_registrations() for details on what |
|
| 2710 | - * models get affected. |
|
| 2711 | - * |
|
| 2712 | - * @param EE_Registration $REG registration to be deleted permanently |
|
| 2713 | - * @return bool true = successful deletion, false = fail. |
|
| 2714 | - * @throws EE_Error |
|
| 2715 | - * @throws InvalidArgumentException |
|
| 2716 | - * @throws InvalidDataTypeException |
|
| 2717 | - * @throws InvalidInterfaceException |
|
| 2718 | - * @throws ReflectionException |
|
| 2719 | - */ |
|
| 2720 | - protected function _delete_registration(EE_Registration $REG) |
|
| 2721 | - { |
|
| 2722 | - // first we start with the transaction... ultimately, we WILL not delete permanently if there are any related |
|
| 2723 | - // registrations on the transaction that are NOT trashed. |
|
| 2724 | - $TXN = $REG->transaction(); |
|
| 2725 | - if (! $TXN instanceof EE_Transaction) { |
|
| 2726 | - EE_Error::add_error( |
|
| 2727 | - sprintf( |
|
| 2728 | - esc_html__( |
|
| 2729 | - 'Unable to permanently delete registration %d because its related transaction has already been deleted. If you can restore the related transaction to the database then this registration can be deleted.', |
|
| 2730 | - 'event_espresso' |
|
| 2731 | - ), |
|
| 2732 | - $REG->id() |
|
| 2733 | - ), |
|
| 2734 | - __FILE__, |
|
| 2735 | - __FUNCTION__, |
|
| 2736 | - __LINE__ |
|
| 2737 | - ); |
|
| 2738 | - return false; |
|
| 2739 | - } |
|
| 2740 | - $REGS = $TXN->get_many_related('Registration'); |
|
| 2741 | - $all_trashed = true; |
|
| 2742 | - foreach ($REGS as $registration) { |
|
| 2743 | - if (! $registration->get('REG_deleted')) { |
|
| 2744 | - $all_trashed = false; |
|
| 2745 | - } |
|
| 2746 | - } |
|
| 2747 | - if (! $all_trashed) { |
|
| 2748 | - EE_Error::add_error( |
|
| 2749 | - esc_html__( |
|
| 2750 | - 'Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', |
|
| 2751 | - 'event_espresso' |
|
| 2752 | - ), |
|
| 2753 | - __FILE__, |
|
| 2754 | - __FUNCTION__, |
|
| 2755 | - __LINE__ |
|
| 2756 | - ); |
|
| 2757 | - return false; |
|
| 2758 | - } |
|
| 2759 | - // k made it here so that means we can delete all the related transactions and their answers (but let's do them |
|
| 2760 | - // separately from THIS one). |
|
| 2761 | - foreach ($REGS as $registration) { |
|
| 2762 | - // delete related answers |
|
| 2763 | - $registration->delete_related_permanently('Answer'); |
|
| 2764 | - // remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
|
| 2765 | - $attendee = $registration->get_first_related('Attendee'); |
|
| 2766 | - if ($attendee instanceof EE_Attendee) { |
|
| 2767 | - $registration->_remove_relation_to($attendee, 'Attendee'); |
|
| 2768 | - } |
|
| 2769 | - // now remove relationships to tickets on this registration. |
|
| 2770 | - $registration->_remove_relations('Ticket'); |
|
| 2771 | - // now delete permanently the checkins related to this registration. |
|
| 2772 | - $registration->delete_related_permanently('Checkin'); |
|
| 2773 | - if ($registration->ID() === $REG->ID()) { |
|
| 2774 | - continue; |
|
| 2775 | - } //we don't want to delete permanently the existing registration just yet. |
|
| 2776 | - // remove relation to transaction for these registrations if NOT the existing registrations |
|
| 2777 | - $registration->_remove_relations('Transaction'); |
|
| 2778 | - // delete permanently any related messages. |
|
| 2779 | - $registration->delete_related_permanently('Message'); |
|
| 2780 | - // now delete this registration permanently |
|
| 2781 | - $registration->delete_permanently(); |
|
| 2782 | - } |
|
| 2783 | - // now all related registrations on the transaction are handled. So let's just handle this registration itself |
|
| 2784 | - // (the transaction and line items should be all that's left). |
|
| 2785 | - // delete the line items related to the transaction for this registration. |
|
| 2786 | - $TXN->delete_related_permanently('Line_Item'); |
|
| 2787 | - // we need to remove all the relationships on the transaction |
|
| 2788 | - $TXN->delete_related_permanently('Payment'); |
|
| 2789 | - $TXN->delete_related_permanently('Extra_Meta'); |
|
| 2790 | - $TXN->delete_related_permanently('Message'); |
|
| 2791 | - // now we can delete this REG permanently (and the transaction of course) |
|
| 2792 | - $REG->delete_related_permanently('Transaction'); |
|
| 2793 | - return $REG->delete_permanently(); |
|
| 2794 | - } |
|
| 2795 | - |
|
| 2796 | - |
|
| 2797 | - /** |
|
| 2798 | - * generates HTML for the Register New Attendee Admin page |
|
| 2799 | - * |
|
| 2800 | - * @throws DomainException |
|
| 2801 | - * @throws EE_Error |
|
| 2802 | - * @throws InvalidArgumentException |
|
| 2803 | - * @throws InvalidDataTypeException |
|
| 2804 | - * @throws InvalidInterfaceException |
|
| 2805 | - * @throws ReflectionException |
|
| 2806 | - */ |
|
| 2807 | - public function new_registration() |
|
| 2808 | - { |
|
| 2809 | - if (! $this->_set_reg_event()) { |
|
| 2810 | - throw new EE_Error( |
|
| 2811 | - esc_html__( |
|
| 2812 | - 'Unable to continue with registering because there is no Event ID in the request', |
|
| 2813 | - 'event_espresso' |
|
| 2814 | - ) |
|
| 2815 | - ); |
|
| 2816 | - } |
|
| 2817 | - /** @var CurrentPage $current_page */ |
|
| 2818 | - $current_page = $this->loader->getShared(CurrentPage::class); |
|
| 2819 | - $current_page->setEspressoPage(true); |
|
| 2820 | - // gotta start with a clean slate if we're not coming here via ajax |
|
| 2821 | - if ( |
|
| 2822 | - ! $this->request->isAjax() |
|
| 2823 | - && ( |
|
| 2824 | - ! $this->request->requestParamIsSet('processing_registration') |
|
| 2825 | - || $this->request->requestParamIsSet('step_error') |
|
| 2826 | - ) |
|
| 2827 | - ) { |
|
| 2828 | - $this->clearSession(__CLASS__, __FUNCTION__); |
|
| 2829 | - } |
|
| 2830 | - $this->_template_args['event_name'] = ''; |
|
| 2831 | - // event name |
|
| 2832 | - if ($this->_reg_event) { |
|
| 2833 | - $this->_template_args['event_name'] = $this->_reg_event->name(); |
|
| 2834 | - $edit_event_url = self::add_query_args_and_nonce( |
|
| 2835 | - [ |
|
| 2836 | - 'action' => 'edit', |
|
| 2837 | - 'post' => $this->_reg_event->ID(), |
|
| 2838 | - ], |
|
| 2839 | - EVENTS_ADMIN_URL |
|
| 2840 | - ); |
|
| 2841 | - $edit_event_lnk = '<a href="' |
|
| 2842 | - . $edit_event_url |
|
| 2843 | - . '" aria-label="' |
|
| 2844 | - . esc_attr__('Edit ', 'event_espresso') |
|
| 2845 | - . $this->_reg_event->name() |
|
| 2846 | - . '">' |
|
| 2847 | - . esc_html__('Edit Event', 'event_espresso') |
|
| 2848 | - . '</a>'; |
|
| 2849 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' |
|
| 2850 | - . $edit_event_lnk |
|
| 2851 | - . '</span>'; |
|
| 2852 | - } |
|
| 2853 | - $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
|
| 2854 | - if ($this->request->isAjax()) { |
|
| 2855 | - $this->_return_json(); |
|
| 2856 | - } |
|
| 2857 | - // grab header |
|
| 2858 | - $template_path = |
|
| 2859 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
| 2860 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
| 2861 | - $template_path, |
|
| 2862 | - $this->_template_args, |
|
| 2863 | - true |
|
| 2864 | - ); |
|
| 2865 | - // $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 2866 | - // the details template wrapper |
|
| 2867 | - $this->display_admin_page_with_sidebar(); |
|
| 2868 | - } |
|
| 2869 | - |
|
| 2870 | - |
|
| 2871 | - /** |
|
| 2872 | - * This returns the content for a registration step |
|
| 2873 | - * |
|
| 2874 | - * @return string html |
|
| 2875 | - * @throws DomainException |
|
| 2876 | - * @throws EE_Error |
|
| 2877 | - * @throws InvalidArgumentException |
|
| 2878 | - * @throws InvalidDataTypeException |
|
| 2879 | - * @throws InvalidInterfaceException |
|
| 2880 | - * @throws ReflectionException |
|
| 2881 | - */ |
|
| 2882 | - protected function _get_registration_step_content() |
|
| 2883 | - { |
|
| 2884 | - if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
| 2885 | - $warning_msg = sprintf( |
|
| 2886 | - esc_html__( |
|
| 2887 | - '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
|
| 2888 | - 'event_espresso' |
|
| 2889 | - ), |
|
| 2890 | - '<br />', |
|
| 2891 | - '<h3 class="important-notice">', |
|
| 2892 | - '</h3>', |
|
| 2893 | - '<div class="float-right">', |
|
| 2894 | - '<span id="redirect_timer" class="important-notice">30</span>', |
|
| 2895 | - '</div>', |
|
| 2896 | - '<b>', |
|
| 2897 | - '</b>' |
|
| 2898 | - ); |
|
| 2899 | - return ' |
|
| 2312 | + } |
|
| 2313 | + |
|
| 2314 | + |
|
| 2315 | + /** |
|
| 2316 | + * Updates the registration's custom questions according to the form info, if the form is submitted. |
|
| 2317 | + * If it's not a post, the "view_registrations" route will be called next on the SAME request |
|
| 2318 | + * to display the page |
|
| 2319 | + * |
|
| 2320 | + * @return void |
|
| 2321 | + * @throws EE_Error |
|
| 2322 | + * @throws InvalidArgumentException |
|
| 2323 | + * @throws InvalidDataTypeException |
|
| 2324 | + * @throws InvalidInterfaceException |
|
| 2325 | + * @throws ReflectionException |
|
| 2326 | + */ |
|
| 2327 | + protected function _update_attendee_registration_form() |
|
| 2328 | + { |
|
| 2329 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
| 2330 | + if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
| 2331 | + $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 2332 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
| 2333 | + if ($success) { |
|
| 2334 | + $what = esc_html__('Registration Form', 'event_espresso'); |
|
| 2335 | + $route = $REG_ID |
|
| 2336 | + ? ['action' => 'view_registration', '_REG_ID' => $REG_ID] |
|
| 2337 | + : ['action' => 'default']; |
|
| 2338 | + $this->_redirect_after_action(true, $what, esc_html__('updated', 'event_espresso'), $route); |
|
| 2339 | + } |
|
| 2340 | + } |
|
| 2341 | + } |
|
| 2342 | + |
|
| 2343 | + |
|
| 2344 | + /** |
|
| 2345 | + * Gets the form for saving registrations custom questions (if done |
|
| 2346 | + * previously retrieves the cached form object, which may have validation errors in it) |
|
| 2347 | + * |
|
| 2348 | + * @param int $REG_ID |
|
| 2349 | + * @return EE_Registration_Custom_Questions_Form |
|
| 2350 | + * @throws EE_Error |
|
| 2351 | + * @throws InvalidArgumentException |
|
| 2352 | + * @throws InvalidDataTypeException |
|
| 2353 | + * @throws InvalidInterfaceException |
|
| 2354 | + * @throws ReflectionException |
|
| 2355 | + */ |
|
| 2356 | + protected function _get_reg_custom_questions_form($REG_ID) |
|
| 2357 | + { |
|
| 2358 | + if (! $this->_reg_custom_questions_form) { |
|
| 2359 | + require_once(REG_ADMIN . 'form_sections/EE_Registration_Custom_Questions_Form.form.php'); |
|
| 2360 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( |
|
| 2361 | + $this->getRegistrationModel()->get_one_by_ID($REG_ID) |
|
| 2362 | + ); |
|
| 2363 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
| 2364 | + } |
|
| 2365 | + return $this->_reg_custom_questions_form; |
|
| 2366 | + } |
|
| 2367 | + |
|
| 2368 | + |
|
| 2369 | + /** |
|
| 2370 | + * Saves |
|
| 2371 | + * |
|
| 2372 | + * @param bool $REG_ID |
|
| 2373 | + * @return bool |
|
| 2374 | + * @throws EE_Error |
|
| 2375 | + * @throws InvalidArgumentException |
|
| 2376 | + * @throws InvalidDataTypeException |
|
| 2377 | + * @throws InvalidInterfaceException |
|
| 2378 | + * @throws ReflectionException |
|
| 2379 | + */ |
|
| 2380 | + private function _save_reg_custom_questions_form($REG_ID = 0) |
|
| 2381 | + { |
|
| 2382 | + if (! $REG_ID) { |
|
| 2383 | + EE_Error::add_error( |
|
| 2384 | + esc_html__( |
|
| 2385 | + 'An error occurred. No registration ID was received.', |
|
| 2386 | + 'event_espresso' |
|
| 2387 | + ), |
|
| 2388 | + __FILE__, |
|
| 2389 | + __FUNCTION__, |
|
| 2390 | + __LINE__ |
|
| 2391 | + ); |
|
| 2392 | + } |
|
| 2393 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
| 2394 | + $form->receive_form_submission($this->request->requestParams()); |
|
| 2395 | + $success = false; |
|
| 2396 | + if ($form->is_valid()) { |
|
| 2397 | + foreach ($form->subforms() as $question_group_form) { |
|
| 2398 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
| 2399 | + $where_conditions = [ |
|
| 2400 | + 'QST_ID' => $question_id, |
|
| 2401 | + 'REG_ID' => $REG_ID, |
|
| 2402 | + ]; |
|
| 2403 | + $possibly_new_values = [ |
|
| 2404 | + 'ANS_value' => $input->normalized_value(), |
|
| 2405 | + ]; |
|
| 2406 | + $answer = EEM_Answer::instance()->get_one([$where_conditions]); |
|
| 2407 | + if ($answer instanceof EE_Answer) { |
|
| 2408 | + $success = $answer->save($possibly_new_values); |
|
| 2409 | + } else { |
|
| 2410 | + // insert it then |
|
| 2411 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
| 2412 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
| 2413 | + $success = $answer->save(); |
|
| 2414 | + } |
|
| 2415 | + } |
|
| 2416 | + } |
|
| 2417 | + } else { |
|
| 2418 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
| 2419 | + } |
|
| 2420 | + return $success; |
|
| 2421 | + } |
|
| 2422 | + |
|
| 2423 | + |
|
| 2424 | + /** |
|
| 2425 | + * generates HTML for the Registration main meta box |
|
| 2426 | + * |
|
| 2427 | + * @return void |
|
| 2428 | + * @throws DomainException |
|
| 2429 | + * @throws EE_Error |
|
| 2430 | + * @throws InvalidArgumentException |
|
| 2431 | + * @throws InvalidDataTypeException |
|
| 2432 | + * @throws InvalidInterfaceException |
|
| 2433 | + * @throws ReflectionException |
|
| 2434 | + */ |
|
| 2435 | + public function _reg_attendees_meta_box() |
|
| 2436 | + { |
|
| 2437 | + $REG = $this->getRegistrationModel(); |
|
| 2438 | + // get all other registrations on this transaction, and cache |
|
| 2439 | + // the attendees for them so we don't have to run another query using force_join |
|
| 2440 | + $registrations = $REG->get_all( |
|
| 2441 | + [ |
|
| 2442 | + [ |
|
| 2443 | + 'TXN_ID' => $this->_registration->transaction_ID(), |
|
| 2444 | + 'REG_ID' => ['!=', $this->_registration->ID()], |
|
| 2445 | + ], |
|
| 2446 | + 'force_join' => ['Attendee'], |
|
| 2447 | + 'default_where_conditions' => 'other_models_only', |
|
| 2448 | + ] |
|
| 2449 | + ); |
|
| 2450 | + $this->_template_args['attendees'] = []; |
|
| 2451 | + $this->_template_args['attendee_notice'] = ''; |
|
| 2452 | + if ( |
|
| 2453 | + empty($registrations) |
|
| 2454 | + || (is_array($registrations) |
|
| 2455 | + && ! EEH_Array::get_one_item_from_array($registrations)) |
|
| 2456 | + ) { |
|
| 2457 | + EE_Error::add_error( |
|
| 2458 | + esc_html__( |
|
| 2459 | + 'There are no records attached to this registration. Something may have gone wrong with the registration', |
|
| 2460 | + 'event_espresso' |
|
| 2461 | + ), |
|
| 2462 | + __FILE__, |
|
| 2463 | + __FUNCTION__, |
|
| 2464 | + __LINE__ |
|
| 2465 | + ); |
|
| 2466 | + $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
|
| 2467 | + } else { |
|
| 2468 | + $att_nmbr = 1; |
|
| 2469 | + foreach ($registrations as $registration) { |
|
| 2470 | + /* @var $registration EE_Registration */ |
|
| 2471 | + $attendee = $registration->attendee() |
|
| 2472 | + ? $registration->attendee() |
|
| 2473 | + : $this->getAttendeeModel()->create_default_object(); |
|
| 2474 | + $this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID(); |
|
| 2475 | + $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname(); |
|
| 2476 | + $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname(); |
|
| 2477 | + $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email(); |
|
| 2478 | + $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price(); |
|
| 2479 | + $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( |
|
| 2480 | + ', ', |
|
| 2481 | + $attendee->full_address_as_array() |
|
| 2482 | + ); |
|
| 2483 | + $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( |
|
| 2484 | + [ |
|
| 2485 | + 'action' => 'edit_attendee', |
|
| 2486 | + 'post' => $attendee->ID(), |
|
| 2487 | + ], |
|
| 2488 | + REG_ADMIN_URL |
|
| 2489 | + ); |
|
| 2490 | + $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = |
|
| 2491 | + $registration->event_obj() instanceof EE_Event |
|
| 2492 | + ? $registration->event_obj()->name() |
|
| 2493 | + : ''; |
|
| 2494 | + $att_nmbr++; |
|
| 2495 | + } |
|
| 2496 | + $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
|
| 2497 | + } |
|
| 2498 | + $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
| 2499 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
| 2500 | + } |
|
| 2501 | + |
|
| 2502 | + |
|
| 2503 | + /** |
|
| 2504 | + * generates HTML for the Edit Registration side meta box |
|
| 2505 | + * |
|
| 2506 | + * @return void |
|
| 2507 | + * @throws DomainException |
|
| 2508 | + * @throws EE_Error |
|
| 2509 | + * @throws InvalidArgumentException |
|
| 2510 | + * @throws InvalidDataTypeException |
|
| 2511 | + * @throws InvalidInterfaceException |
|
| 2512 | + * @throws ReflectionException |
|
| 2513 | + */ |
|
| 2514 | + public function _reg_registrant_side_meta_box() |
|
| 2515 | + { |
|
| 2516 | + /*@var $attendee EE_Attendee */ |
|
| 2517 | + $att_check = $this->_registration->attendee(); |
|
| 2518 | + $attendee = $att_check instanceof EE_Attendee |
|
| 2519 | + ? $att_check |
|
| 2520 | + : $this->getAttendeeModel()->create_default_object(); |
|
| 2521 | + // now let's determine if this is not the primary registration. If it isn't then we set the |
|
| 2522 | + // primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the |
|
| 2523 | + // primary registration object (that way we know if we need to show create button or not) |
|
| 2524 | + if (! $this->_registration->is_primary_registrant()) { |
|
| 2525 | + $primary_registration = $this->_registration->get_primary_registration(); |
|
| 2526 | + $primary_attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() |
|
| 2527 | + : null; |
|
| 2528 | + if (! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
| 2529 | + // in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own |
|
| 2530 | + // custom attendee object so let's not worry about the primary reg. |
|
| 2531 | + $primary_registration = null; |
|
| 2532 | + } |
|
| 2533 | + } else { |
|
| 2534 | + $primary_registration = null; |
|
| 2535 | + } |
|
| 2536 | + $this->_template_args['ATT_ID'] = $attendee->ID(); |
|
| 2537 | + $this->_template_args['fname'] = $attendee->fname(); |
|
| 2538 | + $this->_template_args['lname'] = $attendee->lname(); |
|
| 2539 | + $this->_template_args['email'] = $attendee->email(); |
|
| 2540 | + $this->_template_args['phone'] = $attendee->phone(); |
|
| 2541 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
| 2542 | + // edit link |
|
| 2543 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
| 2544 | + [ |
|
| 2545 | + 'action' => 'edit_attendee', |
|
| 2546 | + 'post' => $attendee->ID(), |
|
| 2547 | + ], |
|
| 2548 | + REG_ADMIN_URL |
|
| 2549 | + ); |
|
| 2550 | + $this->_template_args['att_edit_title'] = esc_html__('View details for this contact.', 'event_espresso'); |
|
| 2551 | + $this->_template_args['att_edit_label'] = esc_html__('View/Edit Contact', 'event_espresso'); |
|
| 2552 | + // create link |
|
| 2553 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration |
|
| 2554 | + ? EE_Admin_Page::add_query_args_and_nonce( |
|
| 2555 | + [ |
|
| 2556 | + 'action' => 'duplicate_attendee', |
|
| 2557 | + '_REG_ID' => $this->_registration->ID(), |
|
| 2558 | + ], |
|
| 2559 | + REG_ADMIN_URL |
|
| 2560 | + ) : ''; |
|
| 2561 | + $this->_template_args['create_label'] = esc_html__('Create Contact', 'event_espresso'); |
|
| 2562 | + $this->_template_args['att_check'] = $att_check; |
|
| 2563 | + $template_path = |
|
| 2564 | + REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
| 2565 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
| 2566 | + } |
|
| 2567 | + |
|
| 2568 | + |
|
| 2569 | + /** |
|
| 2570 | + * trash or restore registrations |
|
| 2571 | + * |
|
| 2572 | + * @param boolean $trash whether to archive or restore |
|
| 2573 | + * @return void |
|
| 2574 | + * @throws DomainException |
|
| 2575 | + * @throws EE_Error |
|
| 2576 | + * @throws EntityNotFoundException |
|
| 2577 | + * @throws InvalidArgumentException |
|
| 2578 | + * @throws InvalidDataTypeException |
|
| 2579 | + * @throws InvalidInterfaceException |
|
| 2580 | + * @throws ReflectionException |
|
| 2581 | + * @throws RuntimeException |
|
| 2582 | + * @throws UnexpectedEntityException |
|
| 2583 | + */ |
|
| 2584 | + protected function _trash_or_restore_registrations(bool $trash = true) |
|
| 2585 | + { |
|
| 2586 | + // if empty _REG_ID then get out because there's nothing to do |
|
| 2587 | + $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true); |
|
| 2588 | + if (empty($REG_IDs)) { |
|
| 2589 | + EE_Error::add_error( |
|
| 2590 | + sprintf( |
|
| 2591 | + esc_html__( |
|
| 2592 | + 'In order to %1$s registrations you must select which ones you wish to %1$s by clicking the checkboxes.', |
|
| 2593 | + 'event_espresso' |
|
| 2594 | + ), |
|
| 2595 | + $trash ? 'trash' : 'restore' |
|
| 2596 | + ), |
|
| 2597 | + __FILE__, |
|
| 2598 | + __LINE__, |
|
| 2599 | + __FUNCTION__ |
|
| 2600 | + ); |
|
| 2601 | + $this->_redirect_after_action(false, '', '', [], true); |
|
| 2602 | + } |
|
| 2603 | + $success = 0; |
|
| 2604 | + $overwrite_msgs = false; |
|
| 2605 | + // Checkboxes |
|
| 2606 | + $reg_count = count($REG_IDs); |
|
| 2607 | + // cycle thru checkboxes |
|
| 2608 | + foreach ($REG_IDs as $REG_ID) { |
|
| 2609 | + /** @var EE_Registration $REG */ |
|
| 2610 | + $REG = $this->getRegistrationModel()->get_one_by_ID($REG_ID); |
|
| 2611 | + if ($trash) { |
|
| 2612 | + $payments = $REG->registration_payments(); |
|
| 2613 | + if (! empty($payments)) { |
|
| 2614 | + $name = $REG->attendee() instanceof EE_Attendee |
|
| 2615 | + ? $REG->attendee()->full_name() |
|
| 2616 | + : esc_html__('Unknown Attendee', 'event_espresso'); |
|
| 2617 | + $overwrite_msgs = true; |
|
| 2618 | + EE_Error::add_error( |
|
| 2619 | + sprintf( |
|
| 2620 | + esc_html__( |
|
| 2621 | + 'The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', |
|
| 2622 | + 'event_espresso' |
|
| 2623 | + ), |
|
| 2624 | + $name |
|
| 2625 | + ), |
|
| 2626 | + __FILE__, |
|
| 2627 | + __FUNCTION__, |
|
| 2628 | + __LINE__ |
|
| 2629 | + ); |
|
| 2630 | + // can't trash this registration because it has payments. |
|
| 2631 | + continue; |
|
| 2632 | + } |
|
| 2633 | + } |
|
| 2634 | + $updated = $trash ? $REG->delete() : $REG->restore(); |
|
| 2635 | + if ($updated) { |
|
| 2636 | + $success++; |
|
| 2637 | + } |
|
| 2638 | + } |
|
| 2639 | + $this->_redirect_after_action( |
|
| 2640 | + $success === $reg_count, // were ALL registrations affected? |
|
| 2641 | + $success > 1 |
|
| 2642 | + ? esc_html__('Registrations', 'event_espresso') |
|
| 2643 | + : esc_html__('Registration', 'event_espresso'), |
|
| 2644 | + $trash |
|
| 2645 | + ? esc_html__('moved to the trash', 'event_espresso') |
|
| 2646 | + : esc_html__('restored', 'event_espresso'), |
|
| 2647 | + $this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']), |
|
| 2648 | + $overwrite_msgs |
|
| 2649 | + ); |
|
| 2650 | + } |
|
| 2651 | + |
|
| 2652 | + |
|
| 2653 | + /** |
|
| 2654 | + * This is used to permanently delete registrations. Note, this will handle not only deleting permanently the |
|
| 2655 | + * registration but also. |
|
| 2656 | + * 1. Removing relations to EE_Attendee |
|
| 2657 | + * 2. Deleting permanently the related transaction, but ONLY if all related registrations to the transaction are |
|
| 2658 | + * ALSO trashed. |
|
| 2659 | + * 3. Deleting permanently any related Line items but only if the above conditions are met. |
|
| 2660 | + * 4. Removing relationships between all tickets and the related registrations |
|
| 2661 | + * 5. Deleting permanently any related Answers (and the answers for other related registrations that were deleted.) |
|
| 2662 | + * 6. Deleting permanently any related Check-ins. |
|
| 2663 | + * |
|
| 2664 | + * @return void |
|
| 2665 | + * @throws EE_Error |
|
| 2666 | + * @throws InvalidArgumentException |
|
| 2667 | + * @throws InvalidDataTypeException |
|
| 2668 | + * @throws InvalidInterfaceException |
|
| 2669 | + * @throws ReflectionException |
|
| 2670 | + */ |
|
| 2671 | + protected function _delete_registrations() |
|
| 2672 | + { |
|
| 2673 | + $REG_MDL = $this->getRegistrationModel(); |
|
| 2674 | + $success = 0; |
|
| 2675 | + // Checkboxes |
|
| 2676 | + $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true); |
|
| 2677 | + |
|
| 2678 | + if (! empty($REG_IDs)) { |
|
| 2679 | + // if array has more than one element than success message should be plural |
|
| 2680 | + $success = count($REG_IDs) > 1 ? 2 : 1; |
|
| 2681 | + // cycle thru checkboxes |
|
| 2682 | + foreach ($REG_IDs as $REG_ID) { |
|
| 2683 | + $REG = $REG_MDL->get_one_by_ID($REG_ID); |
|
| 2684 | + if (! $REG instanceof EE_Registration) { |
|
| 2685 | + continue; |
|
| 2686 | + } |
|
| 2687 | + $deleted = $this->_delete_registration($REG); |
|
| 2688 | + if (! $deleted) { |
|
| 2689 | + $success = 0; |
|
| 2690 | + } |
|
| 2691 | + } |
|
| 2692 | + } |
|
| 2693 | + |
|
| 2694 | + $what = $success > 1 |
|
| 2695 | + ? esc_html__('Registrations', 'event_espresso') |
|
| 2696 | + : esc_html__('Registration', 'event_espresso'); |
|
| 2697 | + $action_desc = esc_html__('permanently deleted.', 'event_espresso'); |
|
| 2698 | + $this->_redirect_after_action( |
|
| 2699 | + $success, |
|
| 2700 | + $what, |
|
| 2701 | + $action_desc, |
|
| 2702 | + $this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']), |
|
| 2703 | + true |
|
| 2704 | + ); |
|
| 2705 | + } |
|
| 2706 | + |
|
| 2707 | + |
|
| 2708 | + /** |
|
| 2709 | + * handles the permanent deletion of a registration. See comments with _delete_registrations() for details on what |
|
| 2710 | + * models get affected. |
|
| 2711 | + * |
|
| 2712 | + * @param EE_Registration $REG registration to be deleted permanently |
|
| 2713 | + * @return bool true = successful deletion, false = fail. |
|
| 2714 | + * @throws EE_Error |
|
| 2715 | + * @throws InvalidArgumentException |
|
| 2716 | + * @throws InvalidDataTypeException |
|
| 2717 | + * @throws InvalidInterfaceException |
|
| 2718 | + * @throws ReflectionException |
|
| 2719 | + */ |
|
| 2720 | + protected function _delete_registration(EE_Registration $REG) |
|
| 2721 | + { |
|
| 2722 | + // first we start with the transaction... ultimately, we WILL not delete permanently if there are any related |
|
| 2723 | + // registrations on the transaction that are NOT trashed. |
|
| 2724 | + $TXN = $REG->transaction(); |
|
| 2725 | + if (! $TXN instanceof EE_Transaction) { |
|
| 2726 | + EE_Error::add_error( |
|
| 2727 | + sprintf( |
|
| 2728 | + esc_html__( |
|
| 2729 | + 'Unable to permanently delete registration %d because its related transaction has already been deleted. If you can restore the related transaction to the database then this registration can be deleted.', |
|
| 2730 | + 'event_espresso' |
|
| 2731 | + ), |
|
| 2732 | + $REG->id() |
|
| 2733 | + ), |
|
| 2734 | + __FILE__, |
|
| 2735 | + __FUNCTION__, |
|
| 2736 | + __LINE__ |
|
| 2737 | + ); |
|
| 2738 | + return false; |
|
| 2739 | + } |
|
| 2740 | + $REGS = $TXN->get_many_related('Registration'); |
|
| 2741 | + $all_trashed = true; |
|
| 2742 | + foreach ($REGS as $registration) { |
|
| 2743 | + if (! $registration->get('REG_deleted')) { |
|
| 2744 | + $all_trashed = false; |
|
| 2745 | + } |
|
| 2746 | + } |
|
| 2747 | + if (! $all_trashed) { |
|
| 2748 | + EE_Error::add_error( |
|
| 2749 | + esc_html__( |
|
| 2750 | + 'Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', |
|
| 2751 | + 'event_espresso' |
|
| 2752 | + ), |
|
| 2753 | + __FILE__, |
|
| 2754 | + __FUNCTION__, |
|
| 2755 | + __LINE__ |
|
| 2756 | + ); |
|
| 2757 | + return false; |
|
| 2758 | + } |
|
| 2759 | + // k made it here so that means we can delete all the related transactions and their answers (but let's do them |
|
| 2760 | + // separately from THIS one). |
|
| 2761 | + foreach ($REGS as $registration) { |
|
| 2762 | + // delete related answers |
|
| 2763 | + $registration->delete_related_permanently('Answer'); |
|
| 2764 | + // remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
|
| 2765 | + $attendee = $registration->get_first_related('Attendee'); |
|
| 2766 | + if ($attendee instanceof EE_Attendee) { |
|
| 2767 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
| 2768 | + } |
|
| 2769 | + // now remove relationships to tickets on this registration. |
|
| 2770 | + $registration->_remove_relations('Ticket'); |
|
| 2771 | + // now delete permanently the checkins related to this registration. |
|
| 2772 | + $registration->delete_related_permanently('Checkin'); |
|
| 2773 | + if ($registration->ID() === $REG->ID()) { |
|
| 2774 | + continue; |
|
| 2775 | + } //we don't want to delete permanently the existing registration just yet. |
|
| 2776 | + // remove relation to transaction for these registrations if NOT the existing registrations |
|
| 2777 | + $registration->_remove_relations('Transaction'); |
|
| 2778 | + // delete permanently any related messages. |
|
| 2779 | + $registration->delete_related_permanently('Message'); |
|
| 2780 | + // now delete this registration permanently |
|
| 2781 | + $registration->delete_permanently(); |
|
| 2782 | + } |
|
| 2783 | + // now all related registrations on the transaction are handled. So let's just handle this registration itself |
|
| 2784 | + // (the transaction and line items should be all that's left). |
|
| 2785 | + // delete the line items related to the transaction for this registration. |
|
| 2786 | + $TXN->delete_related_permanently('Line_Item'); |
|
| 2787 | + // we need to remove all the relationships on the transaction |
|
| 2788 | + $TXN->delete_related_permanently('Payment'); |
|
| 2789 | + $TXN->delete_related_permanently('Extra_Meta'); |
|
| 2790 | + $TXN->delete_related_permanently('Message'); |
|
| 2791 | + // now we can delete this REG permanently (and the transaction of course) |
|
| 2792 | + $REG->delete_related_permanently('Transaction'); |
|
| 2793 | + return $REG->delete_permanently(); |
|
| 2794 | + } |
|
| 2795 | + |
|
| 2796 | + |
|
| 2797 | + /** |
|
| 2798 | + * generates HTML for the Register New Attendee Admin page |
|
| 2799 | + * |
|
| 2800 | + * @throws DomainException |
|
| 2801 | + * @throws EE_Error |
|
| 2802 | + * @throws InvalidArgumentException |
|
| 2803 | + * @throws InvalidDataTypeException |
|
| 2804 | + * @throws InvalidInterfaceException |
|
| 2805 | + * @throws ReflectionException |
|
| 2806 | + */ |
|
| 2807 | + public function new_registration() |
|
| 2808 | + { |
|
| 2809 | + if (! $this->_set_reg_event()) { |
|
| 2810 | + throw new EE_Error( |
|
| 2811 | + esc_html__( |
|
| 2812 | + 'Unable to continue with registering because there is no Event ID in the request', |
|
| 2813 | + 'event_espresso' |
|
| 2814 | + ) |
|
| 2815 | + ); |
|
| 2816 | + } |
|
| 2817 | + /** @var CurrentPage $current_page */ |
|
| 2818 | + $current_page = $this->loader->getShared(CurrentPage::class); |
|
| 2819 | + $current_page->setEspressoPage(true); |
|
| 2820 | + // gotta start with a clean slate if we're not coming here via ajax |
|
| 2821 | + if ( |
|
| 2822 | + ! $this->request->isAjax() |
|
| 2823 | + && ( |
|
| 2824 | + ! $this->request->requestParamIsSet('processing_registration') |
|
| 2825 | + || $this->request->requestParamIsSet('step_error') |
|
| 2826 | + ) |
|
| 2827 | + ) { |
|
| 2828 | + $this->clearSession(__CLASS__, __FUNCTION__); |
|
| 2829 | + } |
|
| 2830 | + $this->_template_args['event_name'] = ''; |
|
| 2831 | + // event name |
|
| 2832 | + if ($this->_reg_event) { |
|
| 2833 | + $this->_template_args['event_name'] = $this->_reg_event->name(); |
|
| 2834 | + $edit_event_url = self::add_query_args_and_nonce( |
|
| 2835 | + [ |
|
| 2836 | + 'action' => 'edit', |
|
| 2837 | + 'post' => $this->_reg_event->ID(), |
|
| 2838 | + ], |
|
| 2839 | + EVENTS_ADMIN_URL |
|
| 2840 | + ); |
|
| 2841 | + $edit_event_lnk = '<a href="' |
|
| 2842 | + . $edit_event_url |
|
| 2843 | + . '" aria-label="' |
|
| 2844 | + . esc_attr__('Edit ', 'event_espresso') |
|
| 2845 | + . $this->_reg_event->name() |
|
| 2846 | + . '">' |
|
| 2847 | + . esc_html__('Edit Event', 'event_espresso') |
|
| 2848 | + . '</a>'; |
|
| 2849 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' |
|
| 2850 | + . $edit_event_lnk |
|
| 2851 | + . '</span>'; |
|
| 2852 | + } |
|
| 2853 | + $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
|
| 2854 | + if ($this->request->isAjax()) { |
|
| 2855 | + $this->_return_json(); |
|
| 2856 | + } |
|
| 2857 | + // grab header |
|
| 2858 | + $template_path = |
|
| 2859 | + REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
| 2860 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
| 2861 | + $template_path, |
|
| 2862 | + $this->_template_args, |
|
| 2863 | + true |
|
| 2864 | + ); |
|
| 2865 | + // $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 2866 | + // the details template wrapper |
|
| 2867 | + $this->display_admin_page_with_sidebar(); |
|
| 2868 | + } |
|
| 2869 | + |
|
| 2870 | + |
|
| 2871 | + /** |
|
| 2872 | + * This returns the content for a registration step |
|
| 2873 | + * |
|
| 2874 | + * @return string html |
|
| 2875 | + * @throws DomainException |
|
| 2876 | + * @throws EE_Error |
|
| 2877 | + * @throws InvalidArgumentException |
|
| 2878 | + * @throws InvalidDataTypeException |
|
| 2879 | + * @throws InvalidInterfaceException |
|
| 2880 | + * @throws ReflectionException |
|
| 2881 | + */ |
|
| 2882 | + protected function _get_registration_step_content() |
|
| 2883 | + { |
|
| 2884 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
| 2885 | + $warning_msg = sprintf( |
|
| 2886 | + esc_html__( |
|
| 2887 | + '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
|
| 2888 | + 'event_espresso' |
|
| 2889 | + ), |
|
| 2890 | + '<br />', |
|
| 2891 | + '<h3 class="important-notice">', |
|
| 2892 | + '</h3>', |
|
| 2893 | + '<div class="float-right">', |
|
| 2894 | + '<span id="redirect_timer" class="important-notice">30</span>', |
|
| 2895 | + '</div>', |
|
| 2896 | + '<b>', |
|
| 2897 | + '</b>' |
|
| 2898 | + ); |
|
| 2899 | + return ' |
|
| 2900 | 2900 | <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
| 2901 | 2901 | <script > |
| 2902 | 2902 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
@@ -2909,958 +2909,958 @@ discard block |
||
| 2909 | 2909 | } |
| 2910 | 2910 | }, 800 ); |
| 2911 | 2911 | </script >'; |
| 2912 | - } |
|
| 2913 | - $template_args = [ |
|
| 2914 | - 'title' => '', |
|
| 2915 | - 'content' => '', |
|
| 2916 | - 'step_button_text' => '', |
|
| 2917 | - 'show_notification_toggle' => false, |
|
| 2918 | - ]; |
|
| 2919 | - // to indicate we're processing a new registration |
|
| 2920 | - $hidden_fields = [ |
|
| 2921 | - 'processing_registration' => [ |
|
| 2922 | - 'type' => 'hidden', |
|
| 2923 | - 'value' => 0, |
|
| 2924 | - ], |
|
| 2925 | - 'event_id' => [ |
|
| 2926 | - 'type' => 'hidden', |
|
| 2927 | - 'value' => $this->_reg_event->ID(), |
|
| 2928 | - ], |
|
| 2929 | - ]; |
|
| 2930 | - // if the cart is empty then we know we're at step one, so we'll display the ticket selector |
|
| 2931 | - $cart = $this->getCart(); |
|
| 2932 | - $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
|
| 2933 | - switch ($step) { |
|
| 2934 | - case 'ticket': |
|
| 2935 | - $hidden_fields['processing_registration']['value'] = 1; |
|
| 2936 | - $template_args['title'] = esc_html__( |
|
| 2937 | - 'Step One: Select the Ticket for this registration', |
|
| 2938 | - 'event_espresso' |
|
| 2939 | - ); |
|
| 2940 | - $template_args['content'] = |
|
| 2941 | - EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
| 2942 | - $template_args['content'] .= '</div>'; |
|
| 2943 | - $template_args['step_button_text'] = esc_html__( |
|
| 2944 | - 'Add Tickets and Continue to Registrant Details', |
|
| 2945 | - 'event_espresso' |
|
| 2946 | - ); |
|
| 2947 | - $template_args['show_notification_toggle'] = false; |
|
| 2948 | - break; |
|
| 2949 | - case 'questions': |
|
| 2950 | - $hidden_fields['processing_registration']['value'] = 2; |
|
| 2951 | - $template_args['title'] = esc_html__( |
|
| 2952 | - 'Step Two: Add Registrant Details for this Registration', |
|
| 2953 | - 'event_espresso' |
|
| 2954 | - ); |
|
| 2955 | - // in theory, we should be able to run EED_SPCO at this point |
|
| 2956 | - // because the cart should have been set up properly by the first process_reg_step run. |
|
| 2957 | - $template_args['content'] = |
|
| 2958 | - EED_Single_Page_Checkout::registration_checkout_for_admin(); |
|
| 2959 | - $template_args['step_button_text'] = esc_html__( |
|
| 2960 | - 'Save Registration and Continue to Details', |
|
| 2961 | - 'event_espresso' |
|
| 2962 | - ); |
|
| 2963 | - $template_args['show_notification_toggle'] = true; |
|
| 2964 | - break; |
|
| 2965 | - } |
|
| 2966 | - // we come back to the process_registration_step route. |
|
| 2967 | - $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); |
|
| 2968 | - return EEH_Template::display_template( |
|
| 2969 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', |
|
| 2970 | - $template_args, |
|
| 2971 | - true |
|
| 2972 | - ); |
|
| 2973 | - } |
|
| 2974 | - |
|
| 2975 | - |
|
| 2976 | - /** |
|
| 2977 | - * set_reg_event |
|
| 2978 | - * |
|
| 2979 | - * @return bool |
|
| 2980 | - * @throws EE_Error |
|
| 2981 | - * @throws InvalidArgumentException |
|
| 2982 | - * @throws InvalidDataTypeException |
|
| 2983 | - * @throws InvalidInterfaceException |
|
| 2984 | - * @throws ReflectionException |
|
| 2985 | - */ |
|
| 2986 | - private function _set_reg_event() |
|
| 2987 | - { |
|
| 2988 | - if (is_object($this->_reg_event)) { |
|
| 2989 | - return true; |
|
| 2990 | - } |
|
| 2991 | - |
|
| 2992 | - $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int'); |
|
| 2993 | - if (! $EVT_ID) { |
|
| 2994 | - return false; |
|
| 2995 | - } |
|
| 2996 | - $this->_reg_event = $this->getEventModel()->get_one_by_ID($EVT_ID); |
|
| 2997 | - return true; |
|
| 2998 | - } |
|
| 2999 | - |
|
| 3000 | - |
|
| 3001 | - /** |
|
| 3002 | - * process_reg_step |
|
| 3003 | - * |
|
| 3004 | - * @return void |
|
| 3005 | - * @throws DomainException |
|
| 3006 | - * @throws EE_Error |
|
| 3007 | - * @throws InvalidArgumentException |
|
| 3008 | - * @throws InvalidDataTypeException |
|
| 3009 | - * @throws InvalidInterfaceException |
|
| 3010 | - * @throws ReflectionException |
|
| 3011 | - * @throws RuntimeException |
|
| 3012 | - */ |
|
| 3013 | - public function process_reg_step() |
|
| 3014 | - { |
|
| 3015 | - EE_System::do_not_cache(); |
|
| 3016 | - $this->_set_reg_event(); |
|
| 3017 | - /** @var CurrentPage $current_page */ |
|
| 3018 | - $current_page = $this->loader->getShared(CurrentPage::class); |
|
| 3019 | - $current_page->setEspressoPage(true); |
|
| 3020 | - $this->request->setRequestParam('uts', time()); |
|
| 3021 | - // what step are we on? |
|
| 3022 | - $cart = $this->getCart(); |
|
| 3023 | - $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
|
| 3024 | - // if doing ajax then we need to verify the nonce |
|
| 3025 | - if ($this->request->isAjax()) { |
|
| 3026 | - $nonce = $this->request->getRequestParam($this->_req_nonce, ''); |
|
| 3027 | - $this->_verify_nonce($nonce, $this->_req_nonce); |
|
| 3028 | - } |
|
| 3029 | - switch ($step) { |
|
| 3030 | - case 'ticket': |
|
| 3031 | - // process ticket selection |
|
| 3032 | - $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
|
| 3033 | - if ($success) { |
|
| 3034 | - EE_Error::add_success( |
|
| 3035 | - esc_html__( |
|
| 3036 | - 'Tickets Selected. Now complete the registration.', |
|
| 3037 | - 'event_espresso' |
|
| 3038 | - ) |
|
| 3039 | - ); |
|
| 3040 | - } else { |
|
| 3041 | - $this->request->setRequestParam('step_error', true); |
|
| 3042 | - $query_args['step_error'] = $this->request->getRequestParam('step_error', true, 'bool'); |
|
| 3043 | - } |
|
| 3044 | - if ($this->request->isAjax()) { |
|
| 3045 | - $this->new_registration(); // display next step |
|
| 3046 | - } else { |
|
| 3047 | - $query_args = [ |
|
| 3048 | - 'action' => 'new_registration', |
|
| 3049 | - 'processing_registration' => 1, |
|
| 3050 | - 'event_id' => $this->_reg_event->ID(), |
|
| 3051 | - 'uts' => time(), |
|
| 3052 | - ]; |
|
| 3053 | - $this->_redirect_after_action( |
|
| 3054 | - false, |
|
| 3055 | - '', |
|
| 3056 | - '', |
|
| 3057 | - $query_args, |
|
| 3058 | - true |
|
| 3059 | - ); |
|
| 3060 | - } |
|
| 3061 | - break; |
|
| 3062 | - case 'questions': |
|
| 3063 | - if (! $this->request->requestParamIsSet('txn_reg_status_change[send_notifications]')) { |
|
| 3064 | - add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
| 3065 | - } |
|
| 3066 | - // process registration |
|
| 3067 | - $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
|
| 3068 | - if ($cart instanceof EE_Cart) { |
|
| 3069 | - $grand_total = $cart->get_grand_total(); |
|
| 3070 | - if ($grand_total instanceof EE_Line_Item) { |
|
| 3071 | - $grand_total->save_this_and_descendants_to_txn(); |
|
| 3072 | - } |
|
| 3073 | - } |
|
| 3074 | - if (! $transaction instanceof EE_Transaction) { |
|
| 3075 | - $query_args = [ |
|
| 3076 | - 'action' => 'new_registration', |
|
| 3077 | - 'processing_registration' => 2, |
|
| 3078 | - 'event_id' => $this->_reg_event->ID(), |
|
| 3079 | - 'uts' => time(), |
|
| 3080 | - ]; |
|
| 3081 | - if ($this->request->isAjax()) { |
|
| 3082 | - // display registration form again because there are errors (maybe validation?) |
|
| 3083 | - $this->new_registration(); |
|
| 3084 | - return; |
|
| 3085 | - } |
|
| 3086 | - $this->_redirect_after_action( |
|
| 3087 | - false, |
|
| 3088 | - '', |
|
| 3089 | - '', |
|
| 3090 | - $query_args, |
|
| 3091 | - true |
|
| 3092 | - ); |
|
| 3093 | - return; |
|
| 3094 | - } |
|
| 3095 | - // maybe update status, and make sure to save transaction if not done already |
|
| 3096 | - if (! $transaction->update_status_based_on_total_paid()) { |
|
| 3097 | - $transaction->save(); |
|
| 3098 | - } |
|
| 3099 | - $this->clearSession(__CLASS__, __FUNCTION__); |
|
| 3100 | - $query_args = [ |
|
| 3101 | - 'action' => 'redirect_to_txn', |
|
| 3102 | - 'TXN_ID' => $transaction->ID(), |
|
| 3103 | - 'EVT_ID' => $this->_reg_event->ID(), |
|
| 3104 | - 'event_name' => urlencode($this->_reg_event->name()), |
|
| 3105 | - 'redirect_from' => 'new_registration', |
|
| 3106 | - ]; |
|
| 3107 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
| 3108 | - break; |
|
| 3109 | - } |
|
| 3110 | - // what are you looking here for? Should be nothing to do at this point. |
|
| 3111 | - } |
|
| 3112 | - |
|
| 3113 | - |
|
| 3114 | - /** |
|
| 3115 | - * redirect_to_txn |
|
| 3116 | - * |
|
| 3117 | - * @return void |
|
| 3118 | - * @throws EE_Error |
|
| 3119 | - * @throws InvalidArgumentException |
|
| 3120 | - * @throws InvalidDataTypeException |
|
| 3121 | - * @throws InvalidInterfaceException |
|
| 3122 | - * @throws ReflectionException |
|
| 3123 | - */ |
|
| 3124 | - public function redirect_to_txn() |
|
| 3125 | - { |
|
| 3126 | - EE_System::do_not_cache(); |
|
| 3127 | - $this->clearSession(__CLASS__, __FUNCTION__); |
|
| 3128 | - $query_args = [ |
|
| 3129 | - 'action' => 'view_transaction', |
|
| 3130 | - 'TXN_ID' => $this->request->getRequestParam('TXN_ID', 0, 'int'), |
|
| 3131 | - 'page' => 'espresso_transactions', |
|
| 3132 | - ]; |
|
| 3133 | - if ($this->request->requestParamIsSet('EVT_ID') && $this->request->requestParamIsSet('redirect_from')) { |
|
| 3134 | - $query_args['EVT_ID'] = $this->request->getRequestParam('EVT_ID', 0, 'int'); |
|
| 3135 | - $query_args['event_name'] = urlencode($this->request->getRequestParam('event_name')); |
|
| 3136 | - $query_args['redirect_from'] = $this->request->getRequestParam('redirect_from'); |
|
| 3137 | - } |
|
| 3138 | - EE_Error::add_success( |
|
| 3139 | - esc_html__( |
|
| 3140 | - 'Registration Created. Please review the transaction and add any payments as necessary', |
|
| 3141 | - 'event_espresso' |
|
| 3142 | - ) |
|
| 3143 | - ); |
|
| 3144 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
| 3145 | - } |
|
| 3146 | - |
|
| 3147 | - |
|
| 3148 | - /** |
|
| 3149 | - * generates HTML for the Attendee Contact List |
|
| 3150 | - * |
|
| 3151 | - * @return void |
|
| 3152 | - * @throws DomainException |
|
| 3153 | - * @throws EE_Error |
|
| 3154 | - */ |
|
| 3155 | - protected function _attendee_contact_list_table() |
|
| 3156 | - { |
|
| 3157 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3158 | - $this->_search_btn_label = esc_html__('Contacts', 'event_espresso'); |
|
| 3159 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
| 3160 | - } |
|
| 3161 | - |
|
| 3162 | - |
|
| 3163 | - /** |
|
| 3164 | - * get_attendees |
|
| 3165 | - * |
|
| 3166 | - * @param $per_page |
|
| 3167 | - * @param bool $count whether to return count or data. |
|
| 3168 | - * @param bool $trash |
|
| 3169 | - * @return array|int |
|
| 3170 | - * @throws EE_Error |
|
| 3171 | - * @throws InvalidArgumentException |
|
| 3172 | - * @throws InvalidDataTypeException |
|
| 3173 | - * @throws InvalidInterfaceException |
|
| 3174 | - * @throws ReflectionException |
|
| 3175 | - */ |
|
| 3176 | - public function get_attendees($per_page, $count = false, $trash = false) |
|
| 3177 | - { |
|
| 3178 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3179 | - require_once(REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php'); |
|
| 3180 | - $orderby = $this->request->getRequestParam('orderby'); |
|
| 3181 | - switch ($orderby) { |
|
| 3182 | - case 'ATT_ID': |
|
| 3183 | - case 'ATT_fname': |
|
| 3184 | - case 'ATT_email': |
|
| 3185 | - case 'ATT_city': |
|
| 3186 | - case 'STA_ID': |
|
| 3187 | - case 'CNT_ID': |
|
| 3188 | - break; |
|
| 3189 | - case 'Registration_Count': |
|
| 3190 | - $orderby = 'Registration_Count'; |
|
| 3191 | - break; |
|
| 3192 | - default: |
|
| 3193 | - $orderby = 'ATT_lname'; |
|
| 3194 | - } |
|
| 3195 | - $sort = $this->request->getRequestParam('order', 'ASC'); |
|
| 3196 | - $current_page = $this->request->getRequestParam('paged', 1, 'int'); |
|
| 3197 | - $per_page = absint($per_page) ? $per_page : 10; |
|
| 3198 | - $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); |
|
| 3199 | - $_where = []; |
|
| 3200 | - $search_term = $this->request->getRequestParam('s'); |
|
| 3201 | - if ($search_term) { |
|
| 3202 | - $search_term = '%' . $search_term . '%'; |
|
| 3203 | - $_where['OR'] = [ |
|
| 3204 | - 'Registration.Event.EVT_name' => ['LIKE', $search_term], |
|
| 3205 | - 'Registration.Event.EVT_desc' => ['LIKE', $search_term], |
|
| 3206 | - 'Registration.Event.EVT_short_desc' => ['LIKE', $search_term], |
|
| 3207 | - 'ATT_fname' => ['LIKE', $search_term], |
|
| 3208 | - 'ATT_lname' => ['LIKE', $search_term], |
|
| 3209 | - 'ATT_short_bio' => ['LIKE', $search_term], |
|
| 3210 | - 'ATT_email' => ['LIKE', $search_term], |
|
| 3211 | - 'ATT_address' => ['LIKE', $search_term], |
|
| 3212 | - 'ATT_address2' => ['LIKE', $search_term], |
|
| 3213 | - 'ATT_city' => ['LIKE', $search_term], |
|
| 3214 | - 'Country.CNT_name' => ['LIKE', $search_term], |
|
| 3215 | - 'State.STA_name' => ['LIKE', $search_term], |
|
| 3216 | - 'ATT_phone' => ['LIKE', $search_term], |
|
| 3217 | - 'Registration.REG_final_price' => ['LIKE', $search_term], |
|
| 3218 | - 'Registration.REG_code' => ['LIKE', $search_term], |
|
| 3219 | - 'Registration.REG_group_size' => ['LIKE', $search_term], |
|
| 3220 | - ]; |
|
| 3221 | - } |
|
| 3222 | - $offset = ($current_page - 1) * $per_page; |
|
| 3223 | - $limit = $count ? null : [$offset, $per_page]; |
|
| 3224 | - $query_args = [ |
|
| 3225 | - $_where, |
|
| 3226 | - 'extra_selects' => ['Registration_Count' => ['Registration.REG_ID', 'count', '%d']], |
|
| 3227 | - 'limit' => $limit, |
|
| 3228 | - ]; |
|
| 3229 | - if (! $count) { |
|
| 3230 | - $query_args['order_by'] = [$orderby => $sort]; |
|
| 3231 | - } |
|
| 3232 | - $query_args[0]['status'] = $trash ? ['!=', 'publish'] : ['IN', ['publish']]; |
|
| 3233 | - return $count |
|
| 3234 | - ? $this->getAttendeeModel()->count($query_args, 'ATT_ID', true) |
|
| 3235 | - : $this->getAttendeeModel()->get_all($query_args); |
|
| 3236 | - } |
|
| 3237 | - |
|
| 3238 | - |
|
| 3239 | - /** |
|
| 3240 | - * This is just taking care of resending the registration confirmation |
|
| 3241 | - * |
|
| 3242 | - * @return void |
|
| 3243 | - * @throws EE_Error |
|
| 3244 | - * @throws InvalidArgumentException |
|
| 3245 | - * @throws InvalidDataTypeException |
|
| 3246 | - * @throws InvalidInterfaceException |
|
| 3247 | - * @throws ReflectionException |
|
| 3248 | - */ |
|
| 3249 | - protected function _resend_registration() |
|
| 3250 | - { |
|
| 3251 | - $this->_process_resend_registration(); |
|
| 3252 | - $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 3253 | - $redirect_to = $this->request->getRequestParam('redirect_to'); |
|
| 3254 | - $query_args = $redirect_to |
|
| 3255 | - ? ['action' => $redirect_to, '_REG_ID' => $REG_ID] |
|
| 3256 | - : ['action' => 'default']; |
|
| 3257 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
| 3258 | - } |
|
| 3259 | - |
|
| 3260 | - |
|
| 3261 | - /** |
|
| 3262 | - * Creates a registration report, but accepts the name of a method to use for preparing the query parameters |
|
| 3263 | - * to use when selecting registrations |
|
| 3264 | - * |
|
| 3265 | - * @param string $method_name_for_getting_query_params the name of the method (on this class) to use for preparing |
|
| 3266 | - * the query parameters from the request |
|
| 3267 | - * @return void ends the request with a redirect or download |
|
| 3268 | - */ |
|
| 3269 | - public function _registrations_report_base(string $method_name_for_getting_query_params) |
|
| 3270 | - { |
|
| 3271 | - $EVT_ID = $this->request->requestParamIsSet('EVT_ID') |
|
| 3272 | - ? $this->request->getRequestParam('EVT_ID', 0, DataType::INT) |
|
| 3273 | - : null; |
|
| 3274 | - if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
| 3275 | - $return_url = $this->request->getRequestParam('return_url', '', DataType::URL); |
|
| 3276 | - $filters = $this->request->getRequestParam('filters', [], DataType::STRING, true); |
|
| 3277 | - $report_params = $this->$method_name_for_getting_query_params($filters); |
|
| 3278 | - $report_params = $this->convertDatetimeObjectsToStrings($report_params); |
|
| 3279 | - $use_filters = $this->request->getRequestParam('use_filters', false, DataType::BOOL); |
|
| 3280 | - wp_redirect( |
|
| 3281 | - EE_Admin_Page::add_query_args_and_nonce( |
|
| 3282 | - [ |
|
| 3283 | - 'page' => EED_Batch::PAGE_SLUG, |
|
| 3284 | - 'batch' => EED_Batch::batch_file_job, |
|
| 3285 | - 'EVT_ID' => $EVT_ID, |
|
| 3286 | - 'filters' => urlencode(serialize($report_params)), |
|
| 3287 | - 'use_filters' => urlencode($use_filters), |
|
| 3288 | - 'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\RegistrationsReport'), |
|
| 3289 | - 'return_url' => urlencode($return_url), |
|
| 3290 | - ] |
|
| 3291 | - ) |
|
| 3292 | - ); |
|
| 3293 | - } else { |
|
| 3294 | - // Pull the current request params |
|
| 3295 | - $request_args = $this->request->requestParams(); |
|
| 3296 | - $request_args = $this->convertDatetimeObjectsToStrings($request_args); |
|
| 3297 | - // Set the required request_args to be passed to the export |
|
| 3298 | - $required_request_args = [ |
|
| 3299 | - 'export' => 'report', |
|
| 3300 | - 'action' => 'registrations_report_for_event', |
|
| 3301 | - 'EVT_ID' => $EVT_ID, |
|
| 3302 | - ]; |
|
| 3303 | - // Merge required request args, overriding any currently set |
|
| 3304 | - $request_args = array_merge($request_args, $required_request_args); |
|
| 3305 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 3306 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 3307 | - $EE_Export = EE_Export::instance($request_args); |
|
| 3308 | - $EE_Export->export(); |
|
| 3309 | - } |
|
| 3310 | - } |
|
| 3311 | - } |
|
| 3312 | - |
|
| 3313 | - |
|
| 3314 | - /** |
|
| 3315 | - * recursively convert Datetime objects in query params array to strings using MySQL format |
|
| 3316 | - * |
|
| 3317 | - * @param array $query_params |
|
| 3318 | - * @return array |
|
| 3319 | - * @since 5.0.19.p |
|
| 3320 | - */ |
|
| 3321 | - private function convertDatetimeObjectsToStrings(array $query_params): array |
|
| 3322 | - { |
|
| 3323 | - foreach ($query_params as $key => $value) { |
|
| 3324 | - if (is_array($value)) { |
|
| 3325 | - $query_params[$key] = $this->convertDatetimeObjectsToStrings($value); |
|
| 3326 | - } elseif ($value instanceof DateTime) { |
|
| 3327 | - $query_params[$key] = $value->format('Y-m-d H:i:s'); |
|
| 3328 | - } |
|
| 3329 | - } |
|
| 3330 | - return $query_params; |
|
| 3331 | - } |
|
| 3332 | - |
|
| 3333 | - |
|
| 3334 | - /** |
|
| 3335 | - * Creates a registration report using only query parameters in the request |
|
| 3336 | - * |
|
| 3337 | - * @return void |
|
| 3338 | - */ |
|
| 3339 | - public function _registrations_report() |
|
| 3340 | - { |
|
| 3341 | - $this->_registrations_report_base('_get_registration_query_parameters'); |
|
| 3342 | - } |
|
| 3343 | - |
|
| 3344 | - |
|
| 3345 | - public function _contact_list_export() |
|
| 3346 | - { |
|
| 3347 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 3348 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 3349 | - $EE_Export = EE_Export::instance($this->request->requestParams()); |
|
| 3350 | - $EE_Export->export_attendees(); |
|
| 3351 | - } |
|
| 3352 | - } |
|
| 3353 | - |
|
| 3354 | - |
|
| 3355 | - public function _contact_list_report() |
|
| 3356 | - { |
|
| 3357 | - if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
| 3358 | - wp_redirect( |
|
| 3359 | - EE_Admin_Page::add_query_args_and_nonce( |
|
| 3360 | - [ |
|
| 3361 | - 'page' => EED_Batch::PAGE_SLUG, |
|
| 3362 | - 'batch' => EED_Batch::batch_file_job, |
|
| 3363 | - 'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\AttendeesReport'), |
|
| 3364 | - 'return_url' => urlencode($this->request->getRequestParam('return_url', '', DataType::URL)), |
|
| 3365 | - ] |
|
| 3366 | - ) |
|
| 3367 | - ); |
|
| 3368 | - } else { |
|
| 3369 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 3370 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 3371 | - $EE_Export = EE_Export::instance($this->request->requestParams()); |
|
| 3372 | - $EE_Export->report_attendees(); |
|
| 3373 | - } |
|
| 3374 | - } |
|
| 3375 | - } |
|
| 3376 | - |
|
| 3377 | - |
|
| 3378 | - |
|
| 3379 | - |
|
| 3380 | - |
|
| 3381 | - /*************************************** ATTENDEE DETAILS ***************************************/ |
|
| 3382 | - /** |
|
| 3383 | - * This duplicates the attendee object for the given incoming registration id and attendee_id. |
|
| 3384 | - * |
|
| 3385 | - * @return void |
|
| 3386 | - * @throws EE_Error |
|
| 3387 | - * @throws InvalidArgumentException |
|
| 3388 | - * @throws InvalidDataTypeException |
|
| 3389 | - * @throws InvalidInterfaceException |
|
| 3390 | - * @throws ReflectionException |
|
| 3391 | - */ |
|
| 3392 | - protected function _duplicate_attendee() |
|
| 3393 | - { |
|
| 3394 | - $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 3395 | - $action = $this->request->getRequestParam('return', 'default'); |
|
| 3396 | - // verify we have necessary info |
|
| 3397 | - if (! $REG_ID) { |
|
| 3398 | - EE_Error::add_error( |
|
| 3399 | - esc_html__( |
|
| 3400 | - 'Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', |
|
| 3401 | - 'event_espresso' |
|
| 3402 | - ), |
|
| 3403 | - __FILE__, |
|
| 3404 | - __LINE__, |
|
| 3405 | - __FUNCTION__ |
|
| 3406 | - ); |
|
| 3407 | - $query_args = ['action' => $action]; |
|
| 3408 | - $this->_redirect_after_action('', '', '', $query_args, true); |
|
| 3409 | - } |
|
| 3410 | - // okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
|
| 3411 | - $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID); |
|
| 3412 | - if (! $registration instanceof EE_Registration) { |
|
| 3413 | - throw new RuntimeException( |
|
| 3414 | - sprintf( |
|
| 3415 | - esc_html__( |
|
| 3416 | - 'Unable to create the contact because a valid registration could not be retrieved for REG ID: %1$d', |
|
| 3417 | - 'event_espresso' |
|
| 3418 | - ), |
|
| 3419 | - $REG_ID |
|
| 3420 | - ) |
|
| 3421 | - ); |
|
| 3422 | - } |
|
| 3423 | - $attendee = $registration->attendee(); |
|
| 3424 | - // remove relation of existing attendee on registration |
|
| 3425 | - $registration->_remove_relation_to($attendee, 'Attendee'); |
|
| 3426 | - // new attendee |
|
| 3427 | - $new_attendee = clone $attendee; |
|
| 3428 | - $new_attendee->set('ATT_ID', 0); |
|
| 3429 | - $new_attendee->save(); |
|
| 3430 | - // add new attendee to reg |
|
| 3431 | - $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
| 3432 | - EE_Error::add_success( |
|
| 3433 | - esc_html__( |
|
| 3434 | - 'New Contact record created. Now make any edits you wish to make for this contact.', |
|
| 3435 | - 'event_espresso' |
|
| 3436 | - ) |
|
| 3437 | - ); |
|
| 3438 | - // redirect to edit page for attendee |
|
| 3439 | - $query_args = ['post' => $new_attendee->ID(), 'action' => 'edit_attendee']; |
|
| 3440 | - $this->_redirect_after_action('', '', '', $query_args, true); |
|
| 3441 | - } |
|
| 3442 | - |
|
| 3443 | - |
|
| 3444 | - /** |
|
| 3445 | - * Callback invoked by parent EE_Admin_CPT class hooked in on `save_post` wp hook. |
|
| 3446 | - * |
|
| 3447 | - * @param int $post_id |
|
| 3448 | - * @param WP_Post $post |
|
| 3449 | - * @throws DomainException |
|
| 3450 | - * @throws EE_Error |
|
| 3451 | - * @throws InvalidArgumentException |
|
| 3452 | - * @throws InvalidDataTypeException |
|
| 3453 | - * @throws InvalidInterfaceException |
|
| 3454 | - * @throws LogicException |
|
| 3455 | - * @throws InvalidFormSubmissionException |
|
| 3456 | - * @throws ReflectionException |
|
| 3457 | - */ |
|
| 3458 | - protected function _insert_update_cpt_item($post_id, $post) |
|
| 3459 | - { |
|
| 3460 | - $success = true; |
|
| 3461 | - $attendee = $post instanceof WP_Post && $post->post_type === EspressoPostType::ATTENDEES |
|
| 3462 | - ? $this->getAttendeeModel()->get_one_by_ID($post_id) |
|
| 3463 | - : null; |
|
| 3464 | - // for attendee updates |
|
| 3465 | - if ($attendee instanceof EE_Attendee) { |
|
| 3466 | - // note we should only be UPDATING attendees at this point. |
|
| 3467 | - $fname = $this->request->getRequestParam('ATT_fname', ''); |
|
| 3468 | - $lname = $this->request->getRequestParam('ATT_lname', ''); |
|
| 3469 | - $updated_fields = [ |
|
| 3470 | - 'ATT_fname' => $fname, |
|
| 3471 | - 'ATT_lname' => $lname, |
|
| 3472 | - 'ATT_full_name' => "{$fname} {$lname}", |
|
| 3473 | - 'ATT_address' => $this->request->getRequestParam('ATT_address', ''), |
|
| 3474 | - 'ATT_address2' => $this->request->getRequestParam('ATT_address2', ''), |
|
| 3475 | - 'ATT_city' => $this->request->getRequestParam('ATT_city', ''), |
|
| 3476 | - 'STA_ID' => $this->request->getRequestParam('STA_ID', ''), |
|
| 3477 | - 'CNT_ISO' => $this->request->getRequestParam('CNT_ISO', ''), |
|
| 3478 | - 'ATT_zip' => $this->request->getRequestParam('ATT_zip', ''), |
|
| 3479 | - ]; |
|
| 3480 | - foreach ($updated_fields as $field => $value) { |
|
| 3481 | - $attendee->set($field, $value); |
|
| 3482 | - } |
|
| 3483 | - |
|
| 3484 | - // process contact details metabox form handler (which will also save the attendee) |
|
| 3485 | - $contact_details_form = $this->getAttendeeContactDetailsMetaboxFormHandler($attendee); |
|
| 3486 | - $success = $contact_details_form->process($this->request->requestParams()); |
|
| 3487 | - |
|
| 3488 | - $attendee_update_callbacks = apply_filters( |
|
| 3489 | - 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', |
|
| 3490 | - [] |
|
| 3491 | - ); |
|
| 3492 | - foreach ($attendee_update_callbacks as $a_callback) { |
|
| 3493 | - if (false === call_user_func_array($a_callback, [$attendee, $this->request->requestParams()])) { |
|
| 3494 | - throw new EE_Error( |
|
| 3495 | - sprintf( |
|
| 3496 | - esc_html__( |
|
| 3497 | - 'The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', |
|
| 3498 | - 'event_espresso' |
|
| 3499 | - ), |
|
| 3500 | - $a_callback |
|
| 3501 | - ) |
|
| 3502 | - ); |
|
| 3503 | - } |
|
| 3504 | - } |
|
| 3505 | - } |
|
| 3506 | - |
|
| 3507 | - if ($success === false) { |
|
| 3508 | - EE_Error::add_error( |
|
| 3509 | - esc_html__( |
|
| 3510 | - 'Something went wrong with updating the meta table data for the registration.', |
|
| 3511 | - 'event_espresso' |
|
| 3512 | - ), |
|
| 3513 | - __FILE__, |
|
| 3514 | - __FUNCTION__, |
|
| 3515 | - __LINE__ |
|
| 3516 | - ); |
|
| 3517 | - } |
|
| 3518 | - } |
|
| 3519 | - |
|
| 3520 | - |
|
| 3521 | - public function trash_cpt_item($post_id) |
|
| 3522 | - { |
|
| 3523 | - } |
|
| 3524 | - |
|
| 3525 | - |
|
| 3526 | - public function delete_cpt_item($post_id) |
|
| 3527 | - { |
|
| 3528 | - } |
|
| 3529 | - |
|
| 3530 | - |
|
| 3531 | - public function restore_cpt_item($post_id) |
|
| 3532 | - { |
|
| 3533 | - } |
|
| 3534 | - |
|
| 3535 | - |
|
| 3536 | - protected function _restore_cpt_item($post_id, $revision_id) |
|
| 3537 | - { |
|
| 3538 | - } |
|
| 3539 | - |
|
| 3540 | - |
|
| 3541 | - /** |
|
| 3542 | - * @throws EE_Error |
|
| 3543 | - * @throws ReflectionException |
|
| 3544 | - * @since 4.10.2.p |
|
| 3545 | - */ |
|
| 3546 | - public function attendee_editor_metaboxes() |
|
| 3547 | - { |
|
| 3548 | - $this->verify_cpt_object(); |
|
| 3549 | - remove_meta_box( |
|
| 3550 | - 'postexcerpt', |
|
| 3551 | - $this->_cpt_routes[ $this->_req_action ], |
|
| 3552 | - 'normal' |
|
| 3553 | - ); |
|
| 3554 | - remove_meta_box('commentstatusdiv', $this->_cpt_routes[ $this->_req_action ], 'normal'); |
|
| 3555 | - if (post_type_supports(EspressoPostType::ATTENDEES, 'excerpt')) { |
|
| 3556 | - $this->addMetaBox( |
|
| 3557 | - 'postexcerpt', |
|
| 3558 | - esc_html__('Short Biography', 'event_espresso'), |
|
| 3559 | - 'post_excerpt_meta_box', |
|
| 3560 | - $this->_cpt_routes[ $this->_req_action ] |
|
| 3561 | - ); |
|
| 3562 | - } |
|
| 3563 | - if (post_type_supports(EspressoPostType::ATTENDEES, 'comments')) { |
|
| 3564 | - $this->addMetaBox( |
|
| 3565 | - 'commentsdiv', |
|
| 3566 | - esc_html__('Notes on the Contact', 'event_espresso'), |
|
| 3567 | - 'post_comment_meta_box', |
|
| 3568 | - $this->_cpt_routes[ $this->_req_action ], |
|
| 3569 | - 'normal', |
|
| 3570 | - 'core' |
|
| 3571 | - ); |
|
| 3572 | - } |
|
| 3573 | - $this->addMetaBox( |
|
| 3574 | - 'attendee_contact_info', |
|
| 3575 | - esc_html__('Contact Info', 'event_espresso'), |
|
| 3576 | - [$this, 'attendee_contact_info'], |
|
| 3577 | - $this->_cpt_routes[ $this->_req_action ], |
|
| 3578 | - 'side', |
|
| 3579 | - 'core' |
|
| 3580 | - ); |
|
| 3581 | - $this->addMetaBox( |
|
| 3582 | - 'attendee_details_address', |
|
| 3583 | - esc_html__('Address Details', 'event_espresso'), |
|
| 3584 | - [$this, 'attendee_address_details'], |
|
| 3585 | - $this->_cpt_routes[ $this->_req_action ], |
|
| 3586 | - 'normal', |
|
| 3587 | - 'core' |
|
| 3588 | - ); |
|
| 3589 | - $this->addMetaBox( |
|
| 3590 | - 'attendee_registrations', |
|
| 3591 | - esc_html__('Registrations for this Contact', 'event_espresso'), |
|
| 3592 | - [$this, 'attendee_registrations_meta_box'], |
|
| 3593 | - $this->_cpt_routes[ $this->_req_action ] |
|
| 3594 | - ); |
|
| 3595 | - } |
|
| 3596 | - |
|
| 3597 | - |
|
| 3598 | - /** |
|
| 3599 | - * Metabox for attendee contact info |
|
| 3600 | - * |
|
| 3601 | - * @param WP_Post $post wp post object |
|
| 3602 | - * @return void attendee contact info ( and form ) |
|
| 3603 | - * @throws EE_Error |
|
| 3604 | - * @throws InvalidArgumentException |
|
| 3605 | - * @throws InvalidDataTypeException |
|
| 3606 | - * @throws InvalidInterfaceException |
|
| 3607 | - * @throws LogicException |
|
| 3608 | - * @throws DomainException |
|
| 3609 | - */ |
|
| 3610 | - public function attendee_contact_info($post) |
|
| 3611 | - { |
|
| 3612 | - // get attendee object ( should already have it ) |
|
| 3613 | - $form = $this->getAttendeeContactDetailsMetaboxFormHandler($this->_cpt_model_obj); |
|
| 3614 | - $form->enqueueStylesAndScripts(); |
|
| 3615 | - echo wp_kses($form->display(), AllowedTags::getWithFormTags()); |
|
| 3616 | - } |
|
| 3617 | - |
|
| 3618 | - |
|
| 3619 | - /** |
|
| 3620 | - * Return form handler for the contact details metabox |
|
| 3621 | - * |
|
| 3622 | - * @param EE_Attendee $attendee |
|
| 3623 | - * @return AttendeeContactDetailsMetaboxFormHandler |
|
| 3624 | - * @throws DomainException |
|
| 3625 | - * @throws InvalidArgumentException |
|
| 3626 | - * @throws InvalidDataTypeException |
|
| 3627 | - * @throws InvalidInterfaceException |
|
| 3628 | - */ |
|
| 3629 | - protected function getAttendeeContactDetailsMetaboxFormHandler(EE_Attendee $attendee) |
|
| 3630 | - { |
|
| 3631 | - return new AttendeeContactDetailsMetaboxFormHandler($attendee, EE_Registry::instance()); |
|
| 3632 | - } |
|
| 3633 | - |
|
| 3634 | - |
|
| 3635 | - /** |
|
| 3636 | - * Metabox for attendee details |
|
| 3637 | - * |
|
| 3638 | - * @param WP_Post $post wp post object |
|
| 3639 | - * @throws EE_Error |
|
| 3640 | - * @throws ReflectionException |
|
| 3641 | - */ |
|
| 3642 | - public function attendee_address_details($post) |
|
| 3643 | - { |
|
| 3644 | - // get attendee object (should already have it) |
|
| 3645 | - $this->_template_args['attendee'] = $this->_cpt_model_obj; |
|
| 3646 | - $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
|
| 3647 | - new EE_Question_Form_Input( |
|
| 3648 | - EE_Question::new_instance( |
|
| 3649 | - [ |
|
| 3650 | - 'QST_ID' => 0, |
|
| 3651 | - 'QST_display_text' => esc_html__('State/Province', 'event_espresso'), |
|
| 3652 | - 'QST_system' => 'admin-state', |
|
| 3653 | - ] |
|
| 3654 | - ), |
|
| 3655 | - EE_Answer::new_instance( |
|
| 3656 | - [ |
|
| 3657 | - 'ANS_ID' => 0, |
|
| 3658 | - 'ANS_value' => $this->_cpt_model_obj->state_ID(), |
|
| 3659 | - ] |
|
| 3660 | - ), |
|
| 3661 | - [ |
|
| 3662 | - 'input_id' => 'STA_ID', |
|
| 3663 | - 'input_name' => 'STA_ID', |
|
| 3664 | - 'input_prefix' => '', |
|
| 3665 | - 'append_qstn_id' => false, |
|
| 3666 | - ] |
|
| 3667 | - ) |
|
| 3668 | - ); |
|
| 3669 | - $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
|
| 3670 | - new EE_Question_Form_Input( |
|
| 3671 | - EE_Question::new_instance( |
|
| 3672 | - [ |
|
| 3673 | - 'QST_ID' => 0, |
|
| 3674 | - 'QST_display_text' => esc_html__('Country', 'event_espresso'), |
|
| 3675 | - 'QST_system' => 'admin-country', |
|
| 3676 | - ] |
|
| 3677 | - ), |
|
| 3678 | - EE_Answer::new_instance( |
|
| 3679 | - [ |
|
| 3680 | - 'ANS_ID' => 0, |
|
| 3681 | - 'ANS_value' => $this->_cpt_model_obj->country_ID(), |
|
| 3682 | - ] |
|
| 3683 | - ), |
|
| 3684 | - [ |
|
| 3685 | - 'input_id' => 'CNT_ISO', |
|
| 3686 | - 'input_name' => 'CNT_ISO', |
|
| 3687 | - 'input_prefix' => '', |
|
| 3688 | - 'append_qstn_id' => false, |
|
| 3689 | - ] |
|
| 3690 | - ) |
|
| 3691 | - ); |
|
| 3692 | - $template = |
|
| 3693 | - REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
| 3694 | - EEH_Template::display_template($template, $this->_template_args); |
|
| 3695 | - } |
|
| 3696 | - |
|
| 3697 | - |
|
| 3698 | - /** |
|
| 3699 | - * _attendee_details |
|
| 3700 | - * |
|
| 3701 | - * @param $post |
|
| 3702 | - * @return void |
|
| 3703 | - * @throws DomainException |
|
| 3704 | - * @throws EE_Error |
|
| 3705 | - * @throws InvalidArgumentException |
|
| 3706 | - * @throws InvalidDataTypeException |
|
| 3707 | - * @throws InvalidInterfaceException |
|
| 3708 | - * @throws ReflectionException |
|
| 3709 | - */ |
|
| 3710 | - public function attendee_registrations_meta_box($post) |
|
| 3711 | - { |
|
| 3712 | - $this->_template_args['attendee'] = $this->_cpt_model_obj; |
|
| 3713 | - $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
|
| 3714 | - $template = |
|
| 3715 | - REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
| 3716 | - EEH_Template::display_template($template, $this->_template_args); |
|
| 3717 | - } |
|
| 3718 | - |
|
| 3719 | - |
|
| 3720 | - /** |
|
| 3721 | - * add in the form fields for the attendee edit |
|
| 3722 | - * |
|
| 3723 | - * @param WP_Post $post wp post object |
|
| 3724 | - * @return void echos html for new form. |
|
| 3725 | - * @throws DomainException |
|
| 3726 | - */ |
|
| 3727 | - public function after_title_form_fields($post) |
|
| 3728 | - { |
|
| 3729 | - if ($post->post_type === EspressoPostType::ATTENDEES) { |
|
| 3730 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
| 3731 | - $template_args['attendee'] = $this->_cpt_model_obj; |
|
| 3732 | - EEH_Template::display_template($template, $template_args); |
|
| 3733 | - } |
|
| 3734 | - } |
|
| 3735 | - |
|
| 3736 | - |
|
| 3737 | - /** |
|
| 3738 | - * _trash_or_restore_attendee |
|
| 3739 | - * |
|
| 3740 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
| 3741 | - * @return void |
|
| 3742 | - * @throws EE_Error |
|
| 3743 | - * @throws InvalidArgumentException |
|
| 3744 | - * @throws InvalidDataTypeException |
|
| 3745 | - * @throws InvalidInterfaceException |
|
| 3746 | - * @throws ReflectionException |
|
| 3747 | - */ |
|
| 3748 | - protected function _trash_or_restore_attendees($trash = true) |
|
| 3749 | - { |
|
| 3750 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3751 | - $status = $trash ? 'trash' : 'publish'; |
|
| 3752 | - // Checkboxes |
|
| 3753 | - if ($this->request->requestParamIsSet('ATT_IDs')) { |
|
| 3754 | - $ATT_IDs = $this->request->getRequestParam('ATT_IDs', [], 'int', true); |
|
| 3755 | - // if array has more than one element than success message should be plural |
|
| 3756 | - $success = count($ATT_IDs) > 1 ? 2 : 1; |
|
| 3757 | - // cycle thru checkboxes |
|
| 3758 | - foreach ($ATT_IDs as $ATT_ID) { |
|
| 3759 | - $updated = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID); |
|
| 3760 | - if (! $updated) { |
|
| 3761 | - $success = 0; |
|
| 3762 | - } |
|
| 3763 | - } |
|
| 3764 | - } else { |
|
| 3765 | - // grab single id and delete |
|
| 3766 | - $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int'); |
|
| 3767 | - // update attendee |
|
| 3768 | - $success = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID) ? 1 : 0; |
|
| 3769 | - } |
|
| 3770 | - $what = $success > 1 |
|
| 3771 | - ? esc_html__('Contacts', 'event_espresso') |
|
| 3772 | - : esc_html__('Contact', 'event_espresso'); |
|
| 3773 | - $action_desc = $trash |
|
| 3774 | - ? esc_html__('moved to the trash', 'event_espresso') |
|
| 3775 | - : esc_html__('restored', 'event_espresso'); |
|
| 3776 | - $this->_redirect_after_action($success, $what, $action_desc, ['action' => 'contact_list']); |
|
| 3777 | - } |
|
| 3778 | - |
|
| 3779 | - |
|
| 3780 | - /** |
|
| 3781 | - * @return void |
|
| 3782 | - * @throws EE_Error |
|
| 3783 | - * @throws ReflectionException |
|
| 3784 | - * @since :VID: |
|
| 3785 | - */ |
|
| 3786 | - protected function deleteAttendees() |
|
| 3787 | - { |
|
| 3788 | - $success = 0; |
|
| 3789 | - $att_ids = $this->getAttIdsFromRequest(); |
|
| 3790 | - foreach ($att_ids as $att_id) { |
|
| 3791 | - $attendee = $this->getAttendeeModel()->get_one_by_ID($att_id); |
|
| 3792 | - if ($attendee instanceof EE_Attendee) { |
|
| 3793 | - $deleted = $attendee->delete_permanently(); |
|
| 3794 | - if($deleted) { |
|
| 3795 | - $success++; |
|
| 3796 | - } |
|
| 3797 | - } |
|
| 3798 | - } |
|
| 3799 | - $what = $success > 1 |
|
| 3800 | - ? esc_html__('Contacts', 'event_espresso') |
|
| 3801 | - : esc_html__('Contact', 'event_espresso'); |
|
| 3802 | - |
|
| 3803 | - $this->_redirect_after_action( |
|
| 3804 | - $success, |
|
| 3805 | - $what, |
|
| 3806 | - esc_html__('deleted', 'event_espresso'), |
|
| 3807 | - [ |
|
| 3808 | - 'action' => 'contact_list', |
|
| 3809 | - 'status' => 'trash', |
|
| 3810 | - ], |
|
| 3811 | - $success == 0 ? true : false |
|
| 3812 | - ); |
|
| 3813 | - } |
|
| 3814 | - |
|
| 3815 | - |
|
| 3816 | - /** |
|
| 3817 | - * @return array |
|
| 3818 | - * @since :VID: |
|
| 3819 | - */ |
|
| 3820 | - private function getAttIdsFromRequest(): array |
|
| 3821 | - { |
|
| 3822 | - if ($this->request->requestParamIsSet('ATT_IDs')) { |
|
| 3823 | - return $this->request->getRequestParam('ATT_IDs', [], 'int', true); |
|
| 3824 | - } else { |
|
| 3825 | - return $this->request->getRequestParam('ATT_ID', [], 'int', true); |
|
| 3826 | - } |
|
| 3827 | - } |
|
| 3828 | - |
|
| 3829 | - |
|
| 3830 | - /** |
|
| 3831 | - * @return EE_Session|null |
|
| 3832 | - * @since 5.0.20.p |
|
| 3833 | - */ |
|
| 3834 | - private function getSession(): ?EE_Session |
|
| 3835 | - { |
|
| 3836 | - return EE_Registry::instance()->SSN; |
|
| 3837 | - } |
|
| 3838 | - |
|
| 3839 | - |
|
| 3840 | - /** |
|
| 3841 | - * @param string $class |
|
| 3842 | - * @param string $function |
|
| 3843 | - * @return void |
|
| 3844 | - * @throws EE_Error |
|
| 3845 | - * @throws ReflectionException |
|
| 3846 | - * @since 5.0.20.p |
|
| 3847 | - */ |
|
| 3848 | - private function clearSession(string $class, string $function) |
|
| 3849 | - { |
|
| 3850 | - $session = $this->getSession(); |
|
| 3851 | - if ($session instanceof EE_Session) { |
|
| 3852 | - $session->clear_session($class, $function); |
|
| 3853 | - } |
|
| 3854 | - } |
|
| 3855 | - |
|
| 3856 | - |
|
| 3857 | - /** |
|
| 3858 | - * @return EE_Cart|null |
|
| 3859 | - * @since 5.0.20.p |
|
| 3860 | - */ |
|
| 3861 | - private function getCart(): ?EE_Cart |
|
| 3862 | - { |
|
| 3863 | - $session = $this->getSession(); |
|
| 3864 | - return $session instanceof EE_Session ? $session->cart() : null; |
|
| 3865 | - } |
|
| 2912 | + } |
|
| 2913 | + $template_args = [ |
|
| 2914 | + 'title' => '', |
|
| 2915 | + 'content' => '', |
|
| 2916 | + 'step_button_text' => '', |
|
| 2917 | + 'show_notification_toggle' => false, |
|
| 2918 | + ]; |
|
| 2919 | + // to indicate we're processing a new registration |
|
| 2920 | + $hidden_fields = [ |
|
| 2921 | + 'processing_registration' => [ |
|
| 2922 | + 'type' => 'hidden', |
|
| 2923 | + 'value' => 0, |
|
| 2924 | + ], |
|
| 2925 | + 'event_id' => [ |
|
| 2926 | + 'type' => 'hidden', |
|
| 2927 | + 'value' => $this->_reg_event->ID(), |
|
| 2928 | + ], |
|
| 2929 | + ]; |
|
| 2930 | + // if the cart is empty then we know we're at step one, so we'll display the ticket selector |
|
| 2931 | + $cart = $this->getCart(); |
|
| 2932 | + $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
|
| 2933 | + switch ($step) { |
|
| 2934 | + case 'ticket': |
|
| 2935 | + $hidden_fields['processing_registration']['value'] = 1; |
|
| 2936 | + $template_args['title'] = esc_html__( |
|
| 2937 | + 'Step One: Select the Ticket for this registration', |
|
| 2938 | + 'event_espresso' |
|
| 2939 | + ); |
|
| 2940 | + $template_args['content'] = |
|
| 2941 | + EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
| 2942 | + $template_args['content'] .= '</div>'; |
|
| 2943 | + $template_args['step_button_text'] = esc_html__( |
|
| 2944 | + 'Add Tickets and Continue to Registrant Details', |
|
| 2945 | + 'event_espresso' |
|
| 2946 | + ); |
|
| 2947 | + $template_args['show_notification_toggle'] = false; |
|
| 2948 | + break; |
|
| 2949 | + case 'questions': |
|
| 2950 | + $hidden_fields['processing_registration']['value'] = 2; |
|
| 2951 | + $template_args['title'] = esc_html__( |
|
| 2952 | + 'Step Two: Add Registrant Details for this Registration', |
|
| 2953 | + 'event_espresso' |
|
| 2954 | + ); |
|
| 2955 | + // in theory, we should be able to run EED_SPCO at this point |
|
| 2956 | + // because the cart should have been set up properly by the first process_reg_step run. |
|
| 2957 | + $template_args['content'] = |
|
| 2958 | + EED_Single_Page_Checkout::registration_checkout_for_admin(); |
|
| 2959 | + $template_args['step_button_text'] = esc_html__( |
|
| 2960 | + 'Save Registration and Continue to Details', |
|
| 2961 | + 'event_espresso' |
|
| 2962 | + ); |
|
| 2963 | + $template_args['show_notification_toggle'] = true; |
|
| 2964 | + break; |
|
| 2965 | + } |
|
| 2966 | + // we come back to the process_registration_step route. |
|
| 2967 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); |
|
| 2968 | + return EEH_Template::display_template( |
|
| 2969 | + REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', |
|
| 2970 | + $template_args, |
|
| 2971 | + true |
|
| 2972 | + ); |
|
| 2973 | + } |
|
| 2974 | + |
|
| 2975 | + |
|
| 2976 | + /** |
|
| 2977 | + * set_reg_event |
|
| 2978 | + * |
|
| 2979 | + * @return bool |
|
| 2980 | + * @throws EE_Error |
|
| 2981 | + * @throws InvalidArgumentException |
|
| 2982 | + * @throws InvalidDataTypeException |
|
| 2983 | + * @throws InvalidInterfaceException |
|
| 2984 | + * @throws ReflectionException |
|
| 2985 | + */ |
|
| 2986 | + private function _set_reg_event() |
|
| 2987 | + { |
|
| 2988 | + if (is_object($this->_reg_event)) { |
|
| 2989 | + return true; |
|
| 2990 | + } |
|
| 2991 | + |
|
| 2992 | + $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int'); |
|
| 2993 | + if (! $EVT_ID) { |
|
| 2994 | + return false; |
|
| 2995 | + } |
|
| 2996 | + $this->_reg_event = $this->getEventModel()->get_one_by_ID($EVT_ID); |
|
| 2997 | + return true; |
|
| 2998 | + } |
|
| 2999 | + |
|
| 3000 | + |
|
| 3001 | + /** |
|
| 3002 | + * process_reg_step |
|
| 3003 | + * |
|
| 3004 | + * @return void |
|
| 3005 | + * @throws DomainException |
|
| 3006 | + * @throws EE_Error |
|
| 3007 | + * @throws InvalidArgumentException |
|
| 3008 | + * @throws InvalidDataTypeException |
|
| 3009 | + * @throws InvalidInterfaceException |
|
| 3010 | + * @throws ReflectionException |
|
| 3011 | + * @throws RuntimeException |
|
| 3012 | + */ |
|
| 3013 | + public function process_reg_step() |
|
| 3014 | + { |
|
| 3015 | + EE_System::do_not_cache(); |
|
| 3016 | + $this->_set_reg_event(); |
|
| 3017 | + /** @var CurrentPage $current_page */ |
|
| 3018 | + $current_page = $this->loader->getShared(CurrentPage::class); |
|
| 3019 | + $current_page->setEspressoPage(true); |
|
| 3020 | + $this->request->setRequestParam('uts', time()); |
|
| 3021 | + // what step are we on? |
|
| 3022 | + $cart = $this->getCart(); |
|
| 3023 | + $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
|
| 3024 | + // if doing ajax then we need to verify the nonce |
|
| 3025 | + if ($this->request->isAjax()) { |
|
| 3026 | + $nonce = $this->request->getRequestParam($this->_req_nonce, ''); |
|
| 3027 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
| 3028 | + } |
|
| 3029 | + switch ($step) { |
|
| 3030 | + case 'ticket': |
|
| 3031 | + // process ticket selection |
|
| 3032 | + $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
|
| 3033 | + if ($success) { |
|
| 3034 | + EE_Error::add_success( |
|
| 3035 | + esc_html__( |
|
| 3036 | + 'Tickets Selected. Now complete the registration.', |
|
| 3037 | + 'event_espresso' |
|
| 3038 | + ) |
|
| 3039 | + ); |
|
| 3040 | + } else { |
|
| 3041 | + $this->request->setRequestParam('step_error', true); |
|
| 3042 | + $query_args['step_error'] = $this->request->getRequestParam('step_error', true, 'bool'); |
|
| 3043 | + } |
|
| 3044 | + if ($this->request->isAjax()) { |
|
| 3045 | + $this->new_registration(); // display next step |
|
| 3046 | + } else { |
|
| 3047 | + $query_args = [ |
|
| 3048 | + 'action' => 'new_registration', |
|
| 3049 | + 'processing_registration' => 1, |
|
| 3050 | + 'event_id' => $this->_reg_event->ID(), |
|
| 3051 | + 'uts' => time(), |
|
| 3052 | + ]; |
|
| 3053 | + $this->_redirect_after_action( |
|
| 3054 | + false, |
|
| 3055 | + '', |
|
| 3056 | + '', |
|
| 3057 | + $query_args, |
|
| 3058 | + true |
|
| 3059 | + ); |
|
| 3060 | + } |
|
| 3061 | + break; |
|
| 3062 | + case 'questions': |
|
| 3063 | + if (! $this->request->requestParamIsSet('txn_reg_status_change[send_notifications]')) { |
|
| 3064 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
| 3065 | + } |
|
| 3066 | + // process registration |
|
| 3067 | + $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
|
| 3068 | + if ($cart instanceof EE_Cart) { |
|
| 3069 | + $grand_total = $cart->get_grand_total(); |
|
| 3070 | + if ($grand_total instanceof EE_Line_Item) { |
|
| 3071 | + $grand_total->save_this_and_descendants_to_txn(); |
|
| 3072 | + } |
|
| 3073 | + } |
|
| 3074 | + if (! $transaction instanceof EE_Transaction) { |
|
| 3075 | + $query_args = [ |
|
| 3076 | + 'action' => 'new_registration', |
|
| 3077 | + 'processing_registration' => 2, |
|
| 3078 | + 'event_id' => $this->_reg_event->ID(), |
|
| 3079 | + 'uts' => time(), |
|
| 3080 | + ]; |
|
| 3081 | + if ($this->request->isAjax()) { |
|
| 3082 | + // display registration form again because there are errors (maybe validation?) |
|
| 3083 | + $this->new_registration(); |
|
| 3084 | + return; |
|
| 3085 | + } |
|
| 3086 | + $this->_redirect_after_action( |
|
| 3087 | + false, |
|
| 3088 | + '', |
|
| 3089 | + '', |
|
| 3090 | + $query_args, |
|
| 3091 | + true |
|
| 3092 | + ); |
|
| 3093 | + return; |
|
| 3094 | + } |
|
| 3095 | + // maybe update status, and make sure to save transaction if not done already |
|
| 3096 | + if (! $transaction->update_status_based_on_total_paid()) { |
|
| 3097 | + $transaction->save(); |
|
| 3098 | + } |
|
| 3099 | + $this->clearSession(__CLASS__, __FUNCTION__); |
|
| 3100 | + $query_args = [ |
|
| 3101 | + 'action' => 'redirect_to_txn', |
|
| 3102 | + 'TXN_ID' => $transaction->ID(), |
|
| 3103 | + 'EVT_ID' => $this->_reg_event->ID(), |
|
| 3104 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
| 3105 | + 'redirect_from' => 'new_registration', |
|
| 3106 | + ]; |
|
| 3107 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
| 3108 | + break; |
|
| 3109 | + } |
|
| 3110 | + // what are you looking here for? Should be nothing to do at this point. |
|
| 3111 | + } |
|
| 3112 | + |
|
| 3113 | + |
|
| 3114 | + /** |
|
| 3115 | + * redirect_to_txn |
|
| 3116 | + * |
|
| 3117 | + * @return void |
|
| 3118 | + * @throws EE_Error |
|
| 3119 | + * @throws InvalidArgumentException |
|
| 3120 | + * @throws InvalidDataTypeException |
|
| 3121 | + * @throws InvalidInterfaceException |
|
| 3122 | + * @throws ReflectionException |
|
| 3123 | + */ |
|
| 3124 | + public function redirect_to_txn() |
|
| 3125 | + { |
|
| 3126 | + EE_System::do_not_cache(); |
|
| 3127 | + $this->clearSession(__CLASS__, __FUNCTION__); |
|
| 3128 | + $query_args = [ |
|
| 3129 | + 'action' => 'view_transaction', |
|
| 3130 | + 'TXN_ID' => $this->request->getRequestParam('TXN_ID', 0, 'int'), |
|
| 3131 | + 'page' => 'espresso_transactions', |
|
| 3132 | + ]; |
|
| 3133 | + if ($this->request->requestParamIsSet('EVT_ID') && $this->request->requestParamIsSet('redirect_from')) { |
|
| 3134 | + $query_args['EVT_ID'] = $this->request->getRequestParam('EVT_ID', 0, 'int'); |
|
| 3135 | + $query_args['event_name'] = urlencode($this->request->getRequestParam('event_name')); |
|
| 3136 | + $query_args['redirect_from'] = $this->request->getRequestParam('redirect_from'); |
|
| 3137 | + } |
|
| 3138 | + EE_Error::add_success( |
|
| 3139 | + esc_html__( |
|
| 3140 | + 'Registration Created. Please review the transaction and add any payments as necessary', |
|
| 3141 | + 'event_espresso' |
|
| 3142 | + ) |
|
| 3143 | + ); |
|
| 3144 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
| 3145 | + } |
|
| 3146 | + |
|
| 3147 | + |
|
| 3148 | + /** |
|
| 3149 | + * generates HTML for the Attendee Contact List |
|
| 3150 | + * |
|
| 3151 | + * @return void |
|
| 3152 | + * @throws DomainException |
|
| 3153 | + * @throws EE_Error |
|
| 3154 | + */ |
|
| 3155 | + protected function _attendee_contact_list_table() |
|
| 3156 | + { |
|
| 3157 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3158 | + $this->_search_btn_label = esc_html__('Contacts', 'event_espresso'); |
|
| 3159 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
| 3160 | + } |
|
| 3161 | + |
|
| 3162 | + |
|
| 3163 | + /** |
|
| 3164 | + * get_attendees |
|
| 3165 | + * |
|
| 3166 | + * @param $per_page |
|
| 3167 | + * @param bool $count whether to return count or data. |
|
| 3168 | + * @param bool $trash |
|
| 3169 | + * @return array|int |
|
| 3170 | + * @throws EE_Error |
|
| 3171 | + * @throws InvalidArgumentException |
|
| 3172 | + * @throws InvalidDataTypeException |
|
| 3173 | + * @throws InvalidInterfaceException |
|
| 3174 | + * @throws ReflectionException |
|
| 3175 | + */ |
|
| 3176 | + public function get_attendees($per_page, $count = false, $trash = false) |
|
| 3177 | + { |
|
| 3178 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3179 | + require_once(REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php'); |
|
| 3180 | + $orderby = $this->request->getRequestParam('orderby'); |
|
| 3181 | + switch ($orderby) { |
|
| 3182 | + case 'ATT_ID': |
|
| 3183 | + case 'ATT_fname': |
|
| 3184 | + case 'ATT_email': |
|
| 3185 | + case 'ATT_city': |
|
| 3186 | + case 'STA_ID': |
|
| 3187 | + case 'CNT_ID': |
|
| 3188 | + break; |
|
| 3189 | + case 'Registration_Count': |
|
| 3190 | + $orderby = 'Registration_Count'; |
|
| 3191 | + break; |
|
| 3192 | + default: |
|
| 3193 | + $orderby = 'ATT_lname'; |
|
| 3194 | + } |
|
| 3195 | + $sort = $this->request->getRequestParam('order', 'ASC'); |
|
| 3196 | + $current_page = $this->request->getRequestParam('paged', 1, 'int'); |
|
| 3197 | + $per_page = absint($per_page) ? $per_page : 10; |
|
| 3198 | + $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); |
|
| 3199 | + $_where = []; |
|
| 3200 | + $search_term = $this->request->getRequestParam('s'); |
|
| 3201 | + if ($search_term) { |
|
| 3202 | + $search_term = '%' . $search_term . '%'; |
|
| 3203 | + $_where['OR'] = [ |
|
| 3204 | + 'Registration.Event.EVT_name' => ['LIKE', $search_term], |
|
| 3205 | + 'Registration.Event.EVT_desc' => ['LIKE', $search_term], |
|
| 3206 | + 'Registration.Event.EVT_short_desc' => ['LIKE', $search_term], |
|
| 3207 | + 'ATT_fname' => ['LIKE', $search_term], |
|
| 3208 | + 'ATT_lname' => ['LIKE', $search_term], |
|
| 3209 | + 'ATT_short_bio' => ['LIKE', $search_term], |
|
| 3210 | + 'ATT_email' => ['LIKE', $search_term], |
|
| 3211 | + 'ATT_address' => ['LIKE', $search_term], |
|
| 3212 | + 'ATT_address2' => ['LIKE', $search_term], |
|
| 3213 | + 'ATT_city' => ['LIKE', $search_term], |
|
| 3214 | + 'Country.CNT_name' => ['LIKE', $search_term], |
|
| 3215 | + 'State.STA_name' => ['LIKE', $search_term], |
|
| 3216 | + 'ATT_phone' => ['LIKE', $search_term], |
|
| 3217 | + 'Registration.REG_final_price' => ['LIKE', $search_term], |
|
| 3218 | + 'Registration.REG_code' => ['LIKE', $search_term], |
|
| 3219 | + 'Registration.REG_group_size' => ['LIKE', $search_term], |
|
| 3220 | + ]; |
|
| 3221 | + } |
|
| 3222 | + $offset = ($current_page - 1) * $per_page; |
|
| 3223 | + $limit = $count ? null : [$offset, $per_page]; |
|
| 3224 | + $query_args = [ |
|
| 3225 | + $_where, |
|
| 3226 | + 'extra_selects' => ['Registration_Count' => ['Registration.REG_ID', 'count', '%d']], |
|
| 3227 | + 'limit' => $limit, |
|
| 3228 | + ]; |
|
| 3229 | + if (! $count) { |
|
| 3230 | + $query_args['order_by'] = [$orderby => $sort]; |
|
| 3231 | + } |
|
| 3232 | + $query_args[0]['status'] = $trash ? ['!=', 'publish'] : ['IN', ['publish']]; |
|
| 3233 | + return $count |
|
| 3234 | + ? $this->getAttendeeModel()->count($query_args, 'ATT_ID', true) |
|
| 3235 | + : $this->getAttendeeModel()->get_all($query_args); |
|
| 3236 | + } |
|
| 3237 | + |
|
| 3238 | + |
|
| 3239 | + /** |
|
| 3240 | + * This is just taking care of resending the registration confirmation |
|
| 3241 | + * |
|
| 3242 | + * @return void |
|
| 3243 | + * @throws EE_Error |
|
| 3244 | + * @throws InvalidArgumentException |
|
| 3245 | + * @throws InvalidDataTypeException |
|
| 3246 | + * @throws InvalidInterfaceException |
|
| 3247 | + * @throws ReflectionException |
|
| 3248 | + */ |
|
| 3249 | + protected function _resend_registration() |
|
| 3250 | + { |
|
| 3251 | + $this->_process_resend_registration(); |
|
| 3252 | + $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 3253 | + $redirect_to = $this->request->getRequestParam('redirect_to'); |
|
| 3254 | + $query_args = $redirect_to |
|
| 3255 | + ? ['action' => $redirect_to, '_REG_ID' => $REG_ID] |
|
| 3256 | + : ['action' => 'default']; |
|
| 3257 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
| 3258 | + } |
|
| 3259 | + |
|
| 3260 | + |
|
| 3261 | + /** |
|
| 3262 | + * Creates a registration report, but accepts the name of a method to use for preparing the query parameters |
|
| 3263 | + * to use when selecting registrations |
|
| 3264 | + * |
|
| 3265 | + * @param string $method_name_for_getting_query_params the name of the method (on this class) to use for preparing |
|
| 3266 | + * the query parameters from the request |
|
| 3267 | + * @return void ends the request with a redirect or download |
|
| 3268 | + */ |
|
| 3269 | + public function _registrations_report_base(string $method_name_for_getting_query_params) |
|
| 3270 | + { |
|
| 3271 | + $EVT_ID = $this->request->requestParamIsSet('EVT_ID') |
|
| 3272 | + ? $this->request->getRequestParam('EVT_ID', 0, DataType::INT) |
|
| 3273 | + : null; |
|
| 3274 | + if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
| 3275 | + $return_url = $this->request->getRequestParam('return_url', '', DataType::URL); |
|
| 3276 | + $filters = $this->request->getRequestParam('filters', [], DataType::STRING, true); |
|
| 3277 | + $report_params = $this->$method_name_for_getting_query_params($filters); |
|
| 3278 | + $report_params = $this->convertDatetimeObjectsToStrings($report_params); |
|
| 3279 | + $use_filters = $this->request->getRequestParam('use_filters', false, DataType::BOOL); |
|
| 3280 | + wp_redirect( |
|
| 3281 | + EE_Admin_Page::add_query_args_and_nonce( |
|
| 3282 | + [ |
|
| 3283 | + 'page' => EED_Batch::PAGE_SLUG, |
|
| 3284 | + 'batch' => EED_Batch::batch_file_job, |
|
| 3285 | + 'EVT_ID' => $EVT_ID, |
|
| 3286 | + 'filters' => urlencode(serialize($report_params)), |
|
| 3287 | + 'use_filters' => urlencode($use_filters), |
|
| 3288 | + 'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\RegistrationsReport'), |
|
| 3289 | + 'return_url' => urlencode($return_url), |
|
| 3290 | + ] |
|
| 3291 | + ) |
|
| 3292 | + ); |
|
| 3293 | + } else { |
|
| 3294 | + // Pull the current request params |
|
| 3295 | + $request_args = $this->request->requestParams(); |
|
| 3296 | + $request_args = $this->convertDatetimeObjectsToStrings($request_args); |
|
| 3297 | + // Set the required request_args to be passed to the export |
|
| 3298 | + $required_request_args = [ |
|
| 3299 | + 'export' => 'report', |
|
| 3300 | + 'action' => 'registrations_report_for_event', |
|
| 3301 | + 'EVT_ID' => $EVT_ID, |
|
| 3302 | + ]; |
|
| 3303 | + // Merge required request args, overriding any currently set |
|
| 3304 | + $request_args = array_merge($request_args, $required_request_args); |
|
| 3305 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 3306 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 3307 | + $EE_Export = EE_Export::instance($request_args); |
|
| 3308 | + $EE_Export->export(); |
|
| 3309 | + } |
|
| 3310 | + } |
|
| 3311 | + } |
|
| 3312 | + |
|
| 3313 | + |
|
| 3314 | + /** |
|
| 3315 | + * recursively convert Datetime objects in query params array to strings using MySQL format |
|
| 3316 | + * |
|
| 3317 | + * @param array $query_params |
|
| 3318 | + * @return array |
|
| 3319 | + * @since 5.0.19.p |
|
| 3320 | + */ |
|
| 3321 | + private function convertDatetimeObjectsToStrings(array $query_params): array |
|
| 3322 | + { |
|
| 3323 | + foreach ($query_params as $key => $value) { |
|
| 3324 | + if (is_array($value)) { |
|
| 3325 | + $query_params[$key] = $this->convertDatetimeObjectsToStrings($value); |
|
| 3326 | + } elseif ($value instanceof DateTime) { |
|
| 3327 | + $query_params[$key] = $value->format('Y-m-d H:i:s'); |
|
| 3328 | + } |
|
| 3329 | + } |
|
| 3330 | + return $query_params; |
|
| 3331 | + } |
|
| 3332 | + |
|
| 3333 | + |
|
| 3334 | + /** |
|
| 3335 | + * Creates a registration report using only query parameters in the request |
|
| 3336 | + * |
|
| 3337 | + * @return void |
|
| 3338 | + */ |
|
| 3339 | + public function _registrations_report() |
|
| 3340 | + { |
|
| 3341 | + $this->_registrations_report_base('_get_registration_query_parameters'); |
|
| 3342 | + } |
|
| 3343 | + |
|
| 3344 | + |
|
| 3345 | + public function _contact_list_export() |
|
| 3346 | + { |
|
| 3347 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 3348 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 3349 | + $EE_Export = EE_Export::instance($this->request->requestParams()); |
|
| 3350 | + $EE_Export->export_attendees(); |
|
| 3351 | + } |
|
| 3352 | + } |
|
| 3353 | + |
|
| 3354 | + |
|
| 3355 | + public function _contact_list_report() |
|
| 3356 | + { |
|
| 3357 | + if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
| 3358 | + wp_redirect( |
|
| 3359 | + EE_Admin_Page::add_query_args_and_nonce( |
|
| 3360 | + [ |
|
| 3361 | + 'page' => EED_Batch::PAGE_SLUG, |
|
| 3362 | + 'batch' => EED_Batch::batch_file_job, |
|
| 3363 | + 'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\AttendeesReport'), |
|
| 3364 | + 'return_url' => urlencode($this->request->getRequestParam('return_url', '', DataType::URL)), |
|
| 3365 | + ] |
|
| 3366 | + ) |
|
| 3367 | + ); |
|
| 3368 | + } else { |
|
| 3369 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
| 3370 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
| 3371 | + $EE_Export = EE_Export::instance($this->request->requestParams()); |
|
| 3372 | + $EE_Export->report_attendees(); |
|
| 3373 | + } |
|
| 3374 | + } |
|
| 3375 | + } |
|
| 3376 | + |
|
| 3377 | + |
|
| 3378 | + |
|
| 3379 | + |
|
| 3380 | + |
|
| 3381 | + /*************************************** ATTENDEE DETAILS ***************************************/ |
|
| 3382 | + /** |
|
| 3383 | + * This duplicates the attendee object for the given incoming registration id and attendee_id. |
|
| 3384 | + * |
|
| 3385 | + * @return void |
|
| 3386 | + * @throws EE_Error |
|
| 3387 | + * @throws InvalidArgumentException |
|
| 3388 | + * @throws InvalidDataTypeException |
|
| 3389 | + * @throws InvalidInterfaceException |
|
| 3390 | + * @throws ReflectionException |
|
| 3391 | + */ |
|
| 3392 | + protected function _duplicate_attendee() |
|
| 3393 | + { |
|
| 3394 | + $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int'); |
|
| 3395 | + $action = $this->request->getRequestParam('return', 'default'); |
|
| 3396 | + // verify we have necessary info |
|
| 3397 | + if (! $REG_ID) { |
|
| 3398 | + EE_Error::add_error( |
|
| 3399 | + esc_html__( |
|
| 3400 | + 'Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', |
|
| 3401 | + 'event_espresso' |
|
| 3402 | + ), |
|
| 3403 | + __FILE__, |
|
| 3404 | + __LINE__, |
|
| 3405 | + __FUNCTION__ |
|
| 3406 | + ); |
|
| 3407 | + $query_args = ['action' => $action]; |
|
| 3408 | + $this->_redirect_after_action('', '', '', $query_args, true); |
|
| 3409 | + } |
|
| 3410 | + // okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
|
| 3411 | + $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID); |
|
| 3412 | + if (! $registration instanceof EE_Registration) { |
|
| 3413 | + throw new RuntimeException( |
|
| 3414 | + sprintf( |
|
| 3415 | + esc_html__( |
|
| 3416 | + 'Unable to create the contact because a valid registration could not be retrieved for REG ID: %1$d', |
|
| 3417 | + 'event_espresso' |
|
| 3418 | + ), |
|
| 3419 | + $REG_ID |
|
| 3420 | + ) |
|
| 3421 | + ); |
|
| 3422 | + } |
|
| 3423 | + $attendee = $registration->attendee(); |
|
| 3424 | + // remove relation of existing attendee on registration |
|
| 3425 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
| 3426 | + // new attendee |
|
| 3427 | + $new_attendee = clone $attendee; |
|
| 3428 | + $new_attendee->set('ATT_ID', 0); |
|
| 3429 | + $new_attendee->save(); |
|
| 3430 | + // add new attendee to reg |
|
| 3431 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
| 3432 | + EE_Error::add_success( |
|
| 3433 | + esc_html__( |
|
| 3434 | + 'New Contact record created. Now make any edits you wish to make for this contact.', |
|
| 3435 | + 'event_espresso' |
|
| 3436 | + ) |
|
| 3437 | + ); |
|
| 3438 | + // redirect to edit page for attendee |
|
| 3439 | + $query_args = ['post' => $new_attendee->ID(), 'action' => 'edit_attendee']; |
|
| 3440 | + $this->_redirect_after_action('', '', '', $query_args, true); |
|
| 3441 | + } |
|
| 3442 | + |
|
| 3443 | + |
|
| 3444 | + /** |
|
| 3445 | + * Callback invoked by parent EE_Admin_CPT class hooked in on `save_post` wp hook. |
|
| 3446 | + * |
|
| 3447 | + * @param int $post_id |
|
| 3448 | + * @param WP_Post $post |
|
| 3449 | + * @throws DomainException |
|
| 3450 | + * @throws EE_Error |
|
| 3451 | + * @throws InvalidArgumentException |
|
| 3452 | + * @throws InvalidDataTypeException |
|
| 3453 | + * @throws InvalidInterfaceException |
|
| 3454 | + * @throws LogicException |
|
| 3455 | + * @throws InvalidFormSubmissionException |
|
| 3456 | + * @throws ReflectionException |
|
| 3457 | + */ |
|
| 3458 | + protected function _insert_update_cpt_item($post_id, $post) |
|
| 3459 | + { |
|
| 3460 | + $success = true; |
|
| 3461 | + $attendee = $post instanceof WP_Post && $post->post_type === EspressoPostType::ATTENDEES |
|
| 3462 | + ? $this->getAttendeeModel()->get_one_by_ID($post_id) |
|
| 3463 | + : null; |
|
| 3464 | + // for attendee updates |
|
| 3465 | + if ($attendee instanceof EE_Attendee) { |
|
| 3466 | + // note we should only be UPDATING attendees at this point. |
|
| 3467 | + $fname = $this->request->getRequestParam('ATT_fname', ''); |
|
| 3468 | + $lname = $this->request->getRequestParam('ATT_lname', ''); |
|
| 3469 | + $updated_fields = [ |
|
| 3470 | + 'ATT_fname' => $fname, |
|
| 3471 | + 'ATT_lname' => $lname, |
|
| 3472 | + 'ATT_full_name' => "{$fname} {$lname}", |
|
| 3473 | + 'ATT_address' => $this->request->getRequestParam('ATT_address', ''), |
|
| 3474 | + 'ATT_address2' => $this->request->getRequestParam('ATT_address2', ''), |
|
| 3475 | + 'ATT_city' => $this->request->getRequestParam('ATT_city', ''), |
|
| 3476 | + 'STA_ID' => $this->request->getRequestParam('STA_ID', ''), |
|
| 3477 | + 'CNT_ISO' => $this->request->getRequestParam('CNT_ISO', ''), |
|
| 3478 | + 'ATT_zip' => $this->request->getRequestParam('ATT_zip', ''), |
|
| 3479 | + ]; |
|
| 3480 | + foreach ($updated_fields as $field => $value) { |
|
| 3481 | + $attendee->set($field, $value); |
|
| 3482 | + } |
|
| 3483 | + |
|
| 3484 | + // process contact details metabox form handler (which will also save the attendee) |
|
| 3485 | + $contact_details_form = $this->getAttendeeContactDetailsMetaboxFormHandler($attendee); |
|
| 3486 | + $success = $contact_details_form->process($this->request->requestParams()); |
|
| 3487 | + |
|
| 3488 | + $attendee_update_callbacks = apply_filters( |
|
| 3489 | + 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', |
|
| 3490 | + [] |
|
| 3491 | + ); |
|
| 3492 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
| 3493 | + if (false === call_user_func_array($a_callback, [$attendee, $this->request->requestParams()])) { |
|
| 3494 | + throw new EE_Error( |
|
| 3495 | + sprintf( |
|
| 3496 | + esc_html__( |
|
| 3497 | + 'The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', |
|
| 3498 | + 'event_espresso' |
|
| 3499 | + ), |
|
| 3500 | + $a_callback |
|
| 3501 | + ) |
|
| 3502 | + ); |
|
| 3503 | + } |
|
| 3504 | + } |
|
| 3505 | + } |
|
| 3506 | + |
|
| 3507 | + if ($success === false) { |
|
| 3508 | + EE_Error::add_error( |
|
| 3509 | + esc_html__( |
|
| 3510 | + 'Something went wrong with updating the meta table data for the registration.', |
|
| 3511 | + 'event_espresso' |
|
| 3512 | + ), |
|
| 3513 | + __FILE__, |
|
| 3514 | + __FUNCTION__, |
|
| 3515 | + __LINE__ |
|
| 3516 | + ); |
|
| 3517 | + } |
|
| 3518 | + } |
|
| 3519 | + |
|
| 3520 | + |
|
| 3521 | + public function trash_cpt_item($post_id) |
|
| 3522 | + { |
|
| 3523 | + } |
|
| 3524 | + |
|
| 3525 | + |
|
| 3526 | + public function delete_cpt_item($post_id) |
|
| 3527 | + { |
|
| 3528 | + } |
|
| 3529 | + |
|
| 3530 | + |
|
| 3531 | + public function restore_cpt_item($post_id) |
|
| 3532 | + { |
|
| 3533 | + } |
|
| 3534 | + |
|
| 3535 | + |
|
| 3536 | + protected function _restore_cpt_item($post_id, $revision_id) |
|
| 3537 | + { |
|
| 3538 | + } |
|
| 3539 | + |
|
| 3540 | + |
|
| 3541 | + /** |
|
| 3542 | + * @throws EE_Error |
|
| 3543 | + * @throws ReflectionException |
|
| 3544 | + * @since 4.10.2.p |
|
| 3545 | + */ |
|
| 3546 | + public function attendee_editor_metaboxes() |
|
| 3547 | + { |
|
| 3548 | + $this->verify_cpt_object(); |
|
| 3549 | + remove_meta_box( |
|
| 3550 | + 'postexcerpt', |
|
| 3551 | + $this->_cpt_routes[ $this->_req_action ], |
|
| 3552 | + 'normal' |
|
| 3553 | + ); |
|
| 3554 | + remove_meta_box('commentstatusdiv', $this->_cpt_routes[ $this->_req_action ], 'normal'); |
|
| 3555 | + if (post_type_supports(EspressoPostType::ATTENDEES, 'excerpt')) { |
|
| 3556 | + $this->addMetaBox( |
|
| 3557 | + 'postexcerpt', |
|
| 3558 | + esc_html__('Short Biography', 'event_espresso'), |
|
| 3559 | + 'post_excerpt_meta_box', |
|
| 3560 | + $this->_cpt_routes[ $this->_req_action ] |
|
| 3561 | + ); |
|
| 3562 | + } |
|
| 3563 | + if (post_type_supports(EspressoPostType::ATTENDEES, 'comments')) { |
|
| 3564 | + $this->addMetaBox( |
|
| 3565 | + 'commentsdiv', |
|
| 3566 | + esc_html__('Notes on the Contact', 'event_espresso'), |
|
| 3567 | + 'post_comment_meta_box', |
|
| 3568 | + $this->_cpt_routes[ $this->_req_action ], |
|
| 3569 | + 'normal', |
|
| 3570 | + 'core' |
|
| 3571 | + ); |
|
| 3572 | + } |
|
| 3573 | + $this->addMetaBox( |
|
| 3574 | + 'attendee_contact_info', |
|
| 3575 | + esc_html__('Contact Info', 'event_espresso'), |
|
| 3576 | + [$this, 'attendee_contact_info'], |
|
| 3577 | + $this->_cpt_routes[ $this->_req_action ], |
|
| 3578 | + 'side', |
|
| 3579 | + 'core' |
|
| 3580 | + ); |
|
| 3581 | + $this->addMetaBox( |
|
| 3582 | + 'attendee_details_address', |
|
| 3583 | + esc_html__('Address Details', 'event_espresso'), |
|
| 3584 | + [$this, 'attendee_address_details'], |
|
| 3585 | + $this->_cpt_routes[ $this->_req_action ], |
|
| 3586 | + 'normal', |
|
| 3587 | + 'core' |
|
| 3588 | + ); |
|
| 3589 | + $this->addMetaBox( |
|
| 3590 | + 'attendee_registrations', |
|
| 3591 | + esc_html__('Registrations for this Contact', 'event_espresso'), |
|
| 3592 | + [$this, 'attendee_registrations_meta_box'], |
|
| 3593 | + $this->_cpt_routes[ $this->_req_action ] |
|
| 3594 | + ); |
|
| 3595 | + } |
|
| 3596 | + |
|
| 3597 | + |
|
| 3598 | + /** |
|
| 3599 | + * Metabox for attendee contact info |
|
| 3600 | + * |
|
| 3601 | + * @param WP_Post $post wp post object |
|
| 3602 | + * @return void attendee contact info ( and form ) |
|
| 3603 | + * @throws EE_Error |
|
| 3604 | + * @throws InvalidArgumentException |
|
| 3605 | + * @throws InvalidDataTypeException |
|
| 3606 | + * @throws InvalidInterfaceException |
|
| 3607 | + * @throws LogicException |
|
| 3608 | + * @throws DomainException |
|
| 3609 | + */ |
|
| 3610 | + public function attendee_contact_info($post) |
|
| 3611 | + { |
|
| 3612 | + // get attendee object ( should already have it ) |
|
| 3613 | + $form = $this->getAttendeeContactDetailsMetaboxFormHandler($this->_cpt_model_obj); |
|
| 3614 | + $form->enqueueStylesAndScripts(); |
|
| 3615 | + echo wp_kses($form->display(), AllowedTags::getWithFormTags()); |
|
| 3616 | + } |
|
| 3617 | + |
|
| 3618 | + |
|
| 3619 | + /** |
|
| 3620 | + * Return form handler for the contact details metabox |
|
| 3621 | + * |
|
| 3622 | + * @param EE_Attendee $attendee |
|
| 3623 | + * @return AttendeeContactDetailsMetaboxFormHandler |
|
| 3624 | + * @throws DomainException |
|
| 3625 | + * @throws InvalidArgumentException |
|
| 3626 | + * @throws InvalidDataTypeException |
|
| 3627 | + * @throws InvalidInterfaceException |
|
| 3628 | + */ |
|
| 3629 | + protected function getAttendeeContactDetailsMetaboxFormHandler(EE_Attendee $attendee) |
|
| 3630 | + { |
|
| 3631 | + return new AttendeeContactDetailsMetaboxFormHandler($attendee, EE_Registry::instance()); |
|
| 3632 | + } |
|
| 3633 | + |
|
| 3634 | + |
|
| 3635 | + /** |
|
| 3636 | + * Metabox for attendee details |
|
| 3637 | + * |
|
| 3638 | + * @param WP_Post $post wp post object |
|
| 3639 | + * @throws EE_Error |
|
| 3640 | + * @throws ReflectionException |
|
| 3641 | + */ |
|
| 3642 | + public function attendee_address_details($post) |
|
| 3643 | + { |
|
| 3644 | + // get attendee object (should already have it) |
|
| 3645 | + $this->_template_args['attendee'] = $this->_cpt_model_obj; |
|
| 3646 | + $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
|
| 3647 | + new EE_Question_Form_Input( |
|
| 3648 | + EE_Question::new_instance( |
|
| 3649 | + [ |
|
| 3650 | + 'QST_ID' => 0, |
|
| 3651 | + 'QST_display_text' => esc_html__('State/Province', 'event_espresso'), |
|
| 3652 | + 'QST_system' => 'admin-state', |
|
| 3653 | + ] |
|
| 3654 | + ), |
|
| 3655 | + EE_Answer::new_instance( |
|
| 3656 | + [ |
|
| 3657 | + 'ANS_ID' => 0, |
|
| 3658 | + 'ANS_value' => $this->_cpt_model_obj->state_ID(), |
|
| 3659 | + ] |
|
| 3660 | + ), |
|
| 3661 | + [ |
|
| 3662 | + 'input_id' => 'STA_ID', |
|
| 3663 | + 'input_name' => 'STA_ID', |
|
| 3664 | + 'input_prefix' => '', |
|
| 3665 | + 'append_qstn_id' => false, |
|
| 3666 | + ] |
|
| 3667 | + ) |
|
| 3668 | + ); |
|
| 3669 | + $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
|
| 3670 | + new EE_Question_Form_Input( |
|
| 3671 | + EE_Question::new_instance( |
|
| 3672 | + [ |
|
| 3673 | + 'QST_ID' => 0, |
|
| 3674 | + 'QST_display_text' => esc_html__('Country', 'event_espresso'), |
|
| 3675 | + 'QST_system' => 'admin-country', |
|
| 3676 | + ] |
|
| 3677 | + ), |
|
| 3678 | + EE_Answer::new_instance( |
|
| 3679 | + [ |
|
| 3680 | + 'ANS_ID' => 0, |
|
| 3681 | + 'ANS_value' => $this->_cpt_model_obj->country_ID(), |
|
| 3682 | + ] |
|
| 3683 | + ), |
|
| 3684 | + [ |
|
| 3685 | + 'input_id' => 'CNT_ISO', |
|
| 3686 | + 'input_name' => 'CNT_ISO', |
|
| 3687 | + 'input_prefix' => '', |
|
| 3688 | + 'append_qstn_id' => false, |
|
| 3689 | + ] |
|
| 3690 | + ) |
|
| 3691 | + ); |
|
| 3692 | + $template = |
|
| 3693 | + REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
| 3694 | + EEH_Template::display_template($template, $this->_template_args); |
|
| 3695 | + } |
|
| 3696 | + |
|
| 3697 | + |
|
| 3698 | + /** |
|
| 3699 | + * _attendee_details |
|
| 3700 | + * |
|
| 3701 | + * @param $post |
|
| 3702 | + * @return void |
|
| 3703 | + * @throws DomainException |
|
| 3704 | + * @throws EE_Error |
|
| 3705 | + * @throws InvalidArgumentException |
|
| 3706 | + * @throws InvalidDataTypeException |
|
| 3707 | + * @throws InvalidInterfaceException |
|
| 3708 | + * @throws ReflectionException |
|
| 3709 | + */ |
|
| 3710 | + public function attendee_registrations_meta_box($post) |
|
| 3711 | + { |
|
| 3712 | + $this->_template_args['attendee'] = $this->_cpt_model_obj; |
|
| 3713 | + $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
|
| 3714 | + $template = |
|
| 3715 | + REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
| 3716 | + EEH_Template::display_template($template, $this->_template_args); |
|
| 3717 | + } |
|
| 3718 | + |
|
| 3719 | + |
|
| 3720 | + /** |
|
| 3721 | + * add in the form fields for the attendee edit |
|
| 3722 | + * |
|
| 3723 | + * @param WP_Post $post wp post object |
|
| 3724 | + * @return void echos html for new form. |
|
| 3725 | + * @throws DomainException |
|
| 3726 | + */ |
|
| 3727 | + public function after_title_form_fields($post) |
|
| 3728 | + { |
|
| 3729 | + if ($post->post_type === EspressoPostType::ATTENDEES) { |
|
| 3730 | + $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
| 3731 | + $template_args['attendee'] = $this->_cpt_model_obj; |
|
| 3732 | + EEH_Template::display_template($template, $template_args); |
|
| 3733 | + } |
|
| 3734 | + } |
|
| 3735 | + |
|
| 3736 | + |
|
| 3737 | + /** |
|
| 3738 | + * _trash_or_restore_attendee |
|
| 3739 | + * |
|
| 3740 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
| 3741 | + * @return void |
|
| 3742 | + * @throws EE_Error |
|
| 3743 | + * @throws InvalidArgumentException |
|
| 3744 | + * @throws InvalidDataTypeException |
|
| 3745 | + * @throws InvalidInterfaceException |
|
| 3746 | + * @throws ReflectionException |
|
| 3747 | + */ |
|
| 3748 | + protected function _trash_or_restore_attendees($trash = true) |
|
| 3749 | + { |
|
| 3750 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3751 | + $status = $trash ? 'trash' : 'publish'; |
|
| 3752 | + // Checkboxes |
|
| 3753 | + if ($this->request->requestParamIsSet('ATT_IDs')) { |
|
| 3754 | + $ATT_IDs = $this->request->getRequestParam('ATT_IDs', [], 'int', true); |
|
| 3755 | + // if array has more than one element than success message should be plural |
|
| 3756 | + $success = count($ATT_IDs) > 1 ? 2 : 1; |
|
| 3757 | + // cycle thru checkboxes |
|
| 3758 | + foreach ($ATT_IDs as $ATT_ID) { |
|
| 3759 | + $updated = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID); |
|
| 3760 | + if (! $updated) { |
|
| 3761 | + $success = 0; |
|
| 3762 | + } |
|
| 3763 | + } |
|
| 3764 | + } else { |
|
| 3765 | + // grab single id and delete |
|
| 3766 | + $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int'); |
|
| 3767 | + // update attendee |
|
| 3768 | + $success = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID) ? 1 : 0; |
|
| 3769 | + } |
|
| 3770 | + $what = $success > 1 |
|
| 3771 | + ? esc_html__('Contacts', 'event_espresso') |
|
| 3772 | + : esc_html__('Contact', 'event_espresso'); |
|
| 3773 | + $action_desc = $trash |
|
| 3774 | + ? esc_html__('moved to the trash', 'event_espresso') |
|
| 3775 | + : esc_html__('restored', 'event_espresso'); |
|
| 3776 | + $this->_redirect_after_action($success, $what, $action_desc, ['action' => 'contact_list']); |
|
| 3777 | + } |
|
| 3778 | + |
|
| 3779 | + |
|
| 3780 | + /** |
|
| 3781 | + * @return void |
|
| 3782 | + * @throws EE_Error |
|
| 3783 | + * @throws ReflectionException |
|
| 3784 | + * @since :VID: |
|
| 3785 | + */ |
|
| 3786 | + protected function deleteAttendees() |
|
| 3787 | + { |
|
| 3788 | + $success = 0; |
|
| 3789 | + $att_ids = $this->getAttIdsFromRequest(); |
|
| 3790 | + foreach ($att_ids as $att_id) { |
|
| 3791 | + $attendee = $this->getAttendeeModel()->get_one_by_ID($att_id); |
|
| 3792 | + if ($attendee instanceof EE_Attendee) { |
|
| 3793 | + $deleted = $attendee->delete_permanently(); |
|
| 3794 | + if($deleted) { |
|
| 3795 | + $success++; |
|
| 3796 | + } |
|
| 3797 | + } |
|
| 3798 | + } |
|
| 3799 | + $what = $success > 1 |
|
| 3800 | + ? esc_html__('Contacts', 'event_espresso') |
|
| 3801 | + : esc_html__('Contact', 'event_espresso'); |
|
| 3802 | + |
|
| 3803 | + $this->_redirect_after_action( |
|
| 3804 | + $success, |
|
| 3805 | + $what, |
|
| 3806 | + esc_html__('deleted', 'event_espresso'), |
|
| 3807 | + [ |
|
| 3808 | + 'action' => 'contact_list', |
|
| 3809 | + 'status' => 'trash', |
|
| 3810 | + ], |
|
| 3811 | + $success == 0 ? true : false |
|
| 3812 | + ); |
|
| 3813 | + } |
|
| 3814 | + |
|
| 3815 | + |
|
| 3816 | + /** |
|
| 3817 | + * @return array |
|
| 3818 | + * @since :VID: |
|
| 3819 | + */ |
|
| 3820 | + private function getAttIdsFromRequest(): array |
|
| 3821 | + { |
|
| 3822 | + if ($this->request->requestParamIsSet('ATT_IDs')) { |
|
| 3823 | + return $this->request->getRequestParam('ATT_IDs', [], 'int', true); |
|
| 3824 | + } else { |
|
| 3825 | + return $this->request->getRequestParam('ATT_ID', [], 'int', true); |
|
| 3826 | + } |
|
| 3827 | + } |
|
| 3828 | + |
|
| 3829 | + |
|
| 3830 | + /** |
|
| 3831 | + * @return EE_Session|null |
|
| 3832 | + * @since 5.0.20.p |
|
| 3833 | + */ |
|
| 3834 | + private function getSession(): ?EE_Session |
|
| 3835 | + { |
|
| 3836 | + return EE_Registry::instance()->SSN; |
|
| 3837 | + } |
|
| 3838 | + |
|
| 3839 | + |
|
| 3840 | + /** |
|
| 3841 | + * @param string $class |
|
| 3842 | + * @param string $function |
|
| 3843 | + * @return void |
|
| 3844 | + * @throws EE_Error |
|
| 3845 | + * @throws ReflectionException |
|
| 3846 | + * @since 5.0.20.p |
|
| 3847 | + */ |
|
| 3848 | + private function clearSession(string $class, string $function) |
|
| 3849 | + { |
|
| 3850 | + $session = $this->getSession(); |
|
| 3851 | + if ($session instanceof EE_Session) { |
|
| 3852 | + $session->clear_session($class, $function); |
|
| 3853 | + } |
|
| 3854 | + } |
|
| 3855 | + |
|
| 3856 | + |
|
| 3857 | + /** |
|
| 3858 | + * @return EE_Cart|null |
|
| 3859 | + * @since 5.0.20.p |
|
| 3860 | + */ |
|
| 3861 | + private function getCart(): ?EE_Cart |
|
| 3862 | + { |
|
| 3863 | + $session = $this->getSession(); |
|
| 3864 | + return $session instanceof EE_Session ? $session->cart() : null; |
|
| 3865 | + } |
|
| 3866 | 3866 | } |
@@ -16,168 +16,168 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Events_Admin_List_Table extends EE_Admin_List_Table |
| 18 | 18 | { |
| 19 | - private ?EE_Datetime $_dtt = null; |
|
| 20 | - |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Initial setup of data properties for the list table. |
|
| 24 | - * |
|
| 25 | - * @throws Exception |
|
| 26 | - */ |
|
| 27 | - protected function _setup_data() |
|
| 28 | - { |
|
| 29 | - $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
|
| 30 | - $this->_all_data_count = $this->_admin_page->get_events(0, 0, true); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Set up of additional properties for the list table. |
|
| 36 | - * |
|
| 37 | - * @throws EE_Error |
|
| 38 | - * @throws ReflectionException |
|
| 39 | - */ |
|
| 40 | - protected function _set_properties() |
|
| 41 | - { |
|
| 42 | - $this->_wp_list_args = [ |
|
| 43 | - 'singular' => esc_html__('event', 'event_espresso'), |
|
| 44 | - 'plural' => esc_html__('events', 'event_espresso'), |
|
| 45 | - 'ajax' => true, // for now |
|
| 46 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
| 47 | - ]; |
|
| 48 | - $approved_registrations = esc_html__('Approved Registrations', 'event_espresso'); |
|
| 49 | - $this->_columns = [ |
|
| 50 | - 'cb' => '<input type="checkbox" />', |
|
| 51 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
| 52 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
| 53 | - 'author' => esc_html__('Author', 'event_espresso'), |
|
| 54 | - 'venue' => esc_html__('Venue', 'event_espresso'), |
|
| 55 | - 'start_date_time' => esc_html__('Event Start', 'event_espresso'), |
|
| 56 | - 'reg_begins' => esc_html__('On Sale', 'event_espresso'), |
|
| 57 | - 'attendees' => ' |
|
| 19 | + private ?EE_Datetime $_dtt = null; |
|
| 20 | + |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Initial setup of data properties for the list table. |
|
| 24 | + * |
|
| 25 | + * @throws Exception |
|
| 26 | + */ |
|
| 27 | + protected function _setup_data() |
|
| 28 | + { |
|
| 29 | + $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
|
| 30 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, true); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Set up of additional properties for the list table. |
|
| 36 | + * |
|
| 37 | + * @throws EE_Error |
|
| 38 | + * @throws ReflectionException |
|
| 39 | + */ |
|
| 40 | + protected function _set_properties() |
|
| 41 | + { |
|
| 42 | + $this->_wp_list_args = [ |
|
| 43 | + 'singular' => esc_html__('event', 'event_espresso'), |
|
| 44 | + 'plural' => esc_html__('events', 'event_espresso'), |
|
| 45 | + 'ajax' => true, // for now |
|
| 46 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
| 47 | + ]; |
|
| 48 | + $approved_registrations = esc_html__('Approved Registrations', 'event_espresso'); |
|
| 49 | + $this->_columns = [ |
|
| 50 | + 'cb' => '<input type="checkbox" />', |
|
| 51 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
| 52 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
| 53 | + 'author' => esc_html__('Author', 'event_espresso'), |
|
| 54 | + 'venue' => esc_html__('Venue', 'event_espresso'), |
|
| 55 | + 'start_date_time' => esc_html__('Event Start', 'event_espresso'), |
|
| 56 | + 'reg_begins' => esc_html__('On Sale', 'event_espresso'), |
|
| 57 | + 'attendees' => ' |
|
| 58 | 58 | <span class="dashicons dashicons-groups ee-status-color--RAP ee-aria-tooltip" |
| 59 | 59 | aria-label="' . $approved_registrations . '"></span> |
| 60 | 60 | <span class="screen-reader-text">' . $approved_registrations . '</span>', |
| 61 | - 'actions' => $this->actionsColumnHeader(), |
|
| 62 | - ]; |
|
| 63 | - $this->addConditionalColumns(); |
|
| 64 | - $this->_sortable_columns = [ |
|
| 65 | - 'id' => ['EVT_ID' => true], |
|
| 66 | - 'name' => ['EVT_name' => false], |
|
| 67 | - 'author' => ['EVT_wp_user' => false], |
|
| 68 | - 'venue' => ['Venue.VNU_name' => false], |
|
| 69 | - 'start_date_time' => ['Datetime.DTT_EVT_start' => false], |
|
| 70 | - 'reg_begins' => ['Datetime.Ticket.TKT_start_date' => false], |
|
| 71 | - ]; |
|
| 72 | - |
|
| 73 | - $this->_primary_column = 'id'; |
|
| 74 | - $this->_hidden_columns = ['author', 'event_category']; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @return array |
|
| 80 | - */ |
|
| 81 | - protected function _get_table_filters() |
|
| 82 | - { |
|
| 83 | - return []; // no filters with decaf |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Setup of views properties. |
|
| 89 | - * |
|
| 90 | - * @throws InvalidDataTypeException |
|
| 91 | - * @throws InvalidInterfaceException |
|
| 92 | - * @throws InvalidArgumentException |
|
| 93 | - * @throws EE_Error |
|
| 94 | - * @throws ReflectionException |
|
| 95 | - */ |
|
| 96 | - protected function _add_view_counts() |
|
| 97 | - { |
|
| 98 | - $this->_views['all']['count'] = $this->_admin_page->total_events(); |
|
| 99 | - $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
|
| 100 | - if ( |
|
| 101 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 102 | - 'ee_delete_events', |
|
| 103 | - 'espresso_events_trash_events' |
|
| 104 | - ) |
|
| 105 | - ) { |
|
| 106 | - $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @param EE_Event $item |
|
| 113 | - * @return string |
|
| 114 | - */ |
|
| 115 | - protected function _get_row_class($item): string |
|
| 116 | - { |
|
| 117 | - $class = parent::_get_row_class($item); |
|
| 118 | - if ($this->_has_checkbox_column) { |
|
| 119 | - $class .= ' has-checkbox-column'; |
|
| 120 | - } |
|
| 121 | - return $class; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * @param EE_Event $item |
|
| 127 | - * @return string |
|
| 128 | - * @throws EE_Error |
|
| 129 | - * @throws ReflectionException |
|
| 130 | - */ |
|
| 131 | - public function column_cb($item): string |
|
| 132 | - { |
|
| 133 | - if (! $item instanceof EE_Event) { |
|
| 134 | - return ''; |
|
| 135 | - } |
|
| 136 | - $this->_dtt = $item->primary_datetime(); // set this for use in other columns |
|
| 137 | - $content = sprintf( |
|
| 138 | - '<input type="checkbox" name="EVT_IDs[]" value="%s" />', |
|
| 139 | - $item->ID() |
|
| 140 | - ); |
|
| 141 | - return $this->columnContent('cb', $content, 'center'); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @param EE_Event $event |
|
| 147 | - * @return string |
|
| 148 | - * @throws EE_Error |
|
| 149 | - * @throws ReflectionException |
|
| 150 | - */ |
|
| 151 | - public function column_id(EE_Event $event): string |
|
| 152 | - { |
|
| 153 | - $content = '<span class="ee-entity-id">' . $event->ID() . '</span>'; |
|
| 154 | - $content .= '<span class="show-on-mobile-view-only">'; |
|
| 155 | - $content .= $this->column_name($event, false); |
|
| 156 | - $content .= '</span>'; |
|
| 157 | - return $this->columnContent('id', $content, 'end'); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * @param EE_Event $event |
|
| 163 | - * @param bool $prep_content |
|
| 164 | - * @return string |
|
| 165 | - * @throws EE_Error |
|
| 166 | - * @throws ReflectionException |
|
| 167 | - */ |
|
| 168 | - public function column_name(EE_Event $event, bool $prep_content = true): string |
|
| 169 | - { |
|
| 170 | - $edit_query_args = [ |
|
| 171 | - 'action' => 'edit', |
|
| 172 | - 'post' => $event->ID(), |
|
| 173 | - ]; |
|
| 174 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
| 175 | - $actions = $this->_column_name_action_setup($event); |
|
| 176 | - $status = esc_attr($event->get_active_status()); |
|
| 177 | - $pretty_status = EEH_Template::pretty_status($status, false, 'sentence'); |
|
| 178 | - $status_dot = '<span class="ee-status-dot ee-status-bg--' . $status . '"></span>'; |
|
| 179 | - $visibility = $event->get_visibility_status(); |
|
| 180 | - $content = ' |
|
| 61 | + 'actions' => $this->actionsColumnHeader(), |
|
| 62 | + ]; |
|
| 63 | + $this->addConditionalColumns(); |
|
| 64 | + $this->_sortable_columns = [ |
|
| 65 | + 'id' => ['EVT_ID' => true], |
|
| 66 | + 'name' => ['EVT_name' => false], |
|
| 67 | + 'author' => ['EVT_wp_user' => false], |
|
| 68 | + 'venue' => ['Venue.VNU_name' => false], |
|
| 69 | + 'start_date_time' => ['Datetime.DTT_EVT_start' => false], |
|
| 70 | + 'reg_begins' => ['Datetime.Ticket.TKT_start_date' => false], |
|
| 71 | + ]; |
|
| 72 | + |
|
| 73 | + $this->_primary_column = 'id'; |
|
| 74 | + $this->_hidden_columns = ['author', 'event_category']; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @return array |
|
| 80 | + */ |
|
| 81 | + protected function _get_table_filters() |
|
| 82 | + { |
|
| 83 | + return []; // no filters with decaf |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Setup of views properties. |
|
| 89 | + * |
|
| 90 | + * @throws InvalidDataTypeException |
|
| 91 | + * @throws InvalidInterfaceException |
|
| 92 | + * @throws InvalidArgumentException |
|
| 93 | + * @throws EE_Error |
|
| 94 | + * @throws ReflectionException |
|
| 95 | + */ |
|
| 96 | + protected function _add_view_counts() |
|
| 97 | + { |
|
| 98 | + $this->_views['all']['count'] = $this->_admin_page->total_events(); |
|
| 99 | + $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
|
| 100 | + if ( |
|
| 101 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 102 | + 'ee_delete_events', |
|
| 103 | + 'espresso_events_trash_events' |
|
| 104 | + ) |
|
| 105 | + ) { |
|
| 106 | + $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @param EE_Event $item |
|
| 113 | + * @return string |
|
| 114 | + */ |
|
| 115 | + protected function _get_row_class($item): string |
|
| 116 | + { |
|
| 117 | + $class = parent::_get_row_class($item); |
|
| 118 | + if ($this->_has_checkbox_column) { |
|
| 119 | + $class .= ' has-checkbox-column'; |
|
| 120 | + } |
|
| 121 | + return $class; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * @param EE_Event $item |
|
| 127 | + * @return string |
|
| 128 | + * @throws EE_Error |
|
| 129 | + * @throws ReflectionException |
|
| 130 | + */ |
|
| 131 | + public function column_cb($item): string |
|
| 132 | + { |
|
| 133 | + if (! $item instanceof EE_Event) { |
|
| 134 | + return ''; |
|
| 135 | + } |
|
| 136 | + $this->_dtt = $item->primary_datetime(); // set this for use in other columns |
|
| 137 | + $content = sprintf( |
|
| 138 | + '<input type="checkbox" name="EVT_IDs[]" value="%s" />', |
|
| 139 | + $item->ID() |
|
| 140 | + ); |
|
| 141 | + return $this->columnContent('cb', $content, 'center'); |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @param EE_Event $event |
|
| 147 | + * @return string |
|
| 148 | + * @throws EE_Error |
|
| 149 | + * @throws ReflectionException |
|
| 150 | + */ |
|
| 151 | + public function column_id(EE_Event $event): string |
|
| 152 | + { |
|
| 153 | + $content = '<span class="ee-entity-id">' . $event->ID() . '</span>'; |
|
| 154 | + $content .= '<span class="show-on-mobile-view-only">'; |
|
| 155 | + $content .= $this->column_name($event, false); |
|
| 156 | + $content .= '</span>'; |
|
| 157 | + return $this->columnContent('id', $content, 'end'); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * @param EE_Event $event |
|
| 163 | + * @param bool $prep_content |
|
| 164 | + * @return string |
|
| 165 | + * @throws EE_Error |
|
| 166 | + * @throws ReflectionException |
|
| 167 | + */ |
|
| 168 | + public function column_name(EE_Event $event, bool $prep_content = true): string |
|
| 169 | + { |
|
| 170 | + $edit_query_args = [ |
|
| 171 | + 'action' => 'edit', |
|
| 172 | + 'post' => $event->ID(), |
|
| 173 | + ]; |
|
| 174 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
| 175 | + $actions = $this->_column_name_action_setup($event); |
|
| 176 | + $status = esc_attr($event->get_active_status()); |
|
| 177 | + $pretty_status = EEH_Template::pretty_status($status, false, 'sentence'); |
|
| 178 | + $status_dot = '<span class="ee-status-dot ee-status-bg--' . $status . '"></span>'; |
|
| 179 | + $visibility = $event->get_visibility_status(); |
|
| 180 | + $content = ' |
|
| 181 | 181 | <div class="ee-layout-row ee-layout-row--fixed"> |
| 182 | 182 | <a class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" |
| 183 | 183 | aria-label="' . $pretty_status . '" |
@@ -186,426 +186,426 @@ discard block |
||
| 186 | 186 | ' . $status_dot . $event->name() . ' |
| 187 | 187 | </a> |
| 188 | 188 | ' . ( |
| 189 | - $visibility |
|
| 190 | - ? '<span class="ee-event-visibility-status ee-status-text-small">(' . esc_html($visibility) . ')</span>' |
|
| 191 | - : '' |
|
| 192 | - ) . ' |
|
| 189 | + $visibility |
|
| 190 | + ? '<span class="ee-event-visibility-status ee-status-text-small">(' . esc_html($visibility) . ')</span>' |
|
| 191 | + : '' |
|
| 192 | + ) . ' |
|
| 193 | 193 | </div>'; |
| 194 | 194 | |
| 195 | - $content .= $this->row_actions($actions); |
|
| 196 | - |
|
| 197 | - return $prep_content ? $this->columnContent('name', $content) : $content; |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * Just a method for setting up the actions for the name column |
|
| 203 | - * |
|
| 204 | - * @param EE_Event $event |
|
| 205 | - * @return array array of actions |
|
| 206 | - * @throws EE_Error |
|
| 207 | - * @throws InvalidArgumentException |
|
| 208 | - * @throws InvalidDataTypeException |
|
| 209 | - * @throws InvalidInterfaceException |
|
| 210 | - * @throws ReflectionException |
|
| 211 | - */ |
|
| 212 | - protected function _column_name_action_setup(EE_Event $event): array |
|
| 213 | - { |
|
| 214 | - // todo: remove when attendees is active |
|
| 215 | - if (! defined('REG_ADMIN_URL')) { |
|
| 216 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
| 217 | - } |
|
| 218 | - $actions = []; |
|
| 219 | - $restore_event_link = ''; |
|
| 220 | - $delete_event_link = ''; |
|
| 221 | - $trash_event_link = ''; |
|
| 222 | - if ( |
|
| 223 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 224 | - 'ee_edit_event', |
|
| 225 | - 'espresso_events_edit', |
|
| 226 | - $event->ID() |
|
| 227 | - ) |
|
| 228 | - ) { |
|
| 229 | - $edit_query_args = [ |
|
| 230 | - 'action' => 'edit', |
|
| 231 | - 'post' => $event->ID(), |
|
| 232 | - ]; |
|
| 233 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
| 234 | - $actions['edit'] = '<a href="' . $edit_link . '" class="ee-aria-tooltip" ' |
|
| 235 | - . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
| 236 | - . esc_html__('Edit', 'event_espresso') |
|
| 237 | - . '</a>'; |
|
| 238 | - } |
|
| 239 | - if ( |
|
| 240 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 241 | - 'ee_read_registrations', |
|
| 242 | - 'espresso_registrations_view_registration' |
|
| 243 | - ) |
|
| 244 | - && EE_Registry::instance()->CAP->current_user_can( |
|
| 245 | - 'ee_read_event', |
|
| 246 | - 'espresso_registrations_view_registration', |
|
| 247 | - $event->ID() |
|
| 248 | - ) |
|
| 249 | - ) { |
|
| 250 | - $attendees_query_args = [ |
|
| 251 | - 'action' => 'default', |
|
| 252 | - 'event_id' => $event->ID(), |
|
| 253 | - ]; |
|
| 254 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
| 255 | - $actions['attendees'] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip"' |
|
| 256 | - . ' aria-label="' . esc_attr__('View Registrations', 'event_espresso') . '">' |
|
| 257 | - . esc_html__('Registrations', 'event_espresso') |
|
| 258 | - . '</a>'; |
|
| 259 | - } |
|
| 260 | - if ( |
|
| 261 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 262 | - 'ee_delete_event', |
|
| 263 | - 'espresso_events_trash_event', |
|
| 264 | - $event->ID() |
|
| 265 | - ) |
|
| 266 | - ) { |
|
| 267 | - $trash_event_query_args = [ |
|
| 268 | - 'action' => 'trash_event', |
|
| 269 | - 'EVT_ID' => $event->ID(), |
|
| 270 | - ]; |
|
| 271 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
| 272 | - $trash_event_query_args, |
|
| 273 | - EVENTS_ADMIN_URL |
|
| 274 | - ); |
|
| 275 | - } |
|
| 276 | - if ( |
|
| 277 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 278 | - 'ee_delete_event', |
|
| 279 | - 'espresso_events_restore_event', |
|
| 280 | - $event->ID() |
|
| 281 | - ) |
|
| 282 | - ) { |
|
| 283 | - $restore_event_query_args = [ |
|
| 284 | - 'action' => 'restore_event', |
|
| 285 | - 'EVT_ID' => $event->ID(), |
|
| 286 | - ]; |
|
| 287 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
| 288 | - $restore_event_query_args, |
|
| 289 | - EVENTS_ADMIN_URL |
|
| 290 | - ); |
|
| 291 | - } |
|
| 292 | - if ( |
|
| 293 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 294 | - 'ee_delete_event', |
|
| 295 | - 'espresso_events_delete_event', |
|
| 296 | - $event->ID() |
|
| 297 | - ) |
|
| 298 | - ) { |
|
| 299 | - $delete_event_query_args = [ |
|
| 300 | - 'action' => 'delete_event', |
|
| 301 | - 'EVT_ID' => $event->ID(), |
|
| 302 | - ]; |
|
| 303 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
| 304 | - $delete_event_query_args, |
|
| 305 | - EVENTS_ADMIN_URL |
|
| 306 | - ); |
|
| 307 | - } |
|
| 308 | - $view_link = get_permalink($event->ID()); |
|
| 309 | - $actions['view'] = '<a href="' . $view_link . '" class="ee-aria-tooltip"' |
|
| 310 | - . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '">' |
|
| 311 | - . esc_html__('View', 'event_espresso') |
|
| 312 | - . '</a>'; |
|
| 313 | - if ($event->get('status') === 'trash') { |
|
| 314 | - if ( |
|
| 315 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 316 | - 'ee_delete_event', |
|
| 317 | - 'espresso_events_restore_event', |
|
| 318 | - $event->ID() |
|
| 319 | - ) |
|
| 320 | - ) { |
|
| 321 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" class="ee-aria-tooltip"' |
|
| 322 | - . ' aria-label="' . esc_attr__('Restore from Trash', 'event_espresso') |
|
| 323 | - . '">' |
|
| 324 | - . esc_html__('Restore from Trash', 'event_espresso') |
|
| 325 | - . '</a>'; |
|
| 326 | - } |
|
| 327 | - if ( |
|
| 328 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 329 | - 'ee_delete_event', |
|
| 330 | - 'espresso_events_delete_event', |
|
| 331 | - $event->ID() |
|
| 332 | - ) |
|
| 333 | - ) { |
|
| 334 | - $actions['delete'] = '<a href="' . $delete_event_link . '" class="ee-aria-tooltip"' |
|
| 335 | - . ' aria-label="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' |
|
| 336 | - . esc_html__('Delete Permanently', 'event_espresso') |
|
| 337 | - . '</a>'; |
|
| 338 | - } |
|
| 339 | - } else { |
|
| 340 | - if ( |
|
| 341 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 342 | - 'ee_delete_event', |
|
| 343 | - 'espresso_events_trash_event', |
|
| 344 | - $event->ID() |
|
| 345 | - ) |
|
| 346 | - ) { |
|
| 347 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" class="ee-aria-tooltip"' |
|
| 348 | - . ' aria-label="' . esc_attr__('Trash Event', 'event_espresso') . '">' |
|
| 349 | - . esc_html__('Trash', 'event_espresso') |
|
| 350 | - . '</a>'; |
|
| 351 | - } |
|
| 352 | - } |
|
| 353 | - return $actions; |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * @param EE_Event $event |
|
| 359 | - * @return string |
|
| 360 | - * @throws EE_Error |
|
| 361 | - * @throws ReflectionException |
|
| 362 | - */ |
|
| 363 | - public function column_author(EE_Event $event): string |
|
| 364 | - { |
|
| 365 | - // user author info |
|
| 366 | - $event_author = get_userdata($event->wp_user()); |
|
| 367 | - $gravatar = get_avatar($event->wp_user(), '24'); |
|
| 368 | - // filter link |
|
| 369 | - $query_args = [ |
|
| 370 | - 'action' => 'default', |
|
| 371 | - 'EVT_wp_user' => $event->wp_user(), |
|
| 372 | - ]; |
|
| 373 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
| 374 | - $content = '<div class="ee-layout-row ee-layout-row--fixed">'; |
|
| 375 | - $content .= ' <a href="' . $filter_url . '" class="ee-event-author ee-aria-tooltip"' |
|
| 376 | - . ' aria-label="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
| 377 | - . $gravatar . $event_author->display_name |
|
| 378 | - . '</a>'; |
|
| 379 | - $content .= '</div>'; |
|
| 380 | - return $this->columnContent('author', $content); |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * @param EE_Event $event |
|
| 386 | - * @return string |
|
| 387 | - * @throws EE_Error |
|
| 388 | - * @throws ReflectionException |
|
| 389 | - */ |
|
| 390 | - public function column_event_category(EE_Event $event): string |
|
| 391 | - { |
|
| 392 | - $event_categories = $event->get_all_event_categories(); |
|
| 393 | - $content = implode( |
|
| 394 | - ', ', |
|
| 395 | - array_map( |
|
| 396 | - function (EE_Term $category) { |
|
| 397 | - return $category->name(); |
|
| 398 | - }, |
|
| 399 | - $event_categories |
|
| 400 | - ) |
|
| 401 | - ); |
|
| 402 | - return $this->columnContent('event_category', $content); |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * @param EE_Event $event |
|
| 408 | - * @return string |
|
| 409 | - * @throws EE_Error |
|
| 410 | - * @throws ReflectionException |
|
| 411 | - */ |
|
| 412 | - public function column_venue(EE_Event $event): string |
|
| 413 | - { |
|
| 414 | - $venue = $event->get_first_related('Venue'); |
|
| 415 | - $content = ! empty($venue) |
|
| 416 | - ? $venue->name() |
|
| 417 | - : ''; |
|
| 418 | - return $this->columnContent('venue', $content); |
|
| 419 | - } |
|
| 420 | - |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * @param EE_Event $event |
|
| 424 | - * @return string |
|
| 425 | - * @throws EE_Error |
|
| 426 | - * @throws ReflectionException |
|
| 427 | - * @throws Exception |
|
| 428 | - */ |
|
| 429 | - public function column_start_date_time(EE_Event $event): string |
|
| 430 | - { |
|
| 431 | - $month_range = $this->request->getRequestParam('month_range'); |
|
| 432 | - if ($month_range) { |
|
| 433 | - $where = ['DTT_EVT_start' => $this->_admin_page->whereParamsForDatetimeMonthRange($month_range)]; |
|
| 434 | - $this->_dtt = $event->get_first_related('Datetime', [$where]); |
|
| 435 | - } |
|
| 436 | - $content = $this->_dtt instanceof EE_Datetime |
|
| 437 | - ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') |
|
| 438 | - : esc_html__('No Date was saved for this Event', 'event_espresso'); |
|
| 439 | - return $this->columnContent('start_date_time', $content); |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * @param EE_Event $event |
|
| 445 | - * @return string |
|
| 446 | - * @throws EE_Error |
|
| 447 | - * @throws ReflectionException |
|
| 448 | - */ |
|
| 449 | - public function column_reg_begins(EE_Event $event): string |
|
| 450 | - { |
|
| 451 | - if ($this->_dtt instanceof EE_Datetime) { |
|
| 452 | - $reg_start = $this->_dtt->get_first_related('Ticket'); |
|
| 453 | - } else { |
|
| 454 | - $reg_start = $event->get_ticket_with_earliest_start_time(); |
|
| 455 | - } |
|
| 456 | - $content = $reg_start instanceof EE_Ticket |
|
| 457 | - ? $reg_start->get_i18n_datetime('TKT_start_date') |
|
| 458 | - : esc_html__('No Tickets have been setup for this Event', 'event_espresso'); |
|
| 459 | - return $this->columnContent('reg_begins', $content); |
|
| 460 | - } |
|
| 461 | - |
|
| 462 | - |
|
| 463 | - /** |
|
| 464 | - * @param EE_Event $event |
|
| 465 | - * @return string |
|
| 466 | - * @throws EE_Error |
|
| 467 | - * @throws InvalidArgumentException |
|
| 468 | - * @throws InvalidDataTypeException |
|
| 469 | - * @throws InvalidInterfaceException |
|
| 470 | - * @throws ReflectionException |
|
| 471 | - */ |
|
| 472 | - public function column_attendees(EE_Event $event): string |
|
| 473 | - { |
|
| 474 | - $attendees_query_args = [ |
|
| 475 | - 'action' => 'default', |
|
| 476 | - 'event_id' => $event->ID(), |
|
| 477 | - '_reg_status' => RegStatus::APPROVED, |
|
| 478 | - ]; |
|
| 479 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
| 480 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count($event->ID()); |
|
| 481 | - |
|
| 482 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
| 483 | - 'ee_read_event', |
|
| 484 | - 'espresso_registrations_view_registration', |
|
| 485 | - $event->ID() |
|
| 486 | - ) && EE_Registry::instance()->CAP->current_user_can( |
|
| 487 | - 'ee_read_registrations', |
|
| 488 | - 'espresso_registrations_view_registration' |
|
| 489 | - ) |
|
| 490 | - ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
| 491 | - : $registered_attendees; |
|
| 492 | - return $this->columnContent('attendees', $content, 'center'); |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - |
|
| 496 | - /** |
|
| 497 | - * @param EE_Event $event |
|
| 498 | - * @return string |
|
| 499 | - * @throws EE_Error |
|
| 500 | - * @throws InvalidArgumentException |
|
| 501 | - * @throws InvalidDataTypeException |
|
| 502 | - * @throws InvalidInterfaceException |
|
| 503 | - * @throws ReflectionException |
|
| 504 | - */ |
|
| 505 | - public function column_tkts_sold(EE_Event $event): string |
|
| 506 | - { |
|
| 507 | - $content = EEM_Ticket::instance()->sum([['Datetime.EVT_ID' => $event->ID()]], 'TKT_sold'); |
|
| 508 | - return $this->columnContent('tkts_sold', $content); |
|
| 509 | - } |
|
| 510 | - |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * @param EE_Event $event |
|
| 514 | - * @return string |
|
| 515 | - * @throws EE_Error |
|
| 516 | - * @throws InvalidArgumentException |
|
| 517 | - * @throws InvalidDataTypeException |
|
| 518 | - * @throws InvalidInterfaceException |
|
| 519 | - * @throws ReflectionException |
|
| 520 | - */ |
|
| 521 | - public function column_actions(EE_Event $event): string |
|
| 522 | - { |
|
| 523 | - // todo: remove when attendees is active |
|
| 524 | - if (! defined('REG_ADMIN_URL')) { |
|
| 525 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
| 526 | - } |
|
| 527 | - $action_links = []; |
|
| 528 | - $view_link = get_permalink($event->ID()); |
|
| 529 | - $action_links[] = '<a href="' . $view_link . '" class="ee-aria-tooltip button button--icon-only"' |
|
| 530 | - . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank"> |
|
| 195 | + $content .= $this->row_actions($actions); |
|
| 196 | + |
|
| 197 | + return $prep_content ? $this->columnContent('name', $content) : $content; |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * Just a method for setting up the actions for the name column |
|
| 203 | + * |
|
| 204 | + * @param EE_Event $event |
|
| 205 | + * @return array array of actions |
|
| 206 | + * @throws EE_Error |
|
| 207 | + * @throws InvalidArgumentException |
|
| 208 | + * @throws InvalidDataTypeException |
|
| 209 | + * @throws InvalidInterfaceException |
|
| 210 | + * @throws ReflectionException |
|
| 211 | + */ |
|
| 212 | + protected function _column_name_action_setup(EE_Event $event): array |
|
| 213 | + { |
|
| 214 | + // todo: remove when attendees is active |
|
| 215 | + if (! defined('REG_ADMIN_URL')) { |
|
| 216 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
| 217 | + } |
|
| 218 | + $actions = []; |
|
| 219 | + $restore_event_link = ''; |
|
| 220 | + $delete_event_link = ''; |
|
| 221 | + $trash_event_link = ''; |
|
| 222 | + if ( |
|
| 223 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 224 | + 'ee_edit_event', |
|
| 225 | + 'espresso_events_edit', |
|
| 226 | + $event->ID() |
|
| 227 | + ) |
|
| 228 | + ) { |
|
| 229 | + $edit_query_args = [ |
|
| 230 | + 'action' => 'edit', |
|
| 231 | + 'post' => $event->ID(), |
|
| 232 | + ]; |
|
| 233 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
| 234 | + $actions['edit'] = '<a href="' . $edit_link . '" class="ee-aria-tooltip" ' |
|
| 235 | + . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
| 236 | + . esc_html__('Edit', 'event_espresso') |
|
| 237 | + . '</a>'; |
|
| 238 | + } |
|
| 239 | + if ( |
|
| 240 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 241 | + 'ee_read_registrations', |
|
| 242 | + 'espresso_registrations_view_registration' |
|
| 243 | + ) |
|
| 244 | + && EE_Registry::instance()->CAP->current_user_can( |
|
| 245 | + 'ee_read_event', |
|
| 246 | + 'espresso_registrations_view_registration', |
|
| 247 | + $event->ID() |
|
| 248 | + ) |
|
| 249 | + ) { |
|
| 250 | + $attendees_query_args = [ |
|
| 251 | + 'action' => 'default', |
|
| 252 | + 'event_id' => $event->ID(), |
|
| 253 | + ]; |
|
| 254 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
| 255 | + $actions['attendees'] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip"' |
|
| 256 | + . ' aria-label="' . esc_attr__('View Registrations', 'event_espresso') . '">' |
|
| 257 | + . esc_html__('Registrations', 'event_espresso') |
|
| 258 | + . '</a>'; |
|
| 259 | + } |
|
| 260 | + if ( |
|
| 261 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 262 | + 'ee_delete_event', |
|
| 263 | + 'espresso_events_trash_event', |
|
| 264 | + $event->ID() |
|
| 265 | + ) |
|
| 266 | + ) { |
|
| 267 | + $trash_event_query_args = [ |
|
| 268 | + 'action' => 'trash_event', |
|
| 269 | + 'EVT_ID' => $event->ID(), |
|
| 270 | + ]; |
|
| 271 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
| 272 | + $trash_event_query_args, |
|
| 273 | + EVENTS_ADMIN_URL |
|
| 274 | + ); |
|
| 275 | + } |
|
| 276 | + if ( |
|
| 277 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 278 | + 'ee_delete_event', |
|
| 279 | + 'espresso_events_restore_event', |
|
| 280 | + $event->ID() |
|
| 281 | + ) |
|
| 282 | + ) { |
|
| 283 | + $restore_event_query_args = [ |
|
| 284 | + 'action' => 'restore_event', |
|
| 285 | + 'EVT_ID' => $event->ID(), |
|
| 286 | + ]; |
|
| 287 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
| 288 | + $restore_event_query_args, |
|
| 289 | + EVENTS_ADMIN_URL |
|
| 290 | + ); |
|
| 291 | + } |
|
| 292 | + if ( |
|
| 293 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 294 | + 'ee_delete_event', |
|
| 295 | + 'espresso_events_delete_event', |
|
| 296 | + $event->ID() |
|
| 297 | + ) |
|
| 298 | + ) { |
|
| 299 | + $delete_event_query_args = [ |
|
| 300 | + 'action' => 'delete_event', |
|
| 301 | + 'EVT_ID' => $event->ID(), |
|
| 302 | + ]; |
|
| 303 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
| 304 | + $delete_event_query_args, |
|
| 305 | + EVENTS_ADMIN_URL |
|
| 306 | + ); |
|
| 307 | + } |
|
| 308 | + $view_link = get_permalink($event->ID()); |
|
| 309 | + $actions['view'] = '<a href="' . $view_link . '" class="ee-aria-tooltip"' |
|
| 310 | + . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '">' |
|
| 311 | + . esc_html__('View', 'event_espresso') |
|
| 312 | + . '</a>'; |
|
| 313 | + if ($event->get('status') === 'trash') { |
|
| 314 | + if ( |
|
| 315 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 316 | + 'ee_delete_event', |
|
| 317 | + 'espresso_events_restore_event', |
|
| 318 | + $event->ID() |
|
| 319 | + ) |
|
| 320 | + ) { |
|
| 321 | + $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" class="ee-aria-tooltip"' |
|
| 322 | + . ' aria-label="' . esc_attr__('Restore from Trash', 'event_espresso') |
|
| 323 | + . '">' |
|
| 324 | + . esc_html__('Restore from Trash', 'event_espresso') |
|
| 325 | + . '</a>'; |
|
| 326 | + } |
|
| 327 | + if ( |
|
| 328 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 329 | + 'ee_delete_event', |
|
| 330 | + 'espresso_events_delete_event', |
|
| 331 | + $event->ID() |
|
| 332 | + ) |
|
| 333 | + ) { |
|
| 334 | + $actions['delete'] = '<a href="' . $delete_event_link . '" class="ee-aria-tooltip"' |
|
| 335 | + . ' aria-label="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' |
|
| 336 | + . esc_html__('Delete Permanently', 'event_espresso') |
|
| 337 | + . '</a>'; |
|
| 338 | + } |
|
| 339 | + } else { |
|
| 340 | + if ( |
|
| 341 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 342 | + 'ee_delete_event', |
|
| 343 | + 'espresso_events_trash_event', |
|
| 344 | + $event->ID() |
|
| 345 | + ) |
|
| 346 | + ) { |
|
| 347 | + $actions['move to trash'] = '<a href="' . $trash_event_link . '" class="ee-aria-tooltip"' |
|
| 348 | + . ' aria-label="' . esc_attr__('Trash Event', 'event_espresso') . '">' |
|
| 349 | + . esc_html__('Trash', 'event_espresso') |
|
| 350 | + . '</a>'; |
|
| 351 | + } |
|
| 352 | + } |
|
| 353 | + return $actions; |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * @param EE_Event $event |
|
| 359 | + * @return string |
|
| 360 | + * @throws EE_Error |
|
| 361 | + * @throws ReflectionException |
|
| 362 | + */ |
|
| 363 | + public function column_author(EE_Event $event): string |
|
| 364 | + { |
|
| 365 | + // user author info |
|
| 366 | + $event_author = get_userdata($event->wp_user()); |
|
| 367 | + $gravatar = get_avatar($event->wp_user(), '24'); |
|
| 368 | + // filter link |
|
| 369 | + $query_args = [ |
|
| 370 | + 'action' => 'default', |
|
| 371 | + 'EVT_wp_user' => $event->wp_user(), |
|
| 372 | + ]; |
|
| 373 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
| 374 | + $content = '<div class="ee-layout-row ee-layout-row--fixed">'; |
|
| 375 | + $content .= ' <a href="' . $filter_url . '" class="ee-event-author ee-aria-tooltip"' |
|
| 376 | + . ' aria-label="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
| 377 | + . $gravatar . $event_author->display_name |
|
| 378 | + . '</a>'; |
|
| 379 | + $content .= '</div>'; |
|
| 380 | + return $this->columnContent('author', $content); |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * @param EE_Event $event |
|
| 386 | + * @return string |
|
| 387 | + * @throws EE_Error |
|
| 388 | + * @throws ReflectionException |
|
| 389 | + */ |
|
| 390 | + public function column_event_category(EE_Event $event): string |
|
| 391 | + { |
|
| 392 | + $event_categories = $event->get_all_event_categories(); |
|
| 393 | + $content = implode( |
|
| 394 | + ', ', |
|
| 395 | + array_map( |
|
| 396 | + function (EE_Term $category) { |
|
| 397 | + return $category->name(); |
|
| 398 | + }, |
|
| 399 | + $event_categories |
|
| 400 | + ) |
|
| 401 | + ); |
|
| 402 | + return $this->columnContent('event_category', $content); |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * @param EE_Event $event |
|
| 408 | + * @return string |
|
| 409 | + * @throws EE_Error |
|
| 410 | + * @throws ReflectionException |
|
| 411 | + */ |
|
| 412 | + public function column_venue(EE_Event $event): string |
|
| 413 | + { |
|
| 414 | + $venue = $event->get_first_related('Venue'); |
|
| 415 | + $content = ! empty($venue) |
|
| 416 | + ? $venue->name() |
|
| 417 | + : ''; |
|
| 418 | + return $this->columnContent('venue', $content); |
|
| 419 | + } |
|
| 420 | + |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * @param EE_Event $event |
|
| 424 | + * @return string |
|
| 425 | + * @throws EE_Error |
|
| 426 | + * @throws ReflectionException |
|
| 427 | + * @throws Exception |
|
| 428 | + */ |
|
| 429 | + public function column_start_date_time(EE_Event $event): string |
|
| 430 | + { |
|
| 431 | + $month_range = $this->request->getRequestParam('month_range'); |
|
| 432 | + if ($month_range) { |
|
| 433 | + $where = ['DTT_EVT_start' => $this->_admin_page->whereParamsForDatetimeMonthRange($month_range)]; |
|
| 434 | + $this->_dtt = $event->get_first_related('Datetime', [$where]); |
|
| 435 | + } |
|
| 436 | + $content = $this->_dtt instanceof EE_Datetime |
|
| 437 | + ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') |
|
| 438 | + : esc_html__('No Date was saved for this Event', 'event_espresso'); |
|
| 439 | + return $this->columnContent('start_date_time', $content); |
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * @param EE_Event $event |
|
| 445 | + * @return string |
|
| 446 | + * @throws EE_Error |
|
| 447 | + * @throws ReflectionException |
|
| 448 | + */ |
|
| 449 | + public function column_reg_begins(EE_Event $event): string |
|
| 450 | + { |
|
| 451 | + if ($this->_dtt instanceof EE_Datetime) { |
|
| 452 | + $reg_start = $this->_dtt->get_first_related('Ticket'); |
|
| 453 | + } else { |
|
| 454 | + $reg_start = $event->get_ticket_with_earliest_start_time(); |
|
| 455 | + } |
|
| 456 | + $content = $reg_start instanceof EE_Ticket |
|
| 457 | + ? $reg_start->get_i18n_datetime('TKT_start_date') |
|
| 458 | + : esc_html__('No Tickets have been setup for this Event', 'event_espresso'); |
|
| 459 | + return $this->columnContent('reg_begins', $content); |
|
| 460 | + } |
|
| 461 | + |
|
| 462 | + |
|
| 463 | + /** |
|
| 464 | + * @param EE_Event $event |
|
| 465 | + * @return string |
|
| 466 | + * @throws EE_Error |
|
| 467 | + * @throws InvalidArgumentException |
|
| 468 | + * @throws InvalidDataTypeException |
|
| 469 | + * @throws InvalidInterfaceException |
|
| 470 | + * @throws ReflectionException |
|
| 471 | + */ |
|
| 472 | + public function column_attendees(EE_Event $event): string |
|
| 473 | + { |
|
| 474 | + $attendees_query_args = [ |
|
| 475 | + 'action' => 'default', |
|
| 476 | + 'event_id' => $event->ID(), |
|
| 477 | + '_reg_status' => RegStatus::APPROVED, |
|
| 478 | + ]; |
|
| 479 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
| 480 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($event->ID()); |
|
| 481 | + |
|
| 482 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
| 483 | + 'ee_read_event', |
|
| 484 | + 'espresso_registrations_view_registration', |
|
| 485 | + $event->ID() |
|
| 486 | + ) && EE_Registry::instance()->CAP->current_user_can( |
|
| 487 | + 'ee_read_registrations', |
|
| 488 | + 'espresso_registrations_view_registration' |
|
| 489 | + ) |
|
| 490 | + ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
| 491 | + : $registered_attendees; |
|
| 492 | + return $this->columnContent('attendees', $content, 'center'); |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + |
|
| 496 | + /** |
|
| 497 | + * @param EE_Event $event |
|
| 498 | + * @return string |
|
| 499 | + * @throws EE_Error |
|
| 500 | + * @throws InvalidArgumentException |
|
| 501 | + * @throws InvalidDataTypeException |
|
| 502 | + * @throws InvalidInterfaceException |
|
| 503 | + * @throws ReflectionException |
|
| 504 | + */ |
|
| 505 | + public function column_tkts_sold(EE_Event $event): string |
|
| 506 | + { |
|
| 507 | + $content = EEM_Ticket::instance()->sum([['Datetime.EVT_ID' => $event->ID()]], 'TKT_sold'); |
|
| 508 | + return $this->columnContent('tkts_sold', $content); |
|
| 509 | + } |
|
| 510 | + |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * @param EE_Event $event |
|
| 514 | + * @return string |
|
| 515 | + * @throws EE_Error |
|
| 516 | + * @throws InvalidArgumentException |
|
| 517 | + * @throws InvalidDataTypeException |
|
| 518 | + * @throws InvalidInterfaceException |
|
| 519 | + * @throws ReflectionException |
|
| 520 | + */ |
|
| 521 | + public function column_actions(EE_Event $event): string |
|
| 522 | + { |
|
| 523 | + // todo: remove when attendees is active |
|
| 524 | + if (! defined('REG_ADMIN_URL')) { |
|
| 525 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
| 526 | + } |
|
| 527 | + $action_links = []; |
|
| 528 | + $view_link = get_permalink($event->ID()); |
|
| 529 | + $action_links[] = '<a href="' . $view_link . '" class="ee-aria-tooltip button button--icon-only"' |
|
| 530 | + . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank"> |
|
| 531 | 531 | <span class="dashicons dashicons-visibility"></span></a>'; |
| 532 | - if ( |
|
| 533 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 534 | - 'ee_edit_event', |
|
| 535 | - 'espresso_events_edit', |
|
| 536 | - $event->ID() |
|
| 537 | - ) |
|
| 538 | - ) { |
|
| 539 | - $edit_query_args = [ |
|
| 540 | - 'action' => 'edit', |
|
| 541 | - 'post' => $event->ID(), |
|
| 542 | - ]; |
|
| 543 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
| 544 | - $action_links[] = '<a href="' . $edit_link . '" class="ee-aria-tooltip button button--icon-only"' |
|
| 545 | - . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
| 546 | - . '<span class="dashicons dashicons-calendar-alt"></span>' |
|
| 547 | - . '</a>'; |
|
| 548 | - } |
|
| 549 | - if ( |
|
| 550 | - EE_Registry::instance()->CAP->current_user_can( |
|
| 551 | - 'ee_read_registrations', |
|
| 552 | - 'espresso_registrations_view_registration' |
|
| 553 | - ) |
|
| 554 | - && EE_Registry::instance()->CAP->current_user_can( |
|
| 555 | - 'ee_read_event', |
|
| 556 | - 'espresso_registrations_view_registration', |
|
| 557 | - $event->ID() |
|
| 558 | - ) |
|
| 559 | - ) { |
|
| 560 | - $attendees_query_args = [ |
|
| 561 | - 'action' => 'default', |
|
| 562 | - 'event_id' => $event->ID(), |
|
| 563 | - ]; |
|
| 564 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
| 565 | - $action_links[] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip button button--icon-only"' |
|
| 566 | - . ' aria-label="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
| 567 | - . '<span class="dashicons dashicons-groups"></span>' |
|
| 568 | - . '</a>'; |
|
| 569 | - } |
|
| 570 | - $action_links = apply_filters( |
|
| 571 | - 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
| 572 | - $action_links, |
|
| 573 | - $event |
|
| 574 | - ); |
|
| 575 | - $content = $this->_action_string( |
|
| 576 | - implode("\n\t", $action_links), |
|
| 577 | - $event, |
|
| 578 | - 'div', |
|
| 579 | - 'event-overview-actions ee-list-table-actions' |
|
| 580 | - ); |
|
| 581 | - return $this->columnContent('actions', $this->actionsModalMenu($content)); |
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - |
|
| 585 | - /** |
|
| 586 | - * Helper for adding columns conditionally |
|
| 587 | - * |
|
| 588 | - * @throws EE_Error |
|
| 589 | - * @throws InvalidArgumentException |
|
| 590 | - * @throws InvalidDataTypeException |
|
| 591 | - * @throws InvalidInterfaceException |
|
| 592 | - * @throws ReflectionException |
|
| 593 | - */ |
|
| 594 | - private function addConditionalColumns() |
|
| 595 | - { |
|
| 596 | - $event_category_count = EEM_Term::instance()->count( |
|
| 597 | - [['Term_Taxonomy.taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY]] |
|
| 598 | - ); |
|
| 599 | - if ($event_category_count === 0) { |
|
| 600 | - return; |
|
| 601 | - } |
|
| 602 | - $column_array = []; |
|
| 603 | - foreach ($this->_columns as $column => $column_label) { |
|
| 604 | - $column_array[ $column ] = $column_label; |
|
| 605 | - if ($column === 'venue') { |
|
| 606 | - $column_array['event_category'] = esc_html__('Event Category', 'event_espresso'); |
|
| 607 | - } |
|
| 608 | - } |
|
| 609 | - $this->_columns = $column_array; |
|
| 610 | - } |
|
| 532 | + if ( |
|
| 533 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 534 | + 'ee_edit_event', |
|
| 535 | + 'espresso_events_edit', |
|
| 536 | + $event->ID() |
|
| 537 | + ) |
|
| 538 | + ) { |
|
| 539 | + $edit_query_args = [ |
|
| 540 | + 'action' => 'edit', |
|
| 541 | + 'post' => $event->ID(), |
|
| 542 | + ]; |
|
| 543 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
| 544 | + $action_links[] = '<a href="' . $edit_link . '" class="ee-aria-tooltip button button--icon-only"' |
|
| 545 | + . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
| 546 | + . '<span class="dashicons dashicons-calendar-alt"></span>' |
|
| 547 | + . '</a>'; |
|
| 548 | + } |
|
| 549 | + if ( |
|
| 550 | + EE_Registry::instance()->CAP->current_user_can( |
|
| 551 | + 'ee_read_registrations', |
|
| 552 | + 'espresso_registrations_view_registration' |
|
| 553 | + ) |
|
| 554 | + && EE_Registry::instance()->CAP->current_user_can( |
|
| 555 | + 'ee_read_event', |
|
| 556 | + 'espresso_registrations_view_registration', |
|
| 557 | + $event->ID() |
|
| 558 | + ) |
|
| 559 | + ) { |
|
| 560 | + $attendees_query_args = [ |
|
| 561 | + 'action' => 'default', |
|
| 562 | + 'event_id' => $event->ID(), |
|
| 563 | + ]; |
|
| 564 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
| 565 | + $action_links[] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip button button--icon-only"' |
|
| 566 | + . ' aria-label="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
| 567 | + . '<span class="dashicons dashicons-groups"></span>' |
|
| 568 | + . '</a>'; |
|
| 569 | + } |
|
| 570 | + $action_links = apply_filters( |
|
| 571 | + 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
| 572 | + $action_links, |
|
| 573 | + $event |
|
| 574 | + ); |
|
| 575 | + $content = $this->_action_string( |
|
| 576 | + implode("\n\t", $action_links), |
|
| 577 | + $event, |
|
| 578 | + 'div', |
|
| 579 | + 'event-overview-actions ee-list-table-actions' |
|
| 580 | + ); |
|
| 581 | + return $this->columnContent('actions', $this->actionsModalMenu($content)); |
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + |
|
| 585 | + /** |
|
| 586 | + * Helper for adding columns conditionally |
|
| 587 | + * |
|
| 588 | + * @throws EE_Error |
|
| 589 | + * @throws InvalidArgumentException |
|
| 590 | + * @throws InvalidDataTypeException |
|
| 591 | + * @throws InvalidInterfaceException |
|
| 592 | + * @throws ReflectionException |
|
| 593 | + */ |
|
| 594 | + private function addConditionalColumns() |
|
| 595 | + { |
|
| 596 | + $event_category_count = EEM_Term::instance()->count( |
|
| 597 | + [['Term_Taxonomy.taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY]] |
|
| 598 | + ); |
|
| 599 | + if ($event_category_count === 0) { |
|
| 600 | + return; |
|
| 601 | + } |
|
| 602 | + $column_array = []; |
|
| 603 | + foreach ($this->_columns as $column => $column_label) { |
|
| 604 | + $column_array[ $column ] = $column_label; |
|
| 605 | + if ($column === 'venue') { |
|
| 606 | + $column_array['event_category'] = esc_html__('Event Category', 'event_espresso'); |
|
| 607 | + } |
|
| 608 | + } |
|
| 609 | + $this->_columns = $column_array; |
|
| 610 | + } |
|
| 611 | 611 | } |
@@ -16,458 +16,458 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class EEM_Payment_Method extends EEM_Base |
| 18 | 18 | { |
| 19 | - const scope_cart = 'CART'; |
|
| 20 | - |
|
| 21 | - const scope_admin = 'ADMIN'; |
|
| 22 | - |
|
| 23 | - const scope_api = 'API'; |
|
| 24 | - |
|
| 25 | - |
|
| 26 | - protected static ?EEM_Payment_Method $_instance = null; |
|
| 27 | - |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * private constructor to prevent direct creation |
|
| 31 | - * |
|
| 32 | - * @param string|null $timezone |
|
| 33 | - * @throws EE_Error |
|
| 34 | - */ |
|
| 35 | - protected function __construct(?string $timezone = '') |
|
| 36 | - { |
|
| 37 | - $this->singular_item = esc_html__('Payment Method', 'event_espresso'); |
|
| 38 | - $this->plural_item = esc_html__('Payment Methods', 'event_espresso'); |
|
| 39 | - $this->_tables = [ |
|
| 40 | - 'Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'), |
|
| 41 | - ]; |
|
| 42 | - $this->_fields = [ |
|
| 43 | - 'Payment_Method' => [ |
|
| 44 | - 'PMD_ID' => new EE_Primary_Key_Int_Field( |
|
| 45 | - 'PMD_ID', |
|
| 46 | - esc_html__('ID', 'event_espresso') |
|
| 47 | - ), |
|
| 48 | - 'PMD_type' => new EE_Plain_Text_Field( |
|
| 49 | - 'PMD_type', |
|
| 50 | - esc_html__('Payment Method Type', 'event_espresso'), |
|
| 51 | - false, |
|
| 52 | - 'Admin_Only' |
|
| 53 | - ), |
|
| 54 | - 'PMD_name' => new EE_Plain_Text_Field( |
|
| 55 | - 'PMD_name', |
|
| 56 | - esc_html__('Name', 'event_espresso'), |
|
| 57 | - false |
|
| 58 | - ), |
|
| 59 | - 'PMD_desc' => new EE_Post_Content_Field( |
|
| 60 | - 'PMD_desc', |
|
| 61 | - esc_html__('Description', 'event_espresso'), |
|
| 62 | - false, |
|
| 63 | - '' |
|
| 64 | - ), |
|
| 65 | - 'PMD_admin_name' => new EE_Plain_Text_Field( |
|
| 66 | - 'PMD_admin_name', |
|
| 67 | - esc_html__('Admin-Only Name', 'event_espresso'), |
|
| 68 | - true |
|
| 69 | - ), |
|
| 70 | - 'PMD_admin_desc' => new EE_Post_Content_Field( |
|
| 71 | - 'PMD_admin_desc', |
|
| 72 | - esc_html__('Admin-Only Description', 'event_espresso'), |
|
| 73 | - true, |
|
| 74 | - '' |
|
| 75 | - ), |
|
| 76 | - 'PMD_slug' => new EE_Slug_Field( |
|
| 77 | - 'PMD_slug', |
|
| 78 | - esc_html__('Slug', 'event_espresso'), |
|
| 79 | - false |
|
| 80 | - ), |
|
| 81 | - 'PMD_order' => new EE_Integer_Field( |
|
| 82 | - 'PMD_order', |
|
| 83 | - esc_html__('Order', 'event_espresso'), |
|
| 84 | - false, |
|
| 85 | - 0 |
|
| 86 | - ), |
|
| 87 | - 'PMD_debug_mode' => new EE_Boolean_Field( |
|
| 88 | - 'PMD_debug_mode', |
|
| 89 | - esc_html__('Sandbox Mode On? (AKA: debug mode)', 'event_espresso'), |
|
| 90 | - false, |
|
| 91 | - false |
|
| 92 | - ), |
|
| 93 | - 'PMD_wp_user' => new EE_WP_User_Field( |
|
| 94 | - 'PMD_wp_user', |
|
| 95 | - esc_html__('Payment Method Creator ID', 'event_espresso'), |
|
| 96 | - false |
|
| 97 | - ), |
|
| 98 | - 'PMD_open_by_default' => new EE_Boolean_Field( |
|
| 99 | - 'PMD_open_by_default', |
|
| 100 | - esc_html__('Open by Default?', 'event_espresso'), |
|
| 101 | - false, |
|
| 102 | - false |
|
| 103 | - ), |
|
| 104 | - 'PMD_button_url' => new EE_Plain_Text_Field( |
|
| 105 | - 'PMD_button_url', |
|
| 106 | - esc_html__('Button URL', 'event_espresso'), |
|
| 107 | - true, |
|
| 108 | - '' |
|
| 109 | - ), |
|
| 110 | - 'PMD_scope' => new EE_Serialized_Text_Field( |
|
| 111 | - 'PMD_scope', |
|
| 112 | - esc_html__('Usable From?', 'event_espresso'), |
|
| 113 | - false, |
|
| 114 | - []// possible values currently are 'CART','ADMIN','API' |
|
| 115 | - ), |
|
| 116 | - ], |
|
| 117 | - ]; |
|
| 118 | - $this->_model_relations = [ |
|
| 119 | - 'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'), |
|
| 120 | - 'Payment' => new EE_Has_Many_Relation(), |
|
| 121 | - 'Transaction' => new EE_Has_Many_Relation(), |
|
| 122 | - 'WP_User' => new EE_Belongs_To_Relation(), |
|
| 123 | - ]; |
|
| 124 | - parent::__construct($timezone); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Gets one by the slug provided |
|
| 130 | - * |
|
| 131 | - * @param string $slug |
|
| 132 | - * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|NULL |
|
| 133 | - * @throws EE_Error |
|
| 134 | - */ |
|
| 135 | - public function get_one_by_slug($slug) |
|
| 136 | - { |
|
| 137 | - return $this->get_one([['PMD_slug' => $slug]]); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Gets all the acceptable scopes for payment methods. |
|
| 143 | - * Keys are their names as store din the DB, and values are nice names for displaying them |
|
| 144 | - * |
|
| 145 | - * @return array |
|
| 146 | - */ |
|
| 147 | - public function scopes() |
|
| 148 | - { |
|
| 149 | - return apply_filters( |
|
| 150 | - 'FHEE__EEM_Payment_Method__scopes', |
|
| 151 | - [ |
|
| 152 | - EEM_Payment_Method::scope_cart => esc_html__('Front-end Registration Page', 'event_espresso'), |
|
| 153 | - EEM_Payment_Method::scope_admin => esc_html__( |
|
| 154 | - 'Admin Registration Page (no online processing)', |
|
| 155 | - 'event_espresso' |
|
| 156 | - ), |
|
| 157 | - ] |
|
| 158 | - ); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Determines if this is an valid scope |
|
| 164 | - * |
|
| 165 | - * @param string $scope like one of EEM_Payment_Method::instance()->scopes() |
|
| 166 | - * @return boolean |
|
| 167 | - */ |
|
| 168 | - public function is_valid_scope($scope) |
|
| 169 | - { |
|
| 170 | - $scopes = $this->scopes(); |
|
| 171 | - if (isset($scopes[ $scope ])) { |
|
| 172 | - return true; |
|
| 173 | - } |
|
| 174 | - return false; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Gets all active payment methods |
|
| 180 | - * |
|
| 181 | - * @param string $scope one of |
|
| 182 | - * @param array $query_params |
|
| 183 | - * @return EE_Base_Class[]|EE_Payment_Method[] |
|
| 184 | - * @throws EE_Error |
|
| 185 | - */ |
|
| 186 | - public function get_all_active($scope = null, $query_params = []) |
|
| 187 | - { |
|
| 188 | - if (! isset($query_params['order_by']) && ! isset($query_params['order'])) { |
|
| 189 | - $query_params['order_by'] = ['PMD_order' => 'ASC', 'PMD_ID' => 'ASC']; |
|
| 190 | - } |
|
| 191 | - return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * Counts all active gateways in the specified scope |
|
| 197 | - * |
|
| 198 | - * @param string $scope one of EEM_Payment_Method::scope_* |
|
| 199 | - * @param array $query_params |
|
| 200 | - * @return int |
|
| 201 | - * @throws EE_Error |
|
| 202 | - */ |
|
| 203 | - public function count_active($scope = null, $query_params = []) |
|
| 204 | - { |
|
| 205 | - return $this->count($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * Creates the $query_params that can be passed into any EEM_Payment_Method as their $query_params |
|
| 211 | - * argument to get all active for a given scope |
|
| 212 | - * |
|
| 213 | - * @param string $scope one of the constants EEM_Payment_Method::scope_* |
|
| 214 | - * @param array $query_params |
|
| 215 | - * @return array |
|
| 216 | - * @throws EE_Error |
|
| 217 | - * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
| 218 | - */ |
|
| 219 | - protected function _get_query_params_for_all_active($scope = null, $query_params = []) |
|
| 220 | - { |
|
| 221 | - if ($scope) { |
|
| 222 | - if ($this->is_valid_scope($scope)) { |
|
| 223 | - return array_replace_recursive([['PMD_scope' => ['LIKE', "%$scope%"]]], $query_params); |
|
| 224 | - } |
|
| 225 | - throw new EE_Error( |
|
| 226 | - sprintf( |
|
| 227 | - esc_html__("'%s' is not a valid scope for a payment method", 'event_espresso'), |
|
| 228 | - $scope |
|
| 229 | - ) |
|
| 230 | - ); |
|
| 231 | - } |
|
| 232 | - $acceptable_scopes = []; |
|
| 233 | - $count = 0; |
|
| 234 | - foreach ($this->scopes() as $scope_name => $desc) { |
|
| 235 | - $count++; |
|
| 236 | - $acceptable_scopes[ 'PMD_scope*' . $count ] = ['LIKE', '%' . $scope_name . '%']; |
|
| 237 | - } |
|
| 238 | - return array_replace_recursive([['OR*active_scope' => $acceptable_scopes]], $query_params); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * Creates the $query_params that can be passed into any EEM_Payment_Method as their $query_params |
|
| 244 | - * argument to get all active for a given scope |
|
| 245 | - * |
|
| 246 | - * @param string $scope one of the constants EEM_Payment_Method::scope_* |
|
| 247 | - * @param array $query_params |
|
| 248 | - * @return array |
|
| 249 | - * @throws EE_Error |
|
| 250 | - * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
| 251 | - */ |
|
| 252 | - public function get_query_params_for_all_active($scope = null, $query_params = []) |
|
| 253 | - { |
|
| 254 | - return $this->_get_query_params_for_all_active($scope, $query_params); |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * Gets one active payment method. see @get_all_active for documentation |
|
| 260 | - * |
|
| 261 | - * @param string $scope |
|
| 262 | - * @param array $query_params |
|
| 263 | - * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|NULL |
|
| 264 | - * @throws EE_Error |
|
| 265 | - */ |
|
| 266 | - public function get_one_active($scope = null, $query_params = []) |
|
| 267 | - { |
|
| 268 | - return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Gets one payment method of that type, regardless of whether its active or not |
|
| 274 | - * |
|
| 275 | - * @param string $type |
|
| 276 | - * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|NULL |
|
| 277 | - * @throws EE_Error |
|
| 278 | - */ |
|
| 279 | - public function get_one_of_type($type) |
|
| 280 | - { |
|
| 281 | - return $this->get_one([['PMD_type' => $type]]); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * Overrides parent ot also check by the slug |
|
| 287 | - * |
|
| 288 | - * @param string|int|EE_Payment_Method $base_class_obj_or_id |
|
| 289 | - * @param boolean $ensure_is_in_db |
|
| 290 | - * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|int|string |
|
| 291 | - * @throws EE_Error |
|
| 292 | - * @see EEM_Base::ensure_is_obj() |
|
| 293 | - */ |
|
| 294 | - public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = false) |
|
| 295 | - { |
|
| 296 | - // first: check if it's a slug |
|
| 297 | - if (is_string($base_class_obj_or_id)) { |
|
| 298 | - $obj = $this->get_one_by_slug($base_class_obj_or_id); |
|
| 299 | - if ($obj) { |
|
| 300 | - return $obj; |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - // ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID) |
|
| 304 | - try { |
|
| 305 | - return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db); |
|
| 306 | - } catch (EE_Error $e) { |
|
| 307 | - // handle it outside the catch |
|
| 308 | - } |
|
| 309 | - throw new EE_Error( |
|
| 310 | - sprintf( |
|
| 311 | - esc_html__("'%s' is neither a Payment Method ID, slug, nor object.", 'event_espresso'), |
|
| 312 | - $base_class_obj_or_id |
|
| 313 | - ) |
|
| 314 | - ); |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - |
|
| 318 | - /** |
|
| 319 | - * Gets the ID of this object, or if its a string finds the object's id |
|
| 320 | - * associated with that slug |
|
| 321 | - * |
|
| 322 | - * @param mixed $base_obj_or_id_or_slug |
|
| 323 | - * @return int |
|
| 324 | - * @throws EE_Error |
|
| 325 | - */ |
|
| 326 | - public function ensure_is_ID($base_obj_or_id_or_slug) |
|
| 327 | - { |
|
| 328 | - if (is_string($base_obj_or_id_or_slug)) { |
|
| 329 | - // assume it's a slug |
|
| 330 | - $base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug); |
|
| 331 | - } |
|
| 332 | - return parent::ensure_is_ID($base_obj_or_id_or_slug); |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - |
|
| 336 | - /** |
|
| 337 | - * Verifies the button urls on all the passed payment methods have a valid button url. |
|
| 338 | - * If not, resets them to their default. |
|
| 339 | - * |
|
| 340 | - * @param EE_Payment_Method[] $payment_methods if NULL, defaults to all payment methods active in the cart |
|
| 341 | - * @throws EE_Error |
|
| 342 | - * @throws ReflectionException |
|
| 343 | - */ |
|
| 344 | - public function verify_button_urls($payment_methods = null) |
|
| 345 | - { |
|
| 346 | - $payment_methods = is_array($payment_methods) |
|
| 347 | - ? $payment_methods |
|
| 348 | - : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
| 349 | - foreach ($payment_methods as $payment_method) { |
|
| 350 | - try { |
|
| 351 | - // If there is really no button URL at all, or if the button URLs still point to decaf folder even |
|
| 352 | - // though this is a caffeinated install, reset it to the default. |
|
| 353 | - $current_button_url = $payment_method->button_url(); |
|
| 354 | - if ( |
|
| 355 | - empty($current_button_url) |
|
| 356 | - || ( |
|
| 357 | - strpos($current_button_url, 'decaf') !== false |
|
| 358 | - && strpos($payment_method->type_obj()->default_button_url(), 'decaf') === false |
|
| 359 | - ) |
|
| 360 | - ) { |
|
| 361 | - $payment_method->save( |
|
| 362 | - [ |
|
| 363 | - 'PMD_button_url' => $payment_method->type_obj()->default_button_url(), |
|
| 364 | - ] |
|
| 365 | - ); |
|
| 366 | - } |
|
| 367 | - } catch (EE_Error $e) { |
|
| 368 | - $payment_method->deactivate(); |
|
| 369 | - } |
|
| 370 | - } |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - |
|
| 374 | - /** |
|
| 375 | - * Overrides parent to not only turn wpdb results into EE_Payment_Method objects, |
|
| 376 | - * but also verifies the payment method type of each is a usable object. If not, |
|
| 377 | - * deactivate it, sets a notification, and deactivates it |
|
| 378 | - * |
|
| 379 | - * @param array $rows |
|
| 380 | - * @return EE_Payment_Method[] |
|
| 381 | - * @throws EE_Error |
|
| 382 | - * @throws InvalidDataTypeException |
|
| 383 | - * @throws ReflectionException |
|
| 384 | - */ |
|
| 385 | - protected function _create_objects($rows = []) |
|
| 386 | - { |
|
| 387 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 388 | - $PMM = EE_Payment_Method_Manager::instance(); |
|
| 389 | - $payment_methods = parent::_create_objects($rows); |
|
| 390 | - /* @var $payment_methods EE_Payment_Method[] */ |
|
| 391 | - $usable_payment_methods = []; |
|
| 392 | - foreach ($payment_methods as $key => $payment_method) { |
|
| 393 | - // check if the payment method type exists and force recheck |
|
| 394 | - $pm_type_exists = $PMM->payment_method_type_exists($payment_method->type(), true); |
|
| 395 | - if ($pm_type_exists) { |
|
| 396 | - $usable_payment_methods[ $key ] = $payment_method; |
|
| 397 | - // some payment methods enqueue their scripts in EE_PMT_*::__construct |
|
| 398 | - // which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue |
|
| 399 | - // its scripts). but for backwards-compat we should continue to do that |
|
| 400 | - $payment_method->type_obj(); |
|
| 401 | - } elseif ($payment_method->active()) { |
|
| 402 | - // only deactivate and notify the admin if the payment is active somewhere |
|
| 403 | - $payment_method->deactivate(); |
|
| 404 | - $payment_method->save(); |
|
| 405 | - do_action( |
|
| 406 | - 'AHEE__EEM_Payment_Method___create_objects_auto_deactivated_payment_method', |
|
| 407 | - $payment_method |
|
| 408 | - ); |
|
| 409 | - new PersistentAdminNotice( |
|
| 410 | - 'auto-deactivated-' . $payment_method->type(), |
|
| 411 | - sprintf( |
|
| 412 | - esc_html__( |
|
| 413 | - 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', |
|
| 414 | - 'event_espresso' |
|
| 415 | - ), |
|
| 416 | - $payment_method->admin_name(), |
|
| 417 | - '<br />', |
|
| 418 | - '<a href="' . admin_url('plugins.php') . '">', |
|
| 419 | - '</a>' |
|
| 420 | - ), |
|
| 421 | - true |
|
| 422 | - ); |
|
| 423 | - } |
|
| 424 | - } |
|
| 425 | - return $usable_payment_methods; |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * Gets all the payment methods which can be used for transaction |
|
| 431 | - * (according to the relations between payment methods and events, and |
|
| 432 | - * the currencies used for the transaction and their relation to payment methods) |
|
| 433 | - * |
|
| 434 | - * @param EE_Transaction $transaction |
|
| 435 | - * @param string $scope @see EEM_Payment_Method::get_all_for_events |
|
| 436 | - * @return EE_Payment_Method[] |
|
| 437 | - * @throws EE_Error |
|
| 438 | - */ |
|
| 439 | - public function get_all_for_transaction($transaction, $scope) |
|
| 440 | - { |
|
| 441 | - // give addons a chance to override what payment methods are chosen based on the transaction |
|
| 442 | - return apply_filters( |
|
| 443 | - 'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods', |
|
| 444 | - $this->get_all_active($scope, ['group_by' => 'PMD_type']), |
|
| 445 | - $transaction, |
|
| 446 | - $scope |
|
| 447 | - ); |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - |
|
| 451 | - /** |
|
| 452 | - * Returns the payment method used for the last payment made for a registration. |
|
| 453 | - * Note: if an offline payment method was selected on the related transaction then this will have no payment |
|
| 454 | - * methods returned. It will ONLY return a payment method for a PAYMENT recorded against the registration. |
|
| 455 | - * |
|
| 456 | - * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the |
|
| 457 | - * registration. |
|
| 458 | - * @return EE_Payment|null |
|
| 459 | - * @throws EE_Error |
|
| 460 | - */ |
|
| 461 | - public function get_last_used_for_registration($registration_or_reg_id) |
|
| 462 | - { |
|
| 463 | - $registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id); |
|
| 464 | - |
|
| 465 | - $query_params = [ |
|
| 466 | - 0 => [ |
|
| 467 | - 'Payment.Registration.REG_ID' => $registration_id, |
|
| 468 | - ], |
|
| 469 | - 'order_by' => ['Payment.PAY_ID' => 'DESC'], |
|
| 470 | - ]; |
|
| 471 | - return $this->get_one($query_params); |
|
| 472 | - } |
|
| 19 | + const scope_cart = 'CART'; |
|
| 20 | + |
|
| 21 | + const scope_admin = 'ADMIN'; |
|
| 22 | + |
|
| 23 | + const scope_api = 'API'; |
|
| 24 | + |
|
| 25 | + |
|
| 26 | + protected static ?EEM_Payment_Method $_instance = null; |
|
| 27 | + |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * private constructor to prevent direct creation |
|
| 31 | + * |
|
| 32 | + * @param string|null $timezone |
|
| 33 | + * @throws EE_Error |
|
| 34 | + */ |
|
| 35 | + protected function __construct(?string $timezone = '') |
|
| 36 | + { |
|
| 37 | + $this->singular_item = esc_html__('Payment Method', 'event_espresso'); |
|
| 38 | + $this->plural_item = esc_html__('Payment Methods', 'event_espresso'); |
|
| 39 | + $this->_tables = [ |
|
| 40 | + 'Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'), |
|
| 41 | + ]; |
|
| 42 | + $this->_fields = [ |
|
| 43 | + 'Payment_Method' => [ |
|
| 44 | + 'PMD_ID' => new EE_Primary_Key_Int_Field( |
|
| 45 | + 'PMD_ID', |
|
| 46 | + esc_html__('ID', 'event_espresso') |
|
| 47 | + ), |
|
| 48 | + 'PMD_type' => new EE_Plain_Text_Field( |
|
| 49 | + 'PMD_type', |
|
| 50 | + esc_html__('Payment Method Type', 'event_espresso'), |
|
| 51 | + false, |
|
| 52 | + 'Admin_Only' |
|
| 53 | + ), |
|
| 54 | + 'PMD_name' => new EE_Plain_Text_Field( |
|
| 55 | + 'PMD_name', |
|
| 56 | + esc_html__('Name', 'event_espresso'), |
|
| 57 | + false |
|
| 58 | + ), |
|
| 59 | + 'PMD_desc' => new EE_Post_Content_Field( |
|
| 60 | + 'PMD_desc', |
|
| 61 | + esc_html__('Description', 'event_espresso'), |
|
| 62 | + false, |
|
| 63 | + '' |
|
| 64 | + ), |
|
| 65 | + 'PMD_admin_name' => new EE_Plain_Text_Field( |
|
| 66 | + 'PMD_admin_name', |
|
| 67 | + esc_html__('Admin-Only Name', 'event_espresso'), |
|
| 68 | + true |
|
| 69 | + ), |
|
| 70 | + 'PMD_admin_desc' => new EE_Post_Content_Field( |
|
| 71 | + 'PMD_admin_desc', |
|
| 72 | + esc_html__('Admin-Only Description', 'event_espresso'), |
|
| 73 | + true, |
|
| 74 | + '' |
|
| 75 | + ), |
|
| 76 | + 'PMD_slug' => new EE_Slug_Field( |
|
| 77 | + 'PMD_slug', |
|
| 78 | + esc_html__('Slug', 'event_espresso'), |
|
| 79 | + false |
|
| 80 | + ), |
|
| 81 | + 'PMD_order' => new EE_Integer_Field( |
|
| 82 | + 'PMD_order', |
|
| 83 | + esc_html__('Order', 'event_espresso'), |
|
| 84 | + false, |
|
| 85 | + 0 |
|
| 86 | + ), |
|
| 87 | + 'PMD_debug_mode' => new EE_Boolean_Field( |
|
| 88 | + 'PMD_debug_mode', |
|
| 89 | + esc_html__('Sandbox Mode On? (AKA: debug mode)', 'event_espresso'), |
|
| 90 | + false, |
|
| 91 | + false |
|
| 92 | + ), |
|
| 93 | + 'PMD_wp_user' => new EE_WP_User_Field( |
|
| 94 | + 'PMD_wp_user', |
|
| 95 | + esc_html__('Payment Method Creator ID', 'event_espresso'), |
|
| 96 | + false |
|
| 97 | + ), |
|
| 98 | + 'PMD_open_by_default' => new EE_Boolean_Field( |
|
| 99 | + 'PMD_open_by_default', |
|
| 100 | + esc_html__('Open by Default?', 'event_espresso'), |
|
| 101 | + false, |
|
| 102 | + false |
|
| 103 | + ), |
|
| 104 | + 'PMD_button_url' => new EE_Plain_Text_Field( |
|
| 105 | + 'PMD_button_url', |
|
| 106 | + esc_html__('Button URL', 'event_espresso'), |
|
| 107 | + true, |
|
| 108 | + '' |
|
| 109 | + ), |
|
| 110 | + 'PMD_scope' => new EE_Serialized_Text_Field( |
|
| 111 | + 'PMD_scope', |
|
| 112 | + esc_html__('Usable From?', 'event_espresso'), |
|
| 113 | + false, |
|
| 114 | + []// possible values currently are 'CART','ADMIN','API' |
|
| 115 | + ), |
|
| 116 | + ], |
|
| 117 | + ]; |
|
| 118 | + $this->_model_relations = [ |
|
| 119 | + 'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'), |
|
| 120 | + 'Payment' => new EE_Has_Many_Relation(), |
|
| 121 | + 'Transaction' => new EE_Has_Many_Relation(), |
|
| 122 | + 'WP_User' => new EE_Belongs_To_Relation(), |
|
| 123 | + ]; |
|
| 124 | + parent::__construct($timezone); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Gets one by the slug provided |
|
| 130 | + * |
|
| 131 | + * @param string $slug |
|
| 132 | + * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|NULL |
|
| 133 | + * @throws EE_Error |
|
| 134 | + */ |
|
| 135 | + public function get_one_by_slug($slug) |
|
| 136 | + { |
|
| 137 | + return $this->get_one([['PMD_slug' => $slug]]); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Gets all the acceptable scopes for payment methods. |
|
| 143 | + * Keys are their names as store din the DB, and values are nice names for displaying them |
|
| 144 | + * |
|
| 145 | + * @return array |
|
| 146 | + */ |
|
| 147 | + public function scopes() |
|
| 148 | + { |
|
| 149 | + return apply_filters( |
|
| 150 | + 'FHEE__EEM_Payment_Method__scopes', |
|
| 151 | + [ |
|
| 152 | + EEM_Payment_Method::scope_cart => esc_html__('Front-end Registration Page', 'event_espresso'), |
|
| 153 | + EEM_Payment_Method::scope_admin => esc_html__( |
|
| 154 | + 'Admin Registration Page (no online processing)', |
|
| 155 | + 'event_espresso' |
|
| 156 | + ), |
|
| 157 | + ] |
|
| 158 | + ); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Determines if this is an valid scope |
|
| 164 | + * |
|
| 165 | + * @param string $scope like one of EEM_Payment_Method::instance()->scopes() |
|
| 166 | + * @return boolean |
|
| 167 | + */ |
|
| 168 | + public function is_valid_scope($scope) |
|
| 169 | + { |
|
| 170 | + $scopes = $this->scopes(); |
|
| 171 | + if (isset($scopes[ $scope ])) { |
|
| 172 | + return true; |
|
| 173 | + } |
|
| 174 | + return false; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Gets all active payment methods |
|
| 180 | + * |
|
| 181 | + * @param string $scope one of |
|
| 182 | + * @param array $query_params |
|
| 183 | + * @return EE_Base_Class[]|EE_Payment_Method[] |
|
| 184 | + * @throws EE_Error |
|
| 185 | + */ |
|
| 186 | + public function get_all_active($scope = null, $query_params = []) |
|
| 187 | + { |
|
| 188 | + if (! isset($query_params['order_by']) && ! isset($query_params['order'])) { |
|
| 189 | + $query_params['order_by'] = ['PMD_order' => 'ASC', 'PMD_ID' => 'ASC']; |
|
| 190 | + } |
|
| 191 | + return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * Counts all active gateways in the specified scope |
|
| 197 | + * |
|
| 198 | + * @param string $scope one of EEM_Payment_Method::scope_* |
|
| 199 | + * @param array $query_params |
|
| 200 | + * @return int |
|
| 201 | + * @throws EE_Error |
|
| 202 | + */ |
|
| 203 | + public function count_active($scope = null, $query_params = []) |
|
| 204 | + { |
|
| 205 | + return $this->count($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * Creates the $query_params that can be passed into any EEM_Payment_Method as their $query_params |
|
| 211 | + * argument to get all active for a given scope |
|
| 212 | + * |
|
| 213 | + * @param string $scope one of the constants EEM_Payment_Method::scope_* |
|
| 214 | + * @param array $query_params |
|
| 215 | + * @return array |
|
| 216 | + * @throws EE_Error |
|
| 217 | + * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
| 218 | + */ |
|
| 219 | + protected function _get_query_params_for_all_active($scope = null, $query_params = []) |
|
| 220 | + { |
|
| 221 | + if ($scope) { |
|
| 222 | + if ($this->is_valid_scope($scope)) { |
|
| 223 | + return array_replace_recursive([['PMD_scope' => ['LIKE', "%$scope%"]]], $query_params); |
|
| 224 | + } |
|
| 225 | + throw new EE_Error( |
|
| 226 | + sprintf( |
|
| 227 | + esc_html__("'%s' is not a valid scope for a payment method", 'event_espresso'), |
|
| 228 | + $scope |
|
| 229 | + ) |
|
| 230 | + ); |
|
| 231 | + } |
|
| 232 | + $acceptable_scopes = []; |
|
| 233 | + $count = 0; |
|
| 234 | + foreach ($this->scopes() as $scope_name => $desc) { |
|
| 235 | + $count++; |
|
| 236 | + $acceptable_scopes[ 'PMD_scope*' . $count ] = ['LIKE', '%' . $scope_name . '%']; |
|
| 237 | + } |
|
| 238 | + return array_replace_recursive([['OR*active_scope' => $acceptable_scopes]], $query_params); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * Creates the $query_params that can be passed into any EEM_Payment_Method as their $query_params |
|
| 244 | + * argument to get all active for a given scope |
|
| 245 | + * |
|
| 246 | + * @param string $scope one of the constants EEM_Payment_Method::scope_* |
|
| 247 | + * @param array $query_params |
|
| 248 | + * @return array |
|
| 249 | + * @throws EE_Error |
|
| 250 | + * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
| 251 | + */ |
|
| 252 | + public function get_query_params_for_all_active($scope = null, $query_params = []) |
|
| 253 | + { |
|
| 254 | + return $this->_get_query_params_for_all_active($scope, $query_params); |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * Gets one active payment method. see @get_all_active for documentation |
|
| 260 | + * |
|
| 261 | + * @param string $scope |
|
| 262 | + * @param array $query_params |
|
| 263 | + * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|NULL |
|
| 264 | + * @throws EE_Error |
|
| 265 | + */ |
|
| 266 | + public function get_one_active($scope = null, $query_params = []) |
|
| 267 | + { |
|
| 268 | + return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Gets one payment method of that type, regardless of whether its active or not |
|
| 274 | + * |
|
| 275 | + * @param string $type |
|
| 276 | + * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|NULL |
|
| 277 | + * @throws EE_Error |
|
| 278 | + */ |
|
| 279 | + public function get_one_of_type($type) |
|
| 280 | + { |
|
| 281 | + return $this->get_one([['PMD_type' => $type]]); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * Overrides parent ot also check by the slug |
|
| 287 | + * |
|
| 288 | + * @param string|int|EE_Payment_Method $base_class_obj_or_id |
|
| 289 | + * @param boolean $ensure_is_in_db |
|
| 290 | + * @return EE_Base_Class|EE_Payment_Method|EE_Soft_Delete_Base_Class|int|string |
|
| 291 | + * @throws EE_Error |
|
| 292 | + * @see EEM_Base::ensure_is_obj() |
|
| 293 | + */ |
|
| 294 | + public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = false) |
|
| 295 | + { |
|
| 296 | + // first: check if it's a slug |
|
| 297 | + if (is_string($base_class_obj_or_id)) { |
|
| 298 | + $obj = $this->get_one_by_slug($base_class_obj_or_id); |
|
| 299 | + if ($obj) { |
|
| 300 | + return $obj; |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + // ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID) |
|
| 304 | + try { |
|
| 305 | + return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db); |
|
| 306 | + } catch (EE_Error $e) { |
|
| 307 | + // handle it outside the catch |
|
| 308 | + } |
|
| 309 | + throw new EE_Error( |
|
| 310 | + sprintf( |
|
| 311 | + esc_html__("'%s' is neither a Payment Method ID, slug, nor object.", 'event_espresso'), |
|
| 312 | + $base_class_obj_or_id |
|
| 313 | + ) |
|
| 314 | + ); |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + |
|
| 318 | + /** |
|
| 319 | + * Gets the ID of this object, or if its a string finds the object's id |
|
| 320 | + * associated with that slug |
|
| 321 | + * |
|
| 322 | + * @param mixed $base_obj_or_id_or_slug |
|
| 323 | + * @return int |
|
| 324 | + * @throws EE_Error |
|
| 325 | + */ |
|
| 326 | + public function ensure_is_ID($base_obj_or_id_or_slug) |
|
| 327 | + { |
|
| 328 | + if (is_string($base_obj_or_id_or_slug)) { |
|
| 329 | + // assume it's a slug |
|
| 330 | + $base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug); |
|
| 331 | + } |
|
| 332 | + return parent::ensure_is_ID($base_obj_or_id_or_slug); |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + |
|
| 336 | + /** |
|
| 337 | + * Verifies the button urls on all the passed payment methods have a valid button url. |
|
| 338 | + * If not, resets them to their default. |
|
| 339 | + * |
|
| 340 | + * @param EE_Payment_Method[] $payment_methods if NULL, defaults to all payment methods active in the cart |
|
| 341 | + * @throws EE_Error |
|
| 342 | + * @throws ReflectionException |
|
| 343 | + */ |
|
| 344 | + public function verify_button_urls($payment_methods = null) |
|
| 345 | + { |
|
| 346 | + $payment_methods = is_array($payment_methods) |
|
| 347 | + ? $payment_methods |
|
| 348 | + : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
| 349 | + foreach ($payment_methods as $payment_method) { |
|
| 350 | + try { |
|
| 351 | + // If there is really no button URL at all, or if the button URLs still point to decaf folder even |
|
| 352 | + // though this is a caffeinated install, reset it to the default. |
|
| 353 | + $current_button_url = $payment_method->button_url(); |
|
| 354 | + if ( |
|
| 355 | + empty($current_button_url) |
|
| 356 | + || ( |
|
| 357 | + strpos($current_button_url, 'decaf') !== false |
|
| 358 | + && strpos($payment_method->type_obj()->default_button_url(), 'decaf') === false |
|
| 359 | + ) |
|
| 360 | + ) { |
|
| 361 | + $payment_method->save( |
|
| 362 | + [ |
|
| 363 | + 'PMD_button_url' => $payment_method->type_obj()->default_button_url(), |
|
| 364 | + ] |
|
| 365 | + ); |
|
| 366 | + } |
|
| 367 | + } catch (EE_Error $e) { |
|
| 368 | + $payment_method->deactivate(); |
|
| 369 | + } |
|
| 370 | + } |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + |
|
| 374 | + /** |
|
| 375 | + * Overrides parent to not only turn wpdb results into EE_Payment_Method objects, |
|
| 376 | + * but also verifies the payment method type of each is a usable object. If not, |
|
| 377 | + * deactivate it, sets a notification, and deactivates it |
|
| 378 | + * |
|
| 379 | + * @param array $rows |
|
| 380 | + * @return EE_Payment_Method[] |
|
| 381 | + * @throws EE_Error |
|
| 382 | + * @throws InvalidDataTypeException |
|
| 383 | + * @throws ReflectionException |
|
| 384 | + */ |
|
| 385 | + protected function _create_objects($rows = []) |
|
| 386 | + { |
|
| 387 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 388 | + $PMM = EE_Payment_Method_Manager::instance(); |
|
| 389 | + $payment_methods = parent::_create_objects($rows); |
|
| 390 | + /* @var $payment_methods EE_Payment_Method[] */ |
|
| 391 | + $usable_payment_methods = []; |
|
| 392 | + foreach ($payment_methods as $key => $payment_method) { |
|
| 393 | + // check if the payment method type exists and force recheck |
|
| 394 | + $pm_type_exists = $PMM->payment_method_type_exists($payment_method->type(), true); |
|
| 395 | + if ($pm_type_exists) { |
|
| 396 | + $usable_payment_methods[ $key ] = $payment_method; |
|
| 397 | + // some payment methods enqueue their scripts in EE_PMT_*::__construct |
|
| 398 | + // which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue |
|
| 399 | + // its scripts). but for backwards-compat we should continue to do that |
|
| 400 | + $payment_method->type_obj(); |
|
| 401 | + } elseif ($payment_method->active()) { |
|
| 402 | + // only deactivate and notify the admin if the payment is active somewhere |
|
| 403 | + $payment_method->deactivate(); |
|
| 404 | + $payment_method->save(); |
|
| 405 | + do_action( |
|
| 406 | + 'AHEE__EEM_Payment_Method___create_objects_auto_deactivated_payment_method', |
|
| 407 | + $payment_method |
|
| 408 | + ); |
|
| 409 | + new PersistentAdminNotice( |
|
| 410 | + 'auto-deactivated-' . $payment_method->type(), |
|
| 411 | + sprintf( |
|
| 412 | + esc_html__( |
|
| 413 | + 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', |
|
| 414 | + 'event_espresso' |
|
| 415 | + ), |
|
| 416 | + $payment_method->admin_name(), |
|
| 417 | + '<br />', |
|
| 418 | + '<a href="' . admin_url('plugins.php') . '">', |
|
| 419 | + '</a>' |
|
| 420 | + ), |
|
| 421 | + true |
|
| 422 | + ); |
|
| 423 | + } |
|
| 424 | + } |
|
| 425 | + return $usable_payment_methods; |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * Gets all the payment methods which can be used for transaction |
|
| 431 | + * (according to the relations between payment methods and events, and |
|
| 432 | + * the currencies used for the transaction and their relation to payment methods) |
|
| 433 | + * |
|
| 434 | + * @param EE_Transaction $transaction |
|
| 435 | + * @param string $scope @see EEM_Payment_Method::get_all_for_events |
|
| 436 | + * @return EE_Payment_Method[] |
|
| 437 | + * @throws EE_Error |
|
| 438 | + */ |
|
| 439 | + public function get_all_for_transaction($transaction, $scope) |
|
| 440 | + { |
|
| 441 | + // give addons a chance to override what payment methods are chosen based on the transaction |
|
| 442 | + return apply_filters( |
|
| 443 | + 'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods', |
|
| 444 | + $this->get_all_active($scope, ['group_by' => 'PMD_type']), |
|
| 445 | + $transaction, |
|
| 446 | + $scope |
|
| 447 | + ); |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + |
|
| 451 | + /** |
|
| 452 | + * Returns the payment method used for the last payment made for a registration. |
|
| 453 | + * Note: if an offline payment method was selected on the related transaction then this will have no payment |
|
| 454 | + * methods returned. It will ONLY return a payment method for a PAYMENT recorded against the registration. |
|
| 455 | + * |
|
| 456 | + * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the |
|
| 457 | + * registration. |
|
| 458 | + * @return EE_Payment|null |
|
| 459 | + * @throws EE_Error |
|
| 460 | + */ |
|
| 461 | + public function get_last_used_for_registration($registration_or_reg_id) |
|
| 462 | + { |
|
| 463 | + $registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id); |
|
| 464 | + |
|
| 465 | + $query_params = [ |
|
| 466 | + 0 => [ |
|
| 467 | + 'Payment.Registration.REG_ID' => $registration_id, |
|
| 468 | + ], |
|
| 469 | + 'order_by' => ['Payment.PAY_ID' => 'DESC'], |
|
| 470 | + ]; |
|
| 471 | + return $this->get_one($query_params); |
|
| 472 | + } |
|
| 473 | 473 | } |