Completed
Branch BUG/3575-event-deletion-previe... (bbeda1)
by
unknown
06:40 queued 04:49
created
caffeinated/admin/new/pricing/Prices_List_Table.class.php 2 patches
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -16,228 +16,228 @@
 block discarded – undo
16 16
 class Prices_List_Table extends EE_Admin_List_Table
17 17
 {
18 18
 
19
-    private $_PRT;
20
-
21
-    /**
22
-     * Array of price types.
23
-     *
24
-     * @var EE_Price_Type[]
25
-     */
26
-    protected $_price_types = array();
27
-
28
-    public function __construct($admin_page)
29
-    {
30
-        parent::__construct($admin_page);
31
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
32
-        $this->_PRT = EEM_Price_Type::instance();
33
-        $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted();
34
-    }
35
-
36
-
37
-    protected function _setup_data()
38
-    {
39
-        $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
40
-        $this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed);
41
-        $this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false);
42
-        $this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true);
43
-    }
44
-
45
-
46
-    protected function _set_properties()
47
-    {
48
-        $this->_wp_list_args = array(
49
-            'singular' => esc_html__('price', 'event_espresso'),
50
-            'plural'   => esc_html__('prices', 'event_espresso'),
51
-            'ajax'     => true,
52
-            'screen'   => $this->_admin_page->get_current_screen()->id,
53
-        );
54
-
55
-        $this->_columns = array(
56
-            'cb'          => '<input type="checkbox" />', // Render a checkbox instead of text
57
-            'name'        => esc_html__('Name', 'event_espresso'),
58
-            'type'        => esc_html__('Price Type', 'event_espresso'),
59
-            'description' => esc_html__('Description', 'event_espresso'),
60
-            'amount'      => esc_html__('Amount', 'event_espresso'),
61
-        );
62
-
63
-        $this->_sortable_columns = array(
64
-            // true means its already sorted
65
-            'name'   => array('name' => false),
66
-            'type'   => array('type' => false),
67
-            'amount' => array('amount' => false),
68
-        );
69
-
70
-        $this->_hidden_columns = array();
71
-
72
-        $this->_ajax_sorting_callback = 'update_prices_order';
73
-    }
74
-
75
-
76
-    protected function _get_table_filters()
77
-    {
78
-    }
79
-
80
-
81
-    protected function _add_view_counts()
82
-    {
83
-        $this->_views['all']['count'] = $this->_all_data_count;
84
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
85
-            $this->_views['trashed']['count'] = $this->_trashed_count;
86
-        }
87
-    }
88
-
89
-
90
-    /**
91
-     * overriding parent method so that we can make sure the row isn't sortable for certain items
92
-     *
93
-     * @param  object $item the current item
94
-     * @return string
95
-     */
96
-    protected function _get_row_class($item)
97
-    {
98
-        static $row_class = '';
99
-        $row_class = ($row_class == '' ? 'alternate' : '');
100
-
101
-        $new_row = $row_class;
102
-
103
-        if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) {
104
-            $new_row .= ' rowsortable';
105
-        }
106
-
107
-        return ' class="' . $new_row . '"';
108
-    }
109
-
110
-
111
-    public function column_cb($item)
112
-    {
113
-        if ($item->type_obj()->base_type() !== 1) {
114
-            return sprintf(
115
-                '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
116
-                $item->ID()
117
-            );
118
-        }
119
-        return '';
120
-    }
121
-
122
-
123
-    public function column_name($item)
124
-    {
125
-
126
-        // Build row actions
127
-        $actions = array();
128
-        // edit price link
129
-        if (
130
-            EE_Registry::instance()->CAP->current_user_can(
131
-                'ee_edit_default_price',
132
-                'pricing_edit_price',
133
-                $item->ID()
134
-            )
135
-        ) {
136
-            $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
137
-                'action' => 'edit_price',
138
-                'id'     => $item->ID(),
139
-            ), PRICING_ADMIN_URL);
140
-            $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="'
141
-                               . esc_attr__('Edit Price', 'event_espresso') . '">'
142
-                               . esc_html__('Edit', 'event_espresso') . '</a>';
143
-        }
144
-
145
-        $name_link = EE_Registry::instance()->CAP->current_user_can(
146
-            'ee_edit_default_price',
147
-            'edit_price',
148
-            $item->ID()
149
-        )
150
-            ? '<a href="' . $edit_lnk_url . '" title="'
151
-              . esc_attr__('Edit Price', 'event_espresso') . '">'
152
-              . stripslashes($item->name()) . '</a>'
153
-            : $item->name();
154
-
155
-        if ($item->type_obj()->base_type() !== 1) {
156
-            if ($this->_view == 'all') {
157
-                // trash price link
158
-                if (
159
-                    EE_Registry::instance()->CAP->current_user_can(
160
-                        'ee_delete_default_price',
161
-                        'pricing_trash_price',
162
-                        $item->ID()
163
-                    )
164
-                ) {
165
-                    $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
166
-                        'action'   => 'trash_price',
167
-                        'id'       => $item->ID(),
168
-                        'noheader' => true,
169
-                    ), PRICING_ADMIN_URL);
170
-                    $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="'
171
-                                        . esc_attr__('Move Price to Trash', 'event_espresso') . '">'
172
-                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>';
173
-                }
174
-            } else {
175
-                if (
176
-                    EE_Registry::instance()->CAP->current_user_can(
177
-                        'ee_delete_default_price',
178
-                        'pricing_restore_price',
179
-                        $item->ID()
180
-                    )
181
-                ) {
182
-                    // restore price link
183
-                    $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
184
-                        'action'   => 'restore_price',
185
-                        'id'       => $item->ID(),
186
-                        'noheader' => true,
187
-                    ), PRICING_ADMIN_URL);
188
-                    $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="'
189
-                                          . esc_attr__('Restore Price', 'event_espresso') . '">'
190
-                                          . esc_html__('Restore', 'event_espresso') . '</a>';
191
-                }
192
-
193
-                // delete price link
194
-                if (
195
-                    EE_Registry::instance()->CAP->current_user_can(
196
-                        'ee_delete_default_price',
197
-                        'pricing_delete_price',
198
-                        $item->ID()
199
-                    )
200
-                ) {
201
-                    $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
202
-                        'action'   => 'delete_price',
203
-                        'id'       => $item->ID(),
204
-                        'noheader' => true,
205
-                    ), PRICING_ADMIN_URL);
206
-                    $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="'
207
-                                         . esc_attr__('Delete Price Permanently', 'event_espresso') . '">'
208
-                                         . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
209
-                }
210
-            }
211
-        }
212
-
213
-        // Return the name contents
214
-        return sprintf(
215
-            '%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
216
-            $name_link,
217
-            $item->ID(),
218
-            $this->row_actions($actions)
219
-        );
220
-    }
221
-
222
-
223
-    public function column_type($item)
224
-    {
225
-        return $this->_price_types[ $item->type() ]->name();
226
-    }
227
-
228
-
229
-    public function column_description($item)
230
-    {
231
-        return stripslashes($item->desc());
232
-    }
233
-
234
-
235
-    public function column_amount($item)
236
-    {
237
-        if ($this->_price_types[ $item->type() ]->is_percent()) {
238
-            return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>';
239
-        } else {
240
-            return '<div class="pad-amnt-rght">' . EEH_Template::format_currency($item->amount()) . '</div>';
241
-        }
242
-    }
19
+	private $_PRT;
20
+
21
+	/**
22
+	 * Array of price types.
23
+	 *
24
+	 * @var EE_Price_Type[]
25
+	 */
26
+	protected $_price_types = array();
27
+
28
+	public function __construct($admin_page)
29
+	{
30
+		parent::__construct($admin_page);
31
+		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
32
+		$this->_PRT = EEM_Price_Type::instance();
33
+		$this->_price_types = $this->_PRT->get_all_deleted_and_undeleted();
34
+	}
35
+
36
+
37
+	protected function _setup_data()
38
+	{
39
+		$trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
40
+		$this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed);
41
+		$this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false);
42
+		$this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true);
43
+	}
44
+
45
+
46
+	protected function _set_properties()
47
+	{
48
+		$this->_wp_list_args = array(
49
+			'singular' => esc_html__('price', 'event_espresso'),
50
+			'plural'   => esc_html__('prices', 'event_espresso'),
51
+			'ajax'     => true,
52
+			'screen'   => $this->_admin_page->get_current_screen()->id,
53
+		);
54
+
55
+		$this->_columns = array(
56
+			'cb'          => '<input type="checkbox" />', // Render a checkbox instead of text
57
+			'name'        => esc_html__('Name', 'event_espresso'),
58
+			'type'        => esc_html__('Price Type', 'event_espresso'),
59
+			'description' => esc_html__('Description', 'event_espresso'),
60
+			'amount'      => esc_html__('Amount', 'event_espresso'),
61
+		);
62
+
63
+		$this->_sortable_columns = array(
64
+			// true means its already sorted
65
+			'name'   => array('name' => false),
66
+			'type'   => array('type' => false),
67
+			'amount' => array('amount' => false),
68
+		);
69
+
70
+		$this->_hidden_columns = array();
71
+
72
+		$this->_ajax_sorting_callback = 'update_prices_order';
73
+	}
74
+
75
+
76
+	protected function _get_table_filters()
77
+	{
78
+	}
79
+
80
+
81
+	protected function _add_view_counts()
82
+	{
83
+		$this->_views['all']['count'] = $this->_all_data_count;
84
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
85
+			$this->_views['trashed']['count'] = $this->_trashed_count;
86
+		}
87
+	}
88
+
89
+
90
+	/**
91
+	 * overriding parent method so that we can make sure the row isn't sortable for certain items
92
+	 *
93
+	 * @param  object $item the current item
94
+	 * @return string
95
+	 */
96
+	protected function _get_row_class($item)
97
+	{
98
+		static $row_class = '';
99
+		$row_class = ($row_class == '' ? 'alternate' : '');
100
+
101
+		$new_row = $row_class;
102
+
103
+		if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) {
104
+			$new_row .= ' rowsortable';
105
+		}
106
+
107
+		return ' class="' . $new_row . '"';
108
+	}
109
+
110
+
111
+	public function column_cb($item)
112
+	{
113
+		if ($item->type_obj()->base_type() !== 1) {
114
+			return sprintf(
115
+				'<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
116
+				$item->ID()
117
+			);
118
+		}
119
+		return '';
120
+	}
121
+
122
+
123
+	public function column_name($item)
124
+	{
125
+
126
+		// Build row actions
127
+		$actions = array();
128
+		// edit price link
129
+		if (
130
+			EE_Registry::instance()->CAP->current_user_can(
131
+				'ee_edit_default_price',
132
+				'pricing_edit_price',
133
+				$item->ID()
134
+			)
135
+		) {
136
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
137
+				'action' => 'edit_price',
138
+				'id'     => $item->ID(),
139
+			), PRICING_ADMIN_URL);
140
+			$actions['edit'] = '<a href="' . $edit_lnk_url . '" title="'
141
+							   . esc_attr__('Edit Price', 'event_espresso') . '">'
142
+							   . esc_html__('Edit', 'event_espresso') . '</a>';
143
+		}
144
+
145
+		$name_link = EE_Registry::instance()->CAP->current_user_can(
146
+			'ee_edit_default_price',
147
+			'edit_price',
148
+			$item->ID()
149
+		)
150
+			? '<a href="' . $edit_lnk_url . '" title="'
151
+			  . esc_attr__('Edit Price', 'event_espresso') . '">'
152
+			  . stripslashes($item->name()) . '</a>'
153
+			: $item->name();
154
+
155
+		if ($item->type_obj()->base_type() !== 1) {
156
+			if ($this->_view == 'all') {
157
+				// trash price link
158
+				if (
159
+					EE_Registry::instance()->CAP->current_user_can(
160
+						'ee_delete_default_price',
161
+						'pricing_trash_price',
162
+						$item->ID()
163
+					)
164
+				) {
165
+					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
166
+						'action'   => 'trash_price',
167
+						'id'       => $item->ID(),
168
+						'noheader' => true,
169
+					), PRICING_ADMIN_URL);
170
+					$actions['trash'] = '<a href="' . $trash_lnk_url . '" title="'
171
+										. esc_attr__('Move Price to Trash', 'event_espresso') . '">'
172
+										. esc_html__('Move to Trash', 'event_espresso') . '</a>';
173
+				}
174
+			} else {
175
+				if (
176
+					EE_Registry::instance()->CAP->current_user_can(
177
+						'ee_delete_default_price',
178
+						'pricing_restore_price',
179
+						$item->ID()
180
+					)
181
+				) {
182
+					// restore price link
183
+					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
184
+						'action'   => 'restore_price',
185
+						'id'       => $item->ID(),
186
+						'noheader' => true,
187
+					), PRICING_ADMIN_URL);
188
+					$actions['restore'] = '<a href="' . $restore_lnk_url . '" title="'
189
+										  . esc_attr__('Restore Price', 'event_espresso') . '">'
190
+										  . esc_html__('Restore', 'event_espresso') . '</a>';
191
+				}
192
+
193
+				// delete price link
194
+				if (
195
+					EE_Registry::instance()->CAP->current_user_can(
196
+						'ee_delete_default_price',
197
+						'pricing_delete_price',
198
+						$item->ID()
199
+					)
200
+				) {
201
+					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
202
+						'action'   => 'delete_price',
203
+						'id'       => $item->ID(),
204
+						'noheader' => true,
205
+					), PRICING_ADMIN_URL);
206
+					$actions['delete'] = '<a href="' . $delete_lnk_url . '" title="'
207
+										 . esc_attr__('Delete Price Permanently', 'event_espresso') . '">'
208
+										 . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
209
+				}
210
+			}
211
+		}
212
+
213
+		// Return the name contents
214
+		return sprintf(
215
+			'%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
216
+			$name_link,
217
+			$item->ID(),
218
+			$this->row_actions($actions)
219
+		);
220
+	}
221
+
222
+
223
+	public function column_type($item)
224
+	{
225
+		return $this->_price_types[ $item->type() ]->name();
226
+	}
227
+
228
+
229
+	public function column_description($item)
230
+	{
231
+		return stripslashes($item->desc());
232
+	}
233
+
234
+
235
+	public function column_amount($item)
236
+	{
237
+		if ($this->_price_types[ $item->type() ]->is_percent()) {
238
+			return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>';
239
+		} else {
240
+			return '<div class="pad-amnt-rght">' . EEH_Template::format_currency($item->amount()) . '</div>';
241
+		}
242
+	}
243 243
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function __construct($admin_page)
29 29
     {
30 30
         parent::__construct($admin_page);
31
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
31
+        require_once(EE_MODELS.'EEM_Price_Type.model.php');
32 32
         $this->_PRT = EEM_Price_Type::instance();
33 33
         $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted();
34 34
     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             $new_row .= ' rowsortable';
105 105
         }
106 106
 
107
-        return ' class="' . $new_row . '"';
107
+        return ' class="'.$new_row.'"';
108 108
     }
109 109
 
110 110
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
                 'action' => 'edit_price',
138 138
                 'id'     => $item->ID(),
139 139
             ), PRICING_ADMIN_URL);
140
-            $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="'
141
-                               . esc_attr__('Edit Price', 'event_espresso') . '">'
142
-                               . esc_html__('Edit', 'event_espresso') . '</a>';
140
+            $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'
141
+                               . esc_attr__('Edit Price', 'event_espresso').'">'
142
+                               . esc_html__('Edit', 'event_espresso').'</a>';
143 143
         }
144 144
 
145 145
         $name_link = EE_Registry::instance()->CAP->current_user_can(
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
             'edit_price',
148 148
             $item->ID()
149 149
         )
150
-            ? '<a href="' . $edit_lnk_url . '" title="'
151
-              . esc_attr__('Edit Price', 'event_espresso') . '">'
152
-              . stripslashes($item->name()) . '</a>'
150
+            ? '<a href="'.$edit_lnk_url.'" title="'
151
+              . esc_attr__('Edit Price', 'event_espresso').'">'
152
+              . stripslashes($item->name()).'</a>'
153 153
             : $item->name();
154 154
 
155 155
         if ($item->type_obj()->base_type() !== 1) {
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
                         'id'       => $item->ID(),
168 168
                         'noheader' => true,
169 169
                     ), PRICING_ADMIN_URL);
170
-                    $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="'
171
-                                        . esc_attr__('Move Price to Trash', 'event_espresso') . '">'
172
-                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>';
170
+                    $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'
171
+                                        . esc_attr__('Move Price to Trash', 'event_espresso').'">'
172
+                                        . esc_html__('Move to Trash', 'event_espresso').'</a>';
173 173
                 }
174 174
             } else {
175 175
                 if (
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
                         'id'       => $item->ID(),
186 186
                         'noheader' => true,
187 187
                     ), PRICING_ADMIN_URL);
188
-                    $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="'
189
-                                          . esc_attr__('Restore Price', 'event_espresso') . '">'
190
-                                          . esc_html__('Restore', 'event_espresso') . '</a>';
188
+                    $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'
189
+                                          . esc_attr__('Restore Price', 'event_espresso').'">'
190
+                                          . esc_html__('Restore', 'event_espresso').'</a>';
191 191
                 }
192 192
 
193 193
                 // delete price link
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
                         'id'       => $item->ID(),
204 204
                         'noheader' => true,
205 205
                     ), PRICING_ADMIN_URL);
206
-                    $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="'
207
-                                         . esc_attr__('Delete Price Permanently', 'event_espresso') . '">'
208
-                                         . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
206
+                    $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'
207
+                                         . esc_attr__('Delete Price Permanently', 'event_espresso').'">'
208
+                                         . esc_html__('Delete Permanently', 'event_espresso').'</a>';
209 209
                 }
210 210
             }
211 211
         }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
     public function column_type($item)
224 224
     {
225
-        return $this->_price_types[ $item->type() ]->name();
225
+        return $this->_price_types[$item->type()]->name();
226 226
     }
227 227
 
228 228
 
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 
235 235
     public function column_amount($item)
236 236
     {
237
-        if ($this->_price_types[ $item->type() ]->is_percent()) {
238
-            return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>';
237
+        if ($this->_price_types[$item->type()]->is_percent()) {
238
+            return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>';
239 239
         } else {
240
-            return '<div class="pad-amnt-rght">' . EEH_Template::format_currency($item->amount()) . '</div>';
240
+            return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>';
241 241
         }
242 242
     }
243 243
 }
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Pricing_Admin_Page.core.php 2 patches
Indentation   +1422 added lines, -1422 removed lines patch added patch discarded remove patch
@@ -12,1430 +12,1430 @@
 block discarded – undo
12 12
 class Pricing_Admin_Page extends EE_Admin_Page
