@@ -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 |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function column_id($item): string |
99 | 99 | { |
100 | - $content = '<span class="ee-entity-id">' . $item->ID() . '</span>'; |
|
101 | - $content .= '<span class="show-on-mobile-view-only">' . $this->column_TKT_name($item, false) . '</span>'; |
|
100 | + $content = '<span class="ee-entity-id">'.$item->ID().'</span>'; |
|
101 | + $content .= '<span class="show-on-mobile-view-only">'.$this->column_TKT_name($item, false).'</span>'; |
|
102 | 102 | return $this->columnContent('id', $content, 'end'); |
103 | 103 | } |
104 | 104 | |
@@ -115,30 +115,30 @@ discard block |
||
115 | 115 | 'action' => 'trash_ticket', |
116 | 116 | 'TKT_ID' => $ticket->ID(), |
117 | 117 | ), TICKETS_ADMIN_URL); |
118 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' |
|
119 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
120 | - . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
118 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" aria-label="' |
|
119 | + . esc_attr__('Move Ticket to trash', 'event_espresso').'">' |
|
120 | + . esc_html__('Trash', 'event_espresso').'</a>'; |
|
121 | 121 | } else { |
122 | 122 | // restore price link |
123 | 123 | $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
124 | 124 | 'action' => 'restore_ticket', |
125 | 125 | 'TKT_ID' => $ticket->ID(), |
126 | 126 | ), TICKETS_ADMIN_URL); |
127 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' |
|
128 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
129 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
127 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" aria-label="' |
|
128 | + . esc_attr__('Restore Ticket', 'event_espresso').'">' |
|
129 | + . esc_html__('Restore', 'event_espresso').'</a>'; |
|
130 | 130 | // delete price link |
131 | 131 | $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
132 | 132 | 'action' => 'delete_ticket', |
133 | 133 | 'TKT_ID' => $ticket->ID(), |
134 | 134 | ), TICKETS_ADMIN_URL); |
135 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' |
|
136 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
137 | - . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
135 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" aria-label="' |
|
136 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso').'">' |
|
137 | + . esc_html__('Delete Permanently', 'event_espresso').'</a>'; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | // return $ticket->get('TKT_name') . $this->row_actions($actions); |
141 | - $content = $prep_content ? $ticket->name() . $this->row_actions($actions) : $ticket->name(); |
|
141 | + $content = $prep_content ? $ticket->name().$this->row_actions($actions) : $ticket->name(); |
|
142 | 142 | return $prep_content ? $this->columnContent('TKT_name', $content) : $content; |
143 | 143 | } |
144 | 144 |
@@ -16,174 +16,174 @@ |
||
16 | 16 | */ |
17 | 17 | class Tickets_List_Table extends EE_Admin_List_Table |
18 | 18 | { |
19 | - protected function _setup_data() |
|
20 | - { |
|
21 | - // \EEH_Debug_Tools::printr(__FUNCTION__, __CLASS__, __FILE__, __LINE__, 2); |
|
22 | - $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
23 | - $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
24 | - $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
25 | - $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
26 | - } |
|
27 | - |
|
28 | - |
|
29 | - protected function _set_properties() |
|
30 | - { |
|
31 | - $this->_wp_list_args = array( |
|
32 | - 'singular' => esc_html__('ticket', 'event_espresso'), |
|
33 | - 'plural' => esc_html__('tickets', 'event_espresso'), |
|
34 | - 'ajax' => true, |
|
35 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
36 | - ); |
|
37 | - |
|
38 | - $this->_columns = array( |
|
39 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
40 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
41 | - 'TKT_name' => esc_html__('Name', 'event_espresso'), |
|
42 | - 'TKT_description' => esc_html__('Description', 'event_espresso'), |
|
43 | - 'TKT_qty' => esc_html__('Quantity', 'event_espresso'), |
|
44 | - 'TKT_uses' => esc_html__('Uses', 'event_espresso'), |
|
45 | - 'TKT_min' => esc_html__('Minimum', 'event_espresso'), |
|
46 | - 'TKT_max' => esc_html__('Maximum', 'event_espresso'), |
|
47 | - 'TKT_price' => esc_html__('Price', 'event_espresso'), |
|
48 | - 'TKT_taxable' => esc_html__('Taxable', 'event_espresso'), |
|
49 | - ); |
|
50 | - |
|
51 | - $this->_sortable_columns = array( |
|
52 | - // TRUE means its already sorted |
|
53 | - 'id' => array('TKT_ID', false), |
|
54 | - 'TKT_name' => array('TKT_name', true), |
|
55 | - 'TKT_description' => array('TKT_description', false), |
|
56 | - 'TKT_qty' => array('TKT_qty', false), |
|
57 | - 'TKT_uses' => array('TKT_uses', false), |
|
58 | - 'TKT_min' => array('TKT_min', false), |
|
59 | - 'TKT_max' => array('TKT_max', false), |
|
60 | - 'TKT_price' => array('TKT_price', false), |
|
61 | - ); |
|
62 | - |
|
63 | - $this->_hidden_columns = array(); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - protected function _get_table_filters() |
|
68 | - { |
|
69 | - return []; |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - protected function _add_view_counts() |
|
74 | - { |
|
75 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
76 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) { |
|
77 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - public function column_cb($item) |
|
83 | - { |
|
84 | - return $item->ID() === 1 |
|
85 | - ? '<span class="dashicons dashicons-lock"></span>' |
|
86 | - : sprintf( |
|
87 | - '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
88 | - $item->ID() |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param EE_Ticket $item |
|
95 | - * @return string |
|
96 | - * @throws EE_Error |
|
97 | - * @throws ReflectionException |
|
98 | - */ |
|
99 | - public function column_id($item): string |
|
100 | - { |
|
101 | - $content = '<span class="ee-entity-id">' . $item->ID() . '</span>'; |
|
102 | - $content .= '<span class="show-on-mobile-view-only">' . $this->column_TKT_name($item, false) . '</span>'; |
|
103 | - return $this->columnContent('id', $content, 'end'); |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - public function column_TKT_name(EE_Ticket $ticket, bool $prep_content = true): string |
|
108 | - { |
|
109 | - // build row actions |
|
110 | - $actions = array(); |
|
111 | - |
|
112 | - // trash links |
|
113 | - if ($ticket->ID() !== 1) { |
|
114 | - if ($this->_view == 'all') { |
|
115 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
116 | - 'action' => 'trash_ticket', |
|
117 | - 'TKT_ID' => $ticket->ID(), |
|
118 | - ), TICKETS_ADMIN_URL); |
|
119 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' |
|
120 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
121 | - . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
122 | - } else { |
|
123 | - // restore price link |
|
124 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
125 | - 'action' => 'restore_ticket', |
|
126 | - 'TKT_ID' => $ticket->ID(), |
|
127 | - ), TICKETS_ADMIN_URL); |
|
128 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' |
|
129 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
130 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
131 | - // delete price link |
|
132 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
133 | - 'action' => 'delete_ticket', |
|
134 | - 'TKT_ID' => $ticket->ID(), |
|
135 | - ), TICKETS_ADMIN_URL); |
|
136 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' |
|
137 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
138 | - . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
139 | - } |
|
140 | - } |
|
141 | - // return $ticket->get('TKT_name') . $this->row_actions($actions); |
|
142 | - $content = $prep_content ? $ticket->name() . $this->row_actions($actions) : $ticket->name(); |
|
143 | - return $prep_content ? $this->columnContent('TKT_name', $content) : $content; |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - public function column_TKT_description(EE_Ticket $ticket) |
|
148 | - { |
|
149 | - return $this->columnContent('TKT_description', $ticket->description()); |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - public function column_TKT_qty(EE_Ticket $ticket) |
|
154 | - { |
|
155 | - |
|
156 | - return $ticket->get_pretty('TKT_qty', 'text'); |
|
157 | - // return $this->columnContent('TKT_qty', $ticket->qty()); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - public function column_TKT_uses(EE_Ticket $ticket) |
|
162 | - { |
|
163 | - return $ticket->get_pretty('TKT_uses', 'text'); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - public function column_TKT_min(EE_Ticket $ticket) |
|
168 | - { |
|
169 | - return $ticket->get('TKT_min'); |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - public function column_TKT_max(EE_Ticket $ticket) |
|
174 | - { |
|
175 | - return $ticket->get_pretty('TKT_max', 'text'); |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - public function column_TKT_price(EE_Ticket $ticket) |
|
180 | - { |
|
181 | - return EEH_Template::format_currency($ticket->get('TKT_price')); |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - public function column_TKT_taxable(EE_Ticket $ticket) |
|
186 | - { |
|
187 | - return $ticket->get('TKT_taxable') ? esc_html__('Yes', 'event_espresso') : esc_html__('No', 'event_espresso'); |
|
188 | - } |
|
19 | + protected function _setup_data() |
|
20 | + { |
|
21 | + // \EEH_Debug_Tools::printr(__FUNCTION__, __CLASS__, __FILE__, __LINE__, 2); |
|
22 | + $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
23 | + $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
24 | + $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
25 | + $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
26 | + } |
|
27 | + |
|
28 | + |
|
29 | + protected function _set_properties() |
|
30 | + { |
|
31 | + $this->_wp_list_args = array( |
|
32 | + 'singular' => esc_html__('ticket', 'event_espresso'), |
|
33 | + 'plural' => esc_html__('tickets', 'event_espresso'), |
|
34 | + 'ajax' => true, |
|
35 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
36 | + ); |
|
37 | + |
|
38 | + $this->_columns = array( |
|
39 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
40 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
41 | + 'TKT_name' => esc_html__('Name', 'event_espresso'), |
|
42 | + 'TKT_description' => esc_html__('Description', 'event_espresso'), |
|
43 | + 'TKT_qty' => esc_html__('Quantity', 'event_espresso'), |
|
44 | + 'TKT_uses' => esc_html__('Uses', 'event_espresso'), |
|
45 | + 'TKT_min' => esc_html__('Minimum', 'event_espresso'), |
|
46 | + 'TKT_max' => esc_html__('Maximum', 'event_espresso'), |
|
47 | + 'TKT_price' => esc_html__('Price', 'event_espresso'), |
|
48 | + 'TKT_taxable' => esc_html__('Taxable', 'event_espresso'), |
|
49 | + ); |
|
50 | + |
|
51 | + $this->_sortable_columns = array( |
|
52 | + // TRUE means its already sorted |
|
53 | + 'id' => array('TKT_ID', false), |
|
54 | + 'TKT_name' => array('TKT_name', true), |
|
55 | + 'TKT_description' => array('TKT_description', false), |
|
56 | + 'TKT_qty' => array('TKT_qty', false), |
|
57 | + 'TKT_uses' => array('TKT_uses', false), |
|
58 | + 'TKT_min' => array('TKT_min', false), |
|
59 | + 'TKT_max' => array('TKT_max', false), |
|
60 | + 'TKT_price' => array('TKT_price', false), |
|
61 | + ); |
|
62 | + |
|
63 | + $this->_hidden_columns = array(); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + protected function _get_table_filters() |
|
68 | + { |
|
69 | + return []; |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + protected function _add_view_counts() |
|
74 | + { |
|
75 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
76 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) { |
|
77 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + public function column_cb($item) |
|
83 | + { |
|
84 | + return $item->ID() === 1 |
|
85 | + ? '<span class="dashicons dashicons-lock"></span>' |
|
86 | + : sprintf( |
|
87 | + '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
88 | + $item->ID() |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param EE_Ticket $item |
|
95 | + * @return string |
|
96 | + * @throws EE_Error |
|
97 | + * @throws ReflectionException |
|
98 | + */ |
|
99 | + public function column_id($item): string |
|
100 | + { |
|
101 | + $content = '<span class="ee-entity-id">' . $item->ID() . '</span>'; |
|
102 | + $content .= '<span class="show-on-mobile-view-only">' . $this->column_TKT_name($item, false) . '</span>'; |
|
103 | + return $this->columnContent('id', $content, 'end'); |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + public function column_TKT_name(EE_Ticket $ticket, bool $prep_content = true): string |
|
108 | + { |
|
109 | + // build row actions |
|
110 | + $actions = array(); |
|
111 | + |
|
112 | + // trash links |
|
113 | + if ($ticket->ID() !== 1) { |
|
114 | + if ($this->_view == 'all') { |
|
115 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
116 | + 'action' => 'trash_ticket', |
|
117 | + 'TKT_ID' => $ticket->ID(), |
|
118 | + ), TICKETS_ADMIN_URL); |
|
119 | + $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' |
|
120 | + . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
121 | + . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
122 | + } else { |
|
123 | + // restore price link |
|
124 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
125 | + 'action' => 'restore_ticket', |
|
126 | + 'TKT_ID' => $ticket->ID(), |
|
127 | + ), TICKETS_ADMIN_URL); |
|
128 | + $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' |
|
129 | + . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
130 | + . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
131 | + // delete price link |
|
132 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
133 | + 'action' => 'delete_ticket', |
|
134 | + 'TKT_ID' => $ticket->ID(), |
|
135 | + ), TICKETS_ADMIN_URL); |
|
136 | + $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' |
|
137 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
138 | + . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
139 | + } |
|
140 | + } |
|
141 | + // return $ticket->get('TKT_name') . $this->row_actions($actions); |
|
142 | + $content = $prep_content ? $ticket->name() . $this->row_actions($actions) : $ticket->name(); |
|
143 | + return $prep_content ? $this->columnContent('TKT_name', $content) : $content; |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + public function column_TKT_description(EE_Ticket $ticket) |
|
148 | + { |
|
149 | + return $this->columnContent('TKT_description', $ticket->description()); |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + public function column_TKT_qty(EE_Ticket $ticket) |
|
154 | + { |
|
155 | + |
|
156 | + return $ticket->get_pretty('TKT_qty', 'text'); |
|
157 | + // return $this->columnContent('TKT_qty', $ticket->qty()); |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + public function column_TKT_uses(EE_Ticket $ticket) |
|
162 | + { |
|
163 | + return $ticket->get_pretty('TKT_uses', 'text'); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + public function column_TKT_min(EE_Ticket $ticket) |
|
168 | + { |
|
169 | + return $ticket->get('TKT_min'); |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + public function column_TKT_max(EE_Ticket $ticket) |
|
174 | + { |
|
175 | + return $ticket->get_pretty('TKT_max', 'text'); |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + public function column_TKT_price(EE_Ticket $ticket) |
|
180 | + { |
|
181 | + return EEH_Template::format_currency($ticket->get('TKT_price')); |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + public function column_TKT_taxable(EE_Ticket $ticket) |
|
186 | + { |
|
187 | + return $ticket->get('TKT_taxable') ? esc_html__('Yes', 'event_espresso') : esc_html__('No', 'event_espresso'); |
|
188 | + } |
|
189 | 189 | } |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function column_id($item): string |
95 | 95 | { |
96 | - $content = '<span class="ee-entity-id">' . $item->ID() . '</span>'; |
|
97 | - $content .= '<span class="show-on-mobile-view-only">' . $this->column_TKT_name($item, false) . '</span>'; |
|
96 | + $content = '<span class="ee-entity-id">'.$item->ID().'</span>'; |
|
97 | + $content .= '<span class="show-on-mobile-view-only">'.$this->column_TKT_name($item, false).'</span>'; |
|
98 | 98 | return $this->columnContent('id', $content, 'end'); |
99 | 99 | } |
100 | 100 | |
@@ -111,30 +111,30 @@ discard block |
||
111 | 111 | 'action' => 'trash_ticket', |
112 | 112 | 'TKT_ID' => $ticket->ID(), |
113 | 113 | ), EVENTS_ADMIN_URL); |
114 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' |
|
115 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
116 | - . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
114 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" aria-label="' |
|
115 | + . esc_attr__('Move Ticket to trash', 'event_espresso').'">' |
|
116 | + . esc_html__('Trash', 'event_espresso').'</a>'; |
|
117 | 117 | } else { |
118 | 118 | // restore price link |
119 | 119 | $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
120 | 120 | 'action' => 'restore_ticket', |
121 | 121 | 'TKT_ID' => $ticket->ID(), |
122 | 122 | ), EVENTS_ADMIN_URL); |
123 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' |
|
124 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
125 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
123 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" aria-label="' |
|
124 | + . esc_attr__('Restore Ticket', 'event_espresso').'">' |
|
125 | + . esc_html__('Restore', 'event_espresso').'</a>'; |
|
126 | 126 | // delete price link |
127 | 127 | $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
128 | 128 | 'action' => 'delete_ticket', |
129 | 129 | 'TKT_ID' => $ticket->ID(), |
130 | 130 | ), EVENTS_ADMIN_URL); |
131 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' |
|
132 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
133 | - . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
131 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" aria-label="' |
|
132 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso').'">' |
|
133 | + . esc_html__('Delete Permanently', 'event_espresso').'</a>'; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - $content = $prep_content ? $ticket->name() . $this->row_actions($actions) : $ticket->name(); |
|
137 | + $content = $prep_content ? $ticket->name().$this->row_actions($actions) : $ticket->name(); |
|
138 | 138 | return $prep_content ? $this->columnContent('TKT_name', $content) : $content; |
139 | 139 | } |
140 | 140 |
@@ -15,172 +15,172 @@ |
||
15 | 15 | */ |
16 | 16 | class Tickets_List_Table extends EE_Admin_List_Table |
17 | 17 | { |
18 | - protected function _setup_data() |
|
19 | - { |
|
20 | - $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
21 | - $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
22 | - $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
23 | - $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _set_properties() |
|
28 | - { |
|
29 | - $this->_wp_list_args = array( |
|
30 | - 'singular' => esc_html__('ticket', 'event_espresso'), |
|
31 | - 'plural' => esc_html__('tickets', 'event_espresso'), |
|
32 | - 'ajax' => true, |
|
33 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
34 | - ); |
|
35 | - |
|
36 | - $this->_columns = array( |
|
37 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
38 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
39 | - 'TKT_name' => esc_html__('Name', 'event_espresso'), |
|
40 | - 'TKT_description' => esc_html__('Description', 'event_espresso'), |
|
41 | - 'TKT_qty' => esc_html__('Quantity', 'event_espresso'), |
|
42 | - 'TKT_uses' => esc_html__('Datetimes', 'event_espresso'), |
|
43 | - 'TKT_min' => esc_html__('Minimum', 'event_espresso'), |
|
44 | - 'TKT_max' => esc_html__('Maximum', 'event_espresso'), |
|
45 | - 'TKT_price' => esc_html__('Price', 'event_espresso'), |
|
46 | - 'TKT_taxable' => esc_html__('Taxable', 'event_espresso'), |
|
47 | - ); |
|
48 | - |
|
49 | - $this->_sortable_columns = array( |
|
50 | - // TRUE means its already sorted |
|
51 | - 'id' => array('TKT_ID', false), |
|
52 | - 'TKT_name' => array('TKT_name' => true), |
|
53 | - 'TKT_description' => array('TKT_description' => false), |
|
54 | - 'TKT_qty' => array('TKT_qty' => false), |
|
55 | - 'TKT_uses' => array('TKT_uses' => false), |
|
56 | - 'TKT_min' => array('TKT_min' => false), |
|
57 | - 'TKT_max' => array('TKT_max' => false), |
|
58 | - 'TKT_price' => array('TKT_price' => false), |
|
59 | - ); |
|
60 | - |
|
61 | - $this->_hidden_columns = array(); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - protected function _get_table_filters() |
|
66 | - { |
|
67 | - return []; |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - protected function _add_view_counts() |
|
72 | - { |
|
73 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
74 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - public function column_cb($item) |
|
79 | - { |
|
80 | - return $item->ID() === 1 |
|
81 | - ? '<span class="dashicons dashicons-lock"></span>' |
|
82 | - : sprintf( |
|
83 | - '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
84 | - $item->ID() |
|
85 | - ); |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @param EE_Ticket $item |
|
91 | - * @return string |
|
92 | - * @throws EE_Error |
|
93 | - * @throws ReflectionException |
|
94 | - */ |
|
95 | - public function column_id($item): string |
|
96 | - { |
|
97 | - $content = '<span class="ee-entity-id">' . $item->ID() . '</span>'; |
|
98 | - $content .= '<span class="show-on-mobile-view-only">' . $this->column_TKT_name($item, false) . '</span>'; |
|
99 | - return $this->columnContent('id', $content, 'end'); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - public function column_TKT_name(EE_Ticket $ticket, bool $prep_content = true): string |
|
104 | - { |
|
105 | - // build row actions |
|
106 | - $actions = array(); |
|
107 | - |
|
108 | - // trash links |
|
109 | - if ($ticket->ID() !== 1) { |
|
110 | - if ($this->_view == 'all') { |
|
111 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
112 | - 'action' => 'trash_ticket', |
|
113 | - 'TKT_ID' => $ticket->ID(), |
|
114 | - ), EVENTS_ADMIN_URL); |
|
115 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' |
|
116 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
117 | - . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
118 | - } else { |
|
119 | - // restore price link |
|
120 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
121 | - 'action' => 'restore_ticket', |
|
122 | - 'TKT_ID' => $ticket->ID(), |
|
123 | - ), EVENTS_ADMIN_URL); |
|
124 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' |
|
125 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
126 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
127 | - // delete price link |
|
128 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
129 | - 'action' => 'delete_ticket', |
|
130 | - 'TKT_ID' => $ticket->ID(), |
|
131 | - ), EVENTS_ADMIN_URL); |
|
132 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' |
|
133 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
134 | - . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
135 | - } |
|
136 | - } |
|
137 | - |
|
138 | - $content = $prep_content ? $ticket->name() . $this->row_actions($actions) : $ticket->name(); |
|
139 | - return $prep_content ? $this->columnContent('TKT_name', $content) : $content; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - public function column_TKT_description(EE_Ticket $ticket): string |
|
144 | - { |
|
145 | - return $this->columnContent('TKT_description', $ticket->description()); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - public function column_TKT_qty(EE_Ticket $ticket): string |
|
150 | - { |
|
151 | - return $this->columnContent('TKT_qty', $ticket->qty(), 'end'); |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - public function column_TKT_uses(EE_Ticket $ticket): string |
|
156 | - { |
|
157 | - return $this->columnContent('TKT_uses', $ticket->uses(), 'end'); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - public function column_TKT_min(EE_Ticket $ticket): string |
|
162 | - { |
|
163 | - return $this->columnContent('TKT_min', $ticket->min(), 'end'); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - public function column_TKT_max(EE_Ticket $ticket): string |
|
168 | - { |
|
169 | - return $this->columnContent('TKT_max', $ticket->max(), 'end'); |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - public function column_TKT_price(EE_Ticket $ticket): string |
|
174 | - { |
|
175 | - return $this->columnContent('TKT_price', $ticket->pretty_price(), 'end'); |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - public function column_TKT_taxable(EE_Ticket $ticket): string |
|
180 | - { |
|
181 | - $content = $ticket->taxable() |
|
182 | - ? esc_html__('Yes', 'event_espresso') |
|
183 | - : esc_html__('No', 'event_espresso'); |
|
184 | - return $this->columnContent('TKT_taxable', $content, 'center'); |
|
185 | - } |
|
18 | + protected function _setup_data() |
|
19 | + { |
|
20 | + $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
21 | + $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
22 | + $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
23 | + $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _set_properties() |
|
28 | + { |
|
29 | + $this->_wp_list_args = array( |
|
30 | + 'singular' => esc_html__('ticket', 'event_espresso'), |
|
31 | + 'plural' => esc_html__('tickets', 'event_espresso'), |
|
32 | + 'ajax' => true, |
|
33 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
34 | + ); |
|
35 | + |
|
36 | + $this->_columns = array( |
|
37 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
38 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
39 | + 'TKT_name' => esc_html__('Name', 'event_espresso'), |
|
40 | + 'TKT_description' => esc_html__('Description', 'event_espresso'), |
|
41 | + 'TKT_qty' => esc_html__('Quantity', 'event_espresso'), |
|
42 | + 'TKT_uses' => esc_html__('Datetimes', 'event_espresso'), |
|
43 | + 'TKT_min' => esc_html__('Minimum', 'event_espresso'), |
|
44 | + 'TKT_max' => esc_html__('Maximum', 'event_espresso'), |
|
45 | + 'TKT_price' => esc_html__('Price', 'event_espresso'), |
|
46 | + 'TKT_taxable' => esc_html__('Taxable', 'event_espresso'), |
|
47 | + ); |
|
48 | + |
|
49 | + $this->_sortable_columns = array( |
|
50 | + // TRUE means its already sorted |
|
51 | + 'id' => array('TKT_ID', false), |
|
52 | + 'TKT_name' => array('TKT_name' => true), |
|
53 | + 'TKT_description' => array('TKT_description' => false), |
|
54 | + 'TKT_qty' => array('TKT_qty' => false), |
|
55 | + 'TKT_uses' => array('TKT_uses' => false), |
|
56 | + 'TKT_min' => array('TKT_min' => false), |
|
57 | + 'TKT_max' => array('TKT_max' => false), |
|
58 | + 'TKT_price' => array('TKT_price' => false), |
|
59 | + ); |
|
60 | + |
|
61 | + $this->_hidden_columns = array(); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + protected function _get_table_filters() |
|
66 | + { |
|
67 | + return []; |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + protected function _add_view_counts() |
|
72 | + { |
|
73 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
74 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + public function column_cb($item) |
|
79 | + { |
|
80 | + return $item->ID() === 1 |
|
81 | + ? '<span class="dashicons dashicons-lock"></span>' |
|
82 | + : sprintf( |
|
83 | + '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
84 | + $item->ID() |
|
85 | + ); |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @param EE_Ticket $item |
|
91 | + * @return string |
|
92 | + * @throws EE_Error |
|
93 | + * @throws ReflectionException |
|
94 | + */ |
|
95 | + public function column_id($item): string |
|
96 | + { |
|
97 | + $content = '<span class="ee-entity-id">' . $item->ID() . '</span>'; |
|
98 | + $content .= '<span class="show-on-mobile-view-only">' . $this->column_TKT_name($item, false) . '</span>'; |
|
99 | + return $this->columnContent('id', $content, 'end'); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + public function column_TKT_name(EE_Ticket $ticket, bool $prep_content = true): string |
|
104 | + { |
|
105 | + // build row actions |
|
106 | + $actions = array(); |
|
107 | + |
|
108 | + // trash links |
|
109 | + if ($ticket->ID() !== 1) { |
|
110 | + if ($this->_view == 'all') { |
|
111 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
112 | + 'action' => 'trash_ticket', |
|
113 | + 'TKT_ID' => $ticket->ID(), |
|
114 | + ), EVENTS_ADMIN_URL); |
|
115 | + $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="' |
|
116 | + . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
117 | + . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
118 | + } else { |
|
119 | + // restore price link |
|
120 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
121 | + 'action' => 'restore_ticket', |
|
122 | + 'TKT_ID' => $ticket->ID(), |
|
123 | + ), EVENTS_ADMIN_URL); |
|
124 | + $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="' |
|
125 | + . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
126 | + . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
127 | + // delete price link |
|
128 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
129 | + 'action' => 'delete_ticket', |
|
130 | + 'TKT_ID' => $ticket->ID(), |
|
131 | + ), EVENTS_ADMIN_URL); |
|
132 | + $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="' |
|
133 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
134 | + . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
135 | + } |
|
136 | + } |
|
137 | + |
|
138 | + $content = $prep_content ? $ticket->name() . $this->row_actions($actions) : $ticket->name(); |
|
139 | + return $prep_content ? $this->columnContent('TKT_name', $content) : $content; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + public function column_TKT_description(EE_Ticket $ticket): string |
|
144 | + { |
|
145 | + return $this->columnContent('TKT_description', $ticket->description()); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + public function column_TKT_qty(EE_Ticket $ticket): string |
|
150 | + { |
|
151 | + return $this->columnContent('TKT_qty', $ticket->qty(), 'end'); |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + public function column_TKT_uses(EE_Ticket $ticket): string |
|
156 | + { |
|
157 | + return $this->columnContent('TKT_uses', $ticket->uses(), 'end'); |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + public function column_TKT_min(EE_Ticket $ticket): string |
|
162 | + { |
|
163 | + return $this->columnContent('TKT_min', $ticket->min(), 'end'); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + public function column_TKT_max(EE_Ticket $ticket): string |
|
168 | + { |
|
169 | + return $this->columnContent('TKT_max', $ticket->max(), 'end'); |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + public function column_TKT_price(EE_Ticket $ticket): string |
|
174 | + { |
|
175 | + return $this->columnContent('TKT_price', $ticket->pretty_price(), 'end'); |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + public function column_TKT_taxable(EE_Ticket $ticket): string |
|
180 | + { |
|
181 | + $content = $ticket->taxable() |
|
182 | + ? esc_html__('Yes', 'event_espresso') |
|
183 | + : esc_html__('No', 'event_espresso'); |
|
184 | + return $this->columnContent('TKT_taxable', $content, 'center'); |
|
185 | + } |
|
186 | 186 | } |
@@ -15,226 +15,226 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Registration_CheckIn_List_Table extends EE_Admin_List_Table |
17 | 17 | { |
18 | - /** |
|
19 | - * EE_Registration_CheckIn_List_Table constructor. |
|
20 | - * |
|
21 | - * @param EE_Admin_Page $admin_page |
|
22 | - */ |
|
23 | - public function __construct($admin_page) |
|
24 | - { |
|
25 | - parent::__construct($admin_page); |
|
26 | - } |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * @throws EE_Error |
|
31 | - */ |
|
32 | - protected function _setup_data() |
|
33 | - { |
|
34 | - $this->_data = $this->_get_checkins($this->_per_page); |
|
35 | - $this->_all_data_count = $this->_get_checkins($this->_per_page, true); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * Sets up the properties for the list table. |
|
41 | - */ |
|
42 | - protected function _set_properties() |
|
43 | - { |
|
44 | - $this->_wp_list_args = array( |
|
45 | - 'singular' => esc_html__('check-in', 'event_espresso'), |
|
46 | - 'plural' => esc_html__('check-ins', 'event_espresso'), |
|
47 | - 'ajax' => true, |
|
48 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
49 | - ); |
|
50 | - |
|
51 | - $this->_columns = array( |
|
52 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
53 | - 'CHK_in' => esc_html__('Check-In', 'event_espresso'), |
|
54 | - 'CHK_timestamp' => esc_html__('Timestamp', 'event_espresso'), |
|
55 | - ); |
|
56 | - |
|
57 | - $this->_sortable_columns = array( |
|
58 | - 'CHK_timestamp' => array('CHK_timestamp' => true), |
|
59 | - ); |
|
60 | - |
|
61 | - $this->_primary_column = 'CHK_in'; |
|
62 | - |
|
63 | - $this->_hidden_columns = array(); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @return array |
|
69 | - */ |
|
70 | - protected function _get_table_filters() |
|
71 | - { |
|
72 | - return []; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * Returning an empty string to remove the search box for this view. |
|
78 | - * |
|
79 | - * @param string $text |
|
80 | - * @param string $input_id |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - public function search_box($text, $input_id) |
|
84 | - { |
|
85 | - return ''; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @throws EE_Error |
|
91 | - */ |
|
92 | - protected function _add_view_counts() |
|
93 | - { |
|
94 | - $this->_views['all']['count'] = $this->_get_checkins(null, true); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @param EE_Checkin $item |
|
100 | - * @return string |
|
101 | - * @throws EE_Error |
|
102 | - * @throws InvalidArgumentException |
|
103 | - * @throws ReflectionException |
|
104 | - * @throws InvalidDataTypeException |
|
105 | - * @throws InvalidInterfaceException |
|
106 | - */ |
|
107 | - public function column_cb($item) |
|
108 | - { |
|
109 | - return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', $item->ID()); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * @param EE_Checkin $item |
|
115 | - * @return string |
|
116 | - * @throws EE_Error |
|
117 | - * @throws InvalidArgumentException |
|
118 | - * @throws InvalidDataTypeException |
|
119 | - * @throws InvalidInterfaceException |
|
120 | - * @throws ReflectionException |
|
121 | - */ |
|
122 | - public function column_CHK_in(EE_Checkin $item) |
|
123 | - { |
|
124 | - $checkin_status_dashicon = CheckinStatusDashicon::fromCheckin($item); |
|
125 | - return ' |
|
18 | + /** |
|
19 | + * EE_Registration_CheckIn_List_Table constructor. |
|
20 | + * |
|
21 | + * @param EE_Admin_Page $admin_page |
|
22 | + */ |
|
23 | + public function __construct($admin_page) |
|
24 | + { |
|
25 | + parent::__construct($admin_page); |
|
26 | + } |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * @throws EE_Error |
|
31 | + */ |
|
32 | + protected function _setup_data() |
|
33 | + { |
|
34 | + $this->_data = $this->_get_checkins($this->_per_page); |
|
35 | + $this->_all_data_count = $this->_get_checkins($this->_per_page, true); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * Sets up the properties for the list table. |
|
41 | + */ |
|
42 | + protected function _set_properties() |
|
43 | + { |
|
44 | + $this->_wp_list_args = array( |
|
45 | + 'singular' => esc_html__('check-in', 'event_espresso'), |
|
46 | + 'plural' => esc_html__('check-ins', 'event_espresso'), |
|
47 | + 'ajax' => true, |
|
48 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
49 | + ); |
|
50 | + |
|
51 | + $this->_columns = array( |
|
52 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
53 | + 'CHK_in' => esc_html__('Check-In', 'event_espresso'), |
|
54 | + 'CHK_timestamp' => esc_html__('Timestamp', 'event_espresso'), |
|
55 | + ); |
|
56 | + |
|
57 | + $this->_sortable_columns = array( |
|
58 | + 'CHK_timestamp' => array('CHK_timestamp' => true), |
|
59 | + ); |
|
60 | + |
|
61 | + $this->_primary_column = 'CHK_in'; |
|
62 | + |
|
63 | + $this->_hidden_columns = array(); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @return array |
|
69 | + */ |
|
70 | + protected function _get_table_filters() |
|
71 | + { |
|
72 | + return []; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * Returning an empty string to remove the search box for this view. |
|
78 | + * |
|
79 | + * @param string $text |
|
80 | + * @param string $input_id |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + public function search_box($text, $input_id) |
|
84 | + { |
|
85 | + return ''; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @throws EE_Error |
|
91 | + */ |
|
92 | + protected function _add_view_counts() |
|
93 | + { |
|
94 | + $this->_views['all']['count'] = $this->_get_checkins(null, true); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @param EE_Checkin $item |
|
100 | + * @return string |
|
101 | + * @throws EE_Error |
|
102 | + * @throws InvalidArgumentException |
|
103 | + * @throws ReflectionException |
|
104 | + * @throws InvalidDataTypeException |
|
105 | + * @throws InvalidInterfaceException |
|
106 | + */ |
|
107 | + public function column_cb($item) |
|
108 | + { |
|
109 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', $item->ID()); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * @param EE_Checkin $item |
|
115 | + * @return string |
|
116 | + * @throws EE_Error |
|
117 | + * @throws InvalidArgumentException |
|
118 | + * @throws InvalidDataTypeException |
|
119 | + * @throws InvalidInterfaceException |
|
120 | + * @throws ReflectionException |
|
121 | + */ |
|
122 | + public function column_CHK_in(EE_Checkin $item) |
|
123 | + { |
|
124 | + $checkin_status_dashicon = CheckinStatusDashicon::fromCheckin($item); |
|
125 | + return ' |
|
126 | 126 | <span class="ee-entity-id ' . $checkin_status_dashicon->cssClasses() . '"></span> |
127 | 127 | <span class="show-on-mobile-view-only">' . $item->get_datetime('CHK_timestamp') . '</span>'; |
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * @param EE_Checkin $item |
|
133 | - * @return string |
|
134 | - * @throws EE_Error |
|
135 | - * @throws InvalidArgumentException |
|
136 | - * @throws InvalidDataTypeException |
|
137 | - * @throws InvalidInterfaceException |
|
138 | - * @throws ReflectionException |
|
139 | - */ |
|
140 | - public function column_CHK_timestamp(EE_Checkin $item) |
|
141 | - { |
|
142 | - $actions = array(); |
|
143 | - $delete_url = EE_Admin_Page::add_query_args_and_nonce( |
|
144 | - array( |
|
145 | - 'action' => 'delete_checkin_row', |
|
146 | - 'DTT_ID' => $this->_req_data['DTT_ID'], |
|
147 | - '_REG_ID' => $this->_req_data['_REG_ID'], |
|
148 | - 'CHK_ID' => $item->ID(), |
|
149 | - ) |
|
150 | - ); |
|
151 | - $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can( |
|
152 | - 'ee_delete_checkins', |
|
153 | - 'espresso_registrations_delete_checkin_row' |
|
154 | - ) |
|
155 | - ? '<a href="' . $delete_url . '" aria-label="' |
|
156 | - . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' |
|
157 | - . esc_html__('Delete', 'event_espresso') . '</a>' |
|
158 | - : ''; |
|
159 | - |
|
160 | - return sprintf( |
|
161 | - '%1$s %2$s', |
|
162 | - $item->get_datetime('CHK_timestamp', '', 'H:i:s a'), |
|
163 | - $this->row_actions($actions) |
|
164 | - ); |
|
165 | - } |
|
166 | - |
|
167 | - |
|
168 | - /** |
|
169 | - * This retrieves all the Check-ins for the given parameters. |
|
170 | - * experimenting with having the query for the table values within the list table. |
|
171 | - * |
|
172 | - * @param int $per_page How many to retrieve per page |
|
173 | - * @param bool $count Whether to return a count or not |
|
174 | - * @return EE_Checkin[]|int |
|
175 | - * @throws EE_Error |
|
176 | - * @throws InvalidArgumentException |
|
177 | - * @throws InvalidDataTypeException |
|
178 | - * @throws InvalidInterfaceException |
|
179 | - */ |
|
180 | - protected function _get_checkins($per_page = 10, $count = false) |
|
181 | - { |
|
182 | - $REG_ID = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : false; |
|
183 | - $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : false; |
|
184 | - |
|
185 | - // if user does not have the capability for the checkins for this registration then get out! |
|
186 | - if ( |
|
187 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
188 | - 'ee_read_checkin', |
|
189 | - 'espresso_registrations_registration_checkins', |
|
190 | - $REG_ID |
|
191 | - ) |
|
192 | - ) { |
|
193 | - return $count ? 0 : array(); |
|
194 | - } |
|
195 | - |
|
196 | - // if no reg id then get out cause need a reg id |
|
197 | - if (empty($REG_ID) || empty($DTT_ID)) { |
|
198 | - throw new EE_Error( |
|
199 | - esc_html__( |
|
200 | - 'This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', |
|
201 | - 'event_espresso' |
|
202 | - ) |
|
203 | - ); |
|
204 | - } |
|
205 | - |
|
206 | - // set orderby |
|
207 | - // note that with this table we're only providing the option to orderby the timestamp value. |
|
208 | - $orderby = 'CHK_timestamp'; |
|
209 | - |
|
210 | - $order = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
211 | - |
|
212 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
213 | - ? $this->_req_data['paged'] |
|
214 | - : 1; |
|
215 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
216 | - ? $this->_req_data['perpage'] |
|
217 | - : $per_page; |
|
218 | - $limit = null; |
|
219 | - if (! $count) { |
|
220 | - $offset = ($current_page - 1) * $per_page; |
|
221 | - $limit = array($offset, $per_page); |
|
222 | - } |
|
223 | - |
|
224 | - $_where = array( |
|
225 | - 'REG_ID' => $REG_ID, |
|
226 | - 'DTT_ID' => $DTT_ID, |
|
227 | - ); |
|
228 | - |
|
229 | - $query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit); |
|
230 | - |
|
231 | - // if no per_page value then we just want to return a count of all Check-ins |
|
232 | - if ($count) { |
|
233 | - return EEM_Checkin::instance()->count(array($_where)); |
|
234 | - } |
|
235 | - |
|
236 | - return $count |
|
237 | - ? EEM_Checkin::instance()->count(array($_where)) |
|
238 | - : EEM_Checkin::instance()->get_all($query_params); |
|
239 | - } |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * @param EE_Checkin $item |
|
133 | + * @return string |
|
134 | + * @throws EE_Error |
|
135 | + * @throws InvalidArgumentException |
|
136 | + * @throws InvalidDataTypeException |
|
137 | + * @throws InvalidInterfaceException |
|
138 | + * @throws ReflectionException |
|
139 | + */ |
|
140 | + public function column_CHK_timestamp(EE_Checkin $item) |
|
141 | + { |
|
142 | + $actions = array(); |
|
143 | + $delete_url = EE_Admin_Page::add_query_args_and_nonce( |
|
144 | + array( |
|
145 | + 'action' => 'delete_checkin_row', |
|
146 | + 'DTT_ID' => $this->_req_data['DTT_ID'], |
|
147 | + '_REG_ID' => $this->_req_data['_REG_ID'], |
|
148 | + 'CHK_ID' => $item->ID(), |
|
149 | + ) |
|
150 | + ); |
|
151 | + $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can( |
|
152 | + 'ee_delete_checkins', |
|
153 | + 'espresso_registrations_delete_checkin_row' |
|
154 | + ) |
|
155 | + ? '<a href="' . $delete_url . '" aria-label="' |
|
156 | + . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' |
|
157 | + . esc_html__('Delete', 'event_espresso') . '</a>' |
|
158 | + : ''; |
|
159 | + |
|
160 | + return sprintf( |
|
161 | + '%1$s %2$s', |
|
162 | + $item->get_datetime('CHK_timestamp', '', 'H:i:s a'), |
|
163 | + $this->row_actions($actions) |
|
164 | + ); |
|
165 | + } |
|
166 | + |
|
167 | + |
|
168 | + /** |
|
169 | + * This retrieves all the Check-ins for the given parameters. |
|
170 | + * experimenting with having the query for the table values within the list table. |
|
171 | + * |
|
172 | + * @param int $per_page How many to retrieve per page |
|
173 | + * @param bool $count Whether to return a count or not |
|
174 | + * @return EE_Checkin[]|int |
|
175 | + * @throws EE_Error |
|
176 | + * @throws InvalidArgumentException |
|
177 | + * @throws InvalidDataTypeException |
|
178 | + * @throws InvalidInterfaceException |
|
179 | + */ |
|
180 | + protected function _get_checkins($per_page = 10, $count = false) |
|
181 | + { |
|
182 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : false; |
|
183 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : false; |
|
184 | + |
|
185 | + // if user does not have the capability for the checkins for this registration then get out! |
|
186 | + if ( |
|
187 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
188 | + 'ee_read_checkin', |
|
189 | + 'espresso_registrations_registration_checkins', |
|
190 | + $REG_ID |
|
191 | + ) |
|
192 | + ) { |
|
193 | + return $count ? 0 : array(); |
|
194 | + } |
|
195 | + |
|
196 | + // if no reg id then get out cause need a reg id |
|
197 | + if (empty($REG_ID) || empty($DTT_ID)) { |
|
198 | + throw new EE_Error( |
|
199 | + esc_html__( |
|
200 | + 'This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', |
|
201 | + 'event_espresso' |
|
202 | + ) |
|
203 | + ); |
|
204 | + } |
|
205 | + |
|
206 | + // set orderby |
|
207 | + // note that with this table we're only providing the option to orderby the timestamp value. |
|
208 | + $orderby = 'CHK_timestamp'; |
|
209 | + |
|
210 | + $order = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
211 | + |
|
212 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
213 | + ? $this->_req_data['paged'] |
|
214 | + : 1; |
|
215 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
216 | + ? $this->_req_data['perpage'] |
|
217 | + : $per_page; |
|
218 | + $limit = null; |
|
219 | + if (! $count) { |
|
220 | + $offset = ($current_page - 1) * $per_page; |
|
221 | + $limit = array($offset, $per_page); |
|
222 | + } |
|
223 | + |
|
224 | + $_where = array( |
|
225 | + 'REG_ID' => $REG_ID, |
|
226 | + 'DTT_ID' => $DTT_ID, |
|
227 | + ); |
|
228 | + |
|
229 | + $query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit); |
|
230 | + |
|
231 | + // if no per_page value then we just want to return a count of all Check-ins |
|
232 | + if ($count) { |
|
233 | + return EEM_Checkin::instance()->count(array($_where)); |
|
234 | + } |
|
235 | + |
|
236 | + return $count |
|
237 | + ? EEM_Checkin::instance()->count(array($_where)) |
|
238 | + : EEM_Checkin::instance()->get_all($query_params); |
|
239 | + } |
|
240 | 240 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | { |
124 | 124 | $checkin_status_dashicon = CheckinStatusDashicon::fromCheckin($item); |
125 | 125 | return ' |
126 | - <span class="ee-entity-id ' . $checkin_status_dashicon->cssClasses() . '"></span> |
|
127 | - <span class="show-on-mobile-view-only">' . $item->get_datetime('CHK_timestamp') . '</span>'; |
|
126 | + <span class="ee-entity-id ' . $checkin_status_dashicon->cssClasses().'"></span> |
|
127 | + <span class="show-on-mobile-view-only">' . $item->get_datetime('CHK_timestamp').'</span>'; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | 'ee_delete_checkins', |
153 | 153 | 'espresso_registrations_delete_checkin_row' |
154 | 154 | ) |
155 | - ? '<a href="' . $delete_url . '" aria-label="' |
|
156 | - . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' |
|
157 | - . esc_html__('Delete', 'event_espresso') . '</a>' |
|
155 | + ? '<a href="'.$delete_url.'" aria-label="' |
|
156 | + . esc_attr__('Click here to delete this check-in record', 'event_espresso').'">' |
|
157 | + . esc_html__('Delete', 'event_espresso').'</a>' |
|
158 | 158 | : ''; |
159 | 159 | |
160 | 160 | return sprintf( |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | ? $this->_req_data['perpage'] |
217 | 217 | : $per_page; |
218 | 218 | $limit = null; |
219 | - if (! $count) { |
|
219 | + if ( ! $count) { |
|
220 | 220 | $offset = ($current_page - 1) * $per_page; |
221 | 221 | $limit = array($offset, $per_page); |
222 | 222 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $this->caps_handler = new RegFormListTableUserCapabilities(EE_Registry::instance()->CAP); |
32 | 32 | parent::__construct($admin_page); |
33 | 33 | |
34 | - if (! defined('REG_ADMIN_URL')) { |
|
34 | + if ( ! defined('REG_ADMIN_URL')) { |
|
35 | 35 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
36 | 36 | } |
37 | 37 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return $system_question || $has_answers |
122 | 122 | ? ' |
123 | 123 | <span class="dashicons dashicons-lock ee-locked-entity ee-aria-tooltip" |
124 | - aria-label="' . $notice . '"></span> |
|
124 | + aria-label="' . $notice.'"></span> |
|
125 | 125 | ' . sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) |
126 | 126 | : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
127 | 127 | } |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | public function column_id(EE_Question $item): string |
137 | 137 | { |
138 | 138 | $content = ' |
139 | - <span class="ee-entity-id">' . $item->ID() . '</span> |
|
139 | + <span class="ee-entity-id">' . $item->ID().'</span> |
|
140 | 140 | <span class="show-on-mobile-view-only"> |
141 | - ' . $this->column_display_text($item, false) . ' |
|
141 | + ' . $this->column_display_text($item, false).' |
|
142 | 142 | </span>'; |
143 | 143 | return $this->columnContent('id', $content, 'end'); |
144 | 144 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | protected function getActionUrl(EE_Question $question, string $action): string |
189 | 189 | { |
190 | - if (! in_array($action, self::$actions)) { |
|
190 | + if ( ! in_array($action, self::$actions)) { |
|
191 | 191 | throw new DomainException(esc_html__('Invalid Action', 'event_espresso')); |
192 | 192 | } |
193 | 193 | return EE_Admin_Page::add_query_args_and_nonce( |
@@ -15,223 +15,223 @@ |
||
15 | 15 | */ |
16 | 16 | class Registration_Form_Questions_Admin_List_Table extends EE_Admin_List_Table |
17 | 17 | { |
18 | - /** |
|
19 | - * @var Registration_Form_Admin_Page $_admin_page |
|
20 | - */ |
|
21 | - protected EE_Admin_Page $_admin_page; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var RegFormListTableUserCapabilities |
|
25 | - */ |
|
26 | - protected $caps_handler; |
|
27 | - |
|
28 | - |
|
29 | - public function __construct($admin_page) |
|
30 | - { |
|
31 | - $this->caps_handler = new RegFormListTableUserCapabilities(EE_Registry::instance()->CAP); |
|
32 | - parent::__construct($admin_page); |
|
33 | - |
|
34 | - if (! defined('REG_ADMIN_URL')) { |
|
35 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
36 | - } |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @throws EE_Error |
|
42 | - */ |
|
43 | - protected function _setup_data() |
|
44 | - { |
|
45 | - if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') { |
|
46 | - $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page); |
|
47 | - } else { |
|
48 | - $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page); |
|
49 | - } |
|
50 | - $this->_all_data_count = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - protected function _set_properties() |
|
55 | - { |
|
56 | - $this->_wp_list_args = [ |
|
57 | - 'singular' => esc_html__('question', 'event_espresso'), |
|
58 | - 'plural' => esc_html__('questions', 'event_espresso'), |
|
59 | - 'ajax' => true, // for now, |
|
60 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
61 | - ]; |
|
62 | - |
|
63 | - $this->_columns = [ |
|
64 | - 'cb' => '<input type="checkbox" />', |
|
65 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
66 | - 'display_text' => esc_html__('Question', 'event_espresso'), |
|
67 | - 'admin_label' => esc_html__('Admin Label', 'event_espresso'), |
|
68 | - 'type' => esc_html__('Type', 'event_espresso'), |
|
69 | - 'values' => esc_html__('Values', 'event_espresso'), |
|
70 | - 'required' => esc_html__('Req', 'event_espresso'), |
|
71 | - ]; |
|
72 | - |
|
73 | - $this->_primary_column = 'id'; |
|
74 | - |
|
75 | - $this->_sortable_columns = [ |
|
76 | - 'id' => ['QST_ID' => false], |
|
77 | - 'display_text' => ['QST_display_text' => false], |
|
78 | - ]; |
|
79 | - |
|
80 | - $this->_hidden_columns = []; |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - // not needed |
|
85 | - protected function _get_table_filters() |
|
86 | - { |
|
87 | - return []; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @throws EE_Error |
|
93 | - */ |
|
94 | - protected function _add_view_counts() |
|
95 | - { |
|
96 | - $this->_views['all']['count'] = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
97 | - if ($this->caps_handler->userCanTrashQuestions()) { |
|
98 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_questions(-1, $this->_current_page, true); |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * @param EE_Question $item |
|
105 | - * @return string |
|
106 | - * @throws EE_Error |
|
107 | - * @throws ReflectionException |
|
108 | - */ |
|
109 | - public function column_cb($item): string |
|
110 | - { |
|
111 | - $system_question = $item->is_system_question(); |
|
112 | - $related_answer_count = $item->count_related('Answer'); |
|
113 | - $has_answers = ! $system_question && $related_answer_count > 0 && $this->_view == 'trash'; |
|
114 | - $notice = $has_answers |
|
115 | - ? esc_html__( |
|
116 | - 'This question has answers attached to it from registrations that have the question. It cannot be permanently deleted.', |
|
117 | - 'event_espresso' |
|
118 | - ) |
|
119 | - : esc_html__('This question is a system question and cannot be trashed', 'event_espresso'); |
|
120 | - |
|
121 | - return $system_question || $has_answers |
|
122 | - ? ' |
|
18 | + /** |
|
19 | + * @var Registration_Form_Admin_Page $_admin_page |
|
20 | + */ |
|
21 | + protected EE_Admin_Page $_admin_page; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var RegFormListTableUserCapabilities |
|
25 | + */ |
|
26 | + protected $caps_handler; |
|
27 | + |
|
28 | + |
|
29 | + public function __construct($admin_page) |
|
30 | + { |
|
31 | + $this->caps_handler = new RegFormListTableUserCapabilities(EE_Registry::instance()->CAP); |
|
32 | + parent::__construct($admin_page); |
|
33 | + |
|
34 | + if (! defined('REG_ADMIN_URL')) { |
|
35 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
36 | + } |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @throws EE_Error |
|
42 | + */ |
|
43 | + protected function _setup_data() |
|
44 | + { |
|
45 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') { |
|
46 | + $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page); |
|
47 | + } else { |
|
48 | + $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page); |
|
49 | + } |
|
50 | + $this->_all_data_count = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + protected function _set_properties() |
|
55 | + { |
|
56 | + $this->_wp_list_args = [ |
|
57 | + 'singular' => esc_html__('question', 'event_espresso'), |
|
58 | + 'plural' => esc_html__('questions', 'event_espresso'), |
|
59 | + 'ajax' => true, // for now, |
|
60 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
61 | + ]; |
|
62 | + |
|
63 | + $this->_columns = [ |
|
64 | + 'cb' => '<input type="checkbox" />', |
|
65 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
66 | + 'display_text' => esc_html__('Question', 'event_espresso'), |
|
67 | + 'admin_label' => esc_html__('Admin Label', 'event_espresso'), |
|
68 | + 'type' => esc_html__('Type', 'event_espresso'), |
|
69 | + 'values' => esc_html__('Values', 'event_espresso'), |
|
70 | + 'required' => esc_html__('Req', 'event_espresso'), |
|
71 | + ]; |
|
72 | + |
|
73 | + $this->_primary_column = 'id'; |
|
74 | + |
|
75 | + $this->_sortable_columns = [ |
|
76 | + 'id' => ['QST_ID' => false], |
|
77 | + 'display_text' => ['QST_display_text' => false], |
|
78 | + ]; |
|
79 | + |
|
80 | + $this->_hidden_columns = []; |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + // not needed |
|
85 | + protected function _get_table_filters() |
|
86 | + { |
|
87 | + return []; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @throws EE_Error |
|
93 | + */ |
|
94 | + protected function _add_view_counts() |
|
95 | + { |
|
96 | + $this->_views['all']['count'] = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
97 | + if ($this->caps_handler->userCanTrashQuestions()) { |
|
98 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_questions(-1, $this->_current_page, true); |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * @param EE_Question $item |
|
105 | + * @return string |
|
106 | + * @throws EE_Error |
|
107 | + * @throws ReflectionException |
|
108 | + */ |
|
109 | + public function column_cb($item): string |
|
110 | + { |
|
111 | + $system_question = $item->is_system_question(); |
|
112 | + $related_answer_count = $item->count_related('Answer'); |
|
113 | + $has_answers = ! $system_question && $related_answer_count > 0 && $this->_view == 'trash'; |
|
114 | + $notice = $has_answers |
|
115 | + ? esc_html__( |
|
116 | + 'This question has answers attached to it from registrations that have the question. It cannot be permanently deleted.', |
|
117 | + 'event_espresso' |
|
118 | + ) |
|
119 | + : esc_html__('This question is a system question and cannot be trashed', 'event_espresso'); |
|
120 | + |
|
121 | + return $system_question || $has_answers |
|
122 | + ? ' |
|
123 | 123 | <span class="dashicons dashicons-lock ee-locked-entity ee-aria-tooltip" |
124 | 124 | aria-label="' . $notice . '"></span> |
125 | 125 | ' . sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) |
126 | - : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * @param EE_Question $item |
|
132 | - * @return string |
|
133 | - * @throws EE_Error |
|
134 | - * @throws ReflectionException |
|
135 | - */ |
|
136 | - public function column_id(EE_Question $item): string |
|
137 | - { |
|
138 | - $content = ' |
|
126 | + : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * @param EE_Question $item |
|
132 | + * @return string |
|
133 | + * @throws EE_Error |
|
134 | + * @throws ReflectionException |
|
135 | + */ |
|
136 | + public function column_id(EE_Question $item): string |
|
137 | + { |
|
138 | + $content = ' |
|
139 | 139 | <span class="ee-entity-id">' . $item->ID() . '</span> |
140 | 140 | <span class="show-on-mobile-view-only"> |
141 | 141 | ' . $this->column_display_text($item, false) . ' |
142 | 142 | </span>'; |
143 | - return $this->columnContent('id', $content, 'end'); |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * @param EE_Question $question |
|
149 | - * @param bool $prep_content |
|
150 | - * @return string |
|
151 | - * @throws EE_Error |
|
152 | - * @throws ReflectionException |
|
153 | - */ |
|
154 | - public function column_display_text(EE_Question $question, bool $prep_content = true): string |
|
155 | - { |
|
156 | - if ($this->caps_handler->userCanEditQuestion($question)) { |
|
157 | - $content = $this->getActionLink( |
|
158 | - $this->getActionUrl($question, self::ACTION_EDIT), |
|
159 | - $prep_content ? $question->display_text() : $question->admin_label(), |
|
160 | - esc_attr__('Edit Question', 'event_espresso'), |
|
161 | - 'row-title' |
|
162 | - ); |
|
163 | - $content .= $this->row_actions( |
|
164 | - [ |
|
165 | - 'edit' => $this->getActionLink( |
|
166 | - $this->getActionUrl($question, self::ACTION_EDIT), |
|
167 | - esc_html__('Edit', 'event_espresso'), |
|
168 | - esc_attr__('Edit Question', 'event_espresso') |
|
169 | - ), |
|
170 | - ] |
|
171 | - ); |
|
172 | - } else { |
|
173 | - $content = $question->display_text(); |
|
174 | - } |
|
175 | - |
|
176 | - return $prep_content ? $this->columnContent('display_text', $content) : $content; |
|
177 | - } |
|
178 | - |
|
179 | - |
|
180 | - /** |
|
181 | - * @param EE_Question $question |
|
182 | - * @param string $action |
|
183 | - * @return string |
|
184 | - * @throws EE_Error |
|
185 | - * @throws ReflectionException |
|
186 | - * @since 5.0.0.p |
|
187 | - */ |
|
188 | - protected function getActionUrl(EE_Question $question, string $action): string |
|
189 | - { |
|
190 | - if (! in_array($action, self::$actions)) { |
|
191 | - throw new DomainException(esc_html__('Invalid Action', 'event_espresso')); |
|
192 | - } |
|
193 | - return EE_Admin_Page::add_query_args_and_nonce( |
|
194 | - [ |
|
195 | - 'action' => $action === self::ACTION_DELETE ? "{$action}_questions" : "{$action}_question", |
|
196 | - 'QST_ID' => $question->ID(), |
|
197 | - 'noheader' => $action !== self::ACTION_EDIT, |
|
198 | - ], |
|
199 | - EE_FORMS_ADMIN_URL |
|
200 | - ); |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - public function column_admin_label(EE_Question $item): string |
|
205 | - { |
|
206 | - return $this->columnContent('admin_label', $item->admin_label()); |
|
207 | - } |
|
208 | - |
|
209 | - |
|
210 | - public function column_values(EE_Question $item): string |
|
211 | - { |
|
212 | - $optionNames = []; |
|
213 | - $options = $item->options(); |
|
214 | - if (empty($options)) { |
|
215 | - $content = "N/A"; |
|
216 | - } else { |
|
217 | - foreach ($options as $option) { |
|
218 | - $optionNames[] = $option->value(); |
|
219 | - } |
|
220 | - $content = implode(', ', $optionNames); |
|
221 | - } |
|
222 | - return $this->columnContent('values', $content); |
|
223 | - } |
|
224 | - |
|
225 | - |
|
226 | - public function column_type(EE_Question $item): string |
|
227 | - { |
|
228 | - return $this->columnContent('type', $item->type()); |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - public function column_required(EE_Question $item): string |
|
233 | - { |
|
234 | - $content = $item->required() ? 'Yes' : ''; |
|
235 | - return $this->columnContent('required', $content); |
|
236 | - } |
|
143 | + return $this->columnContent('id', $content, 'end'); |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * @param EE_Question $question |
|
149 | + * @param bool $prep_content |
|
150 | + * @return string |
|
151 | + * @throws EE_Error |
|
152 | + * @throws ReflectionException |
|
153 | + */ |
|
154 | + public function column_display_text(EE_Question $question, bool $prep_content = true): string |
|
155 | + { |
|
156 | + if ($this->caps_handler->userCanEditQuestion($question)) { |
|
157 | + $content = $this->getActionLink( |
|
158 | + $this->getActionUrl($question, self::ACTION_EDIT), |
|
159 | + $prep_content ? $question->display_text() : $question->admin_label(), |
|
160 | + esc_attr__('Edit Question', 'event_espresso'), |
|
161 | + 'row-title' |
|
162 | + ); |
|
163 | + $content .= $this->row_actions( |
|
164 | + [ |
|
165 | + 'edit' => $this->getActionLink( |
|
166 | + $this->getActionUrl($question, self::ACTION_EDIT), |
|
167 | + esc_html__('Edit', 'event_espresso'), |
|
168 | + esc_attr__('Edit Question', 'event_espresso') |
|
169 | + ), |
|
170 | + ] |
|
171 | + ); |
|
172 | + } else { |
|
173 | + $content = $question->display_text(); |
|
174 | + } |
|
175 | + |
|
176 | + return $prep_content ? $this->columnContent('display_text', $content) : $content; |
|
177 | + } |
|
178 | + |
|
179 | + |
|
180 | + /** |
|
181 | + * @param EE_Question $question |
|
182 | + * @param string $action |
|
183 | + * @return string |
|
184 | + * @throws EE_Error |
|
185 | + * @throws ReflectionException |
|
186 | + * @since 5.0.0.p |
|
187 | + */ |
|
188 | + protected function getActionUrl(EE_Question $question, string $action): string |
|
189 | + { |
|
190 | + if (! in_array($action, self::$actions)) { |
|
191 | + throw new DomainException(esc_html__('Invalid Action', 'event_espresso')); |
|
192 | + } |
|
193 | + return EE_Admin_Page::add_query_args_and_nonce( |
|
194 | + [ |
|
195 | + 'action' => $action === self::ACTION_DELETE ? "{$action}_questions" : "{$action}_question", |
|
196 | + 'QST_ID' => $question->ID(), |
|
197 | + 'noheader' => $action !== self::ACTION_EDIT, |
|
198 | + ], |
|
199 | + EE_FORMS_ADMIN_URL |
|
200 | + ); |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + public function column_admin_label(EE_Question $item): string |
|
205 | + { |
|
206 | + return $this->columnContent('admin_label', $item->admin_label()); |
|
207 | + } |
|
208 | + |
|
209 | + |
|
210 | + public function column_values(EE_Question $item): string |
|
211 | + { |
|
212 | + $optionNames = []; |
|
213 | + $options = $item->options(); |
|
214 | + if (empty($options)) { |
|
215 | + $content = "N/A"; |
|
216 | + } else { |
|
217 | + foreach ($options as $option) { |
|
218 | + $optionNames[] = $option->value(); |
|
219 | + } |
|
220 | + $content = implode(', ', $optionNames); |
|
221 | + } |
|
222 | + return $this->columnContent('values', $content); |
|
223 | + } |
|
224 | + |
|
225 | + |
|
226 | + public function column_type(EE_Question $item): string |
|
227 | + { |
|
228 | + return $this->columnContent('type', $item->type()); |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + public function column_required(EE_Question $item): string |
|
233 | + { |
|
234 | + $content = $item->required() ? 'Yes' : ''; |
|
235 | + return $this->columnContent('required', $content); |
|
236 | + } |
|
237 | 237 | } |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | function espressoPerson(string $id, string $email, string $name, string $desc): string |
65 | 65 | { |
66 | 66 | return ' |
67 | - <li class="ee-card ee-credits-person" id="ee-person-' . $id . '"> |
|
68 | - <a href="' . esp_gravatar_profile($email) . '" target="_blank"> |
|
69 | - ' . esp_gravatar_image($email, $name) . ' |
|
67 | + <li class="ee-card ee-credits-person" id="ee-person-' . $id.'"> |
|
68 | + <a href="' . esp_gravatar_profile($email).'" target="_blank"> |
|
69 | + ' . esp_gravatar_image($email, $name).' |
|
70 | 70 | </a> |
71 | 71 | <p> |
72 | - <a class="web" href="' . esp_gravatar_profile($email) . '" target="_blank">' . $name . '</a> |
|
73 | - <span class="title">' . $desc . '</span> |
|
72 | + <a class="web" href="' . esp_gravatar_profile($email).'" target="_blank">'.$name.'</a> |
|
73 | + <span class="title">' . $desc.'</span> |
|
74 | 74 | </p> |
75 | 75 | </li>'; |
76 | 76 | } |
77 | 77 | |
78 | 78 | function esp_gravatar_profile(string $email): string |
79 | 79 | { |
80 | - return esc_url_raw('https://www.gravatar.com/' . md5($email)); |
|
80 | + return esc_url_raw('https://www.gravatar.com/'.md5($email)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | function esp_gravatar_image(string $email, string $name): string |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
153 | 153 | 'event_espresso' |
154 | 154 | ), |
155 | - '<a href="' . admin_url('credits.php') . '">', |
|
155 | + '<a href="'.admin_url('credits.php').'">', |
|
156 | 156 | '</a>' |
157 | 157 | ); |
158 | 158 | ?> |
@@ -3,67 +3,67 @@ discard block |
||
3 | 3 | use EventEspresso\core\services\request\sanitizers\AllowedTags; |
4 | 4 | |
5 | 5 | $tEEm_members = [ |
6 | - esc_html__('Founders', 'event_espresso') => [ |
|
7 | - 'garth-koyle' => [ |
|
8 | - 'email' => '[email protected]', |
|
9 | - 'name' => 'Garth Koyle', |
|
10 | - 'desc' => esc_html__('Co-Founder', 'event_espresso'), |
|
11 | - ], |
|
12 | - ], |
|
13 | - esc_html__('Core Developers', 'event_espresso') => [ |
|
14 | - 'brent-christensen' => [ |
|
15 | - 'email' => '[email protected]', |
|
16 | - 'name' => 'Brent Christensen', |
|
17 | - 'desc' => esc_html__('Lead Developer', 'event_espresso'), |
|
18 | - ], |
|
19 | - 'nazar-kolivoshka' => [ |
|
20 | - 'email' => '[email protected]', |
|
21 | - 'name' => 'Nazar Kolivoshka', |
|
22 | - 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
23 | - ], |
|
24 | - 'alex' => [ |
|
25 | - 'email' => '[email protected]', |
|
26 | - 'name' => 'Alexander Kucheryuk', |
|
27 | - 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
28 | - ], |
|
29 | - ], |
|
30 | - esc_html__('Support Staff', 'event_espresso') => [ |
|
31 | - 'tony-warwick' => [ |
|
32 | - 'email' => '[email protected]', |
|
33 | - 'name' => 'Tony Warwick', |
|
34 | - 'desc' => esc_html__('Support Lead', 'event_espresso'), |
|
35 | - ], |
|
36 | - 'janice-gutierrez' => [ |
|
37 | - 'email' => '[email protected]', |
|
38 | - 'name' => 'Janice Gutierrez', |
|
39 | - 'desc' => esc_html__('Support', 'event_espresso'), |
|
40 | - ], |
|
41 | - 'chinny-love-verana' => [ |
|
42 | - 'email' => '[email protected]', |
|
43 | - 'name' => 'Chinny Love Verana', |
|
44 | - 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
45 | - ], |
|
46 | - 'kimiko-catherine-sy' => [ |
|
47 | - 'email' => '[email protected]', |
|
48 | - 'name' => 'Kimiko Catherine Sy', |
|
49 | - 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
50 | - ], |
|
51 | - 'sam' => [ |
|
52 | - 'email' => '[email protected]', |
|
53 | - 'name' => 'Sam', |
|
54 | - 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
55 | - ], |
|
56 | - 'rio-michael-miranda' => [ |
|
57 | - 'email' => '[email protected]', |
|
58 | - 'name' => 'Rio Michael Miranda', |
|
59 | - 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
60 | - ], |
|
61 | - ], |
|
6 | + esc_html__('Founders', 'event_espresso') => [ |
|
7 | + 'garth-koyle' => [ |
|
8 | + 'email' => '[email protected]', |
|
9 | + 'name' => 'Garth Koyle', |
|
10 | + 'desc' => esc_html__('Co-Founder', 'event_espresso'), |
|
11 | + ], |
|
12 | + ], |
|
13 | + esc_html__('Core Developers', 'event_espresso') => [ |
|
14 | + 'brent-christensen' => [ |
|
15 | + 'email' => '[email protected]', |
|
16 | + 'name' => 'Brent Christensen', |
|
17 | + 'desc' => esc_html__('Lead Developer', 'event_espresso'), |
|
18 | + ], |
|
19 | + 'nazar-kolivoshka' => [ |
|
20 | + 'email' => '[email protected]', |
|
21 | + 'name' => 'Nazar Kolivoshka', |
|
22 | + 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
23 | + ], |
|
24 | + 'alex' => [ |
|
25 | + 'email' => '[email protected]', |
|
26 | + 'name' => 'Alexander Kucheryuk', |
|
27 | + 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
28 | + ], |
|
29 | + ], |
|
30 | + esc_html__('Support Staff', 'event_espresso') => [ |
|
31 | + 'tony-warwick' => [ |
|
32 | + 'email' => '[email protected]', |
|
33 | + 'name' => 'Tony Warwick', |
|
34 | + 'desc' => esc_html__('Support Lead', 'event_espresso'), |
|
35 | + ], |
|
36 | + 'janice-gutierrez' => [ |
|
37 | + 'email' => '[email protected]', |
|
38 | + 'name' => 'Janice Gutierrez', |
|
39 | + 'desc' => esc_html__('Support', 'event_espresso'), |
|
40 | + ], |
|
41 | + 'chinny-love-verana' => [ |
|
42 | + 'email' => '[email protected]', |
|
43 | + 'name' => 'Chinny Love Verana', |
|
44 | + 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
45 | + ], |
|
46 | + 'kimiko-catherine-sy' => [ |
|
47 | + 'email' => '[email protected]', |
|
48 | + 'name' => 'Kimiko Catherine Sy', |
|
49 | + 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
50 | + ], |
|
51 | + 'sam' => [ |
|
52 | + 'email' => '[email protected]', |
|
53 | + 'name' => 'Sam', |
|
54 | + 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
55 | + ], |
|
56 | + 'rio-michael-miranda' => [ |
|
57 | + 'email' => '[email protected]', |
|
58 | + 'name' => 'Rio Michael Miranda', |
|
59 | + 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
60 | + ], |
|
61 | + ], |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | function espressoPerson(string $id, string $email, string $name, string $desc): string |
65 | 65 | { |
66 | - return ' |
|
66 | + return ' |
|
67 | 67 | <li class="ee-card ee-credits-person" id="ee-person-' . $id . '"> |
68 | 68 | <a href="' . esp_gravatar_profile($email) . '" target="_blank"> |
69 | 69 | ' . esp_gravatar_image($email, $name) . ' |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | function esp_gravatar_profile(string $email): string |
79 | 79 | { |
80 | - return esc_url_raw('https://www.gravatar.com/' . md5($email)); |
|
80 | + return esc_url_raw('https://www.gravatar.com/' . md5($email)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | function esp_gravatar_image(string $email, string $name): string |
84 | 84 | { |
85 | - $email = md5($email); |
|
86 | - $name = esc_attr($name); |
|
87 | - $url = esc_url_raw("https://0.gravatar.com/avatar/{$email}?s=60"); |
|
88 | - return "<img src='{$url}' class='gravatar' alt='{$name}'/>"; |
|
85 | + $email = md5($email); |
|
86 | + $name = esc_attr($name); |
|
87 | + $url = esc_url_raw("https://0.gravatar.com/avatar/{$email}?s=60"); |
|
88 | + return "<img src='{$url}' class='gravatar' alt='{$name}'/>"; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | <h4> |
98 | 98 | <?php esc_html_e( |
99 | - 'Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', |
|
100 | - 'event_espresso' |
|
101 | - ); ?> |
|
99 | + 'Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', |
|
100 | + 'event_espresso' |
|
101 | + ); ?> |
|
102 | 102 | </h4> |
103 | 103 | |
104 | 104 | <div class='ee-credits-tEEm'> |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | <h3 class="wp-people-group"><?php echo esc_html($tEEm); ?></h3> |
107 | 107 | <ul class="ee-card-grid ee-card-grid-4-cols" id="' . sanitize_key($tEEm) . '"> |
108 | 108 | <?php foreach ($members as $id => $person) { |
109 | - echo wp_kses( |
|
110 | - espressoPerson($id, $person['email'], $person['name'], $person['desc']), |
|
111 | - AllowedTags::getAllowedTags() |
|
112 | - ); |
|
113 | - } |
|
114 | - ?> |
|
109 | + echo wp_kses( |
|
110 | + espressoPerson($id, $person['email'], $person['name'], $person['desc']), |
|
111 | + AllowedTags::getAllowedTags() |
|
112 | + ); |
|
113 | + } |
|
114 | + ?> |
|
115 | 115 | </ul> |
116 | 116 | <?php } ?> |
117 | 117 | </div> |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | <h3 class="wp-people-group"><?php esc_html_e('Contributor Recognition', 'event_espresso'); ?></h3> |
120 | 120 | <p class="description"> |
121 | 121 | <?php |
122 | - printf( |
|
123 | - esc_html__( |
|
124 | - 'For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', |
|
125 | - 'event_espresso' |
|
126 | - ), |
|
127 | - '<a href="https://github.com/eventespresso/event-espresso-core" aria-label="Contribute to Event Espresso by making a pull request via GitHub" target="_blank">', |
|
128 | - '</a>' |
|
129 | - ); |
|
130 | - ?> |
|
122 | + printf( |
|
123 | + esc_html__( |
|
124 | + 'For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', |
|
125 | + 'event_espresso' |
|
126 | + ), |
|
127 | + '<a href="https://github.com/eventespresso/event-espresso-core" aria-label="Contribute to Event Espresso by making a pull request via GitHub" target="_blank">', |
|
128 | + '</a>' |
|
129 | + ); |
|
130 | + ?> |
|
131 | 131 | </p> |
132 | 132 | |
133 | 133 | <ul class='wp-credits-list'> |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | <h3 class="wp-people-group"><?php esc_html_e('External Libraries', 'event_espresso'); ?></h3> |
142 | 142 | <p class="description"> |
143 | 143 | <?php |
144 | - printf( |
|
145 | - esc_html__( |
|
146 | - 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
|
147 | - 'event_espresso' |
|
148 | - ), |
|
149 | - '<a href="' . admin_url('credits.php') . '">', |
|
150 | - '</a>' |
|
151 | - ); |
|
152 | - ?> |
|
144 | + printf( |
|
145 | + esc_html__( |
|
146 | + 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
|
147 | + 'event_espresso' |
|
148 | + ), |
|
149 | + '<a href="' . admin_url('credits.php') . '">', |
|
150 | + '</a>' |
|
151 | + ); |
|
152 | + ?> |
|
153 | 153 | </p> |
154 | 154 | <ul class="wp-credits-list"> |
155 | 155 | <li><a href="https://openexchangerates.github.io/accounting.js/" target='_blank'>accounting.js</a>,</li> |
@@ -36,24 +36,24 @@ discard block |
||
36 | 36 | <td><h3><?php esc_html_e('1', 'event_espresso'); ?></h3></td> |
37 | 37 | <td> |
38 | 38 | <?php echo apply_filters( |
39 | - 'FHEE__ee_migration_page__option_1_main', |
|
40 | - sprintf( |
|
41 | - __( |
|
42 | - '%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.', |
|
43 | - "event_espresso" |
|
44 | - ), |
|
45 | - '<strong>', |
|
46 | - '</strong>', |
|
47 | - '<a id="migration-risks" class="" aria-label="' |
|
48 | - . esc_attr__('click for more details', "event_espresso") |
|
49 | - . '">', |
|
50 | - '</a>', |
|
51 | - $current_db_state, |
|
52 | - $next_db_state |
|
53 | - ), |
|
54 | - $current_db_state, |
|
55 | - $next_db_state |
|
56 | - ); ?> |
|
39 | + 'FHEE__ee_migration_page__option_1_main', |
|
40 | + sprintf( |
|
41 | + __( |
|
42 | + '%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.', |
|
43 | + "event_espresso" |
|
44 | + ), |
|
45 | + '<strong>', |
|
46 | + '</strong>', |
|
47 | + '<a id="migration-risks" class="" aria-label="' |
|
48 | + . esc_attr__('click for more details', "event_espresso") |
|
49 | + . '">', |
|
50 | + '</a>', |
|
51 | + $current_db_state, |
|
52 | + $next_db_state |
|
53 | + ), |
|
54 | + $current_db_state, |
|
55 | + $next_db_state |
|
56 | + ); ?> |
|
57 | 57 | <a id="display-migration-details" |
58 | 58 | class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" |
59 | 59 | rel="migration-details" |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | style="display:none;" |
67 | 67 | > |
68 | 68 | <?php printf( |
69 | - esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), |
|
70 | - ' ' |
|
71 | - ); ?> |
|
69 | + esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), |
|
70 | + ' ' |
|
71 | + ); ?> |
|
72 | 72 | </a> |
73 | 73 | </td> |
74 | 74 | <td> |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | class="toggle-migration-monitor button--primary" |
77 | 77 | > |
78 | 78 | <?php echo esc_html( |
79 | - apply_filters( |
|
80 | - 'FHEE__ee_migration_page__option_1_button_text', |
|
81 | - sprintf( |
|
82 | - __("Migrate My %s Data to %s", "event_espresso"), |
|
83 | - $current_db_state, |
|
84 | - $next_db_state |
|
85 | - ), |
|
86 | - $current_db_state, |
|
87 | - $next_db_state |
|
88 | - ) |
|
89 | - ); ?> |
|
79 | + apply_filters( |
|
80 | + 'FHEE__ee_migration_page__option_1_button_text', |
|
81 | + sprintf( |
|
82 | + __("Migrate My %s Data to %s", "event_espresso"), |
|
83 | + $current_db_state, |
|
84 | + $next_db_state |
|
85 | + ), |
|
86 | + $current_db_state, |
|
87 | + $next_db_state |
|
88 | + ) |
|
89 | + ); ?> |
|
90 | 90 | </a> |
91 | 91 | </td> |
92 | 92 | </tr> |
@@ -95,33 +95,33 @@ discard block |
||
95 | 95 | <div id="migration-details-dv" style="display: none; padding: 1em;"> |
96 | 96 | <span class="reminder-spn"> |
97 | 97 | <?php printf( |
98 | - esc_html__( |
|
99 | - "%s Important: %s Before migrating, please back up your database and files.", |
|
100 | - "event_espresso" |
|
101 | - ), |
|
102 | - "<b>", |
|
103 | - "</b>" |
|
104 | - ); ?> |
|
98 | + esc_html__( |
|
99 | + "%s Important: %s Before migrating, please back up your database and files.", |
|
100 | + "event_espresso" |
|
101 | + ), |
|
102 | + "<b>", |
|
103 | + "</b>" |
|
104 | + ); ?> |
|
105 | 105 | </span> |
106 | 106 | <p> |
107 | 107 | <?php printf( |
108 | - esc_html__( |
|
109 | - '%1$sNot sure how to backup your existing data?%2$s Here is %3$sWordPress\'s explanation%7$s, and here\'s %6$sour explanation%7$s.%8$sYou can also search the WordPress plugin database for %4$s database backup plugins %7$s,%8$sor have one of our dedicated support technicians help you by purchasing a %5$sPriority Support Token%7$s.', |
|
110 | - "event_espresso" |
|
111 | - ), |
|
112 | - '<b>', |
|
113 | - '</b>', |
|
114 | - "<a href='https://codex.wordpress.org/Backing_Up_Your_Database'>", |
|
115 | - "<a href='" |
|
116 | - . admin_url( |
|
117 | - 'plugin-install.php?tab=search&type=term&s=database+backup&plugin-search-input=Search+Plugins' |
|
118 | - ) |
|
119 | - . "'>", |
|
120 | - "<a href='https://eventespresso.com/product/priority-support-tokens/'>", |
|
121 | - '<a href="https://eventespresso.com/wiki/how-to-back-up-your-site/">', |
|
122 | - "</a>", |
|
123 | - '<br/>' |
|
124 | - ); ?> |
|
108 | + esc_html__( |
|
109 | + '%1$sNot sure how to backup your existing data?%2$s Here is %3$sWordPress\'s explanation%7$s, and here\'s %6$sour explanation%7$s.%8$sYou can also search the WordPress plugin database for %4$s database backup plugins %7$s,%8$sor have one of our dedicated support technicians help you by purchasing a %5$sPriority Support Token%7$s.', |
|
110 | + "event_espresso" |
|
111 | + ), |
|
112 | + '<b>', |
|
113 | + '</b>', |
|
114 | + "<a href='https://codex.wordpress.org/Backing_Up_Your_Database'>", |
|
115 | + "<a href='" |
|
116 | + . admin_url( |
|
117 | + 'plugin-install.php?tab=search&type=term&s=database+backup&plugin-search-input=Search+Plugins' |
|
118 | + ) |
|
119 | + . "'>", |
|
120 | + "<a href='https://eventespresso.com/product/priority-support-tokens/'>", |
|
121 | + '<a href="https://eventespresso.com/wiki/how-to-back-up-your-site/">', |
|
122 | + "</a>", |
|
123 | + '<br/>' |
|
124 | + ); ?> |
|
125 | 125 | </p> |
126 | 126 | <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?> |
127 | 127 | </div> |
@@ -133,28 +133,28 @@ discard block |
||
133 | 133 | </td> |
134 | 134 | <td> |
135 | 135 | <?php echo esc_html( |
136 | - apply_filters( |
|
137 | - 'FHEE__ee_migration_page__option_2_main', |
|
138 | - sprintf( |
|
139 | - __( |
|
140 | - 'I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', |
|
141 | - "event_espresso" |
|
142 | - ), |
|
143 | - $current_db_state, |
|
144 | - $next_db_state, |
|
145 | - $ultimate_db_state |
|
146 | - ), |
|
147 | - $current_db_state, |
|
148 | - $next_db_state, |
|
149 | - $ultimate_db_state |
|
150 | - ) |
|
151 | - ); ?> |
|
136 | + apply_filters( |
|
137 | + 'FHEE__ee_migration_page__option_2_main', |
|
138 | + sprintf( |
|
139 | + __( |
|
140 | + 'I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', |
|
141 | + "event_espresso" |
|
142 | + ), |
|
143 | + $current_db_state, |
|
144 | + $next_db_state, |
|
145 | + $ultimate_db_state |
|
146 | + ), |
|
147 | + $current_db_state, |
|
148 | + $next_db_state, |
|
149 | + $ultimate_db_state |
|
150 | + ) |
|
151 | + ); ?> |
|
152 | 152 | <br /> |
153 | 153 | <span class="reminder-spn"> |
154 | 154 | <?php esc_html_e( |
155 | - 'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', |
|
156 | - 'event_espresso' |
|
157 | - ); ?> |
|
155 | + 'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', |
|
156 | + 'event_espresso' |
|
157 | + ); ?> |
|
158 | 158 | </span> |
159 | 159 | <a id="display-no-migration-details" |
160 | 160 | class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | style="display:none;" |
169 | 169 | > |
170 | 170 | <?php printf( |
171 | - esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), |
|
172 | - ' ' |
|
173 | - ); ?> |
|
171 | + esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), |
|
172 | + ' ' |
|
173 | + ); ?> |
|
174 | 174 | </a> |
175 | 175 | </td> |
176 | 176 | <td> |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | href="<?php echo esc_url_raw($reset_db_page_link); ?>" |
180 | 180 | > |
181 | 181 | <?php echo esc_html( |
182 | - apply_filters( |
|
183 | - 'FHEE__ee_migration_page__option_2_button_text', |
|
184 | - sprintf( |
|
185 | - __("Just Start %s and Delete Existing Data", "event_espresso"), |
|
186 | - $ultimate_db_state |
|
187 | - ), |
|
188 | - $ultimate_db_state |
|
189 | - ) |
|
190 | - ); ?> |
|
182 | + apply_filters( |
|
183 | + 'FHEE__ee_migration_page__option_2_button_text', |
|
184 | + sprintf( |
|
185 | + __("Just Start %s and Delete Existing Data", "event_espresso"), |
|
186 | + $ultimate_db_state |
|
187 | + ), |
|
188 | + $ultimate_db_state |
|
189 | + ) |
|
190 | + ); ?> |
|
191 | 191 | </a> |
192 | 192 | </td> |
193 | 193 | </tr> |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | <div id="no-migration-details-dv" style="display: none; padding: 1em;"> |
197 | 197 | <p> |
198 | 198 | <?php echo esc_html( |
199 | - apply_filters( |
|
200 | - 'FHEE__ee_migration_page__option_2_details', |
|
201 | - sprintf( |
|
202 | - __( |
|
203 | - "If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", |
|
204 | - "event_espresso" |
|
205 | - ), |
|
206 | - $ultimate_db_state |
|
207 | - ), |
|
208 | - $ultimate_db_state |
|
209 | - ) |
|
210 | - ); ?> |
|
199 | + apply_filters( |
|
200 | + 'FHEE__ee_migration_page__option_2_details', |
|
201 | + sprintf( |
|
202 | + __( |
|
203 | + "If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", |
|
204 | + "event_espresso" |
|
205 | + ), |
|
206 | + $ultimate_db_state |
|
207 | + ), |
|
208 | + $ultimate_db_state |
|
209 | + ) |
|
210 | + ); ?> |
|
211 | 211 | </p> |
212 | 212 | </div> |
213 | 213 | </td> |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | <?php |
60 | 60 | // only show if logged-in user has access |
61 | 61 | if ( |
62 | - EE_Registry::instance()->CAP->current_user_can( |
|
63 | - 'ee_edit_contact', |
|
64 | - 'view_or_edit_contact_button', |
|
65 | - $ATT_ID |
|
66 | - ) |
|
62 | + EE_Registry::instance()->CAP->current_user_can( |
|
63 | + 'ee_edit_contact', |
|
64 | + 'view_or_edit_contact_button', |
|
65 | + $ATT_ID |
|
66 | + ) |
|
67 | 67 | ) : ?> |
68 | 68 | <div class='ee-admin-button-row'> |
69 | 69 | <a class="ee-aria-tooltip button button--small button--secondary" href="<?php echo esc_url_raw($att_edit_link); ?>" |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | <?php if (! empty($create_link)) : ?> |
77 | 77 | <a class="ee-aria-tooltip button button--small button--secondary" href="<?php echo esc_url_raw($create_link); ?>" |
78 | 78 | aria-label="<?php esc_attr_e( |
79 | - 'This registration shares the contact details for the primary registration in this group. If you\'d like this registration to have its own details, you can do so by clicking this button', |
|
80 | - 'event_espresso' |
|
81 | - ); ?>" |
|
79 | + 'This registration shares the contact details for the primary registration in this group. If you\'d like this registration to have its own details, you can do so by clicking this button', |
|
80 | + 'event_espresso' |
|
81 | + ); ?>" |
|
82 | 82 | > |
83 | 83 | <span class="ee-icon ee-icon-user-add-new"></span> |
84 | 84 | <?php echo esc_html($create_label); ?> |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | |
19 | 19 | $attendee_full_name = "$fname $lname"; |
20 | 20 | $email = sanitize_email($email); |
21 | -$avatar = get_avatar_url($email); |
|
21 | +$avatar = get_avatar_url($email); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <div id='admin-side-mbox-primary-registrant-dv' class='admin-side-mbox-dv'> |
25 | - <?php if (! empty($avatar)) : ?> |
|
25 | + <?php if ( ! empty($avatar)) : ?> |
|
26 | 26 | <div class="ee-admin-attendee-avatar"> |
27 | 27 | <img alt="profile pic for <?php echo esc_html($attendee_full_name); ?>" src="<?php echo $avatar; ?>" /> |
28 | 28 | </div> |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | <a href="mailto:<?php echo esc_attr($email); ?>"><?php echo esc_html($email); ?></a> |
38 | 38 | </div> |
39 | 39 | </div> |
40 | - <?php if (! empty($phone)) : ?> |
|
40 | + <?php if ( ! empty($phone)) : ?> |
|
41 | 41 | <div class='ee-admin-attendee-phone'> |
42 | 42 | <div class='ee-admin-contact-details-with-dashicon'> |
43 | 43 | <span class='dashicons dashicons-phone'></span> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | </div> |
46 | 46 | </div> |
47 | 47 | <?php endif; ?> |
48 | - <?php if (! empty($formatted_address)) : ?> |
|
48 | + <?php if ( ! empty($formatted_address)) : ?> |
|
49 | 49 | <div class='ee-admin-attendee-address'> |
50 | 50 | <div class='ee-admin-contact-details-with-dashicon'> |
51 | 51 | <span class='dashicons dashicons-location'></span> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <?php echo esc_html($att_edit_label); ?> |
74 | 74 | </a> |
75 | 75 | |
76 | - <?php if (! empty($create_link)) : ?> |
|
76 | + <?php if ( ! empty($create_link)) : ?> |
|
77 | 77 | <a class="ee-aria-tooltip button button--small button--secondary" href="<?php echo esc_url_raw($create_link); ?>" |
78 | 78 | aria-label="<?php esc_attr_e( |
79 | 79 | 'This registration shares the contact details for the primary registration in this group. If you\'d like this registration to have its own details, you can do so by clicking this button', |
@@ -86,4 +86,4 @@ discard block |
||
86 | 86 | <?php endif; ?> |
87 | 87 | |
88 | 88 | </div> |
89 | -<?php endif;?> |
|
89 | +<?php endif; ?> |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | |
68 | 68 | public function column_id($item) |
69 | 69 | { |
70 | - $content = '<span class="ee-entity-id">' . $item->get('term_id') . '</span>'; |
|
70 | + $content = '<span class="ee-entity-id">'.$item->get('term_id').'</span>'; |
|
71 | 71 | $content .= ' |
72 | 72 | <span class="show-on-mobile-view-only"> |
73 | - ' . $this->column_name($item, false) . ' |
|
73 | + ' . $this->column_name($item, false).' |
|
74 | 74 | </span>'; |
75 | 75 | return $this->columnContent('id', $content, 'end'); |
76 | 76 | } |
@@ -95,30 +95,30 @@ discard block |
||
95 | 95 | $term_name = $item->get_first_related('Term')->get('name'); |
96 | 96 | |
97 | 97 | $actions = array( |
98 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf( |
|
98 | + 'edit' => '<a href="'.$edit_link.'" aria-label="'.sprintf( |
|
99 | 99 | /* translators: The name of the venue category */ |
100 | 100 | esc_attr__( |
101 | 101 | 'Edit Category (%s)', |
102 | 102 | 'event_espresso' |
103 | 103 | ), |
104 | 104 | $term_name |
105 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
105 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>', |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | |
109 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf( |
|
109 | + $actions['delete'] = '<a href="'.$delete_link.'" aria-label="'.sprintf( |
|
110 | 110 | /* translators: The name of the venue category */ |
111 | 111 | esc_attr__( |
112 | 112 | 'Delete Category (%s)', |
113 | 113 | 'event_espresso' |
114 | 114 | ), |
115 | 115 | $term_name |
116 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
116 | + ).'">'.esc_html__('Delete', 'event_espresso').'</a>'; |
|
117 | 117 | |
118 | 118 | $content = ' |
119 | 119 | <strong> |
120 | - <a class="row-title" href="' . $edit_link . '"> |
|
121 | - ' . $item->get_first_related('Term')->get('name') . ' |
|
120 | + <a class="row-title" href="' . $edit_link.'"> |
|
121 | + ' . $item->get_first_related('Term')->get('name').' |
|
122 | 122 | </a> |
123 | 123 | </strong>'; |
124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | public function column_shortcode(EE_Term_Taxonomy $item): string |
131 | 131 | { |
132 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
132 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="'.$item->get_first_related('Term')->get('slug').'"]'; |
|
133 | 133 | return $this->columnContent('shortcode', $content); |
134 | 134 | } |
135 | 135 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'category' => $item->get_first_related('Term')->ID(), |
142 | 142 | ); |
143 | 143 | $content = ' |
144 | - <a href="' . EE_Admin_Page::add_query_args_and_nonce($args, EE_VENUES_ADMIN_URL) . '"> |
|
145 | - ' . $item->get('term_count') . ' |
|
144 | + <a href="' . EE_Admin_Page::add_query_args_and_nonce($args, EE_VENUES_ADMIN_URL).'"> |
|
145 | + ' . $item->get('term_count').' |
|
146 | 146 | </a>'; |
147 | 147 | return $this->columnContent('count', $content, 'end'); |
148 | 148 | } |
@@ -13,137 +13,137 @@ |
||
13 | 13 | */ |
14 | 14 | class Venue_Categories_Admin_List_Table extends EE_Admin_List_Table |
15 | 15 | { |
16 | - protected function _setup_data() |
|
17 | - { |
|
18 | - $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
19 | - $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true); |
|
20 | - } |
|
21 | - |
|
22 | - |
|
23 | - protected function _set_properties() |
|
24 | - { |
|
25 | - $this->_wp_list_args = array( |
|
26 | - 'singular' => esc_html__('venue category', 'event_espresso'), |
|
27 | - 'plural' => esc_html__('venue categories', 'event_espresso'), |
|
28 | - 'ajax' => true, // for now, |
|
29 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
30 | - ); |
|
31 | - |
|
32 | - $this->_columns = array( |
|
33 | - 'cb' => '<input type="checkbox" />', |
|
34 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
35 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
36 | - 'count' => esc_html__('Venues', 'event_espresso'), |
|
37 | - ); |
|
38 | - |
|
39 | - $this->_sortable_columns = array( |
|
40 | - 'id' => array('Term.term_id' => true), |
|
41 | - 'name' => array('Term.slug' => false), |
|
42 | - 'count' => array('term_count' => false), |
|
43 | - ); |
|
44 | - |
|
45 | - $this->_hidden_columns = array(); |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - // not needed |
|
50 | - protected function _get_table_filters() |
|
51 | - { |
|
52 | - return []; |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - protected function _add_view_counts() |
|
57 | - { |
|
58 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - public function column_cb($item) |
|
63 | - { |
|
64 | - return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - public function column_id($item) |
|
69 | - { |
|
70 | - $content = '<span class="ee-entity-id">' . $item->get('term_id') . '</span>'; |
|
71 | - $content .= ' |
|
16 | + protected function _setup_data() |
|
17 | + { |
|
18 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
19 | + $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true); |
|
20 | + } |
|
21 | + |
|
22 | + |
|
23 | + protected function _set_properties() |
|
24 | + { |
|
25 | + $this->_wp_list_args = array( |
|
26 | + 'singular' => esc_html__('venue category', 'event_espresso'), |
|
27 | + 'plural' => esc_html__('venue categories', 'event_espresso'), |
|
28 | + 'ajax' => true, // for now, |
|
29 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
30 | + ); |
|
31 | + |
|
32 | + $this->_columns = array( |
|
33 | + 'cb' => '<input type="checkbox" />', |
|
34 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
35 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
36 | + 'count' => esc_html__('Venues', 'event_espresso'), |
|
37 | + ); |
|
38 | + |
|
39 | + $this->_sortable_columns = array( |
|
40 | + 'id' => array('Term.term_id' => true), |
|
41 | + 'name' => array('Term.slug' => false), |
|
42 | + 'count' => array('term_count' => false), |
|
43 | + ); |
|
44 | + |
|
45 | + $this->_hidden_columns = array(); |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + // not needed |
|
50 | + protected function _get_table_filters() |
|
51 | + { |
|
52 | + return []; |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + protected function _add_view_counts() |
|
57 | + { |
|
58 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + public function column_cb($item) |
|
63 | + { |
|
64 | + return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + public function column_id($item) |
|
69 | + { |
|
70 | + $content = '<span class="ee-entity-id">' . $item->get('term_id') . '</span>'; |
|
71 | + $content .= ' |
|
72 | 72 | <span class="show-on-mobile-view-only"> |
73 | 73 | ' . $this->column_name($item, false) . ' |
74 | 74 | </span>'; |
75 | - return $this->columnContent('id', $content, 'end'); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - public function column_name(EE_Term_Taxonomy $item, bool $prep_content = true): string |
|
80 | - { |
|
81 | - $VEN_CAT_ID = $item->get('term_id'); |
|
82 | - $edit_query_args = array( |
|
83 | - 'action' => 'edit_category', |
|
84 | - 'VEN_CAT_ID' => $VEN_CAT_ID, |
|
85 | - ); |
|
86 | - |
|
87 | - $delete_query_args = array( |
|
88 | - 'action' => 'delete_category', |
|
89 | - 'VEN_CAT_ID' => $VEN_CAT_ID, |
|
90 | - ); |
|
91 | - |
|
92 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
93 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
94 | - |
|
95 | - $term_name = $item->get_first_related('Term')->get('name'); |
|
96 | - |
|
97 | - $actions = array( |
|
98 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf( |
|
99 | - /* translators: The name of the venue category */ |
|
100 | - esc_attr__( |
|
101 | - 'Edit Category (%s)', |
|
102 | - 'event_espresso' |
|
103 | - ), |
|
104 | - $term_name |
|
105 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
106 | - ); |
|
107 | - |
|
108 | - |
|
109 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf( |
|
110 | - /* translators: The name of the venue category */ |
|
111 | - esc_attr__( |
|
112 | - 'Delete Category (%s)', |
|
113 | - 'event_espresso' |
|
114 | - ), |
|
115 | - $term_name |
|
116 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
117 | - |
|
118 | - $content = ' |
|
75 | + return $this->columnContent('id', $content, 'end'); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + public function column_name(EE_Term_Taxonomy $item, bool $prep_content = true): string |
|
80 | + { |
|
81 | + $VEN_CAT_ID = $item->get('term_id'); |
|
82 | + $edit_query_args = array( |
|
83 | + 'action' => 'edit_category', |
|
84 | + 'VEN_CAT_ID' => $VEN_CAT_ID, |
|
85 | + ); |
|
86 | + |
|
87 | + $delete_query_args = array( |
|
88 | + 'action' => 'delete_category', |
|
89 | + 'VEN_CAT_ID' => $VEN_CAT_ID, |
|
90 | + ); |
|
91 | + |
|
92 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
93 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
94 | + |
|
95 | + $term_name = $item->get_first_related('Term')->get('name'); |
|
96 | + |
|
97 | + $actions = array( |
|
98 | + 'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf( |
|
99 | + /* translators: The name of the venue category */ |
|
100 | + esc_attr__( |
|
101 | + 'Edit Category (%s)', |
|
102 | + 'event_espresso' |
|
103 | + ), |
|
104 | + $term_name |
|
105 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
106 | + ); |
|
107 | + |
|
108 | + |
|
109 | + $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf( |
|
110 | + /* translators: The name of the venue category */ |
|
111 | + esc_attr__( |
|
112 | + 'Delete Category (%s)', |
|
113 | + 'event_espresso' |
|
114 | + ), |
|
115 | + $term_name |
|
116 | + ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
117 | + |
|
118 | + $content = ' |
|
119 | 119 | <strong> |
120 | 120 | <a class="row-title" href="' . $edit_link . '"> |
121 | 121 | ' . $item->get_first_related('Term')->get('name') . ' |
122 | 122 | </a> |
123 | 123 | </strong>'; |
124 | 124 | |
125 | - $content .= $prep_content ? $this->row_actions($actions) : ''; |
|
126 | - return $prep_content ? $this->columnContent('name', $content) : $content; |
|
127 | - } |
|
125 | + $content .= $prep_content ? $this->row_actions($actions) : ''; |
|
126 | + return $prep_content ? $this->columnContent('name', $content) : $content; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | |
130 | - public function column_shortcode(EE_Term_Taxonomy $item): string |
|
131 | - { |
|
132 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
133 | - return $this->columnContent('shortcode', $content); |
|
134 | - } |
|
130 | + public function column_shortcode(EE_Term_Taxonomy $item): string |
|
131 | + { |
|
132 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
133 | + return $this->columnContent('shortcode', $content); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | |
137 | - public function column_count(EE_Term_Taxonomy $item): string |
|
138 | - { |
|
139 | - $args = array( |
|
140 | - 'action' => 'default', |
|
141 | - 'category' => $item->get_first_related('Term')->ID(), |
|
142 | - ); |
|
143 | - $content = ' |
|
137 | + public function column_count(EE_Term_Taxonomy $item): string |
|
138 | + { |
|
139 | + $args = array( |
|
140 | + 'action' => 'default', |
|
141 | + 'category' => $item->get_first_related('Term')->ID(), |
|
142 | + ); |
|
143 | + $content = ' |
|
144 | 144 | <a href="' . EE_Admin_Page::add_query_args_and_nonce($args, EE_VENUES_ADMIN_URL) . '"> |
145 | 145 | ' . $item->get('term_count') . ' |
146 | 146 | </a>'; |
147 | - return $this->columnContent('count', $content, 'end'); |
|
148 | - } |
|
147 | + return $this->columnContent('count', $content, 'end'); |
|
148 | + } |
|
149 | 149 | } |