13 13
 {
14 14
 
15
-    /**
16
-     *    constructor
17
-     *
18
-     * @Constructor
19
-     * @access public
20
-     * @param bool $routing
21
-     * @return Pricing_Admin_Page
22
-     */
23
-    public function __construct($routing = true)
24
-    {
25
-        parent::__construct($routing);
26
-    }
27
-
28
-
29
-    protected function _init_page_props()
30
-    {
31
-        $this->page_slug = PRICING_PG_SLUG;
32
-        $this->page_label = PRICING_LABEL;
33
-        $this->_admin_base_url = PRICING_ADMIN_URL;
34
-        $this->_admin_base_path = PRICING_ADMIN;
35
-    }
36
-
37
-
38
-    protected function _ajax_hooks()
39
-    {
40
-        add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order'));
41
-    }
42
-
43
-
44
-    protected function _define_page_props()
45
-    {
46
-        $this->_admin_page_title = PRICING_LABEL;
47
-        $this->_labels = array(
48
-            'buttons' => array(
49
-                'add'         => esc_html__('Add New Default Price', 'event_espresso'),
50
-                'edit'        => esc_html__('Edit Default Price', 'event_espresso'),
51
-                'delete'      => esc_html__('Delete Default Price', 'event_espresso'),
52
-                'add_type'    => esc_html__('Add New Default Price Type', 'event_espresso'),
53
-                'edit_type'   => esc_html__('Edit Price Type', 'event_espresso'),
54
-                'delete_type' => esc_html__('Delete Price Type', 'event_espresso'),
55
-            ),
56
-        );
57
-    }
58
-
59
-
60
-    /**
61
-     *        an array for storing request actions and their corresponding methods
62
-     *
63
-     * @access private
64
-     * @return void
65
-     */
66
-    protected function _set_page_routes()
67
-    {
68
-        $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID'])
69
-            ? $this->_req_data['PRC_ID'] : 0;
70
-        $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID'])
71
-            ? $this->_req_data['PRT_ID'] : 0;
72
-        $this->_page_routes = array(
73
-            'default'                     => array(
74
-                'func'       => '_price_overview_list_table',
75
-                'capability' => 'ee_read_default_prices',
76
-            ),
77
-            'add_new_price'               => array(
78
-                'func'       => '_edit_price_details',
79
-                'args'       => array('new_price' => true),
80
-                'capability' => 'ee_edit_default_prices',
81
-            ),
82
-            'edit_price'                  => array(
83
-                'func'       => '_edit_price_details',
84
-                'args'       => array('new_price' => false),
85
-                'capability' => 'ee_edit_default_price',
86
-                'obj_id'     => $prc_id,
87
-            ),
88
-            'insert_price'                => array(
89
-                'func'       => '_insert_or_update_price',
90
-                'args'       => array('new_price' => true),
91
-                'noheader'   => true,
92
-                'capability' => 'ee_edit_default_prices',
93
-            ),
94
-            'update_price'                => array(
95
-                'func'       => '_insert_or_update_price',
96
-                'args'       => array('new_price' => false),
97
-                'noheader'   => true,
98
-                'capability' => 'ee_edit_default_price',
99
-                'obj_id'     => $prc_id,
100
-            ),
101
-            'trash_price'                 => array(
102
-                'func'       => '_trash_or_restore_price',
103
-                'args'       => array('trash' => true),
104
-                'noheader'   => true,
105
-                'capability' => 'ee_delete_default_price',
106
-                'obj_id'     => $prc_id,
107
-            ),
108
-            'restore_price'               => array(
109
-                'func'       => '_trash_or_restore_price',
110
-                'args'       => array('trash' => false),
111
-                'noheader'   => true,
112
-                'capability' => 'ee_delete_default_price',
113
-                'obj_id'     => $prc_id,
114
-            ),
115
-            'delete_price'                => array(
116
-                'func'       => '_delete_price',
117
-                'noheader'   => true,
118
-                'capability' => 'ee_delete_default_price',
119
-                'obj_id'     => $prc_id,
120
-            ),
121
-            'espresso_update_price_order' => array(
122
-                'func'       => 'update_price_order',
123
-                'noheader'   => true,
124
-                'capability' => 'ee_edit_default_prices',
125
-            ),
126
-            // price types
127
-            'price_types'                 => array(
128
-                'func'       => '_price_types_overview_list_table',
129
-                'capability' => 'ee_read_default_price_types',
130
-            ),
131
-            'add_new_price_type'          => array(
132
-                'func'       => '_edit_price_type_details',
133
-                'capability' => 'ee_edit_default_price_types',
134
-            ),
135
-            'edit_price_type'             => array(
136
-                'func'       => '_edit_price_type_details',
137
-                'capability' => 'ee_edit_default_price_type',
138
-                'obj_id'     => $prt_id,
139
-            ),
140
-            'insert_price_type'           => array(
141
-                'func'       => '_insert_or_update_price_type',
142
-                'args'       => array('new_price_type' => true),
143
-                'noheader'   => true,
144
-                'capability' => 'ee_edit_default_price_types',
145
-            ),
146
-            'update_price_type'           => array(
147
-                'func'       => '_insert_or_update_price_type',
148
-                'args'       => array('new_price_type' => false),
149
-                'noheader'   => true,
150
-                'capability' => 'ee_edit_default_price_type',
151
-                'obj_id'     => $prt_id,
152
-            ),
153
-            'trash_price_type'            => array(
154
-                'func'       => '_trash_or_restore_price_type',
155
-                'args'       => array('trash' => true),
156
-                'noheader'   => true,
157
-                'capability' => 'ee_delete_default_price_type',
158
-                'obj_id'     => $prt_id,
159
-            ),
160
-            'restore_price_type'          => array(
161
-                'func'       => '_trash_or_restore_price_type',
162
-                'args'       => array('trash' => false),
163
-                'noheader'   => true,
164
-                'capability' => 'ee_delete_default_price_type',
165
-                'obj_id'     => $prt_id,
166
-            ),
167
-            'delete_price_type'           => array(
168
-                'func'       => '_delete_price_type',
169
-                'noheader'   => true,
170
-                'capability' => 'ee_delete_default_price_type',
171
-                'obj_id'     => $prt_id,
172
-            ),
173
-            'tax_settings'                => array(
174
-                'func'       => '_tax_settings',
175
-                'capability' => 'manage_options',
176
-            ),
177
-            'update_tax_settings'         => array(
178
-                'func'       => '_update_tax_settings',
179
-                'capability' => 'manage_options',
180
-                'noheader'   => true,
181
-            ),
182
-        );
183
-    }
184
-
185
-
186
-    protected function _set_page_config()
187
-    {
188
-
189
-        $this->_page_config = array(
190
-            'default'            => array(
191
-                'nav'           => array(
192
-                    'label' => esc_html__('Default Pricing', 'event_espresso'),
193
-                    'order' => 10,
194
-                ),
195
-                'list_table'    => 'Prices_List_Table',
196
-                'help_tabs'     => array(
197
-                    'pricing_default_pricing_help_tab'                           => array(
198
-                        'title'    => esc_html__('Default Pricing', 'event_espresso'),
199
-                        'filename' => 'pricing_default_pricing',
200
-                    ),
201
-                    'pricing_default_pricing_table_column_headings_help_tab'     => array(
202
-                        'title'    => esc_html__('Default Pricing Table Column Headings', 'event_espresso'),
203
-                        'filename' => 'pricing_default_pricing_table_column_headings',
204
-                    ),
205
-                    'pricing_default_pricing_views_bulk_actions_search_help_tab' => array(
206
-                        'title'    => esc_html__('Default Pricing Views & Bulk Actions & Search', 'event_espresso'),
207
-                        'filename' => 'pricing_default_pricing_views_bulk_actions_search',
208
-                    ),
209
-                ),
210
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
211
-                // 'help_tour'     => array('Pricing_Default_Prices_Help_Tour'),
212
-                'require_nonce' => false,
213
-            ),
214
-            'add_new_price'      => array(
215
-                'nav'           => array(
216
-                    'label'      => esc_html__('Add New Default Price', 'event_espresso'),
217
-                    'order'      => 20,
218
-                    'persistent' => false,
219
-                ),
220
-                'help_tabs'     => array(
221
-                    'add_new_default_price_help_tab' => array(
222
-                        'title'    => esc_html__('Add New Default Price', 'event_espresso'),
223
-                        'filename' => 'pricing_add_new_default_price',
224
-                    ),
225
-                ),
226
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
227
-                // 'help_tour'     => array('Pricing_Add_New_Default_Price_Help_Tour'),
228
-                'metaboxes'     => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
229
-                'require_nonce' => false,
230
-            ),
231
-            'edit_price'         => array(
232
-                'nav'           => array(
233
-                    'label'      => esc_html__('Edit Default Price', 'event_espresso'),
234
-                    'order'      => 20,
235
-                    'url'        => isset($this->_req_data['id']) ? add_query_arg(
236
-                        array('id' => $this->_req_data['id']),
237
-                        $this->_current_page_view_url
238
-                    ) : $this->_admin_base_url,
239
-                    'persistent' => false,
240
-                ),
241
-                'metaboxes'     => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
242
-                'help_tabs'     => array(
243
-                    'edit_default_price_help_tab' => array(
244
-                        'title'    => esc_html__('Edit Default Price', 'event_espresso'),
245
-                        'filename' => 'pricing_edit_default_price',
246
-                    ),
247
-                ),
248
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
249
-                // 'help_tour'     => array('Pricing_Edit_Default_Price_Help_Tour'),
250
-                'require_nonce' => false,
251
-            ),
252
-            'price_types'        => array(
253
-                'nav'           => array(
254
-                    'label' => esc_html__('Price Types', 'event_espresso'),
255
-                    'order' => 30,
256
-                ),
257
-                'list_table'    => 'Price_Types_List_Table',
258
-                'help_tabs'     => array(
259
-                    'pricing_price_types_help_tab'                           => array(
260
-                        'title'    => esc_html__('Price Types', 'event_espresso'),
261
-                        'filename' => 'pricing_price_types',
262
-                    ),
263
-                    'pricing_price_types_table_column_headings_help_tab'     => array(
264
-                        'title'    => esc_html__('Price Types Table Column Headings', 'event_espresso'),
265
-                        'filename' => 'pricing_price_types_table_column_headings',
266
-                    ),
267
-                    'pricing_price_types_views_bulk_actions_search_help_tab' => array(
268
-                        'title'    => esc_html__('Price Types Views & Bulk Actions & Search', 'event_espresso'),
269
-                        'filename' => 'pricing_price_types_views_bulk_actions_search',
270
-                    ),
271
-                ),
272
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
273
-                // 'help_tour'     => array('Pricing_Price_Types_Default_Help_Tour'),
274
-                'metaboxes'     => array('_espresso_news_post_box', '_espresso_links_post_box'),
275
-                'require_nonce' => false,
276
-            ),
277
-            'add_new_price_type' => array(
278
-                'nav'           => array(
279
-                    'label'      => esc_html__('Add New Price Type', 'event_espresso'),
280
-                    'order'      => 40,
281
-                    'persistent' => false,
282
-                ),
283
-                'help_tabs'     => array(
284
-                    'add_new_price_type_help_tab' => array(
285
-                        'title'    => esc_html__('Add New Price Type', 'event_espresso'),
286
-                        'filename' => 'pricing_add_new_price_type',
287
-                    ),
288
-                ),
289
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
290
-                // 'help_tour'     => array('Pricing_Add_New_Price_Type_Help_Tour'),
291
-                'metaboxes'     => array(
292
-                    '_publish_post_box',
293
-                    '_espresso_news_post_box',
294
-                    '_price_type_details_meta_boxes',
295
-                ),
296
-                'require_nonce' => false,
297
-            ),
298
-            'edit_price_type'    => array(
299
-                'nav'       => array(
300
-                    'label'      => esc_html__('Edit Price Type', 'event_espresso'),
301
-                    'order'      => 40,
302
-                    'persistent' => false,
303
-                ),
304
-                'help_tabs' => array(
305
-                    'edit_price_type_help_tab' => array(
306
-                        'title'    => esc_html__('Edit Price Type', 'event_espresso'),
307
-                        'filename' => 'pricing_edit_price_type',
308
-                    ),
309
-                ),
310
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
311
-                // 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'),
312
-                'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
313
-
314
-                'require_nonce' => false,
315
-            ),
316
-            'tax_settings'       => array(
317
-                'nav'           => array(
318
-                    'label' => esc_html__('Tax Settings', 'event_espresso'),
319
-                    'order' => 40,
320
-                ),
321
-                'labels'        => array(
322
-                    'publishbox' => esc_html__('Update Tax Settings', 'event_espresso'),
323
-                ),
324
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
325
-                // 'help_tabs'     => array(
326
-                //     'registration_form_reg_form_settings_help_tab' => array(
327
-                //         'title'    => esc_html__('Registration Form Settings', 'event_espresso'),
328
-                //         'filename' => 'registration_form_reg_form_settings'
329
-                //     ),
330
-                // ),
331
-                // 'help_tour'     => array('Registration_Form_Settings_Help_Tour'),
332
-                'require_nonce' => true,
333
-            ),
334
-        );
335
-    }
336
-
337
-
338
-    protected function _add_screen_options()
339
-    {
340
-        // todo
341
-    }
342
-
343
-
344
-    protected function _add_screen_options_default()
345
-    {
346
-        $this->_per_page_screen_option();
347
-    }
348
-
349
-
350
-    protected function _add_screen_options_price_types()
351
-    {
352
-        $page_title = $this->_admin_page_title;
353
-        $this->_admin_page_title = esc_html__('Price Types', 'event_espresso');
354
-        $this->_per_page_screen_option();
355
-        $this->_admin_page_title = $page_title;
356
-    }
357
-
358
-
359
-    protected function _add_feature_pointers()
360
-    {
361
-    }
362
-
363
-
364
-    public function load_scripts_styles()
365
-    {
366
-        // styles
367
-        wp_enqueue_style('espresso-ui-theme');
368
-        wp_register_style(
369
-            'espresso_PRICING',
370
-            PRICING_ASSETS_URL . 'espresso_pricing_admin.css',
371
-            array(),
372
-            EVENT_ESPRESSO_VERSION
373
-        );
374
-        wp_enqueue_style('espresso_PRICING');
375
-
376
-        // scripts
377
-        wp_enqueue_script('ee_admin_js');
378
-        wp_enqueue_script('jquery-ui-position');
379
-        wp_enqueue_script('jquery-ui-widget');
380
-        // wp_enqueue_script('jquery-ui-dialog');
381
-        // wp_enqueue_script('jquery-ui-draggable');
382
-        // wp_enqueue_script('jquery-ui-datepicker');
383
-        wp_register_script(
384
-            'espresso_PRICING',
385
-            PRICING_ASSETS_URL . 'espresso_pricing_admin.js',
386
-            array('jquery'),
387
-            EVENT_ESPRESSO_VERSION,
388
-            true
389
-        );
390
-        wp_enqueue_script('espresso_PRICING');
391
-    }
392
-
393
-
394
-    public function load_scripts_styles_default()
395
-    {
396
-        wp_enqueue_script('espresso_ajax_table_sorting');
397
-    }
398
-
399
-
400
-    public function admin_footer_scripts()
401
-    {
402
-    }
403
-
404
-    public function admin_init()
405
-    {
406
-    }
407
-
408
-    public function admin_notices()
409
-    {
410
-    }
411
-
412
-
413
-    protected function _set_list_table_views_default()
414
-    {
415
-        $this->_views = array(
416
-            'all' => array(
417
-                'slug'        => 'all',
418
-                'label'       => esc_html__('View All Default Pricing', 'event_espresso'),
419
-                'count'       => 0,
420
-                'bulk_action' => array(
421
-                    'trash_price' => esc_html__('Move to Trash', 'event_espresso'),
422
-                ),
423
-            ),
424
-        );
425
-
426
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
427
-            $this->_views['trashed'] = array(
428
-                'slug'        => 'trashed',
429
-                'label'       => esc_html__('Trash', 'event_espresso'),
430
-                'count'       => 0,
431
-                'bulk_action' => array(
432
-                    'restore_price' => esc_html__('Restore from Trash', 'event_espresso'),
433
-                    'delete_price'  => esc_html__('Delete Permanently', 'event_espresso'),
434
-                ),
435
-            );
436
-        }
437
-    }
438
-
439
-
440
-    protected function _set_list_table_views_price_types()
441
-    {
442
-        $this->_views = array(
443
-            'all' => array(
444
-                'slug'        => 'all',
445
-                'label'       => esc_html__('All', 'event_espresso'),
446
-                'count'       => 0,
447
-                'bulk_action' => array(
448
-                    'trash_price_type' => esc_html__('Move to Trash', 'event_espresso'),
449
-                ),
450
-            ),
451
-        );
452
-
453
-        if (
454
-            EE_Registry::instance()->CAP->current_user_can(
455
-                'ee_delete_default_price_types',
456
-                'pricing_trash_price_type'
457
-            )
458
-        ) {
459
-            $this->_views['trashed'] = array(
460
-                'slug'        => 'trashed',
461
-                'label'       => esc_html__('Trash', 'event_espresso'),
462
-                'count'       => 0,
463
-                'bulk_action' => array(
464
-                    'restore_price_type' => esc_html__('Restore from Trash', 'event_espresso'),
465
-                    'delete_price_type'  => esc_html__('Delete Permanently', 'event_espresso'),
466
-                ),
467
-            );
468
-        }
469
-    }
470
-
471
-
472
-    /**
473
-     *        generates HTML for main Prices Admin page
474
-     *
475
-     * @access protected
476
-     * @return void
477
-     */
478
-    protected function _price_overview_list_table()
479
-    {
480
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
481
-            'add_new_price',
482
-            'add',
483
-            array(),
484
-            'add-new-h2'
485
-        );
486
-        $this->admin_page_title .= $this->_learn_more_about_pricing_link();
487
-        $this->_search_btn_label = esc_html__('Default Prices', 'event_espresso');
488
-        $this->display_admin_list_table_page_with_no_sidebar();
489
-    }
490
-
491
-
492
-    /**
493
-     *    retrieve data for Prices List table
494
-     *
495
-     * @access public
496
-     * @param  int     $per_page how many prices displayed per page
497
-     * @param  boolean $count    return the count or objects
498
-     * @param  boolean $trashed  whether the current view is of the trash can - eww yuck!
499
-     * @return mixed (int|array)  int = count || array of price objects
500
-     */
501
-    public function get_prices_overview_data($per_page = 10, $count = false, $trashed = false)
502
-    {
503
-
504
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
505
-        // start with an empty array
506
-        $event_pricing = array();
507
-
508
-        require_once(PRICING_ADMIN . 'Prices_List_Table.class.php');
509
-        require_once(EE_MODELS . 'EEM_Price.model.php');
510
-        // $PRC = EEM_Price::instance();
511
-
512
-        $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
513
-        $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
514
-            : 'ASC';
515
-
516
-        switch ($this->_req_data['orderby']) {
517
-            case 'name':
518
-                $orderby = array('PRC_name' => $order);
519
-                break;
520
-            case 'type':
521
-                $orderby = array('Price_Type.PRT_name' => $order);
522
-                break;
523
-            case 'amount':
524
-                $orderby = array('PRC_amount' => $order);
525
-                break;
526
-            default:
527
-                $orderby = array('PRC_order' => $order, 'Price_Type.PRT_order' => $order, 'PRC_ID' => $order);
528
-        }
529
-
530
-        $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
531
-            ? $this->_req_data['paged'] : 1;
532
-        $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
533
-            ? $this->_req_data['perpage'] : $per_page;
534
-
535
-        $_where = array(
536
-            'PRC_is_default' => 1,
537
-            'PRC_deleted'    => $trashed,
538
-        );
539
-
540
-        $offset = ($current_page - 1) * $per_page;
541
-        $limit = array($offset, $per_page);
542
-
543
-        if (isset($this->_req_data['s'])) {
544
-            $sstr = '%' . $this->_req_data['s'] . '%';
545
-            $_where['OR'] = array(
546
-                'PRC_name'            => array('LIKE', $sstr),
547
-                'PRC_desc'            => array('LIKE', $sstr),
548
-                'PRC_amount'          => array('LIKE', $sstr),
549
-                'Price_Type.PRT_name' => array('LIKE', $sstr),
550
-            );
551
-        }
552
-
553
-        $query_params = array(
554
-            $_where,
555
-            'order_by' => $orderby,
556
-            'limit'    => $limit,
557
-            'group_by' => 'PRC_ID',
558
-        );
559
-
560
-        if ($count) {
561
-            return $trashed ? EEM_Price::instance()->count(array($_where))
562
-                : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
563
-        } else {
564
-            return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
565
-        }
566
-    }
567
-
568
-
569
-    /**
570
-     *        _price_details
571
-     *
572
-     * @access protected
573
-     * @return void
574
-     */
575
-    protected function _edit_price_details()
576
-    {
577
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
578
-        // grab price ID
579
-        $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id'])
580
-            : false;
581
-        // change page title based on request action
582
-        switch ($this->_req_action) {
583
-            case 'add_new_price':
584
-                $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso');
585
-                break;
586
-            case 'edit_price':
587
-                $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso');
588
-                break;
589
-            default:
590
-                $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
591
-        }
592
-        // add PRC_ID to title if editing
593
-        $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
594
-
595
-        // get prices
596
-        require_once(EE_MODELS . 'EEM_Price.model.php');
597
-        $PRC = EEM_Price::instance();
598
-
599
-        if ($PRC_ID) {
600
-            $price = $PRC->get_one_by_ID($PRC_ID);
601
-            $additional_hidden_fields = array(
602
-                'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID),
603
-            );
604
-            $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
605
-        } else {
606
-            $price = $PRC->get_new_price();
607
-            $this->_set_add_edit_form_tags('insert_price');
608
-        }
609
-
610
-        $this->_template_args['PRC_ID'] = $PRC_ID;
611
-        $this->_template_args['price'] = $price;
612
-
613
-        // get price types
614
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
615
-        $PRT = EEM_Price_Type::instance();
616
-        $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
617
-        $price_type_names = array();
618
-        if (empty($price_types)) {
619
-            $msg = esc_html__(
620
-                'You have no price types defined. Please add a price type before adding a price.',
621
-                'event_espresso'
622
-            );
623
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
624
-            exit();
625
-        } else {
626
-            foreach ($price_types as $type) {
627
-                // if ($type->is_global()) {
628
-                $price_type_names[] = array('id' => $type->ID(), 'text' => $type->name());
629
-            // }
630
-            }
631
-        }
632
-
633
-        $this->_template_args['price_types'] = $price_type_names;
634
-        $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
635
-
636
-        $this->_set_publish_post_box_vars('id', $PRC_ID);
637
-        // the details template wrapper
638
-        $this->display_admin_page_with_sidebar();
639
-    }
640
-
641
-
642
-    /**
643
-     *        declare price details page metaboxes
644
-     *
645
-     * @access protected
646
-     * @return void
647
-     */
648
-    protected function _price_details_meta_boxes()
649
-    {
650
-        add_meta_box(
651
-            'edit-price-details-mbox',
652
-            esc_html__('Default Price Details', 'event_espresso'),
653
-            array($this, '_edit_price_details_meta_box'),
654
-            $this->wp_page_slug,
655
-            'normal',
656
-            'high'
657
-        );
658
-    }
659
-
660
-
661
-    /**
662
-     *        _edit_price_details_meta_box
663
-     *
664
-     * @access public
665
-     * @return void
666
-     */
667
-    public function _edit_price_details_meta_box()
668
-    {
669
-        echo EEH_Template::display_template(
670
-            PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php',
671
-            $this->_template_args,
672
-            true
673
-        );
674
-    }
675
-
676
-
677
-    /**
678
-     *        set_price_column_values
679
-     *
680
-     * @access protected
681
-     * @return array
682
-     */
683
-    protected function set_price_column_values()
684
-    {
685
-
686
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
687
-
688
-        $set_column_values = array(
689
-            'PRT_ID'         => absint($this->_req_data['PRT_ID']),
690
-            'PRC_amount'     => $this->_req_data['PRC_amount'],
691
-            'PRC_name'       => $this->_req_data['PRC_name'],
692
-            'PRC_desc'       => $this->_req_data['PRC_desc'],
693
-            'PRC_is_default' => 1,
694
-            'PRC_overrides'  => null,
695
-            'PRC_order'      => 0,
696
-            'PRC_deleted'    => 0,
697
-            'PRC_parent'     => 0,
698
-        );
699
-        return $set_column_values;
700
-    }
701
-
702
-
703
-    /**
704
-     *        insert_or_update_price
705
-     *
706
-     * @param boolean $insert - whether to insert or update
707
-     * @access protected
708
-     * @return void
709
-     */
710
-    protected function _insert_or_update_price($insert = false)
711
-    {
712
-
713
-        // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
714
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
715
-
716
-        require_once(EE_MODELS . 'EEM_Price.model.php');
717
-        $PRC = EEM_Price::instance();
718
-
719
-        // why be so pessimistic ???  : (
720
-        $success = 0;
721
-
722
-        $set_column_values = $this->set_price_column_values();
723
-        // is this a new Price ?
724
-        if ($insert) {
725
-            // run the insert
726
-            if ($PRC_ID = $PRC->insert($set_column_values)) {
727
-                // make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
728
-                $PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
729
-                if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
730
-                    $ticket = EEM_Ticket::instance()->get_one_by_ID(1);
731
-                    $ticket->_add_relation_to($PR, 'Price');
732
-                    $ticket->save();
733
-                }
734
-                $success = 1;
735
-            } else {
736
-                $PRC_ID = false;
737
-                $success = 0;
738
-            }
739
-            $action_desc = 'created';
740
-        } else {
741
-            $PRC_ID = absint($this->_req_data['PRC_ID']);
742
-            // run the update
743
-            $where_cols_n_values = array('PRC_ID' => $PRC_ID);
744
-            if ($PRC->update($set_column_values, array($where_cols_n_values))) {
745
-                $success = 1;
746
-            }
747
-
748
-            $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
749
-            if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
750
-                // if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated.
751
-                if ($PRC_ID === 1) {
752
-                    $ticket = $PR->get_first_related('Ticket');
753
-                    if ($ticket) {
754
-                        $ticket->set('TKT_price', $PR->get('PRC_amount'));
755
-                        $ticket->set('TKT_name', $PR->get('PRC_name'));
756
-                        $ticket->set('TKT_description', $PR->get('PRC_desc'));
757
-                        $ticket->save();
758
-                    }
759
-                } else {
760
-                    // we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
761
-                    $ticket = EEM_Ticket::instance()->get_one_by_ID(1);
762
-                    $ticket->_add_relation_to($PRC_ID, 'Price');
763
-                    $ticket->save();
764
-                }
765
-            }
766
-
767
-            $action_desc = 'updated';
768
-        }
769
-
770
-        $query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
771
-
772
-        $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
773
-    }
774
-
775
-
776
-    /**
777
-     *        _trash_or_restore_price
778
-     *
779
-     * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)
780
-     * @access protected
781
-     * @return void
782
-     */
783
-    protected function _trash_or_restore_price($trash = true)
784
-    {
785
-
786
-        // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
787
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
788
-
789
-        require_once(EE_MODELS . 'EEM_Price.model.php');
790
-        $PRC = EEM_Price::instance();
791
-
792
-        $success = 1;
793
-        $PRC_deleted = $trash ? true : false;
794
-
795
-        // get base ticket for updating
796
-        $ticket = EEM_Ticket::instance()->get_one_by_ID(1);
797
-        // Checkboxes
798
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
799
-            // if array has more than one element than success message should be plural
800
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
801
-            // cycle thru checkboxes
802
-            while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
803
-                if (! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
804
-                    $success = 0;
805
-                } else {
806
-                    $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
807
-                    if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
808
-                        // if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
809
-                        if ($PRC_deleted) {
810
-                            $ticket->_remove_relation_to($PRC_ID, 'Price');
811
-                        } else {
812
-                            $ticket->_add_relation_to($PRC_ID, 'Price');
813
-                        }
814
-                        $ticket->save();
815
-                    }
816
-                }
817
-            }
818
-        } else {
819
-            // grab single id and delete
820
-            $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
821
-            if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
822
-                $success = 0;
823
-            } else {
824
-                $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
825
-                if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
826
-                    // if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
827
-                    if ($PRC_deleted) {
828
-                        $ticket->_remove_relation_to($PRC_ID, 'Price');
829
-                    } else {
830
-                        $ticket->_add_relation_to($PRC_ID, 'Price');
831
-                    }
832
-                    $ticket->save();
833
-                }
834
-            }
835
-        }
836
-        $query_args = array(
837
-            'action' => 'default',
838
-        );
839
-
840
-        if ($success) {
841
-            if ($trash) {
842
-                $msg = $success == 2
843
-                    ? esc_html__('The Prices have been trashed.', 'event_espresso')
844
-                    : esc_html__(
845
-                        'The Price has been trashed.',
846
-                        'event_espresso'
847
-                    );
848
-            } else {
849
-                $msg = $success == 2
850
-                    ? esc_html__('The Prices have been restored.', 'event_espresso')
851
-                    : esc_html__(
852
-                        'The Price has been restored.',
853
-                        'event_espresso'
854
-                    );
855
-            }
856
-
857
-            EE_Error::add_success($msg);
858
-        }
859
-
860
-        $this->_redirect_after_action(false, '', '', $query_args, true);
861
-    }
862
-
863
-
864
-    /**
865
-     *        _delete_price
866
-     *
867
-     * @access protected
868
-     * @return void
869
-     */
870
-    protected function _delete_price()
871
-    {
872
-
873
-        // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
874
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
875
-
876
-        require_once(EE_MODELS . 'EEM_Price.model.php');
877
-        $PRC = EEM_Price::instance();
878
-
879
-        $success = 1;
880
-        // Checkboxes
881
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
882
-            // if array has more than one element than success message should be plural
883
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
884
-            // cycle thru bulk action checkboxes
885
-            while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
886
-                if (! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
887
-                    $success = 0;
888
-                }
889
-            }
890
-        } else {
891
-            // grab single id and delete
892
-            $PRC_ID = absint($this->_req_data['id']);
893
-            if (! $PRC->delete_permanently_by_ID($PRC_ID)) {
894
-                $success = 0;
895
-            }
896
-        }
897
-
898
-        $this->_redirect_after_action($success, 'Prices', 'deleted', array());
899
-    }
900
-
901
-
902
-    public function update_price_order()
903
-    {
904
-        $success = esc_html__('Price order was updated successfully.', 'event_espresso');
905
-
906
-        // grab our row IDs
907
-        $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(
908
-            ',',
909
-            rtrim(
910
-                $this->_req_data['row_ids'],
911
-                ','
912
-            )
913
-        ) : false;
914
-
915
-        if (is_array($row_ids)) {
916
-            for ($i = 0; $i < count($row_ids); $i++) {
917
-                // Update the prices when re-ordering
918
-                $id = absint($row_ids[ $i ]);
919
-                if (
920
-                    EEM_Price::instance()->update(
921
-                        array('PRC_order' => $i + 1),
922
-                        array(array('PRC_ID' => $id))
923
-                    ) === false
924
-                ) {
925
-                    $success = false;
926
-                }
927
-            }
928
-        } else {
929
-            $success = false;
930
-        }
931
-
932
-        $errors = ! $success ? esc_html__('An error occurred. The price order was not updated.', 'event_espresso') : false;
933
-
934
-        echo wp_json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
935
-        die();
936
-    }
937
-
938
-
939
-
940
-
941
-
942
-
943
-    /**************************************************************************************************************************************************************
15
+	/**
16
+	 *    constructor
17
+	 *
18
+	 * @Constructor
19
+	 * @access public
20
+	 * @param bool $routing
21
+	 * @return Pricing_Admin_Page
22
+	 */
23
+	public function __construct($routing = true)
24
+	{
25
+		parent::__construct($routing);
26
+	}
27
+
28
+
29
+	protected function _init_page_props()
30
+	{
31
+		$this->page_slug = PRICING_PG_SLUG;
32
+		$this->page_label = PRICING_LABEL;
33
+		$this->_admin_base_url = PRICING_ADMIN_URL;
34
+		$this->_admin_base_path = PRICING_ADMIN;
35
+	}
36
+
37
+
38
+	protected function _ajax_hooks()
39
+	{
40
+		add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order'));
41
+	}
42
+
43
+
44
+	protected function _define_page_props()
45
+	{
46
+		$this->_admin_page_title = PRICING_LABEL;
47
+		$this->_labels = array(
48
+			'buttons' => array(
49
+				'add'         => esc_html__('Add New Default Price', 'event_espresso'),
50
+				'edit'        => esc_html__('Edit Default Price', 'event_espresso'),
51
+				'delete'      => esc_html__('Delete Default Price', 'event_espresso'),
52
+				'add_type'    => esc_html__('Add New Default Price Type', 'event_espresso'),
53
+				'edit_type'   => esc_html__('Edit Price Type', 'event_espresso'),
54
+				'delete_type' => esc_html__('Delete Price Type', 'event_espresso'),
55
+			),
56
+		);
57
+	}
58
+
59
+
60
+	/**
61
+	 *        an array for storing request actions and their corresponding methods
62
+	 *
63
+	 * @access private
64
+	 * @return void
65
+	 */
66
+	protected function _set_page_routes()
67
+	{
68
+		$prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID'])
69
+			? $this->_req_data['PRC_ID'] : 0;
70
+		$prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID'])
71
+			? $this->_req_data['PRT_ID'] : 0;
72
+		$this->_page_routes = array(
73
+			'default'                     => array(
74
+				'func'       => '_price_overview_list_table',
75
+				'capability' => 'ee_read_default_prices',
76
+			),
77
+			'add_new_price'               => array(
78
+				'func'       => '_edit_price_details',
79
+				'args'       => array('new_price' => true),
80
+				'capability' => 'ee_edit_default_prices',
81
+			),
82
+			'edit_price'                  => array(
83
+				'func'       => '_edit_price_details',
84
+				'args'       => array('new_price' => false),
85
+				'capability' => 'ee_edit_default_price',
86
+				'obj_id'     => $prc_id,
87
+			),
88
+			'insert_price'                => array(
89
+				'func'       => '_insert_or_update_price',
90
+				'args'       => array('new_price' => true),
91
+				'noheader'   => true,
92
+				'capability' => 'ee_edit_default_prices',
93
+			),
94
+			'update_price'                => array(
95
+				'func'       => '_insert_or_update_price',
96
+				'args'       => array('new_price' => false),
97
+				'noheader'   => true,
98
+				'capability' => 'ee_edit_default_price',
99
+				'obj_id'     => $prc_id,
100
+			),
101
+			'trash_price'                 => array(
102
+				'func'       => '_trash_or_restore_price',
103
+				'args'       => array('trash' => true),
104
+				'noheader'   => true,
105
+				'capability' => 'ee_delete_default_price',
106
+				'obj_id'     => $prc_id,
107
+			),
108
+			'restore_price'               => array(
109
+				'func'       => '_trash_or_restore_price',
110
+				'args'       => array('trash' => false),
111
+				'noheader'   => true,
112
+				'capability' => 'ee_delete_default_price',
113
+				'obj_id'     => $prc_id,
114
+			),
115
+			'delete_price'                => array(
116
+				'func'       => '_delete_price',
117
+				'noheader'   => true,
118
+				'capability' => 'ee_delete_default_price',
119
+				'obj_id'     => $prc_id,
120
+			),
121
+			'espresso_update_price_order' => array(
122
+				'func'       => 'update_price_order',
123
+				'noheader'   => true,
124
+				'capability' => 'ee_edit_default_prices',
125
+			),
126
+			// price types
127
+			'price_types'                 => array(
128
+				'func'       => '_price_types_overview_list_table',
129
+				'capability' => 'ee_read_default_price_types',
130
+			),
131
+			'add_new_price_type'          => array(
132
+				'func'       => '_edit_price_type_details',
133
+				'capability' => 'ee_edit_default_price_types',
134
+			),
135
+			'edit_price_type'             => array(
136
+				'func'       => '_edit_price_type_details',
137
+				'capability' => 'ee_edit_default_price_type',
138
+				'obj_id'     => $prt_id,
139
+			),
140
+			'insert_price_type'           => array(
141
+				'func'       => '_insert_or_update_price_type',
142
+				'args'       => array('new_price_type' => true),
143
+				'noheader'   => true,
144
+				'capability' => 'ee_edit_default_price_types',
145
+			),
146
+			'update_price_type'           => array(
147
+				'func'       => '_insert_or_update_price_type',
148
+				'args'       => array('new_price_type' => false),
149
+				'noheader'   => true,
150
+				'capability' => 'ee_edit_default_price_type',
151
+				'obj_id'     => $prt_id,
152
+			),
153
+			'trash_price_type'            => array(
154
+				'func'       => '_trash_or_restore_price_type',
155
+				'args'       => array('trash' => true),
156
+				'noheader'   => true,
157
+				'capability' => 'ee_delete_default_price_type',
158
+				'obj_id'     => $prt_id,
159
+			),
160
+			'restore_price_type'          => array(
161
+				'func'       => '_trash_or_restore_price_type',
162
+				'args'       => array('trash' => false),
163
+				'noheader'   => true,
164
+				'capability' => 'ee_delete_default_price_type',
165
+				'obj_id'     => $prt_id,
166
+			),
167
+			'delete_price_type'           => array(
168
+				'func'       => '_delete_price_type',
169
+				'noheader'   => true,
170
+				'capability' => 'ee_delete_default_price_type',
171
+				'obj_id'     => $prt_id,
172
+			),
173
+			'tax_settings'                => array(
174
+				'func'       => '_tax_settings',
175
+				'capability' => 'manage_options',
176
+			),
177
+			'update_tax_settings'         => array(
178
+				'func'       => '_update_tax_settings',
179
+				'capability' => 'manage_options',
180
+				'noheader'   => true,
181
+			),
182
+		);
183
+	}
184
+
185
+
186
+	protected function _set_page_config()
187
+	{
188
+
189
+		$this->_page_config = array(
190
+			'default'            => array(
191
+				'nav'           => array(
192
+					'label' => esc_html__('Default Pricing', 'event_espresso'),
193
+					'order' => 10,
194
+				),
195
+				'list_table'    => 'Prices_List_Table',
196
+				'help_tabs'     => array(
197
+					'pricing_default_pricing_help_tab'                           => array(
198
+						'title'    => esc_html__('Default Pricing', 'event_espresso'),
199
+						'filename' => 'pricing_default_pricing',
200
+					),
201
+					'pricing_default_pricing_table_column_headings_help_tab'     => array(
202
+						'title'    => esc_html__('Default Pricing Table Column Headings', 'event_espresso'),
203
+						'filename' => 'pricing_default_pricing_table_column_headings',
204
+					),
205
+					'pricing_default_pricing_views_bulk_actions_search_help_tab' => array(
206
+						'title'    => esc_html__('Default Pricing Views & Bulk Actions & Search', 'event_espresso'),
207
+						'filename' => 'pricing_default_pricing_views_bulk_actions_search',
208
+					),
209
+				),
210
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
211
+				// 'help_tour'     => array('Pricing_Default_Prices_Help_Tour'),
212
+				'require_nonce' => false,
213
+			),
214
+			'add_new_price'      => array(
215
+				'nav'           => array(
216
+					'label'      => esc_html__('Add New Default Price', 'event_espresso'),
217
+					'order'      => 20,
218
+					'persistent' => false,
219
+				),
220
+				'help_tabs'     => array(
221
+					'add_new_default_price_help_tab' => array(
222
+						'title'    => esc_html__('Add New Default Price', 'event_espresso'),
223
+						'filename' => 'pricing_add_new_default_price',
224
+					),
225
+				),
226
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
227
+				// 'help_tour'     => array('Pricing_Add_New_Default_Price_Help_Tour'),
228
+				'metaboxes'     => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
229
+				'require_nonce' => false,
230
+			),
231
+			'edit_price'         => array(
232
+				'nav'           => array(
233
+					'label'      => esc_html__('Edit Default Price', 'event_espresso'),
234
+					'order'      => 20,
235
+					'url'        => isset($this->_req_data['id']) ? add_query_arg(
236
+						array('id' => $this->_req_data['id']),
237
+						$this->_current_page_view_url
238
+					) : $this->_admin_base_url,
239
+					'persistent' => false,
240
+				),
241
+				'metaboxes'     => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
242
+				'help_tabs'     => array(
243
+					'edit_default_price_help_tab' => array(
244
+						'title'    => esc_html__('Edit Default Price', 'event_espresso'),
245
+						'filename' => 'pricing_edit_default_price',
246
+					),
247
+				),
248
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
249
+				// 'help_tour'     => array('Pricing_Edit_Default_Price_Help_Tour'),
250
+				'require_nonce' => false,
251
+			),
252
+			'price_types'        => array(
253
+				'nav'           => array(
254
+					'label' => esc_html__('Price Types', 'event_espresso'),
255
+					'order' => 30,
256
+				),
257
+				'list_table'    => 'Price_Types_List_Table',
258
+				'help_tabs'     => array(
259
+					'pricing_price_types_help_tab'                           => array(
260
+						'title'    => esc_html__('Price Types', 'event_espresso'),
261
+						'filename' => 'pricing_price_types',
262
+					),
263
+					'pricing_price_types_table_column_headings_help_tab'     => array(
264
+						'title'    => esc_html__('Price Types Table Column Headings', 'event_espresso'),
265
+						'filename' => 'pricing_price_types_table_column_headings',
266
+					),
267
+					'pricing_price_types_views_bulk_actions_search_help_tab' => array(
268
+						'title'    => esc_html__('Price Types Views & Bulk Actions & Search', 'event_espresso'),
269
+						'filename' => 'pricing_price_types_views_bulk_actions_search',
270
+					),
271
+				),
272
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
273
+				// 'help_tour'     => array('Pricing_Price_Types_Default_Help_Tour'),
274
+				'metaboxes'     => array('_espresso_news_post_box', '_espresso_links_post_box'),
275
+				'require_nonce' => false,
276
+			),
277
+			'add_new_price_type' => array(
278
+				'nav'           => array(
279
+					'label'      => esc_html__('Add New Price Type', 'event_espresso'),
280
+					'order'      => 40,
281
+					'persistent' => false,
282
+				),
283
+				'help_tabs'     => array(
284
+					'add_new_price_type_help_tab' => array(
285
+						'title'    => esc_html__('Add New Price Type', 'event_espresso'),
286
+						'filename' => 'pricing_add_new_price_type',
287
+					),
288
+				),
289
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
290
+				// 'help_tour'     => array('Pricing_Add_New_Price_Type_Help_Tour'),
291
+				'metaboxes'     => array(
292
+					'_publish_post_box',
293
+					'_espresso_news_post_box',
294
+					'_price_type_details_meta_boxes',
295
+				),
296
+				'require_nonce' => false,
297
+			),
298
+			'edit_price_type'    => array(
299
+				'nav'       => array(
300
+					'label'      => esc_html__('Edit Price Type', 'event_espresso'),
301
+					'order'      => 40,
302
+					'persistent' => false,
303
+				),
304
+				'help_tabs' => array(
305
+					'edit_price_type_help_tab' => array(
306
+						'title'    => esc_html__('Edit Price Type', 'event_espresso'),
307
+						'filename' => 'pricing_edit_price_type',
308
+					),
309
+				),
310
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
311
+				// 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'),
312
+				'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
313
+
314
+				'require_nonce' => false,
315
+			),
316
+			'tax_settings'       => array(
317
+				'nav'           => array(
318
+					'label' => esc_html__('Tax Settings', 'event_espresso'),
319
+					'order' => 40,
320
+				),
321
+				'labels'        => array(
322
+					'publishbox' => esc_html__('Update Tax Settings', 'event_espresso'),
323
+				),
324
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
325
+				// 'help_tabs'     => array(
326
+				//     'registration_form_reg_form_settings_help_tab' => array(
327
+				//         'title'    => esc_html__('Registration Form Settings', 'event_espresso'),
328
+				//         'filename' => 'registration_form_reg_form_settings'
329
+				//     ),
330
+				// ),
331
+				// 'help_tour'     => array('Registration_Form_Settings_Help_Tour'),
332
+				'require_nonce' => true,
333
+			),
334
+		);
335
+	}
336
+
337
+
338
+	protected function _add_screen_options()
339
+	{
340
+		// todo
341
+	}
342
+
343
+
344
+	protected function _add_screen_options_default()
345
+	{
346
+		$this->_per_page_screen_option();
347
+	}
348
+
349
+
350
+	protected function _add_screen_options_price_types()
351
+	{
352
+		$page_title = $this->_admin_page_title;
353
+		$this->_admin_page_title = esc_html__('Price Types', 'event_espresso');
354
+		$this->_per_page_screen_option();
355
+		$this->_admin_page_title = $page_title;
356
+	}
357
+
358
+
359
+	protected function _add_feature_pointers()
360
+	{
361
+	}
362
+
363
+
364
+	public function load_scripts_styles()
365
+	{
366
+		// styles
367
+		wp_enqueue_style('espresso-ui-theme');
368
+		wp_register_style(
369
+			'espresso_PRICING',
370
+			PRICING_ASSETS_URL . 'espresso_pricing_admin.css',
371
+			array(),
372
+			EVENT_ESPRESSO_VERSION
373
+		);
374
+		wp_enqueue_style('espresso_PRICING');
375
+
376
+		// scripts
377
+		wp_enqueue_script('ee_admin_js');
378
+		wp_enqueue_script('jquery-ui-position');
379
+		wp_enqueue_script('jquery-ui-widget');
380
+		// wp_enqueue_script('jquery-ui-dialog');
381
+		// wp_enqueue_script('jquery-ui-draggable');
382
+		// wp_enqueue_script('jquery-ui-datepicker');
383
+		wp_register_script(
384
+			'espresso_PRICING',
385
+			PRICING_ASSETS_URL . 'espresso_pricing_admin.js',
386
+			array('jquery'),
387
+			EVENT_ESPRESSO_VERSION,
388
+			true
389
+		);
390
+		wp_enqueue_script('espresso_PRICING');
391
+	}
392
+
393
+
394
+	public function load_scripts_styles_default()
395
+	{
396
+		wp_enqueue_script('espresso_ajax_table_sorting');
397
+	}
398
+
399
+
400
+	public function admin_footer_scripts()
401
+	{
402
+	}
403
+
404
+	public function admin_init()
405
+	{
406
+	}
407
+
408
+	public function admin_notices()
409
+	{
410
+	}
411
+
412
+
413
+	protected function _set_list_table_views_default()
414
+	{
415
+		$this->_views = array(
416
+			'all' => array(
417
+				'slug'        => 'all',
418
+				'label'       => esc_html__('View All Default Pricing', 'event_espresso'),
419
+				'count'       => 0,
420
+				'bulk_action' => array(
421
+					'trash_price' => esc_html__('Move to Trash', 'event_espresso'),
422
+				),
423
+			),
424
+		);
425
+
426
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
427
+			$this->_views['trashed'] = array(
428
+				'slug'        => 'trashed',
429
+				'label'       => esc_html__('Trash', 'event_espresso'),
430
+				'count'       => 0,
431
+				'bulk_action' => array(
432
+					'restore_price' => esc_html__('Restore from Trash', 'event_espresso'),
433
+					'delete_price'  => esc_html__('Delete Permanently', 'event_espresso'),
434
+				),
435
+			);
436
+		}
437
+	}
438
+
439
+
440
+	protected function _set_list_table_views_price_types()
441
+	{
442
+		$this->_views = array(
443
+			'all' => array(
444
+				'slug'        => 'all',
445
+				'label'       => esc_html__('All', 'event_espresso'),
446
+				'count'       => 0,
447
+				'bulk_action' => array(
448
+					'trash_price_type' => esc_html__('Move to Trash', 'event_espresso'),
449
+				),
450
+			),
451
+		);
452
+
453
+		if (
454
+			EE_Registry::instance()->CAP->current_user_can(
455
+				'ee_delete_default_price_types',
456
+				'pricing_trash_price_type'
457
+			)
458
+		) {
459
+			$this->_views['trashed'] = array(
460
+				'slug'        => 'trashed',
461
+				'label'       => esc_html__('Trash', 'event_espresso'),
462
+				'count'       => 0,
463
+				'bulk_action' => array(
464
+					'restore_price_type' => esc_html__('Restore from Trash', 'event_espresso'),
465
+					'delete_price_type'  => esc_html__('Delete Permanently', 'event_espresso'),
466
+				),
467
+			);
468
+		}
469
+	}
470
+
471
+
472
+	/**
473
+	 *        generates HTML for main Prices Admin page
474
+	 *
475
+	 * @access protected
476
+	 * @return void
477
+	 */
478
+	protected function _price_overview_list_table()
479
+	{
480
+		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
481
+			'add_new_price',
482
+			'add',
483
+			array(),
484
+			'add-new-h2'
485
+		);
486
+		$this->admin_page_title .= $this->_learn_more_about_pricing_link();
487
+		$this->_search_btn_label = esc_html__('Default Prices', 'event_espresso');
488
+		$this->display_admin_list_table_page_with_no_sidebar();
489
+	}
490
+
491
+
492
+	/**
493
+	 *    retrieve data for Prices List table
494
+	 *
495
+	 * @access public
496
+	 * @param  int     $per_page how many prices displayed per page
497
+	 * @param  boolean $count    return the count or objects
498
+	 * @param  boolean $trashed  whether the current view is of the trash can - eww yuck!
499
+	 * @return mixed (int|array)  int = count || array of price objects
500
+	 */
501
+	public function get_prices_overview_data($per_page = 10, $count = false, $trashed = false)
502
+	{
503
+
504
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
505
+		// start with an empty array
506
+		$event_pricing = array();
507
+
508
+		require_once(PRICING_ADMIN . 'Prices_List_Table.class.php');
509
+		require_once(EE_MODELS . 'EEM_Price.model.php');
510
+		// $PRC = EEM_Price::instance();
511
+
512
+		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
513
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
514
+			: 'ASC';
515
+
516
+		switch ($this->_req_data['orderby']) {
517
+			case 'name':
518
+				$orderby = array('PRC_name' => $order);
519
+				break;
520
+			case 'type':
521
+				$orderby = array('Price_Type.PRT_name' => $order);
522
+				break;
523
+			case 'amount':
524
+				$orderby = array('PRC_amount' => $order);
525
+				break;
526
+			default:
527
+				$orderby = array('PRC_order' => $order, 'Price_Type.PRT_order' => $order, 'PRC_ID' => $order);
528
+		}
529
+
530
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
531
+			? $this->_req_data['paged'] : 1;
532
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
533
+			? $this->_req_data['perpage'] : $per_page;
534
+
535
+		$_where = array(
536
+			'PRC_is_default' => 1,
537
+			'PRC_deleted'    => $trashed,
538
+		);
539
+
540
+		$offset = ($current_page - 1) * $per_page;
541
+		$limit = array($offset, $per_page);
542
+
543
+		if (isset($this->_req_data['s'])) {
544
+			$sstr = '%' . $this->_req_data['s'] . '%';
545
+			$_where['OR'] = array(
546
+				'PRC_name'            => array('LIKE', $sstr),
547
+				'PRC_desc'            => array('LIKE', $sstr),
548
+				'PRC_amount'          => array('LIKE', $sstr),
549
+				'Price_Type.PRT_name' => array('LIKE', $sstr),
550
+			);
551
+		}
552
+
553
+		$query_params = array(
554
+			$_where,
555
+			'order_by' => $orderby,
556
+			'limit'    => $limit,
557
+			'group_by' => 'PRC_ID',
558
+		);
559
+
560
+		if ($count) {
561
+			return $trashed ? EEM_Price::instance()->count(array($_where))
562
+				: EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
563
+		} else {
564
+			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
565
+		}
566
+	}
567
+
568
+
569
+	/**
570
+	 *        _price_details
571
+	 *
572
+	 * @access protected
573
+	 * @return void
574
+	 */
575
+	protected function _edit_price_details()
576
+	{
577
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
578
+		// grab price ID
579
+		$PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id'])
580
+			: false;
581
+		// change page title based on request action
582
+		switch ($this->_req_action) {
583
+			case 'add_new_price':
584
+				$this->_admin_page_title = esc_html__('Add New Price', 'event_espresso');
585
+				break;
586
+			case 'edit_price':
587
+				$this->_admin_page_title = esc_html__('Edit Price', 'event_espresso');
588
+				break;
589
+			default:
590
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
591
+		}
592
+		// add PRC_ID to title if editing
593
+		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
594
+
595
+		// get prices
596
+		require_once(EE_MODELS . 'EEM_Price.model.php');
597
+		$PRC = EEM_Price::instance();
598
+
599
+		if ($PRC_ID) {
600
+			$price = $PRC->get_one_by_ID($PRC_ID);
601
+			$additional_hidden_fields = array(
602
+				'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID),
603
+			);
604
+			$this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
605
+		} else {
606
+			$price = $PRC->get_new_price();
607
+			$this->_set_add_edit_form_tags('insert_price');
608
+		}
609
+
610
+		$this->_template_args['PRC_ID'] = $PRC_ID;
611
+		$this->_template_args['price'] = $price;
612
+
613
+		// get price types
614
+		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
615
+		$PRT = EEM_Price_Type::instance();
616
+		$price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
617
+		$price_type_names = array();
618
+		if (empty($price_types)) {
619
+			$msg = esc_html__(
620
+				'You have no price types defined. Please add a price type before adding a price.',
621
+				'event_espresso'
622
+			);
623
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
624
+			exit();
625
+		} else {
626
+			foreach ($price_types as $type) {
627
+				// if ($type->is_global()) {
628
+				$price_type_names[] = array('id' => $type->ID(), 'text' => $type->name());
629
+			// }
630
+			}
631
+		}
632
+
633
+		$this->_template_args['price_types'] = $price_type_names;
634
+		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
635
+
636
+		$this->_set_publish_post_box_vars('id', $PRC_ID);
637
+		// the details template wrapper
638
+		$this->display_admin_page_with_sidebar();
639
+	}
640
+
641
+
642
+	/**
643
+	 *        declare price details page metaboxes
644
+	 *
645
+	 * @access protected
646
+	 * @return void
647
+	 */
648
+	protected function _price_details_meta_boxes()
649
+	{
650
+		add_meta_box(
651
+			'edit-price-details-mbox',
652
+			esc_html__('Default Price Details', 'event_espresso'),
653
+			array($this, '_edit_price_details_meta_box'),
654
+			$this->wp_page_slug,
655
+			'normal',
656
+			'high'
657
+		);
658
+	}
659
+
660
+
661
+	/**
662
+	 *        _edit_price_details_meta_box
663
+	 *
664
+	 * @access public
665
+	 * @return void
666
+	 */
667
+	public function _edit_price_details_meta_box()
668
+	{
669
+		echo EEH_Template::display_template(
670
+			PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php',
671
+			$this->_template_args,
672
+			true
673
+		);
674
+	}
675
+
676
+
677
+	/**
678
+	 *        set_price_column_values
679
+	 *
680
+	 * @access protected
681
+	 * @return array
682
+	 */
683
+	protected function set_price_column_values()
684
+	{
685
+
686
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
687
+
688
+		$set_column_values = array(
689
+			'PRT_ID'         => absint($this->_req_data['PRT_ID']),
690
+			'PRC_amount'     => $this->_req_data['PRC_amount'],
691
+			'PRC_name'       => $this->_req_data['PRC_name'],
692
+			'PRC_desc'       => $this->_req_data['PRC_desc'],
693
+			'PRC_is_default' => 1,
694
+			'PRC_overrides'  => null,
695
+			'PRC_order'      => 0,
696
+			'PRC_deleted'    => 0,
697
+			'PRC_parent'     => 0,
698
+		);
699
+		return $set_column_values;
700
+	}
701
+
702
+
703
+	/**
704
+	 *        insert_or_update_price
705
+	 *
706
+	 * @param boolean $insert - whether to insert or update
707
+	 * @access protected
708
+	 * @return void
709
+	 */
710
+	protected function _insert_or_update_price($insert = false)
711
+	{
712
+
713
+		// echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
714
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
715
+
716
+		require_once(EE_MODELS . 'EEM_Price.model.php');
717
+		$PRC = EEM_Price::instance();
718
+
719
+		// why be so pessimistic ???  : (
720
+		$success = 0;
721
+
722
+		$set_column_values = $this->set_price_column_values();
723
+		// is this a new Price ?
724
+		if ($insert) {
725
+			// run the insert
726
+			if ($PRC_ID = $PRC->insert($set_column_values)) {
727
+				// make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
728
+				$PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
729
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
730
+					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
731
+					$ticket->_add_relation_to($PR, 'Price');
732
+					$ticket->save();
733
+				}
734
+				$success = 1;
735
+			} else {
736
+				$PRC_ID = false;
737
+				$success = 0;
738
+			}
739
+			$action_desc = 'created';
740
+		} else {
741
+			$PRC_ID = absint($this->_req_data['PRC_ID']);
742
+			// run the update
743
+			$where_cols_n_values = array('PRC_ID' => $PRC_ID);
744
+			if ($PRC->update($set_column_values, array($where_cols_n_values))) {
745
+				$success = 1;
746
+			}
747
+
748
+			$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
749
+			if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
750
+				// if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated.
751
+				if ($PRC_ID === 1) {
752
+					$ticket = $PR->get_first_related('Ticket');
753
+					if ($ticket) {
754
+						$ticket->set('TKT_price', $PR->get('PRC_amount'));
755
+						$ticket->set('TKT_name', $PR->get('PRC_name'));
756
+						$ticket->set('TKT_description', $PR->get('PRC_desc'));
757
+						$ticket->save();
758
+					}
759
+				} else {
760
+					// we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
761
+					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
762
+					$ticket->_add_relation_to($PRC_ID, 'Price');
763
+					$ticket->save();
764
+				}
765
+			}
766
+
767
+			$action_desc = 'updated';
768
+		}
769
+
770
+		$query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
771
+
772
+		$this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
773
+	}
774
+
775
+
776
+	/**
777
+	 *        _trash_or_restore_price
778
+	 *
779
+	 * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)
780
+	 * @access protected
781
+	 * @return void
782
+	 */
783
+	protected function _trash_or_restore_price($trash = true)
784
+	{
785
+
786
+		// echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
787
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
788
+
789
+		require_once(EE_MODELS . 'EEM_Price.model.php');
790
+		$PRC = EEM_Price::instance();
791
+
792
+		$success = 1;
793
+		$PRC_deleted = $trash ? true : false;
794
+
795
+		// get base ticket for updating
796
+		$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
797
+		// Checkboxes
798
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
799
+			// if array has more than one element than success message should be plural
800
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
801
+			// cycle thru checkboxes
802
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
803
+				if (! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
804
+					$success = 0;
805
+				} else {
806
+					$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
807
+					if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
808
+						// if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
809
+						if ($PRC_deleted) {
810
+							$ticket->_remove_relation_to($PRC_ID, 'Price');
811
+						} else {
812
+							$ticket->_add_relation_to($PRC_ID, 'Price');
813
+						}
814
+						$ticket->save();
815
+					}
816
+				}
817
+			}
818
+		} else {
819
+			// grab single id and delete
820
+			$PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
821
+			if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
822
+				$success = 0;
823
+			} else {
824
+				$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
825
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
826
+					// if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
827
+					if ($PRC_deleted) {
828
+						$ticket->_remove_relation_to($PRC_ID, 'Price');
829
+					} else {
830
+						$ticket->_add_relation_to($PRC_ID, 'Price');
831
+					}
832
+					$ticket->save();
833
+				}
834
+			}
835
+		}
836
+		$query_args = array(
837
+			'action' => 'default',
838
+		);
839
+
840
+		if ($success) {
841
+			if ($trash) {
842
+				$msg = $success == 2
843
+					? esc_html__('The Prices have been trashed.', 'event_espresso')
844
+					: esc_html__(
845
+						'The Price has been trashed.',
846
+						'event_espresso'
847
+					);
848
+			} else {
849
+				$msg = $success == 2
850
+					? esc_html__('The Prices have been restored.', 'event_espresso')
851
+					: esc_html__(
852
+						'The Price has been restored.',
853
+						'event_espresso'
854
+					);
855
+			}
856
+
857
+			EE_Error::add_success($msg);
858
+		}
859
+
860
+		$this->_redirect_after_action(false, '', '', $query_args, true);
861
+	}
862
+
863
+
864
+	/**
865
+	 *        _delete_price
866
+	 *
867
+	 * @access protected
868
+	 * @return void
869
+	 */
870
+	protected function _delete_price()
871
+	{
872
+
873
+		// echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
874
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
875
+
876
+		require_once(EE_MODELS . 'EEM_Price.model.php');
877
+		$PRC = EEM_Price::instance();
878
+
879
+		$success = 1;
880
+		// Checkboxes
881
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
882
+			// if array has more than one element than success message should be plural
883
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
884
+			// cycle thru bulk action checkboxes
885
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
886
+				if (! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
887
+					$success = 0;
888
+				}
889
+			}
890
+		} else {
891
+			// grab single id and delete
892
+			$PRC_ID = absint($this->_req_data['id']);
893
+			if (! $PRC->delete_permanently_by_ID($PRC_ID)) {
894
+				$success = 0;
895
+			}
896
+		}
897
+
898
+		$this->_redirect_after_action($success, 'Prices', 'deleted', array());
899
+	}
900
+
901
+
902
+	public function update_price_order()
903
+	{
904
+		$success = esc_html__('Price order was updated successfully.', 'event_espresso');
905
+
906
+		// grab our row IDs
907
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(
908
+			',',
909
+			rtrim(
910
+				$this->_req_data['row_ids'],
911
+				','
912
+			)
913
+		) : false;
914
+
915
+		if (is_array($row_ids)) {
916
+			for ($i = 0; $i < count($row_ids); $i++) {
917
+				// Update the prices when re-ordering
918
+				$id = absint($row_ids[ $i ]);
919
+				if (
920
+					EEM_Price::instance()->update(
921
+						array('PRC_order' => $i + 1),
922
+						array(array('PRC_ID' => $id))
923
+					) === false
924
+				) {
925
+					$success = false;
926
+				}
927
+			}
928
+		} else {
929
+			$success = false;
930
+		}
931
+
932
+		$errors = ! $success ? esc_html__('An error occurred. The price order was not updated.', 'event_espresso') : false;
933
+
934
+		echo wp_json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
935
+		die();
936
+	}
937
+
938
+
939
+
940
+
941
+
942
+
943
+	/**************************************************************************************************************************************************************
944 944
      ********************************************************************  TICKET PRICE TYPES  ******************************************************************
945 945
      **************************************************************************************************************************************************************/
946 946
 
947 947
 
948
-    /**
949
-     *        generates HTML for main Prices Admin page
950
-     *
951
-     * @access protected
952
-     * @return void
953
-     */
954
-    protected function _price_types_overview_list_table()
955
-    {
956
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
957
-            'add_new_price_type',
958
-            'add_type',
959
-            array(),
960
-            'add-new-h2'
961
-        );
962
-        $this->admin_page_title .= $this->_learn_more_about_pricing_link();
963
-        $this->_search_btn_label = esc_html__('Price Types', 'event_espresso');
964
-        $this->display_admin_list_table_page_with_no_sidebar();
965
-    }
966
-
967
-
968
-    /**
969
-     *    retrieve data for Price Types List table
970
-     *
971
-     * @access public
972
-     * @param  int     $per_page how many prices displayed per page
973
-     * @param  boolean $count    return the count or objects
974
-     * @param  boolean $trashed  whether the current view is of the trash can - eww yuck!
975
-     * @return mixed (int|array)  int = count || array of price objects
976
-     */
977
-    public function get_price_types_overview_data($per_page = 10, $count = false, $trashed = false)
978
-    {
979
-
980
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
981
-        // start with an empty array
982
-
983
-        require_once(PRICING_ADMIN . 'Price_Types_List_Table.class.php');
984
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
985
-
986
-        $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
987
-        $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
988
-            : 'ASC';
989
-        switch ($this->_req_data['orderby']) {
990
-            case 'name':
991
-                $orderby = array('PRT_name' => $order);
992
-                break;
993
-            default:
994
-                $orderby = array('PRT_order' => $order);
995
-        }
996
-
997
-
998
-        $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
999
-            ? $this->_req_data['paged'] : 1;
1000
-        $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
1001
-            ? $this->_req_data['perpage'] : $per_page;
1002
-
1003
-        $offset = ($current_page - 1) * $per_page;
1004
-        $limit = array($offset, $per_page);
1005
-
1006
-        $_where = array('PRT_deleted' => $trashed, 'PBT_ID' => array('!=', 1));
1007
-
1008
-        if (isset($this->_req_data['s'])) {
1009
-            $sstr = '%' . $this->_req_data['s'] . '%';
1010
-            $_where['OR'] = array(
1011
-                'PRT_name' => array('LIKE', $sstr),
1012
-            );
1013
-        }
1014
-        $query_params = array(
1015
-            $_where,
1016
-            'order_by' => $orderby,
1017
-            'limit'    => $limit,
1018
-        );
1019
-        if ($count) {
1020
-            return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
1021
-        } else {
1022
-            return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
1023
-        }
1024
-
1025
-        // EEH_Debug_Tools::printr( $price_types, '$price_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1026
-    }
1027
-
1028
-
1029
-    /**
1030
-     *        _edit_price_type_details
1031
-     *
1032
-     * @access protected
1033
-     * @return void
1034
-     */
1035
-    protected function _edit_price_type_details()
1036
-    {
1037
-
1038
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1039
-
1040
-
1041
-        // grab price type ID
1042
-        $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id'])
1043
-            : false;
1044
-        // change page title based on request action
1045
-        switch ($this->_req_action) {
1046
-            case 'add_new_price_type':
1047
-                $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso');
1048
-                break;
1049
-            case 'edit_price_type':
1050
-                $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso');
1051
-                break;
1052
-            default:
1053
-                $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
1054
-        }
1055
-        // add PRT_ID to title if editing
1056
-        $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
1057
-
1058
-        if ($PRT_ID) {
1059
-            $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
1060
-            $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
1061
-            $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
1062
-        } else {
1063
-            $price_type = EEM_Price_Type::instance()->get_new_price_type();
1064
-            $this->_set_add_edit_form_tags('insert_price_type');
1065
-        }
1066
-
1067
-        $this->_template_args['PRT_ID'] = $PRT_ID;
1068
-        $this->_template_args['price_type'] = $price_type;
1069
-
1070
-
1071
-        $base_types = EEM_Price_Type::instance()->get_base_types();
1072
-        $select_values = array();
1073
-        foreach ($base_types as $ref => $text) {
1074
-            if ($ref == EEM_Price_Type::base_type_base_price) {
1075
-                // do not allow creation of base_type_base_prices because that's a system only base type.
1076
-                continue;
1077
-            }
1078
-            $values[] = array('id' => $ref, 'text' => $text);
1079
-        }
1080
-
1081
-
1082
-        $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input(
1083
-            'base_type',
1084
-            $values,
1085
-            $price_type->base_type(),
1086
-            'id="price-type-base-type-slct"'
1087
-        );
1088
-        $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1089
-        $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1090
-        $this->_set_publish_post_box_vars('id', $PRT_ID, false, $redirect_URL);
1091
-        // the details template wrapper
1092
-        $this->display_admin_page_with_sidebar();
1093
-    }
1094
-
1095
-
1096
-    /**
1097
-     *        declare price type details page metaboxes
1098
-     *
1099
-     * @access protected
1100
-     * @return void
1101
-     */
1102
-    protected function _price_type_details_meta_boxes()
1103
-    {
1104
-        add_meta_box(
1105
-            'edit-price-details-mbox',
1106
-            esc_html__('Price Type Details', 'event_espresso'),
1107
-            array($this, '_edit_price_type_details_meta_box'),
1108
-            $this->wp_page_slug,
1109
-            'normal',
1110
-            'high'
1111
-        );
1112
-    }
1113
-
1114
-
1115
-    /**
1116
-     *        _edit_price_type_details_meta_box
1117
-     *
1118
-     * @access public
1119
-     * @return void
1120
-     */
1121
-    public function _edit_price_type_details_meta_box()
1122
-    {
1123
-        echo EEH_Template::display_template(
1124
-            PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php',
1125
-            $this->_template_args,
1126
-            true
1127
-        );
1128
-    }
1129
-
1130
-
1131
-    /**
1132
-     *        set_price_type_column_values
1133
-     *
1134
-     * @access protected
1135
-     * @return void
1136
-     */
1137
-    protected function set_price_type_column_values()
1138
-    {
1139
-
1140
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1141
-
1142
-        $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type']
1143
-            : EEM_Price_Type::base_type_base_price;
1144
-
1145
-        switch ($base_type) {
1146
-            case EEM_Price_Type::base_type_base_price:
1147
-                $this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_base_price;
1148
-                $this->_req_data['PRT_is_percent'] = 0;
1149
-                $this->_req_data['PRT_order'] = 0;
1150
-                break;
1151
-
1152
-            case EEM_Price_Type::base_type_discount:
1153
-                $this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_discount;
1154
-                break;
1155
-
1156
-            case EEM_Price_Type::base_type_surcharge:
1157
-                $this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_surcharge;
1158
-                break;
1159
-
1160
-            case EEM_Price_Type::base_type_tax:
1161
-                $this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_tax;
1162
-                $this->_req_data['PRT_is_percent'] = 1;
1163
-                break;
1164
-        }/**/
1165
-
1166
-        $set_column_values = array(
1167
-            'PRT_name'       => $this->_req_data['PRT_name'],
1168
-            'PBT_ID'         => absint($this->_req_data['PBT_ID']),
1169
-            'PRT_is_percent' => absint($this->_req_data['PRT_is_percent']),
1170
-            'PRT_order'      => absint($this->_req_data['PRT_order']),
1171
-            'PRT_deleted'    => 0,
1172
-        );
1173
-
1174
-        return $set_column_values;
1175
-    }
1176
-
1177
-
1178
-    /**
1179
-     *        _insert_or_update_price_type
1180
-     *
1181
-     * @param boolean $new_price_type - whether to insert or update
1182
-     * @access protected
1183
-     * @return void
1184
-     */
1185
-    protected function _insert_or_update_price_type($new_price_type = false)
1186
-    {
1187
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1188
-
1189
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1190
-        $PRT = EEM_Price_Type::instance();
1191
-
1192
-        // why be so pessimistic ???  : (
1193
-        $success = 0;
1194
-
1195
-        $set_column_values = $this->set_price_type_column_values();
1196
-        // is this a new Price ?
1197
-        if ($new_price_type) {
1198
-            // run the insert
1199
-            if ($PRT_ID = $PRT->insert($set_column_values)) {
1200
-                $success = 1;
1201
-            }
1202
-            $action_desc = 'created';
1203
-        } else {
1204
-            $PRT_ID = absint($this->_req_data['PRT_ID']);
1205
-            // run the update
1206
-            $where_cols_n_values = array('PRT_ID' => $PRT_ID);
1207
-            if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1208
-                $success = 1;
1209
-            }
1210
-            $action_desc = 'updated';
1211
-        }
1212
-
1213
-        $query_args = array('action' => 'edit_price_type', 'id' => $PRT_ID);
1214
-        $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1215
-    }
1216
-
1217
-
1218
-    /**
1219
-     *        _trash_or_restore_price_type
1220
-     *
1221
-     * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)
1222
-     * @access protected
1223
-     * @return void
1224
-     */
1225
-    protected function _trash_or_restore_price_type($trash = true)
1226
-    {
1227
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1228
-
1229
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1230
-        $PRT = EEM_Price_Type::instance();
1231
-
1232
-        $success = 1;
1233
-        $PRT_deleted = $trash ? true : false;
1234
-        // Checkboxes
1235
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1236
-            // if array has more than one element than success message should be plural
1237
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1238
-            $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1239
-            // cycle thru checkboxes
1240
-            while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1241
-                if (! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1242
-                    $success = 0;
1243
-                }
1244
-            }
1245
-        } else {
1246
-            // grab single id and delete
1247
-            $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1248
-            if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1249
-                $success = 0;
1250
-            }
1251
-            $what = 'Price Type';
1252
-        }
1253
-
1254
-        $query_args = array('action' => 'price_types');
1255
-        if ($success) {
1256
-            if ($trash) {
1257
-                $msg = $success > 1
1258
-                    ? esc_html__('The Price Types have been trashed.', 'event_espresso')
1259
-                    : esc_html__(
1260
-                        'The Price Type has been trashed.',
1261
-                        'event_espresso'
1262
-                    );
1263
-            } else {
1264
-                $msg = $success > 1
1265
-                    ? esc_html__('The Price Types have been restored.', 'event_espresso')
1266
-                    : esc_html__(
1267
-                        'The Price Type has been restored.',
1268
-                        'event_espresso'
1269
-                    );
1270
-            }
1271
-            EE_Error::add_success($msg);
1272
-        }
1273
-
1274
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1275
-    }
1276
-
1277
-
1278
-    /**
1279
-     *        _delete_price_type
1280
-     *
1281
-     * @access protected
1282
-     * @return void
1283
-     */
1284
-    protected function _delete_price_type()
1285
-    {
1286
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1287
-
1288
-        $PRT = EEM_Price_Type::instance();
1289
-
1290
-        $success = 1;
1291
-        // Checkboxes
1292
-        if (! empty($this->_req_data['checkbox'])) {
1293
-            // if array has more than one element than success message should be plural
1294
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1295
-            $what = $PRT->item_name($success);
1296
-            // cycle thru bulk action checkboxes
1297
-            while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1298
-                if (! $PRT->delete_permanently_by_ID($PRT_ID)) {
1299
-                    $success = 0;
1300
-                }
1301
-            }
1302
-        }
1303
-
1304
-
1305
-        $query_args = array('action' => 'price_types');
1306
-        $this->_redirect_after_action($success, $what, 'deleted', $query_args);
1307
-    }
1308
-
1309
-
1310
-    /**
1311
-     *        _learn_more_about_pricing_link
1312
-     *
1313
-     * @access protected
1314
-     * @return string
1315
-     */
1316
-    protected function _learn_more_about_pricing_link()
1317
-    {
1318
-        return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . esc_html__(
1319
-            'learn more about how pricing works',
1320
-            'event_espresso'
1321
-        ) . '</a>';
1322
-    }
1323
-
1324
-
1325
-    protected function _tax_settings()
1326
-    {
1327
-        $this->_set_add_edit_form_tags('update_tax_settings');
1328
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
1329
-        $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html();
1330
-        $this->display_admin_page_with_sidebar();
1331
-    }
1332
-
1333
-
1334
-    /**
1335
-     * @return \EE_Form_Section_Proper
1336
-     * @throws \EE_Error
1337
-     */
1338
-    protected function tax_settings_form()
1339
-    {
1340
-        return new EE_Form_Section_Proper(
1341
-            array(
1342
-                'name'            => 'tax_settings_form',
1343
-                'html_id'         => 'tax_settings_form',
1344
-                'layout_strategy' => new EE_Div_Per_Section_Layout(),
1345
-                'subsections'     => apply_filters(
1346
-                    'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections',
1347
-                    array(
1348
-                        'tax_settings' => new EE_Form_Section_Proper(
1349
-                            array(
1350
-                                'name'            => 'tax_settings_tbl',
1351
-                                'html_id'         => 'tax_settings_tbl',
1352
-                                'html_class'      => 'form-table',
1353
-                                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1354
-                                'subsections'     => array(
1355
-                                    'prices_displayed_including_taxes' => new EE_Yes_No_Input(
1356
-                                        array(
1357
-                                            'html_label_text'         => esc_html__(
1358
-                                                "Show Prices With Taxes Included?",
1359
-                                                'event_espresso'
1360
-                                            ),
1361
-                                            'html_help_text'          => esc_html__(
1362
-                                                'Indicates whether or not to display prices with the taxes included',
1363
-                                                'event_espresso'
1364
-                                            ),
1365
-                                            'default'                 => isset(
1366
-                                                EE_Registry::instance()
1367
-                                                    ->CFG
1368
-                                                    ->tax_settings
1369
-                                                    ->prices_displayed_including_taxes
1370
-                                            )
1371
-                                                ? EE_Registry::instance()
1372
-                                                    ->CFG
1373
-                                                    ->tax_settings
1374
-                                                    ->prices_displayed_including_taxes
1375
-                                                : true,
1376
-                                            'display_html_label_text' => false,
1377
-                                        )
1378
-                                    ),
1379
-                                ),
1380
-                            )
1381
-                        ),
1382
-                    )
1383
-                ),
1384
-            )
1385
-        );
1386
-    }
1387
-
1388
-
1389
-    /**
1390
-     * _update_tax_settings
1391
-     *
1392
-     * @since 4.9.13
1393
-     * @return void
1394
-     */
1395
-    public function _update_tax_settings()
1396
-    {
1397
-        if (! isset(EE_Registry::instance()->CFG->tax_settings)) {
1398
-            EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config();
1399
-        }
1400
-        try {
1401
-            $tax_form = $this->tax_settings_form();
1402
-            // check for form submission
1403
-            if ($tax_form->was_submitted()) {
1404
-                // capture form data
1405
-                $tax_form->receive_form_submission();
1406
-                // validate form data
1407
-                if ($tax_form->is_valid()) {
1408
-                    // grab validated data from form
1409
-                    $valid_data = $tax_form->valid_data();
1410
-                    // set data on config
1411
-                    EE_Registry::instance()
1412
-                        ->CFG
1413
-                        ->tax_settings
1414
-                        ->prices_displayed_including_taxes
1415
-                        = $valid_data['tax_settings']['prices_displayed_including_taxes'];
1416
-                } else {
1417
-                    if ($tax_form->submission_error_message() !== '') {
1418
-                        EE_Error::add_error(
1419
-                            $tax_form->submission_error_message(),
1420
-                            __FILE__,
1421
-                            __FUNCTION__,
1422
-                            __LINE__
1423
-                        );
1424
-                    }
1425
-                }
1426
-            }
1427
-        } catch (EE_Error $e) {
1428
-            EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__);
1429
-        }
1430
-
1431
-        $what = 'Tax Settings';
1432
-        $success = $this->_update_espresso_configuration(
1433
-            $what,
1434
-            EE_Registry::instance()->CFG->tax_settings,
1435
-            __FILE__,
1436
-            __FUNCTION__,
1437
-            __LINE__
1438
-        );
1439
-        $this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings'));
1440
-    }
948
+	/**
949
+	 *        generates HTML for main Prices Admin page
950
+	 *
951
+	 * @access protected
952
+	 * @return void
953
+	 */
954
+	protected function _price_types_overview_list_table()
955
+	{
956
+		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
957
+			'add_new_price_type',
958
+			'add_type',
959
+			array(),
960
+			'add-new-h2'
961
+		);
962
+		$this->admin_page_title .= $this->_learn_more_about_pricing_link();
963
+		$this->_search_btn_label = esc_html__('Price Types', 'event_espresso');
964
+		$this->display_admin_list_table_page_with_no_sidebar();
965
+	}
966
+
967
+
968
+	/**
969
+	 *    retrieve data for Price Types List table
970
+	 *
971
+	 * @access public
972
+	 * @param  int     $per_page how many prices displayed per page
973
+	 * @param  boolean $count    return the count or objects
974
+	 * @param  boolean $trashed  whether the current view is of the trash can - eww yuck!
975
+	 * @return mixed (int|array)  int = count || array of price objects
976
+	 */
977
+	public function get_price_types_overview_data($per_page = 10, $count = false, $trashed = false)
978
+	{
979
+
980
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
981
+		// start with an empty array
982
+
983
+		require_once(PRICING_ADMIN . 'Price_Types_List_Table.class.php');
984
+		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
985
+
986
+		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
987
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
988
+			: 'ASC';
989
+		switch ($this->_req_data['orderby']) {
990
+			case 'name':
991
+				$orderby = array('PRT_name' => $order);
992
+				break;
993
+			default:
994
+				$orderby = array('PRT_order' => $order);
995
+		}
996
+
997
+
998
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
999
+			? $this->_req_data['paged'] : 1;
1000
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
1001
+			? $this->_req_data['perpage'] : $per_page;
1002
+
1003
+		$offset = ($current_page - 1) * $per_page;
1004
+		$limit = array($offset, $per_page);
1005
+
1006
+		$_where = array('PRT_deleted' => $trashed, 'PBT_ID' => array('!=', 1));
1007
+
1008
+		if (isset($this->_req_data['s'])) {
1009
+			$sstr = '%' . $this->_req_data['s'] . '%';
1010
+			$_where['OR'] = array(
1011
+				'PRT_name' => array('LIKE', $sstr),
1012
+			);
1013
+		}
1014
+		$query_params = array(
1015
+			$_where,
1016
+			'order_by' => $orderby,
1017
+			'limit'    => $limit,
1018
+		);
1019
+		if ($count) {
1020
+			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
1021
+		} else {
1022
+			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
1023
+		}
1024
+
1025
+		// EEH_Debug_Tools::printr( $price_types, '$price_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1026
+	}
1027
+
1028
+
1029
+	/**
1030
+	 *        _edit_price_type_details
1031
+	 *
1032
+	 * @access protected
1033
+	 * @return void
1034
+	 */
1035
+	protected function _edit_price_type_details()
1036
+	{
1037
+
1038
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1039
+
1040
+
1041
+		// grab price type ID
1042
+		$PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id'])
1043
+			: false;
1044
+		// change page title based on request action
1045
+		switch ($this->_req_action) {
1046
+			case 'add_new_price_type':
1047
+				$this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso');
1048
+				break;
1049
+			case 'edit_price_type':
1050
+				$this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso');
1051
+				break;
1052
+			default:
1053
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
1054
+		}
1055
+		// add PRT_ID to title if editing
1056
+		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
1057
+
1058
+		if ($PRT_ID) {
1059
+			$price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
1060
+			$additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
1061
+			$this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
1062
+		} else {
1063
+			$price_type = EEM_Price_Type::instance()->get_new_price_type();
1064
+			$this->_set_add_edit_form_tags('insert_price_type');
1065
+		}
1066
+
1067
+		$this->_template_args['PRT_ID'] = $PRT_ID;
1068
+		$this->_template_args['price_type'] = $price_type;
1069
+
1070
+
1071
+		$base_types = EEM_Price_Type::instance()->get_base_types();
1072
+		$select_values = array();
1073
+		foreach ($base_types as $ref => $text) {
1074
+			if ($ref == EEM_Price_Type::base_type_base_price) {
1075
+				// do not allow creation of base_type_base_prices because that's a system only base type.
1076
+				continue;
1077
+			}
1078
+			$values[] = array('id' => $ref, 'text' => $text);
1079
+		}
1080
+
1081
+
1082
+		$this->_template_args['base_type_select'] = EEH_Form_Fields::select_input(
1083
+			'base_type',
1084
+			$values,
1085
+			$price_type->base_type(),
1086
+			'id="price-type-base-type-slct"'
1087
+		);
1088
+		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1089
+		$redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1090
+		$this->_set_publish_post_box_vars('id', $PRT_ID, false, $redirect_URL);
1091
+		// the details template wrapper
1092
+		$this->display_admin_page_with_sidebar();
1093
+	}
1094
+
1095
+
1096
+	/**
1097
+	 *        declare price type details page metaboxes
1098
+	 *
1099
+	 * @access protected
1100
+	 * @return void
1101
+	 */
1102
+	protected function _price_type_details_meta_boxes()
1103
+	{
1104
+		add_meta_box(
1105
+			'edit-price-details-mbox',
1106
+			esc_html__('Price Type Details', 'event_espresso'),
1107
+			array($this, '_edit_price_type_details_meta_box'),
1108
+			$this->wp_page_slug,
1109
+			'normal',
1110
+			'high'
1111
+		);
1112
+	}
1113
+
1114
+
1115
+	/**
1116
+	 *        _edit_price_type_details_meta_box
1117
+	 *
1118
+	 * @access public
1119
+	 * @return void
1120
+	 */
1121
+	public function _edit_price_type_details_meta_box()
1122
+	{
1123
+		echo EEH_Template::display_template(
1124
+			PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php',
1125
+			$this->_template_args,
1126
+			true
1127
+		);
1128
+	}
1129
+
1130
+
1131
+	/**
1132
+	 *        set_price_type_column_values
1133
+	 *
1134
+	 * @access protected
1135
+	 * @return void
1136
+	 */
1137
+	protected function set_price_type_column_values()
1138
+	{
1139
+
1140
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1141
+
1142
+		$base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type']
1143
+			: EEM_Price_Type::base_type_base_price;
1144
+
1145
+		switch ($base_type) {
1146
+			case EEM_Price_Type::base_type_base_price:
1147
+				$this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_base_price;
1148
+				$this->_req_data['PRT_is_percent'] = 0;
1149
+				$this->_req_data['PRT_order'] = 0;
1150
+				break;
1151
+
1152
+			case EEM_Price_Type::base_type_discount:
1153
+				$this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_discount;
1154
+				break;
1155
+
1156
+			case EEM_Price_Type::base_type_surcharge:
1157
+				$this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_surcharge;
1158
+				break;
1159
+
1160
+			case EEM_Price_Type::base_type_tax:
1161
+				$this->_req_data['PBT_ID'] = EEM_Price_Type::base_type_tax;
1162
+				$this->_req_data['PRT_is_percent'] = 1;
1163
+				break;
1164
+		}/**/
1165
+
1166
+		$set_column_values = array(
1167
+			'PRT_name'       => $this->_req_data['PRT_name'],
1168
+			'PBT_ID'         => absint($this->_req_data['PBT_ID']),
1169
+			'PRT_is_percent' => absint($this->_req_data['PRT_is_percent']),
1170
+			'PRT_order'      => absint($this->_req_data['PRT_order']),
1171
+			'PRT_deleted'    => 0,
1172
+		);
1173
+
1174
+		return $set_column_values;
1175
+	}
1176
+
1177
+
1178
+	/**
1179
+	 *        _insert_or_update_price_type
1180
+	 *
1181
+	 * @param boolean $new_price_type - whether to insert or update
1182
+	 * @access protected
1183
+	 * @return void
1184
+	 */
1185
+	protected function _insert_or_update_price_type($new_price_type = false)
1186
+	{
1187
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1188
+
1189
+		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1190
+		$PRT = EEM_Price_Type::instance();
1191
+
1192
+		// why be so pessimistic ???  : (
1193
+		$success = 0;
1194
+
1195
+		$set_column_values = $this->set_price_type_column_values();
1196
+		// is this a new Price ?
1197
+		if ($new_price_type) {
1198
+			// run the insert
1199
+			if ($PRT_ID = $PRT->insert($set_column_values)) {
1200
+				$success = 1;
1201
+			}
1202
+			$action_desc = 'created';
1203
+		} else {
1204
+			$PRT_ID = absint($this->_req_data['PRT_ID']);
1205
+			// run the update
1206
+			$where_cols_n_values = array('PRT_ID' => $PRT_ID);
1207
+			if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1208
+				$success = 1;
1209
+			}
1210
+			$action_desc = 'updated';
1211
+		}
1212
+
1213
+		$query_args = array('action' => 'edit_price_type', 'id' => $PRT_ID);
1214
+		$this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1215
+	}
1216
+
1217
+
1218
+	/**
1219
+	 *        _trash_or_restore_price_type
1220
+	 *
1221
+	 * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)
1222
+	 * @access protected
1223
+	 * @return void
1224
+	 */
1225
+	protected function _trash_or_restore_price_type($trash = true)
1226
+	{
1227
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1228
+
1229
+		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1230
+		$PRT = EEM_Price_Type::instance();
1231
+
1232
+		$success = 1;
1233
+		$PRT_deleted = $trash ? true : false;
1234
+		// Checkboxes
1235
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1236
+			// if array has more than one element than success message should be plural
1237
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1238
+			$what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1239
+			// cycle thru checkboxes
1240
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1241
+				if (! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1242
+					$success = 0;
1243
+				}
1244
+			}
1245
+		} else {
1246
+			// grab single id and delete
1247
+			$PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1248
+			if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1249
+				$success = 0;
1250
+			}
1251
+			$what = 'Price Type';
1252
+		}
1253
+
1254
+		$query_args = array('action' => 'price_types');
1255
+		if ($success) {
1256
+			if ($trash) {
1257
+				$msg = $success > 1
1258
+					? esc_html__('The Price Types have been trashed.', 'event_espresso')
1259
+					: esc_html__(
1260
+						'The Price Type has been trashed.',
1261
+						'event_espresso'
1262
+					);
1263
+			} else {
1264
+				$msg = $success > 1
1265
+					? esc_html__('The Price Types have been restored.', 'event_espresso')
1266
+					: esc_html__(
1267
+						'The Price Type has been restored.',
1268
+						'event_espresso'
1269
+					);
1270
+			}
1271
+			EE_Error::add_success($msg);
1272
+		}
1273
+
1274
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1275
+	}
1276
+
1277
+
1278
+	/**
1279
+	 *        _delete_price_type
1280
+	 *
1281
+	 * @access protected
1282
+	 * @return void
1283
+	 */
1284
+	protected function _delete_price_type()
1285
+	{
1286
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1287
+
1288
+		$PRT = EEM_Price_Type::instance();
1289
+
1290
+		$success = 1;
1291
+		// Checkboxes
1292
+		if (! empty($this->_req_data['checkbox'])) {
1293
+			// if array has more than one element than success message should be plural
1294
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1295
+			$what = $PRT->item_name($success);
1296
+			// cycle thru bulk action checkboxes
1297
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1298
+				if (! $PRT->delete_permanently_by_ID($PRT_ID)) {
1299
+					$success = 0;
1300
+				}
1301
+			}
1302
+		}
1303
+
1304
+
1305
+		$query_args = array('action' => 'price_types');
1306
+		$this->_redirect_after_action($success, $what, 'deleted', $query_args);
1307
+	}
1308
+
1309
+
1310
+	/**
1311
+	 *        _learn_more_about_pricing_link
1312
+	 *
1313
+	 * @access protected
1314
+	 * @return string
1315
+	 */
1316
+	protected function _learn_more_about_pricing_link()
1317
+	{
1318
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . esc_html__(
1319
+			'learn more about how pricing works',
1320
+			'event_espresso'
1321
+		) . '</a>';
1322
+	}
1323
+
1324
+
1325
+	protected function _tax_settings()
1326
+	{
1327
+		$this->_set_add_edit_form_tags('update_tax_settings');
1328
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
1329
+		$this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html();
1330
+		$this->display_admin_page_with_sidebar();
1331
+	}
1332
+
1333
+
1334
+	/**
1335
+	 * @return \EE_Form_Section_Proper
1336
+	 * @throws \EE_Error
1337
+	 */
1338
+	protected function tax_settings_form()
1339
+	{
1340
+		return new EE_Form_Section_Proper(
1341
+			array(
1342
+				'name'            => 'tax_settings_form',
1343
+				'html_id'         => 'tax_settings_form',
1344
+				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1345
+				'subsections'     => apply_filters(
1346
+					'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections',
1347
+					array(
1348
+						'tax_settings' => new EE_Form_Section_Proper(
1349
+							array(
1350
+								'name'            => 'tax_settings_tbl',
1351
+								'html_id'         => 'tax_settings_tbl',
1352
+								'html_class'      => 'form-table',
1353
+								'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1354
+								'subsections'     => array(
1355
+									'prices_displayed_including_taxes' => new EE_Yes_No_Input(
1356
+										array(
1357
+											'html_label_text'         => esc_html__(
1358
+												"Show Prices With Taxes Included?",
1359
+												'event_espresso'
1360
+											),
1361
+											'html_help_text'          => esc_html__(
1362
+												'Indicates whether or not to display prices with the taxes included',
1363
+												'event_espresso'
1364
+											),
1365
+											'default'                 => isset(
1366
+												EE_Registry::instance()
1367
+													->CFG
1368
+													->tax_settings
1369
+													->prices_displayed_including_taxes
1370
+											)
1371
+												? EE_Registry::instance()
1372
+													->CFG
1373
+													->tax_settings
1374
+													->prices_displayed_including_taxes
1375
+												: true,
1376
+											'display_html_label_text' => false,
1377
+										)
1378
+									),
1379
+								),
1380
+							)
1381
+						),
1382
+					)
1383
+				),
1384
+			)
1385
+		);
1386
+	}
1387
+
1388
+
1389
+	/**
1390
+	 * _update_tax_settings
1391
+	 *
1392
+	 * @since 4.9.13
1393
+	 * @return void
1394
+	 */
1395
+	public function _update_tax_settings()
1396
+	{
1397
+		if (! isset(EE_Registry::instance()->CFG->tax_settings)) {
1398
+			EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config();
1399
+		}
1400
+		try {
1401
+			$tax_form = $this->tax_settings_form();
1402
+			// check for form submission
1403
+			if ($tax_form->was_submitted()) {
1404
+				// capture form data
1405
+				$tax_form->receive_form_submission();
1406
+				// validate form data
1407
+				if ($tax_form->is_valid()) {
1408
+					// grab validated data from form
1409
+					$valid_data = $tax_form->valid_data();
1410
+					// set data on config
1411
+					EE_Registry::instance()
1412
+						->CFG
1413
+						->tax_settings
1414
+						->prices_displayed_including_taxes
1415
+						= $valid_data['tax_settings']['prices_displayed_including_taxes'];
1416
+				} else {
1417
+					if ($tax_form->submission_error_message() !== '') {
1418
+						EE_Error::add_error(
1419
+							$tax_form->submission_error_message(),
1420
+							__FILE__,
1421
+							__FUNCTION__,
1422
+							__LINE__
1423
+						);
1424
+					}
1425
+				}
1426
+			}
1427
+		} catch (EE_Error $e) {
1428
+			EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__);
1429
+		}
1430
+
1431
+		$what = 'Tax Settings';
1432
+		$success = $this->_update_espresso_configuration(
1433
+			$what,
1434
+			EE_Registry::instance()->CFG->tax_settings,
1435
+			__FILE__,
1436
+			__FUNCTION__,
1437
+			__LINE__
1438
+		);
1439
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings'));
1440
+	}
1441 1441
 }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         wp_enqueue_style('espresso-ui-theme');
368 368
         wp_register_style(
369 369
             'espresso_PRICING',
370
-            PRICING_ASSETS_URL . 'espresso_pricing_admin.css',
370
+            PRICING_ASSETS_URL.'espresso_pricing_admin.css',
371 371
             array(),
372 372
             EVENT_ESPRESSO_VERSION
373 373
         );
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         // wp_enqueue_script('jquery-ui-datepicker');
383 383
         wp_register_script(
384 384
             'espresso_PRICING',
385
-            PRICING_ASSETS_URL . 'espresso_pricing_admin.js',
385
+            PRICING_ASSETS_URL.'espresso_pricing_admin.js',
386 386
             array('jquery'),
387 387
             EVENT_ESPRESSO_VERSION,
388 388
             true
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      */
478 478
     protected function _price_overview_list_table()
479 479
     {
480
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
480
+        $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
481 481
             'add_new_price',
482 482
             'add',
483 483
             array(),
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
         // start with an empty array
506 506
         $event_pricing = array();
507 507
 
508
-        require_once(PRICING_ADMIN . 'Prices_List_Table.class.php');
509
-        require_once(EE_MODELS . 'EEM_Price.model.php');
508
+        require_once(PRICING_ADMIN.'Prices_List_Table.class.php');
509
+        require_once(EE_MODELS.'EEM_Price.model.php');
510 510
         // $PRC = EEM_Price::instance();
511 511
 
512 512
         $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
         $limit = array($offset, $per_page);
542 542
 
543 543
         if (isset($this->_req_data['s'])) {
544
-            $sstr = '%' . $this->_req_data['s'] . '%';
544
+            $sstr = '%'.$this->_req_data['s'].'%';
545 545
             $_where['OR'] = array(
546 546
                 'PRC_name'            => array('LIKE', $sstr),
547 547
                 'PRC_desc'            => array('LIKE', $sstr),
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
                 $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
591 591
         }
592 592
         // add PRC_ID to title if editing
593
-        $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
593
+        $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title;
594 594
 
595 595
         // get prices
596
-        require_once(EE_MODELS . 'EEM_Price.model.php');
596
+        require_once(EE_MODELS.'EEM_Price.model.php');
597 597
         $PRC = EEM_Price::instance();
598 598
 
599 599
         if ($PRC_ID) {
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
         $this->_template_args['price'] = $price;
612 612
 
613 613
         // get price types
614
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
614
+        require_once(EE_MODELS.'EEM_Price_Type.model.php');
615 615
         $PRT = EEM_Price_Type::instance();
616 616
         $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
617 617
         $price_type_names = array();
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
     public function _edit_price_details_meta_box()
668 668
     {
669 669
         echo EEH_Template::display_template(
670
-            PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php',
670
+            PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php',
671 671
             $this->_template_args,
672 672
             true
673 673
         );
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
         // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
714 714
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
715 715
 
716
-        require_once(EE_MODELS . 'EEM_Price.model.php');
716
+        require_once(EE_MODELS.'EEM_Price.model.php');
717 717
         $PRC = EEM_Price::instance();
718 718
 
719 719
         // why be so pessimistic ???  : (
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
         // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
787 787
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
788 788
 
789
-        require_once(EE_MODELS . 'EEM_Price.model.php');
789
+        require_once(EE_MODELS.'EEM_Price.model.php');
790 790
         $PRC = EEM_Price::instance();
791 791
 
792 792
         $success = 1;
@@ -795,12 +795,12 @@  discard block
 block discarded – undo
795 795
         // get base ticket for updating
796 796
         $ticket = EEM_Ticket::instance()->get_one_by_ID(1);
797 797
         // Checkboxes
798
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
798
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
799 799
             // if array has more than one element than success message should be plural
800 800
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
801 801
             // cycle thru checkboxes
802 802
             while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
803
-                if (! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
803
+                if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
804 804
                     $success = 0;
805 805
                 } else {
806 806
                     $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
@@ -873,24 +873,24 @@  discard block
 block discarded – undo
873 873
         // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
874 874
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
875 875
 
876
-        require_once(EE_MODELS . 'EEM_Price.model.php');
876
+        require_once(EE_MODELS.'EEM_Price.model.php');
877 877
         $PRC = EEM_Price::instance();
878 878
 
879 879
         $success = 1;
880 880
         // Checkboxes
881
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
881
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
882 882
             // if array has more than one element than success message should be plural
883 883
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
884 884
             // cycle thru bulk action checkboxes
885 885
             while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
886
-                if (! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
886
+                if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
887 887
                     $success = 0;
888 888
                 }
889 889
             }
890 890
         } else {
891 891
             // grab single id and delete
892 892
             $PRC_ID = absint($this->_req_data['id']);
893
-            if (! $PRC->delete_permanently_by_ID($PRC_ID)) {
893
+            if ( ! $PRC->delete_permanently_by_ID($PRC_ID)) {
894 894
                 $success = 0;
895 895
             }
896 896
         }
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
         if (is_array($row_ids)) {
916 916
             for ($i = 0; $i < count($row_ids); $i++) {
917 917
                 // Update the prices when re-ordering
918
-                $id = absint($row_ids[ $i ]);
918
+                $id = absint($row_ids[$i]);
919 919
                 if (
920 920
                     EEM_Price::instance()->update(
921 921
                         array('PRC_order' => $i + 1),
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
      */
954 954
     protected function _price_types_overview_list_table()
955 955
     {
956
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
956
+        $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
957 957
             'add_new_price_type',
958 958
             'add_type',
959 959
             array(),
@@ -980,8 +980,8 @@  discard block
 block discarded – undo
980 980
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
981 981
         // start with an empty array
982 982
 
983
-        require_once(PRICING_ADMIN . 'Price_Types_List_Table.class.php');
984
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
983
+        require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php');
984
+        require_once(EE_MODELS.'EEM_Price_Type.model.php');
985 985
 
986 986
         $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
987 987
         $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
         $_where = array('PRT_deleted' => $trashed, 'PBT_ID' => array('!=', 1));
1007 1007
 
1008 1008
         if (isset($this->_req_data['s'])) {
1009
-            $sstr = '%' . $this->_req_data['s'] . '%';
1009
+            $sstr = '%'.$this->_req_data['s'].'%';
1010 1010
             $_where['OR'] = array(
1011 1011
                 'PRT_name' => array('LIKE', $sstr),
1012 1012
             );
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
                 $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
1054 1054
         }
1055 1055
         // add PRT_ID to title if editing
1056
-        $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
1056
+        $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title;
1057 1057
 
1058 1058
         if ($PRT_ID) {
1059 1059
             $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
     public function _edit_price_type_details_meta_box()
1122 1122
     {
1123 1123
         echo EEH_Template::display_template(
1124
-            PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php',
1124
+            PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php',
1125 1125
             $this->_template_args,
1126 1126
             true
1127 1127
         );
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
     {
1187 1187
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1188 1188
 
1189
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1189
+        require_once(EE_MODELS.'EEM_Price_Type.model.php');
1190 1190
         $PRT = EEM_Price_Type::instance();
1191 1191
 
1192 1192
         // why be so pessimistic ???  : (
@@ -1226,19 +1226,19 @@  discard block
 block discarded – undo
1226 1226
     {
1227 1227
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1228 1228
 
1229
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1229
+        require_once(EE_MODELS.'EEM_Price_Type.model.php');
1230 1230
         $PRT = EEM_Price_Type::instance();
1231 1231
 
1232 1232
         $success = 1;
1233 1233
         $PRT_deleted = $trash ? true : false;
1234 1234
         // Checkboxes
1235
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1235
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1236 1236
             // if array has more than one element than success message should be plural
1237 1237
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1238 1238
             $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1239 1239
             // cycle thru checkboxes
1240 1240
             while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1241
-                if (! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1241
+                if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1242 1242
                     $success = 0;
1243 1243
                 }
1244 1244
             }
@@ -1289,13 +1289,13 @@  discard block
 block discarded – undo
1289 1289
 
1290 1290
         $success = 1;
1291 1291
         // Checkboxes
1292
-        if (! empty($this->_req_data['checkbox'])) {
1292
+        if ( ! empty($this->_req_data['checkbox'])) {
1293 1293
             // if array has more than one element than success message should be plural
1294 1294
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1295 1295
             $what = $PRT->item_name($success);
1296 1296
             // cycle thru bulk action checkboxes
1297 1297
             while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1298
-                if (! $PRT->delete_permanently_by_ID($PRT_ID)) {
1298
+                if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) {
1299 1299
                     $success = 0;
1300 1300
                 }
1301 1301
             }
@@ -1315,10 +1315,10 @@  discard block
 block discarded – undo
1315 1315
      */
1316 1316
     protected function _learn_more_about_pricing_link()
1317 1317
     {
1318
-        return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . esc_html__(
1318
+        return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.esc_html__(
1319 1319
             'learn more about how pricing works',
1320 1320
             'event_espresso'
1321
-        ) . '</a>';
1321
+        ).'</a>';
1322 1322
     }
1323 1323
 
1324 1324
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
      */
1395 1395
     public function _update_tax_settings()
1396 1396
     {
1397
-        if (! isset(EE_Registry::instance()->CFG->tax_settings)) {
1397
+        if ( ! isset(EE_Registry::instance()->CFG->tax_settings)) {
1398 1398
             EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config();
1399 1399
         }
1400 1400
         try {
Please login to merge, or discard this patch.
caffeinated/admin/new/tickets/Tickets_Admin_Page_Init.core.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -28,51 +28,51 @@
 block discarded – undo
28 28
 {
29 29
 
30 30
 
31
-    /**
32
-     *        constructor
33
-     *
34
-     * @Constructor
35
-     * @access public
36
-     * @return void
37
-     */
38
-    public function __construct()
39
-    {
31
+	/**
32
+	 *        constructor
33
+	 *
34
+	 * @Constructor
35
+	 * @access public
36
+	 * @return void
37
+	 */
38
+	public function __construct()
39
+	{
40 40
 
41
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
41
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
42 42
 
43
-        define('TICKETS_PG_SLUG', 'tickets');
44
-        define('TICKETS_LABEL', esc_html__('Default Tickets', 'event_espresso'));
45
-        define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . TICKETS_PG_SLUG . '/');
46
-        define('TICKETS_ADMIN_URL', admin_url('admin.php?page=' . TICKETS_PG_SLUG));
47
-        define('TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets/');
48
-        define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/assets/');
49
-        define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates/');
50
-        define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/templates/');
43
+		define('TICKETS_PG_SLUG', 'tickets');
44
+		define('TICKETS_LABEL', esc_html__('Default Tickets', 'event_espresso'));
45
+		define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . TICKETS_PG_SLUG . '/');
46
+		define('TICKETS_ADMIN_URL', admin_url('admin.php?page=' . TICKETS_PG_SLUG));
47
+		define('TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets/');
48
+		define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/assets/');
49
+		define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates/');
50
+		define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/templates/');
51 51
 
52
-        parent::__construct();
53
-        $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS;
54
-    }
52
+		parent::__construct();
53
+		$this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS;
54
+	}
55 55
 
56 56
 
57
-    protected function _set_init_properties()
58
-    {
59
-        $this->label = TICKETS_LABEL;
60
-    }
57
+	protected function _set_init_properties()
58
+	{
59
+		$this->label = TICKETS_LABEL;
60
+	}
61 61
 
62 62
 
63
-    protected function _set_menu_map()
64
-    {
65
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
66
-            array(
67
-                'menu_group'      => 'management',
68
-                'menu_order'      => 15,
69
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
70
-                'parent_slug'     => 'espresso_events',
71
-                'menu_slug'       => TICKETS_PG_SLUG,
72
-                'menu_label'      => TICKETS_LABEL,
73
-                'capability'      => 'ee_read_default_tickets',
74
-                'admin_init_page' => $this,
75
-            )
76
-        );
77
-    }
63
+	protected function _set_menu_map()
64
+	{
65
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
66
+			array(
67
+				'menu_group'      => 'management',
68
+				'menu_order'      => 15,
69
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
70
+				'parent_slug'     => 'espresso_events',
71
+				'menu_slug'       => TICKETS_PG_SLUG,
72
+				'menu_label'      => TICKETS_LABEL,
73
+				'capability'      => 'ee_read_default_tickets',
74
+				'admin_init_page' => $this,
75
+			)
76
+		);
77
+	}
78 78
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@
 block discarded – undo
42 42
 
43 43
         define('TICKETS_PG_SLUG', 'tickets');
44 44
         define('TICKETS_LABEL', esc_html__('Default Tickets', 'event_espresso'));
45
-        define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . TICKETS_PG_SLUG . '/');
46
-        define('TICKETS_ADMIN_URL', admin_url('admin.php?page=' . TICKETS_PG_SLUG));
47
-        define('TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets/');
48
-        define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/assets/');
49
-        define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates/');
50
-        define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/templates/');
45
+        define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN.'new/'.TICKETS_PG_SLUG.'/');
46
+        define('TICKETS_ADMIN_URL', admin_url('admin.php?page='.TICKETS_PG_SLUG));
47
+        define('TICKETS_ASSETS_PATH', TICKETS_ADMIN.'assets/');
48
+        define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new/'.TICKETS_PG_SLUG.'/assets/');
49
+        define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN.'templates/');
50
+        define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new/'.TICKETS_PG_SLUG.'/templates/');
51 51
 
52 52
         parent::__construct();
53
-        $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS;
53
+        $this->_folder_path = EE_CORE_CAF_ADMIN.'new/'.$this->_folder_name.DS;
54 54
     }
55 55
 
56 56
 
Please login to merge, or discard this patch.
caffeinated/admin/new/tickets/Tickets_List_Table.class.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -18,153 +18,153 @@
 block discarded – undo
18 18
 {
19 19
 
20 20
 
21
-    protected function _setup_data()
22
-    {
23
-        $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
24
-        $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed);
25
-        $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false);
26
-        $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true);
27
-    }
28
-
29
-
30
-    protected function _set_properties()
31
-    {
32
-        $this->_wp_list_args = array(
33
-            'singular' => esc_html__('ticket', 'event_espresso'),
34
-            'plural'   => esc_html__('tickets', 'event_espresso'),
35
-            'ajax'     => true,
36
-            'screen'   => $this->_admin_page->get_current_screen()->id,
37
-        );
38
-
39
-        $this->_columns = array(
40
-            'cb'              => '<input type="checkbox" />', // Render a checkbox instead of text
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
-            'TKT_name'        => array('TKT_name', true),
54
-            'TKT_description' => array('TKT_description', false),
55
-            'TKT_qty'         => array('TKT_qty', false),
56
-            'TKT_uses'        => array('TKT_uses', false),
57
-            'TKT_min'         => array('TKT_min', false),
58
-            'TKT_max'         => array('TKT_max', false),
59
-            'TKT_price'       => array('TKT_price', false),
60
-        );
61
-
62
-        $this->_hidden_columns = array();
63
-    }
64
-
65
-
66
-    protected function _get_table_filters()
67
-    {
68
-    }
69
-
70
-
71
-    protected function _add_view_counts()
72
-    {
73
-        $this->_views['all']['count'] = $this->_all_data_count;
74
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) {
75
-            $this->_views['trashed']['count'] = $this->_trashed_count;
76
-        }
77
-    }
78
-
79
-
80
-    public function column_cb($item)
81
-    {
82
-        return $item->ID() === 1
83
-            ? '<span class="ee-lock-icon"></span>'
84
-            : sprintf(
85
-                '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
86
-                $item->ID()
87
-            );
88
-    }
89
-
90
-
91
-    public function column_TKT_name($item)
92
-    {
93
-        // build row actions
94
-        $actions = array();
95
-
96
-        // trash links
97
-        if ($item->ID() !== 1) {
98
-            if ($this->_view == 'all') {
99
-                $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
100
-                    'action' => 'trash_ticket',
101
-                    'TKT_ID' => $item->ID(),
102
-                ), TICKETS_ADMIN_URL);
103
-                $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="'
104
-                                    . esc_attr__('Move Ticket to trash', 'event_espresso') . '">'
105
-                                    . esc_html__('Trash', 'event_espresso') . '</a>';
106
-            } else {
107
-                // restore price link
108
-                $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
109
-                    'action' => 'restore_ticket',
110
-                    'TKT_ID' => $item->ID(),
111
-                ), TICKETS_ADMIN_URL);
112
-                $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="'
113
-                                      . esc_attr__('Restore Ticket', 'event_espresso') . '">'
114
-                                      . esc_html__('Restore', 'event_espresso') . '</a>';
115
-                // delete price link
116
-                $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
117
-                    'action' => 'delete_ticket',
118
-                    'TKT_ID' => $item->ID(),
119
-                ), TICKETS_ADMIN_URL);
120
-                $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="'
121
-                                     . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">'
122
-                                     . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
123
-            }
124
-        }
125
-
126
-        return $item->get('TKT_name') . $this->row_actions($actions);
127
-    }
128
-
129
-
130
-    public function column_TKT_description($item)
131
-    {
132
-        return $item->get('TKT_description');
133
-    }
134
-
135
-
136
-    public function column_TKT_qty($item)
137
-    {
138
-        return $item->get_pretty('TKT_qty', 'text');
139
-    }
140
-
141
-
142
-    public function column_TKT_uses($item)
143
-    {
144
-        return $item->get_pretty('TKT_uses', 'text');
145
-    }
146
-
147
-
148
-    public function column_TKT_min($item)
149
-    {
150
-        return $item->get('TKT_min');
151
-    }
152
-
153
-
154
-    public function column_TKT_max($item)
155
-    {
156
-        return $item->get_pretty('TKT_max', 'text');
157
-    }
158
-
159
-
160
-    public function column_TKT_price($item)
161
-    {
162
-        return EEH_Template::format_currency($item->get('TKT_price'));
163
-    }
164
-
165
-
166
-    public function column_TKT_taxable($item)
167
-    {
168
-        return $item->get('TKT_taxable') ? esc_html__('Yes', 'event_espresso') : esc_html__('No', 'event_espresso');
169
-    }
21
+	protected function _setup_data()
22
+	{
23
+		$trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
24
+		$this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed);
25
+		$this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false);
26
+		$this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true);
27
+	}
28
+
29
+
30
+	protected function _set_properties()
31
+	{
32
+		$this->_wp_list_args = array(
33
+			'singular' => esc_html__('ticket', 'event_espresso'),
34
+			'plural'   => esc_html__('tickets', 'event_espresso'),
35
+			'ajax'     => true,
36
+			'screen'   => $this->_admin_page->get_current_screen()->id,
37
+		);
38
+
39
+		$this->_columns = array(
40
+			'cb'              => '<input type="checkbox" />', // Render a checkbox instead of text
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
+			'TKT_name'        => array('TKT_name', true),
54
+			'TKT_description' => array('TKT_description', false),
55
+			'TKT_qty'         => array('TKT_qty', false),
56
+			'TKT_uses'        => array('TKT_uses', false),
57
+			'TKT_min'         => array('TKT_min', false),
58
+			'TKT_max'         => array('TKT_max', false),
59
+			'TKT_price'       => array('TKT_price', false),
60
+		);
61
+
62
+		$this->_hidden_columns = array();
63
+	}
64
+
65
+
66
+	protected function _get_table_filters()
67
+	{
68
+	}
69
+
70
+
71
+	protected function _add_view_counts()
72
+	{
73
+		$this->_views['all']['count'] = $this->_all_data_count;
74
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) {
75
+			$this->_views['trashed']['count'] = $this->_trashed_count;
76
+		}
77
+	}
78
+
79
+
80
+	public function column_cb($item)
81
+	{
82
+		return $item->ID() === 1
83
+			? '<span class="ee-lock-icon"></span>'
84
+			: sprintf(
85
+				'<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
86
+				$item->ID()
87
+			);
88
+	}
89
+
90
+
91
+	public function column_TKT_name($item)
92
+	{
93
+		// build row actions
94
+		$actions = array();
95
+
96
+		// trash links
97
+		if ($item->ID() !== 1) {
98
+			if ($this->_view == 'all') {
99
+				$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
100
+					'action' => 'trash_ticket',
101
+					'TKT_ID' => $item->ID(),
102
+				), TICKETS_ADMIN_URL);
103
+				$actions['trash'] = '<a href="' . $trash_lnk_url . '" title="'
104
+									. esc_attr__('Move Ticket to trash', 'event_espresso') . '">'
105
+									. esc_html__('Trash', 'event_espresso') . '</a>';
106
+			} else {
107
+				// restore price link
108
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
109
+					'action' => 'restore_ticket',
110
+					'TKT_ID' => $item->ID(),
111
+				), TICKETS_ADMIN_URL);
112
+				$actions['restore'] = '<a href="' . $restore_lnk_url . '" title="'
113
+									  . esc_attr__('Restore Ticket', 'event_espresso') . '">'
114
+									  . esc_html__('Restore', 'event_espresso') . '</a>';
115
+				// delete price link
116
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
117
+					'action' => 'delete_ticket',
118
+					'TKT_ID' => $item->ID(),
119
+				), TICKETS_ADMIN_URL);
120
+				$actions['delete'] = '<a href="' . $delete_lnk_url . '" title="'
121
+									 . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">'
122
+									 . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
123
+			}
124
+		}
125
+
126
+		return $item->get('TKT_name') . $this->row_actions($actions);
127
+	}
128
+
129
+
130
+	public function column_TKT_description($item)
131
+	{
132
+		return $item->get('TKT_description');
133
+	}
134
+
135
+
136
+	public function column_TKT_qty($item)
137
+	{
138
+		return $item->get_pretty('TKT_qty', 'text');
139
+	}
140
+
141
+
142
+	public function column_TKT_uses($item)
143
+	{
144
+		return $item->get_pretty('TKT_uses', 'text');
145
+	}
146
+
147
+
148
+	public function column_TKT_min($item)
149
+	{
150
+		return $item->get('TKT_min');
151
+	}
152
+
153
+
154
+	public function column_TKT_max($item)
155
+	{
156
+		return $item->get_pretty('TKT_max', 'text');
157
+	}
158
+
159
+
160
+	public function column_TKT_price($item)
161
+	{
162
+		return EEH_Template::format_currency($item->get('TKT_price'));
163
+	}
164
+
165
+
166
+	public function column_TKT_taxable($item)
167
+	{
168
+		return $item->get('TKT_taxable') ? esc_html__('Yes', 'event_espresso') : esc_html__('No', 'event_espresso');
169
+	}
170 170
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -100,30 +100,30 @@
 block discarded – undo
100 100
                     'action' => 'trash_ticket',
101 101
                     'TKT_ID' => $item->ID(),
102 102
                 ), TICKETS_ADMIN_URL);
103
-                $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="'
104
-                                    . esc_attr__('Move Ticket to trash', 'event_espresso') . '">'
105
-                                    . esc_html__('Trash', 'event_espresso') . '</a>';
103
+                $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'
104
+                                    . esc_attr__('Move Ticket to trash', 'event_espresso').'">'
105
+                                    . esc_html__('Trash', 'event_espresso').'</a>';
106 106
             } else {
107 107
                 // restore price link
108 108
                 $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
109 109
                     'action' => 'restore_ticket',
110 110
                     'TKT_ID' => $item->ID(),
111 111
                 ), TICKETS_ADMIN_URL);
112
-                $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="'
113
-                                      . esc_attr__('Restore Ticket', 'event_espresso') . '">'
114
-                                      . esc_html__('Restore', 'event_espresso') . '</a>';
112
+                $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'
113
+                                      . esc_attr__('Restore Ticket', 'event_espresso').'">'
114
+                                      . esc_html__('Restore', 'event_espresso').'</a>';
115 115
                 // delete price link
116 116
                 $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
117 117
                     'action' => 'delete_ticket',
118 118
                     'TKT_ID' => $item->ID(),
119 119
                 ), TICKETS_ADMIN_URL);
120
-                $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="'
121
-                                     . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">'
122
-                                     . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
120
+                $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'
121
+                                     . esc_attr__('Delete Ticket Permanently', 'event_espresso').'">'
122
+                                     . esc_html__('Delete Permanently', 'event_espresso').'</a>';
123 123
             }
124 124
         }
125 125
 
126
-        return $item->get('TKT_name') . $this->row_actions($actions);
126
+        return $item->get('TKT_name').$this->row_actions($actions);
127 127
     }
128 128
 
129 129
 
Please login to merge, or discard this patch.
declined_registration/EE_Declined_Registration_message_type.class.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -15,47 +15,47 @@
 block discarded – undo
15 15
 class EE_Declined_Registration_message_type extends EE_Registration_Base_message_type
16 16
 {
17 17
 
18
-    public function __construct()
19
-    {
20
-        $this->name = 'declined_registration';
21
-        $this->description = esc_html__('This message type is for messages sent to registrants when their registration is declined.', 'event_espresso');
22
-        $this->label = array(
23
-            'singular' => esc_html__('registration declined', 'event_espresso'),
24
-            'plural' => esc_html__('registrations declined', 'event_espresso')
25
-            );
26
-        $this->_master_templates = array(
27
-            'email' => 'not_approved_registration'
28
-            );
29
-        parent::__construct();
30
-    }
31
-
32
-
33
-
34
-
35
-    /**
36
-     * _set_contexts
37
-     * This sets up the contexts associated with the message_type
38
-     *
39
-     * @access  protected
40
-     * @return  void
41
-     */
42
-    protected function _set_contexts()
43
-    {
44
-        $this->_context_label = array(
45
-            'label' => esc_html__('recipient', 'event_espresso'),
46
-            'plural' => esc_html__('recipients', 'event_espresso'),
47
-            'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different registration details sent out depending on who the recipient is', 'event_espresso')
48
-            );
49
-
50
-        $this->_contexts = array(
51
-            'admin' => array(
52
-                'label' => esc_html__('Event Admin', 'event_espresso'),
53
-                'description' => esc_html__('This template is what event administrators will receive with an declined registration', 'event_espresso')
54
-                ),
55
-            'attendee' => array(
56
-                'label' => esc_html__('Registrant', 'event_espresso'),
57
-                'description' => esc_html__('This template is what each registrant for the event will receive when their registration is declined.', 'event_espresso')
58
-                )
59
-            );
60
-    }
18
+	public function __construct()
19
+	{
20
+		$this->name = 'declined_registration';
21
+		$this->description = esc_html__('This message type is for messages sent to registrants when their registration is declined.', 'event_espresso');
22
+		$this->label = array(
23
+			'singular' => esc_html__('registration declined', 'event_espresso'),
24
+			'plural' => esc_html__('registrations declined', 'event_espresso')
25
+			);
26
+		$this->_master_templates = array(
27
+			'email' => 'not_approved_registration'
28
+			);
29
+		parent::__construct();
30
+	}
31
+
32
+
33
+
34
+
35
+	/**
36
+	 * _set_contexts
37
+	 * This sets up the contexts associated with the message_type
38
+	 *
39
+	 * @access  protected
40
+	 * @return  void
41
+	 */
42
+	protected function _set_contexts()
43
+	{
44
+		$this->_context_label = array(
45
+			'label' => esc_html__('recipient', 'event_espresso'),
46
+			'plural' => esc_html__('recipients', 'event_espresso'),
47
+			'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different registration details sent out depending on who the recipient is', 'event_espresso')
48
+			);
49
+
50
+		$this->_contexts = array(
51
+			'admin' => array(
52
+				'label' => esc_html__('Event Admin', 'event_espresso'),
53
+				'description' => esc_html__('This template is what event administrators will receive with an declined registration', 'event_espresso')
54
+				),
55
+			'attendee' => array(
56
+				'label' => esc_html__('Registrant', 'event_espresso'),
57
+				'description' => esc_html__('This template is what each registrant for the event will receive when their registration is declined.', 'event_espresso')
58
+				)
59
+			);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
message_type/newsletter/EE_Messages_Contacts_incoming_data.class.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -13,109 +13,109 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @since    4.3.0
20
-     * @param  EE_Attendee[]     $data expecting an array of EE_Attendee objects.
21
-     * @throws EE_Error
22
-     * @access protected
23
-     */
24
-    public function __construct($data = array())
25
-    {
26
-
27
-        // validate that the first element in the array is an EE_Attendee object.  Note that the array may be indexed by REG_ID so we will just shift off the first element.
28
-        $ctc_chk = reset($data);
29
-        if (! $ctc_chk instanceof EE_Attendee) {
30
-            throw new EE_Error(esc_html__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso'));
31
-        }
32
-
33
-        parent::__construct($data);
34
-    }
35
-
36
-
37
-    /**
38
-     * @see parent class for phpdocs.
39
-     * @param array $attendees
40
-     * @return array
41
-     */
42
-    public static function convert_data_for_persistent_storage($attendees)
43
-    {
44
-        $attendee_ids = array_filter(
45
-            array_map(
46
-                function ($attendee) {
47
-                    if ($attendee instanceof EE_Attendee) {
48
-                        return $attendee->ID();
49
-                    }
50
-                    return false;
51
-                },
52
-                $attendees
53
-            )
54
-        );
55
-        return $attendee_ids;
56
-    }
57
-
58
-
59
-
60
-
61
-    /**
62
-     * @see parent class for phpdocs
63
-     * @param array $attendee_ids
64
-     * @return EE_Attendee[]
65
-     */
66
-    public static function convert_data_from_persistent_storage($attendee_ids)
67
-    {
68
-        $attendee_ids = (array) $attendee_ids;
69
-        $attendees = EEM_Attendee::instance()->get_all(
70
-            array(
71
-              array( 'ATT_ID' => array( 'IN', $attendee_ids ) )
72
-            )
73
-        );
74
-        return $attendees;
75
-    }
76
-
77
-
78
-
79
-
80
-    /**
81
-     * setup the data.
82
-     *
83
-     * Sets up the expected data object for the messages prep using incoming registration objects.
84
-     *
85
-     * @since   4.3.0
86
-     *
87
-     * @return void
88
-     * @access protected
89
-     */
90
-    protected function _setup_data()
91
-    {
92
-
93
-        // we'll loop through each contact and setup the data needed.  Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact).
94
-        $this->txn = null;
95
-        $this->taxes = null;
96
-        $this->grand_total_price_object = '';
97
-        $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = '';
98
-        $this->payment = null;
99
-        $this->billing = array();
100
-        $this->reg_objs = array();
101
-        $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer =  $this->registrations = array();
102
-        $this->total_ticket_count = 0;
103
-        $this->primary_attendee_data = array(
104
-            'registration_id' => 0,
105
-            'att_obj' => null,
106
-            'reg_obj' => null,
107
-            'primary_att_obj' => null,
108
-            'primary_reg_obj' => null
109
-            );
110
-
111
-        foreach ($this->_data as $contact) {
112
-            $id = $contact->ID();
113
-            $reg = $contact->get_first_related('Registration');
114
-            $this->attendees[ $id ]['att_obj'] = $contact;
115
-            $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg;
116
-            $this->attendees[ $id ]['attendee_email'] = $contact->email();
117
-            $this->attendees[ $id ]['tkt_objs'] = array();
118
-            $this->attendees[ $id ]['evt_objs'] = array();
119
-        }
120
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @since    4.3.0
20
+	 * @param  EE_Attendee[]     $data expecting an array of EE_Attendee objects.
21
+	 * @throws EE_Error
22
+	 * @access protected
23
+	 */
24
+	public function __construct($data = array())
25
+	{
26
+
27
+		// validate that the first element in the array is an EE_Attendee object.  Note that the array may be indexed by REG_ID so we will just shift off the first element.
28
+		$ctc_chk = reset($data);
29
+		if (! $ctc_chk instanceof EE_Attendee) {
30
+			throw new EE_Error(esc_html__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso'));
31
+		}
32
+
33
+		parent::__construct($data);
34
+	}
35
+
36
+
37
+	/**
38
+	 * @see parent class for phpdocs.
39
+	 * @param array $attendees
40
+	 * @return array
41
+	 */
42
+	public static function convert_data_for_persistent_storage($attendees)
43
+	{
44
+		$attendee_ids = array_filter(
45
+			array_map(
46
+				function ($attendee) {
47
+					if ($attendee instanceof EE_Attendee) {
48
+						return $attendee->ID();
49
+					}
50
+					return false;
51
+				},
52
+				$attendees
53
+			)
54
+		);
55
+		return $attendee_ids;
56
+	}
57
+
58
+
59
+
60
+
61
+	/**
62
+	 * @see parent class for phpdocs
63
+	 * @param array $attendee_ids
64
+	 * @return EE_Attendee[]
65
+	 */
66
+	public static function convert_data_from_persistent_storage($attendee_ids)
67
+	{
68
+		$attendee_ids = (array) $attendee_ids;
69
+		$attendees = EEM_Attendee::instance()->get_all(
70
+			array(
71
+			  array( 'ATT_ID' => array( 'IN', $attendee_ids ) )
72
+			)
73
+		);
74
+		return $attendees;
75
+	}
76
+
77
+
78
+
79
+
80
+	/**
81
+	 * setup the data.
82
+	 *
83
+	 * Sets up the expected data object for the messages prep using incoming registration objects.
84
+	 *
85
+	 * @since   4.3.0
86
+	 *
87
+	 * @return void
88
+	 * @access protected
89
+	 */
90
+	protected function _setup_data()
91
+	{
92
+
93
+		// we'll loop through each contact and setup the data needed.  Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact).
94
+		$this->txn = null;
95
+		$this->taxes = null;
96
+		$this->grand_total_price_object = '';
97
+		$this->user_id = $this->ip_address = $this->user_agent = $this->init_access = '';
98
+		$this->payment = null;
99
+		$this->billing = array();
100
+		$this->reg_objs = array();
101
+		$this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer =  $this->registrations = array();
102
+		$this->total_ticket_count = 0;
103
+		$this->primary_attendee_data = array(
104
+			'registration_id' => 0,
105
+			'att_obj' => null,
106
+			'reg_obj' => null,
107
+			'primary_att_obj' => null,
108
+			'primary_reg_obj' => null
109
+			);
110
+
111
+		foreach ($this->_data as $contact) {
112
+			$id = $contact->ID();
113
+			$reg = $contact->get_first_related('Registration');
114
+			$this->attendees[ $id ]['att_obj'] = $contact;
115
+			$this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg;
116
+			$this->attendees[ $id ]['attendee_email'] = $contact->email();
117
+			$this->attendees[ $id ]['tkt_objs'] = array();
118
+			$this->attendees[ $id ]['evt_objs'] = array();
119
+		}
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         // validate that the first element in the array is an EE_Attendee object.  Note that the array may be indexed by REG_ID so we will just shift off the first element.
28 28
         $ctc_chk = reset($data);
29
-        if (! $ctc_chk instanceof EE_Attendee) {
29
+        if ( ! $ctc_chk instanceof EE_Attendee) {
30 30
             throw new EE_Error(esc_html__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso'));
31 31
         }
32 32
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $attendee_ids = array_filter(
45 45
             array_map(
46
-                function ($attendee) {
46
+                function($attendee) {
47 47
                     if ($attendee instanceof EE_Attendee) {
48 48
                         return $attendee->ID();
49 49
                     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $attendee_ids = (array) $attendee_ids;
69 69
         $attendees = EEM_Attendee::instance()->get_all(
70 70
             array(
71
-              array( 'ATT_ID' => array( 'IN', $attendee_ids ) )
71
+              array('ATT_ID' => array('IN', $attendee_ids))
72 72
             )
73 73
         );
74 74
         return $attendees;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->payment = null;
99 99
         $this->billing = array();
100 100
         $this->reg_objs = array();
101
-        $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer =  $this->registrations = array();
101
+        $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array();
102 102
         $this->total_ticket_count = 0;
103 103
         $this->primary_attendee_data = array(
104 104
             'registration_id' => 0,
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
         foreach ($this->_data as $contact) {
112 112
             $id = $contact->ID();
113 113
             $reg = $contact->get_first_related('Registration');
114
-            $this->attendees[ $id ]['att_obj'] = $contact;
115
-            $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg;
116
-            $this->attendees[ $id ]['attendee_email'] = $contact->email();
117
-            $this->attendees[ $id ]['tkt_objs'] = array();
118
-            $this->attendees[ $id ]['evt_objs'] = array();
114
+            $this->attendees[$id]['att_obj'] = $contact;
115
+            $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg;
116
+            $this->attendees[$id]['attendee_email'] = $contact->email();
117
+            $this->attendees[$id]['tkt_objs'] = array();
118
+            $this->attendees[$id]['evt_objs'] = array();
119 119
         }
120 120
     }
121 121
 }
Please login to merge, or discard this patch.
message_type/payment_reminder/EE_Payment_Reminder_message_type.class.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,49 +15,49 @@
 block discarded – undo
15 15
 class EE_Payment_Reminder_message_type extends EE_Payment_Base_message_type
16 16
 {
17 17
 
18
-    public function __construct()
19
-    {
20
-
21
-        // setup type details for reference
22
-        $this->name = 'payment_reminder';
23
-        $this->description = esc_html__('This message type is used for all payment reminder messages.  These are triggered when an offline gateway registration is completed or when manually triggered via event administrators via the transaction admin page(s).', 'event_espresso');
24
-        $this->label = array(
25
-            'singular' => esc_html__('payment reminder', 'event_espresso'),
26
-            'plural' => esc_html__('payment reminders', 'event_espresso')
27
-            );
28
-        $this->_master_templates = array(
29
-            'email' => 'payment'
30
-            );
31
-
32
-        parent::__construct();
33
-    }
34
-
35
-
36
-
37
-    /**
38
-     * _set_contexts
39
-     * This sets up the contexts associated with the message_type
40
-     *
41
-     * @access  protected
42
-     * @return  void
43
-     */
44
-    protected function _set_contexts()
45
-    {
46
-        $this->_context_label = array(
47
-            'label' => esc_html__('recipient', 'event_espresso'),
48
-            'plural' => esc_html__('recipients', 'event_espresso'),
49
-            'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different payment details sent out depending on who the recipient is', 'event_espresso')
50
-            );
51
-
52
-        $this->_contexts = array(
53
-            'admin' => array(
54
-                'label' => esc_html__('Event Admin', 'event_espresso'),
55
-                'description' => esc_html__('This template is what event administrators will receive on a successful payment', 'event_espresso')
56
-                ),
57
-            'primary_attendee' => array(
58
-                'label' => esc_html__('Primary Registrant', 'event_espresso'),
59
-                'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive on successful payment', 'event_espresso')
60
-                )
61
-            );
62
-    }
18
+	public function __construct()
19
+	{
20
+
21
+		// setup type details for reference
22
+		$this->name = 'payment_reminder';
23
+		$this->description = esc_html__('This message type is used for all payment reminder messages.  These are triggered when an offline gateway registration is completed or when manually triggered via event administrators via the transaction admin page(s).', 'event_espresso');
24
+		$this->label = array(
25
+			'singular' => esc_html__('payment reminder', 'event_espresso'),
26
+			'plural' => esc_html__('payment reminders', 'event_espresso')
27
+			);
28
+		$this->_master_templates = array(
29
+			'email' => 'payment'
30
+			);
31
+
32
+		parent::__construct();
33
+	}
34
+
35
+
36
+
37
+	/**
38
+	 * _set_contexts
39
+	 * This sets up the contexts associated with the message_type
40
+	 *
41
+	 * @access  protected
42
+	 * @return  void
43
+	 */
44
+	protected function _set_contexts()
45
+	{
46
+		$this->_context_label = array(
47
+			'label' => esc_html__('recipient', 'event_espresso'),
48
+			'plural' => esc_html__('recipients', 'event_espresso'),
49
+			'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different payment details sent out depending on who the recipient is', 'event_espresso')
50
+			);
51
+
52
+		$this->_contexts = array(
53
+			'admin' => array(
54
+				'label' => esc_html__('Event Admin', 'event_espresso'),
55
+				'description' => esc_html__('This template is what event administrators will receive on a successful payment', 'event_espresso')
56
+				),
57
+			'primary_attendee' => array(
58
+				'label' => esc_html__('Primary Registrant', 'event_espresso'),
59
+				'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive on successful payment', 'event_espresso')
60
+				)
61
+			);
62
+	}
63 63
 }
Please login to merge, or discard this patch.
message_type/payment_failed/EE_Payment_Failed_message_type.class.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -14,49 +14,49 @@
 block discarded – undo
14 14
 class EE_Payment_Failed_message_type extends EE_Payment_Base_message_type
15 15
 {
16 16
 
17
-    public function __construct()
18
-    {
19
-
20
-        // setup type details for reference
21
-        $this->name = 'payment_failed';
22
-        $this->description = esc_html__('This message type is used for all failed payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso');
23
-        $this->label = array(
24
-            'singular' => esc_html__('payment failed', 'event_espresso'),
25
-            'plural' => esc_html__('payments failed', 'event_espresso')
26
-            );
27
-
28
-        $this->_master_templates = array(
29
-            'email' => 'payment'
30
-            );
31
-
32
-        parent::__construct();
33
-    }
34
-
35
-
36
-    /**
37
-     * _set_contexts
38
-     * This sets up the contexts associated with the message_type
39
-     *
40
-     * @access  protected
41
-     * @return  void
42
-     */
43
-    protected function _set_contexts()
44
-    {
45
-        $this->_context_label = array(
46
-            'label' => esc_html__('recipient', 'event_espresso'),
47
-            'plural' => esc_html__('recipients', 'event_espresso'),
48
-            'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different payment details sent out depending on who the recipient is', 'event_espresso')
49
-            );
50
-
51
-        $this->_contexts = array(
52
-            'admin' => array(
53
-                'label' => esc_html__('Event Admin', 'event_espresso'),
54
-                'description' => esc_html__('This template is what event administrators will receive when payment fails.', 'event_espresso')
55
-                ),
56
-            'primary_attendee' => array(
57
-                'label' => esc_html__('Primary Registrant', 'event_espresso'),
58
-                'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive when the payment fails.', 'event_espresso')
59
-                )
60
-            );
61
-    }
17
+	public function __construct()
18
+	{
19
+
20
+		// setup type details for reference
21
+		$this->name = 'payment_failed';
22
+		$this->description = esc_html__('This message type is used for all failed payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso');
23
+		$this->label = array(
24
+			'singular' => esc_html__('payment failed', 'event_espresso'),
25
+			'plural' => esc_html__('payments failed', 'event_espresso')
26
+			);
27
+
28
+		$this->_master_templates = array(
29
+			'email' => 'payment'
30
+			);
31
+
32
+		parent::__construct();
33
+	}
34
+
35
+
36
+	/**
37
+	 * _set_contexts
38
+	 * This sets up the contexts associated with the message_type
39
+	 *
40
+	 * @access  protected
41
+	 * @return  void
42
+	 */
43
+	protected function _set_contexts()
44
+	{
45
+		$this->_context_label = array(
46
+			'label' => esc_html__('recipient', 'event_espresso'),
47
+			'plural' => esc_html__('recipients', 'event_espresso'),
48
+			'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different payment details sent out depending on who the recipient is', 'event_espresso')
49
+			);
50
+
51
+		$this->_contexts = array(
52
+			'admin' => array(
53
+				'label' => esc_html__('Event Admin', 'event_espresso'),
54
+				'description' => esc_html__('This template is what event administrators will receive when payment fails.', 'event_espresso')
55
+				),
56
+			'primary_attendee' => array(
57
+				'label' => esc_html__('Primary Registrant', 'event_espresso'),
58
+				'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive when the payment fails.', 'event_espresso')
59
+				)
60
+			);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
message_type/payment_cancelled/EE_Payment_Cancelled_message_type.class.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -14,49 +14,49 @@
 block discarded – undo
14 14
 class EE_Payment_Cancelled_message_type extends EE_Payment_Base_message_type
15 15
 {
16 16
 
17
-    public function __construct()
18
-    {
19
-
20
-        // setup type details for reference
21
-        $this->name = 'payment_cancelled';
22
-        $this->description = esc_html__('This message type is used for all cancelled payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso');
23
-        $this->label = array(
24
-            'singular' => esc_html__('payment cancelled', 'event_espresso'),
25
-            'plural' => esc_html__('payments cancelled', 'event_espresso')
26
-            );
27
-
28
-        $this->_master_templates = array(
29
-            'email' => 'payment'
30
-            );
31
-
32
-        parent::__construct();
33
-    }
34
-
35
-
36
-    /**
37
-     * _set_contexts
38
-     * This sets up the contexts associated with the message_type
39
-     *
40
-     * @access  protected
41
-     * @return  void
42
-     */
43
-    protected function _set_contexts()
44
-    {
45
-        $this->_context_label = array(
46
-            'label' => esc_html__('recipient', 'event_espresso'),
47
-            'plural' => esc_html__('recipients', 'event_espresso'),
48
-            'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different payment details sent out depending on who the recipient is.', 'event_espresso')
49
-            );
50
-
51
-        $this->_contexts = array(
52
-            'admin' => array(
53
-                'label' => esc_html__('Event Admin', 'event_espresso'),
54
-                'description' => esc_html__('This template is what event administrators will receive when payment is cancelled.', 'event_espresso')
55
-                ),
56
-            'primary_attendee' => array(
57
-                'label' => esc_html__('Primary Registrant', 'event_espresso'),
58
-                'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive when the payment is cancelled.', 'event_espresso')
59
-                )
60
-            );
61
-    }
17
+	public function __construct()
18
+	{
19
+
20
+		// setup type details for reference
21
+		$this->name = 'payment_cancelled';
22
+		$this->description = esc_html__('This message type is used for all cancelled payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso');
23
+		$this->label = array(
24
+			'singular' => esc_html__('payment cancelled', 'event_espresso'),
25
+			'plural' => esc_html__('payments cancelled', 'event_espresso')
26
+			);
27
+
28
+		$this->_master_templates = array(
29
+			'email' => 'payment'
30
+			);
31
+
32
+		parent::__construct();
33
+	}
34
+
35
+
36
+	/**
37
+	 * _set_contexts
38
+	 * This sets up the contexts associated with the message_type
39
+	 *
40
+	 * @access  protected
41
+	 * @return  void
42
+	 */
43
+	protected function _set_contexts()
44
+	{
45
+		$this->_context_label = array(
46
+			'label' => esc_html__('recipient', 'event_espresso'),
47
+			'plural' => esc_html__('recipients', 'event_espresso'),
48
+			'description' => esc_html__('Recipient\'s are who will receive the template.  You may want different payment details sent out depending on who the recipient is.', 'event_espresso')
49
+			);
50
+
51
+		$this->_contexts = array(
52
+			'admin' => array(
53
+				'label' => esc_html__('Event Admin', 'event_espresso'),
54
+				'description' => esc_html__('This template is what event administrators will receive when payment is cancelled.', 'event_espresso')
55
+				),
56
+			'primary_attendee' => array(
57
+				'label' => esc_html__('Primary Registrant', 'event_espresso'),
58
+				'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive when the payment is cancelled.', 'event_espresso')
59
+				)
60
+			);
61
+	}
62 62
 }
Please login to merge, or discard this patch.