@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | - if ( isset( $_POST['give_payment_mode'] ) ) { |
|
42 | - do_action( 'give_purchase_form', $_POST['give_form_id'] ); |
|
41 | + if (isset($_POST['give_payment_mode'])) { |
|
42 | + do_action('give_purchase_form', $_POST['give_form_id']); |
|
43 | 43 | exit(); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
48 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
47 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
48 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Sets an error on checkout if no gateways are enabled |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | function give_no_gateway_error() { |
58 | 58 | $gateways = give_get_enabled_payment_gateways(); |
59 | 59 | |
60 | - if ( empty( $gateways ) ) { |
|
61 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
60 | + if (empty($gateways)) { |
|
61 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
62 | 62 | } else { |
63 | - give_unset_error( 'no_gateways' ); |
|
63 | + give_unset_error('no_gateways'); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | -add_action( 'init', 'give_no_gateway_error' ); |
|
67 | +add_action('init', 'give_no_gateway_error'); |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | * @since 1.0 |
112 | 112 | * @access public |
113 | 113 | * |
114 | - * @param int $column Column ID. |
|
115 | - * @param int $row_id Row ID. |
|
116 | - * |
|
117 | - * @return object |
|
114 | + * @param int $column Column ID. |
|
115 | + * @param int $row_id Row ID. |
|
116 | + * |
|
117 | + * @return object |
|
118 | 118 | */ |
119 | 119 | public function get_by( $column, $row_id ) { |
120 | - /* @var WPDB $wpdb */ |
|
121 | - global $wpdb; |
|
120 | + /* @var WPDB $wpdb */ |
|
121 | + global $wpdb; |
|
122 | 122 | |
123 | 123 | $column = esc_sql( $column ); |
124 | 124 | return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @since 1.0 |
131 | 131 | * @access public |
132 | - * |
|
133 | - * @param int $column Column ID. |
|
134 | - * @param int $row_id Row ID. |
|
135 | - * |
|
132 | + * |
|
133 | + * @param int $column Column ID. |
|
134 | + * @param int $row_id Row ID. |
|
135 | + * |
|
136 | 136 | * @return string Column value. |
137 | 137 | */ |
138 | 138 | public function get_column( $column, $row_id ) { |
139 | - /* @var WPDB $wpdb */ |
|
140 | - global $wpdb; |
|
139 | + /* @var WPDB $wpdb */ |
|
140 | + global $wpdb; |
|
141 | 141 | |
142 | 142 | $column = esc_sql( $column ); |
143 | 143 | return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
@@ -148,16 +148,16 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | * @access public |
151 | - * |
|
152 | - * @param int $column Column ID. |
|
153 | - * @param string $column_where Column name. |
|
154 | - * @param string $column_value Column value. |
|
155 | - * |
|
151 | + * |
|
152 | + * @param int $column Column ID. |
|
153 | + * @param string $column_where Column name. |
|
154 | + * @param string $column_value Column value. |
|
155 | + * |
|
156 | 156 | * @return string |
157 | 157 | */ |
158 | 158 | public function get_column_by( $column, $column_where, $column_value ) { |
159 | - /* @var WPDB $wpdb */ |
|
160 | - global $wpdb; |
|
159 | + /* @var WPDB $wpdb */ |
|
160 | + global $wpdb; |
|
161 | 161 | |
162 | 162 | $column_where = esc_sql( $column_where ); |
163 | 163 | $column = esc_sql( $column ); |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | * @access public |
172 | - * |
|
173 | - * @param array $data |
|
174 | - * @param string $type |
|
175 | - * |
|
172 | + * |
|
173 | + * @param array $data |
|
174 | + * @param string $type |
|
175 | + * |
|
176 | 176 | * @return int |
177 | 177 | */ |
178 | 178 | public function insert( $data, $type = '' ) { |
179 | - /* @var WPDB $wpdb */ |
|
180 | - global $wpdb; |
|
179 | + /* @var WPDB $wpdb */ |
|
180 | + global $wpdb; |
|
181 | 181 | |
182 | 182 | // Set default values |
183 | 183 | $data = wp_parse_args( $data, $this->get_column_defaults() ); |
@@ -209,16 +209,16 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @since 1.0 |
211 | 211 | * @access public |
212 | - * |
|
213 | - * @param int $row_id Column ID |
|
214 | - * @param array $data |
|
215 | - * @param string $where Column value |
|
216 | - * |
|
212 | + * |
|
213 | + * @param int $row_id Column ID |
|
214 | + * @param array $data |
|
215 | + * @param string $where Column value |
|
216 | + * |
|
217 | 217 | * @return bool |
218 | 218 | */ |
219 | 219 | public function update( $row_id, $data = array(), $where = '' ) { |
220 | - /* @var WPDB $wpdb */ |
|
221 | - global $wpdb; |
|
220 | + /* @var WPDB $wpdb */ |
|
221 | + global $wpdb; |
|
222 | 222 | |
223 | 223 | // Row ID must be positive integer |
224 | 224 | $row_id = absint( $row_id ); |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @since 1.0 |
258 | 258 | * @access public |
259 | - * |
|
260 | - * @param int $row_id Column ID. |
|
261 | - * |
|
259 | + * |
|
260 | + * @param int $row_id Column ID. |
|
261 | + * |
|
262 | 262 | * @return bool |
263 | 263 | */ |
264 | 264 | public function delete( $row_id = 0 ) { |
265 | - /* @var WPDB $wpdb */ |
|
266 | - global $wpdb; |
|
265 | + /* @var WPDB $wpdb */ |
|
266 | + global $wpdb; |
|
267 | 267 | |
268 | 268 | // Row ID must be positive integer |
269 | 269 | $row_id = absint( $row_id ); |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @since 1.3.2 |
286 | 286 | * @access public |
287 | - * |
|
287 | + * |
|
288 | 288 | * @param string $table The table name. |
289 | - * |
|
289 | + * |
|
290 | 290 | * @return bool If the table name exists. |
291 | 291 | */ |
292 | 292 | public function table_exists( $table ) { |
293 | - /* @var WPDB $wpdb */ |
|
293 | + /* @var WPDB $wpdb */ |
|
294 | 294 | global $wpdb; |
295 | 295 | |
296 | 296 | $table = sanitize_text_field( $table ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return object |
100 | 100 | */ |
101 | - public function get( $row_id ) { |
|
101 | + public function get($row_id) { |
|
102 | 102 | /* @var WPDB $wpdb */ |
103 | 103 | global $wpdb; |
104 | 104 | |
105 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
105 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return object |
118 | 118 | */ |
119 | - public function get_by( $column, $row_id ) { |
|
119 | + public function get_by($column, $row_id) { |
|
120 | 120 | /* @var WPDB $wpdb */ |
121 | 121 | global $wpdb; |
122 | 122 | |
123 | - $column = esc_sql( $column ); |
|
124 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
123 | + $column = esc_sql($column); |
|
124 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return string Column value. |
137 | 137 | */ |
138 | - public function get_column( $column, $row_id ) { |
|
138 | + public function get_column($column, $row_id) { |
|
139 | 139 | /* @var WPDB $wpdb */ |
140 | 140 | global $wpdb; |
141 | 141 | |
142 | - $column = esc_sql( $column ); |
|
143 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
142 | + $column = esc_sql($column); |
|
143 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
158 | + public function get_column_by($column, $column_where, $column_value) { |
|
159 | 159 | /* @var WPDB $wpdb */ |
160 | 160 | global $wpdb; |
161 | 161 | |
162 | - $column_where = esc_sql( $column_where ); |
|
163 | - $column = esc_sql( $column ); |
|
164 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
162 | + $column_where = esc_sql($column_where); |
|
163 | + $column = esc_sql($column); |
|
164 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -175,31 +175,31 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return int |
177 | 177 | */ |
178 | - public function insert( $data, $type = '' ) { |
|
178 | + public function insert($data, $type = '') { |
|
179 | 179 | /* @var WPDB $wpdb */ |
180 | 180 | global $wpdb; |
181 | 181 | |
182 | 182 | // Set default values |
183 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
183 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
184 | 184 | |
185 | - do_action( 'give_pre_insert_' . $type, $data ); |
|
185 | + do_action('give_pre_insert_'.$type, $data); |
|
186 | 186 | |
187 | 187 | // Initialise column format array |
188 | 188 | $column_formats = $this->get_columns(); |
189 | 189 | |
190 | 190 | // Force fields to lower case |
191 | - $data = array_change_key_case( $data ); |
|
191 | + $data = array_change_key_case($data); |
|
192 | 192 | |
193 | 193 | // White list columns |
194 | - $data = array_intersect_key( $data, $column_formats ); |
|
194 | + $data = array_intersect_key($data, $column_formats); |
|
195 | 195 | |
196 | 196 | // Reorder $column_formats to match the order of columns given in $data |
197 | - $data_keys = array_keys( $data ); |
|
198 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
197 | + $data_keys = array_keys($data); |
|
198 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
199 | 199 | |
200 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
200 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
201 | 201 | |
202 | - do_action( 'give_post_insert_' . $type, $wpdb->insert_id, $data ); |
|
202 | + do_action('give_post_insert_'.$type, $wpdb->insert_id, $data); |
|
203 | 203 | |
204 | 204 | return $wpdb->insert_id; |
205 | 205 | } |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return bool |
218 | 218 | */ |
219 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
219 | + public function update($row_id, $data = array(), $where = '') { |
|
220 | 220 | /* @var WPDB $wpdb */ |
221 | 221 | global $wpdb; |
222 | 222 | |
223 | 223 | // Row ID must be positive integer |
224 | - $row_id = absint( $row_id ); |
|
224 | + $row_id = absint($row_id); |
|
225 | 225 | |
226 | - if ( empty( $row_id ) ) { |
|
226 | + if (empty($row_id)) { |
|
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | |
230 | - if ( empty( $where ) ) { |
|
230 | + if (empty($where)) { |
|
231 | 231 | $where = $this->primary_key; |
232 | 232 | } |
233 | 233 | |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | $column_formats = $this->get_columns(); |
236 | 236 | |
237 | 237 | // Force fields to lower case |
238 | - $data = array_change_key_case( $data ); |
|
238 | + $data = array_change_key_case($data); |
|
239 | 239 | |
240 | 240 | // White list columns |
241 | - $data = array_intersect_key( $data, $column_formats ); |
|
241 | + $data = array_intersect_key($data, $column_formats); |
|
242 | 242 | |
243 | 243 | // Reorder $column_formats to match the order of columns given in $data |
244 | - $data_keys = array_keys( $data ); |
|
245 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
244 | + $data_keys = array_keys($data); |
|
245 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
246 | 246 | |
247 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
247 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
248 | 248 | return false; |
249 | 249 | } |
250 | 250 | |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return bool |
263 | 263 | */ |
264 | - public function delete( $row_id = 0 ) { |
|
264 | + public function delete($row_id = 0) { |
|
265 | 265 | /* @var WPDB $wpdb */ |
266 | 266 | global $wpdb; |
267 | 267 | |
268 | 268 | // Row ID must be positive integer |
269 | - $row_id = absint( $row_id ); |
|
269 | + $row_id = absint($row_id); |
|
270 | 270 | |
271 | - if ( empty( $row_id ) ) { |
|
271 | + if (empty($row_id)) { |
|
272 | 272 | return false; |
273 | 273 | } |
274 | 274 | |
275 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
275 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return bool If the table name exists. |
291 | 291 | */ |
292 | - public function table_exists( $table ) { |
|
292 | + public function table_exists($table) { |
|
293 | 293 | /* @var WPDB $wpdb */ |
294 | 294 | global $wpdb; |
295 | 295 | |
296 | - $table = sanitize_text_field( $table ); |
|
296 | + $table = sanitize_text_field($table); |
|
297 | 297 | |
298 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
298 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return bool Returns if the customers table was installed and upgrade routine run. |
308 | 308 | */ |
309 | 309 | public function installed() { |
310 | - return $this->table_exists( $this->table_name ); |
|
310 | + return $this->table_exists($this->table_name); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | - if ( isset( $_GET['give_action'] ) ) { |
|
28 | - do_action( 'give_' . $_GET['give_action'], $_GET ); |
|
27 | + if (isset($_GET['give_action'])) { |
|
28 | + do_action('give_'.$_GET['give_action'], $_GET); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -add_action( 'init', 'give_get_actions' ); |
|
32 | +add_action('init', 'give_get_actions'); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function give_post_actions() { |
44 | - if ( isset( $_POST['give_action'] ) ) { |
|
45 | - do_action( 'give_' . $_POST['give_action'], $_POST ); |
|
44 | + if (isset($_POST['give_action'])) { |
|
45 | + do_action('give_'.$_POST['give_action'], $_POST); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -add_action( 'init', 'give_post_actions' ); |
|
49 | +add_action('init', 'give_post_actions'); |
@@ -398,6 +398,7 @@ |
||
398 | 398 | * |
399 | 399 | * @since 1.6 |
400 | 400 | * |
401 | + * @param Give_Payment $payment |
|
401 | 402 | * @return mixed|void |
402 | 403 | */ |
403 | 404 | function get_row_actions( $payment ) { |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -118,37 +118,37 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
124 | 124 | 'ajax' => false // Does this table support ajax? |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function advanced_filters() { |
133 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
134 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
135 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
133 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
134 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
135 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
136 | 136 | ?> |
137 | 137 | <div id="give-payment-filters"> |
138 | 138 | <span id="give-payment-date-filters"> |
139 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
139 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
140 | 140 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
141 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
141 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
142 | 142 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
143 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
143 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
144 | 144 | </span> |
145 | - <?php if ( ! empty( $status ) ) : ?> |
|
146 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
145 | + <?php if ( ! empty($status)) : ?> |
|
146 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
147 | 147 | <?php endif; ?> |
148 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
149 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
148 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
149 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
150 | 150 | <?php endif; ?> |
151 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
151 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
152 | 152 | </div> |
153 | 153 | |
154 | 154 | <?php |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - public function search_box( $text, $input_id ) { |
|
169 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
168 | + public function search_box($text, $input_id) { |
|
169 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - $input_id = $input_id . '-search-input'; |
|
173 | + $input_id = $input_id.'-search-input'; |
|
174 | 174 | |
175 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
176 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
175 | + if ( ! empty($_REQUEST['orderby'])) { |
|
176 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
177 | 177 | } |
178 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
179 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
178 | + if ( ! empty($_REQUEST['order'])) { |
|
179 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
180 | 180 | } |
181 | 181 | ?> |
182 | 182 | <p class="search-box"> |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_payment_history_search' ); |
|
191 | + do_action('give_payment_history_search'); |
|
192 | 192 | ?> |
193 | 193 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
194 | 194 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
195 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
195 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
196 | 196 | </p> |
197 | 197 | <?php |
198 | 198 | } |
@@ -206,52 +206,52 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function get_views() { |
208 | 208 | |
209 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
210 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
211 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
212 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
213 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
214 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
215 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
216 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
217 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
209 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
210 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
211 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
212 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
213 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
214 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
215 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
216 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
217 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
218 | 218 | |
219 | 219 | $views = array( |
220 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
220 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
221 | 221 | 'status', |
222 | 222 | 'paged' |
223 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
224 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
223 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
224 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
225 | 225 | 'status' => 'publish', |
226 | 226 | 'paged' => false |
227 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
228 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
227 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
228 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
229 | 229 | 'status' => 'pending', |
230 | 230 | 'paged' => false |
231 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
232 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
231 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
232 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
233 | 233 | 'status' => 'refunded', |
234 | 234 | 'paged' => false |
235 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
236 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
235 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
236 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
237 | 237 | 'status' => 'revoked', |
238 | 238 | 'paged' => false |
239 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
240 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
239 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
240 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
241 | 241 | 'status' => 'failed', |
242 | 242 | 'paged' => false |
243 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
244 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
243 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
244 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
245 | 245 | 'status' => 'cancelled', |
246 | 246 | 'paged' => false |
247 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
248 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
247 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
248 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
249 | 249 | 'status' => 'abandoned', |
250 | 250 | 'paged' => false |
251 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ) |
|
251 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count) |
|
252 | 252 | ); |
253 | 253 | |
254 | - return apply_filters( 'give_payments_table_views', $views ); |
|
254 | + return apply_filters('give_payments_table_views', $views); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | public function get_columns() { |
265 | 265 | $columns = array( |
266 | 266 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
267 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
268 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
269 | - 'status' => esc_html__( 'Status', 'give' ), |
|
270 | - 'date' => esc_html__( 'Date', 'give' ), |
|
271 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
272 | - 'details' => esc_html__( 'Details', 'give' ), |
|
267 | + 'donation' => esc_html__('Donation', 'give'), |
|
268 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
269 | + 'status' => esc_html__('Status', 'give'), |
|
270 | + 'date' => esc_html__('Date', 'give'), |
|
271 | + 'amount' => esc_html__('Amount', 'give'), |
|
272 | + 'details' => esc_html__('Details', 'give'), |
|
273 | 273 | ); |
274 | 274 | |
275 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
275 | + return apply_filters('give_payments_table_columns', $columns); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_sortable_columns() { |
286 | 286 | $columns = array( |
287 | - 'donation' => array( 'ID', true ), |
|
288 | - 'amount' => array( 'amount', false ), |
|
289 | - 'date' => array( 'date', false ) |
|
287 | + 'donation' => array('ID', true), |
|
288 | + 'amount' => array('amount', false), |
|
289 | + 'date' => array('date', false) |
|
290 | 290 | ); |
291 | 291 | |
292 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
292 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -315,59 +315,59 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Column Name |
317 | 317 | */ |
318 | - public function column_default( $payment, $column_name ) { |
|
318 | + public function column_default($payment, $column_name) { |
|
319 | 319 | |
320 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
321 | - $row_actions = $this->get_row_actions( $payment ); |
|
320 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
321 | + $row_actions = $this->get_row_actions($payment); |
|
322 | 322 | |
323 | - switch ( $column_name ) { |
|
323 | + switch ($column_name) { |
|
324 | 324 | case 'donation' : |
325 | 325 | ob_start(); |
326 | 326 | ?> |
327 | - <a href="<?php echo $single_donation_url; ?>" data-tooltip="<?php esc_html_e( 'View details', 'give' ) ?>">#<?php echo $payment->ID; ?></a> <?php _e( 'by', 'give' ); ?> <?php echo $this->get_donor( $payment ); ?> |
|
327 | + <a href="<?php echo $single_donation_url; ?>" data-tooltip="<?php esc_html_e('View details', 'give') ?>">#<?php echo $payment->ID; ?></a> <?php _e('by', 'give'); ?> <?php echo $this->get_donor($payment); ?> |
|
328 | 328 | <br> |
329 | - <?php echo $this->get_donor_email( $payment ); ?> |
|
330 | - <?php echo $this->row_actions( $row_actions ); ?> |
|
329 | + <?php echo $this->get_donor_email($payment); ?> |
|
330 | + <?php echo $this->row_actions($row_actions); ?> |
|
331 | 331 | <?php |
332 | 332 | $value = ob_get_clean(); |
333 | 333 | break; |
334 | 334 | |
335 | 335 | case 'amount' : |
336 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
337 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
336 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
337 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case 'donation_form' : |
341 | 341 | |
342 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
343 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
342 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
343 | + $level = give_get_payment_form_title($payment->meta, true); |
|
344 | 344 | |
345 | - if ( ! empty( $level ) ) { |
|
345 | + if ( ! empty($level)) { |
|
346 | 346 | $value .= $level; |
347 | 347 | } |
348 | 348 | |
349 | 349 | break; |
350 | 350 | |
351 | 351 | case 'date' : |
352 | - $date = strtotime( $payment->date ); |
|
353 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
352 | + $date = strtotime($payment->date); |
|
353 | + $value = date_i18n(get_option('date_format'), $date); |
|
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'status' : |
357 | - $value = $this->get_payment_status( $payment ); |
|
357 | + $value = $this->get_payment_status($payment); |
|
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'details' : |
361 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_donation_url . '" data-tooltip="' . __( 'View details', 'give' ) . '" class="give-payment-details-link button button-small" title="' . __( 'View Details', 'give' ) . '"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
361 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.$single_donation_url.'" data-tooltip="'.__('View details', 'give').'" class="give-payment-details-link button button-small" title="'.__('View Details', 'give').'"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | default: |
365 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
365 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
366 | 366 | break; |
367 | 367 | |
368 | 368 | } |
369 | 369 | |
370 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
370 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return string Data shown in the Email column |
382 | 382 | */ |
383 | - public function get_donor_email( $payment ) { |
|
383 | + public function get_donor_email($payment) { |
|
384 | 384 | |
385 | - $email = give_get_payment_user_email( $payment->ID ); |
|
385 | + $email = give_get_payment_user_email($payment->ID); |
|
386 | 386 | |
387 | - if ( empty( $email ) ) { |
|
388 | - $email = esc_html__( '(unknown)', 'give' ); |
|
387 | + if (empty($email)) { |
|
388 | + $email = esc_html__('(unknown)', 'give'); |
|
389 | 389 | } |
390 | 390 | |
391 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
391 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; |
|
392 | 392 | |
393 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
393 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -400,31 +400,31 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return mixed|void |
402 | 402 | */ |
403 | - function get_row_actions( $payment ) { |
|
403 | + function get_row_actions($payment) { |
|
404 | 404 | |
405 | 405 | $row_actions = array(); |
406 | - $email = give_get_payment_user_email( $payment->ID ); |
|
406 | + $email = give_get_payment_user_email($payment->ID); |
|
407 | 407 | |
408 | 408 | // Add search term string back to base URL |
409 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
410 | - if ( ! empty( $search_terms ) ) { |
|
411 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
409 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
410 | + if ( ! empty($search_terms)) { |
|
411 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
412 | 412 | } |
413 | 413 | |
414 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
415 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
414 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
415 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
416 | 416 | 'give-action' => 'email_links', |
417 | 417 | 'purchase_id' => $payment->ID |
418 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
418 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
422 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
423 | 423 | 'give-action' => 'delete_payment', |
424 | 424 | 'purchase_id' => $payment->ID |
425 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
425 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
426 | 426 | |
427 | - return apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
427 | + return apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @return string Data shown in the Email column |
439 | 439 | */ |
440 | - function get_payment_status( $payment ) { |
|
441 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
442 | - if ( $payment->mode == 'test' ) { |
|
443 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
440 | + function get_payment_status($payment) { |
|
441 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
442 | + if ($payment->mode == 'test') { |
|
443 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | return $value; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string Displays a checkbox |
458 | 458 | */ |
459 | - public function column_cb( $payment ) { |
|
459 | + public function column_cb($payment) { |
|
460 | 460 | return sprintf( |
461 | 461 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
462 | 462 | 'payment', |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return string Displays a checkbox |
476 | 476 | */ |
477 | - public function get_payment_id( $payment ) { |
|
478 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
477 | + public function get_payment_id($payment) { |
|
478 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string Data shown in the User column |
490 | 490 | */ |
491 | - public function get_donor( $payment ) { |
|
491 | + public function get_donor($payment) { |
|
492 | 492 | |
493 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
493 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
494 | 494 | |
495 | - if ( ! empty( $customer_id ) ) { |
|
496 | - $customer = new Give_Customer( $customer_id ); |
|
497 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
495 | + if ( ! empty($customer_id)) { |
|
496 | + $customer = new Give_Customer($customer_id); |
|
497 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
498 | 498 | } else { |
499 | - $email = give_get_payment_user_email( $payment->ID ); |
|
500 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
499 | + $email = give_get_payment_user_email($payment->ID); |
|
500 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
501 | 501 | } |
502 | 502 | |
503 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
503 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -512,18 +512,18 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function get_bulk_actions() { |
514 | 514 | $actions = array( |
515 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
516 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
517 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
518 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
519 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
520 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
521 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
522 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
523 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
515 | + 'delete' => esc_html__('Delete', 'give'), |
|
516 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
517 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
518 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
519 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
520 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
521 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
522 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
523 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
524 | 524 | ); |
525 | 525 | |
526 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
526 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -534,59 +534,59 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function process_bulk_action() { |
537 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
537 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
538 | 538 | $action = $this->current_action(); |
539 | 539 | |
540 | - if ( ! is_array( $ids ) ) { |
|
541 | - $ids = array( $ids ); |
|
540 | + if ( ! is_array($ids)) { |
|
541 | + $ids = array($ids); |
|
542 | 542 | } |
543 | 543 | |
544 | - if ( empty( $action ) ) { |
|
544 | + if (empty($action)) { |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - foreach ( $ids as $id ) { |
|
548 | + foreach ($ids as $id) { |
|
549 | 549 | |
550 | 550 | // Detect when a bulk action is being triggered... |
551 | - switch ( $this->current_action() ) { |
|
551 | + switch ($this->current_action()) { |
|
552 | 552 | |
553 | 553 | case'delete': |
554 | - give_delete_purchase( $id ); |
|
554 | + give_delete_purchase($id); |
|
555 | 555 | break; |
556 | 556 | |
557 | 557 | case 'set-status-publish': |
558 | - give_update_payment_status( $id, 'publish' ); |
|
558 | + give_update_payment_status($id, 'publish'); |
|
559 | 559 | break; |
560 | 560 | |
561 | 561 | case 'set-status-pending': |
562 | - give_update_payment_status( $id, 'pending' ); |
|
562 | + give_update_payment_status($id, 'pending'); |
|
563 | 563 | break; |
564 | 564 | |
565 | 565 | case 'set-status-refunded': |
566 | - give_update_payment_status( $id, 'refunded' ); |
|
566 | + give_update_payment_status($id, 'refunded'); |
|
567 | 567 | break; |
568 | 568 | case 'set-status-revoked': |
569 | - give_update_payment_status( $id, 'revoked' ); |
|
569 | + give_update_payment_status($id, 'revoked'); |
|
570 | 570 | break; |
571 | 571 | |
572 | 572 | case 'set-status-failed': |
573 | - give_update_payment_status( $id, 'failed' ); |
|
573 | + give_update_payment_status($id, 'failed'); |
|
574 | 574 | break; |
575 | 575 | |
576 | 576 | case 'set-status-cancelled': |
577 | - give_update_payment_status( $id, 'cancelled' ); |
|
577 | + give_update_payment_status($id, 'cancelled'); |
|
578 | 578 | break; |
579 | 579 | |
580 | 580 | case 'set-status-abandoned': |
581 | - give_update_payment_status( $id, 'abandoned' ); |
|
581 | + give_update_payment_status($id, 'abandoned'); |
|
582 | 582 | break; |
583 | 583 | |
584 | 584 | case 'set-status-preapproval': |
585 | - give_update_payment_status( $id, 'preapproval' ); |
|
585 | + give_update_payment_status($id, 'preapproval'); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | case 'resend-receipt': |
589 | - give_email_donation_receipt( $id, false ); |
|
589 | + give_email_donation_receipt($id, false); |
|
590 | 590 | break; |
591 | 591 | } |
592 | 592 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @param int $id The ID of the payment. |
599 | 599 | * @param string $current_action The action that is being triggered. |
600 | 600 | */ |
601 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
601 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | } |
@@ -614,27 +614,27 @@ discard block |
||
614 | 614 | |
615 | 615 | $args = array(); |
616 | 616 | |
617 | - if ( isset( $_GET['user'] ) ) { |
|
618 | - $args['user'] = urldecode( $_GET['user'] ); |
|
619 | - } elseif ( isset( $_GET['s'] ) ) { |
|
620 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
621 | - if ( $is_user ) { |
|
622 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
623 | - unset( $args['s'] ); |
|
617 | + if (isset($_GET['user'])) { |
|
618 | + $args['user'] = urldecode($_GET['user']); |
|
619 | + } elseif (isset($_GET['s'])) { |
|
620 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
621 | + if ($is_user) { |
|
622 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
623 | + unset($args['s']); |
|
624 | 624 | } else { |
625 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
625 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
630 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
629 | + if ( ! empty($_GET['start-date'])) { |
|
630 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
631 | 631 | } |
632 | 632 | |
633 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
634 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
633 | + if ( ! empty($_GET['end-date'])) { |
|
634 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
635 | 635 | } |
636 | 636 | |
637 | - $payment_count = give_count_payments( $args ); |
|
637 | + $payment_count = give_count_payments($args); |
|
638 | 638 | $this->complete_count = $payment_count->publish; |
639 | 639 | $this->pending_count = $payment_count->pending; |
640 | 640 | $this->refunded_count = $payment_count->refunded; |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $this->cancelled_count = $payment_count->cancelled; |
644 | 644 | $this->abandoned_count = $payment_count->abandoned; |
645 | 645 | |
646 | - foreach ( $payment_count as $count ) { |
|
646 | + foreach ($payment_count as $count) { |
|
647 | 647 | $this->total_count += $count; |
648 | 648 | } |
649 | 649 | } |
@@ -658,26 +658,26 @@ discard block |
||
658 | 658 | public function payments_data() { |
659 | 659 | |
660 | 660 | $per_page = $this->per_page; |
661 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
662 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
663 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
664 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
666 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
667 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
668 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
669 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
670 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
671 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
672 | - |
|
673 | - if ( ! empty( $search ) ) { |
|
661 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
662 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
663 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
664 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
666 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
667 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
668 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
669 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
670 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
671 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
672 | + |
|
673 | + if ( ! empty($search)) { |
|
674 | 674 | $status = 'any'; // Force all payment statuses when searching |
675 | 675 | } |
676 | 676 | |
677 | 677 | $args = array( |
678 | 678 | 'output' => 'payments', |
679 | 679 | 'number' => $per_page, |
680 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
680 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
681 | 681 | 'orderby' => $orderby, |
682 | 682 | 'order' => $order, |
683 | 683 | 'user' => $user, |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | 'end_date' => $end_date, |
692 | 692 | ); |
693 | 693 | |
694 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
694 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
695 | 695 | |
696 | 696 | $args['search_in_notes'] = true; |
697 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
697 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
701 | - $p_query = new Give_Payments_Query( $args ); |
|
701 | + $p_query = new Give_Payments_Query($args); |
|
702 | 702 | |
703 | 703 | return $p_query->get_payments(); |
704 | 704 | |
@@ -718,17 +718,17 @@ discard block |
||
718 | 718 | */ |
719 | 719 | public function prepare_items() { |
720 | 720 | |
721 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
721 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
722 | 722 | |
723 | 723 | $columns = $this->get_columns(); |
724 | 724 | $hidden = array(); // No hidden columns |
725 | 725 | $sortable = $this->get_sortable_columns(); |
726 | 726 | $data = $this->payments_data(); |
727 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
727 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
728 | 728 | |
729 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
729 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
730 | 730 | |
731 | - switch ( $status ) { |
|
731 | + switch ($status) { |
|
732 | 732 | case 'publish': |
733 | 733 | $total_items = $this->complete_count; |
734 | 734 | break; |
@@ -755,19 +755,19 @@ discard block |
||
755 | 755 | break; |
756 | 756 | default: |
757 | 757 | // Retrieve the count of the non-default-Give status |
758 | - $count = wp_count_posts( 'give_payment' ); |
|
758 | + $count = wp_count_posts('give_payment'); |
|
759 | 759 | $total_items = $count->{$status}; |
760 | 760 | break; |
761 | 761 | } |
762 | 762 | |
763 | 763 | $this->items = $data; |
764 | 764 | |
765 | - $this->set_pagination_args( array( |
|
765 | + $this->set_pagination_args(array( |
|
766 | 766 | 'total_items' => $total_items, |
767 | 767 | // WE have to calculate the total number of items |
768 | 768 | 'per_page' => $this->per_page, |
769 | 769 | // WE have to determine how many items to show on a page |
770 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
770 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
771 | 771 | // WE have to calculate the total number of pages |
772 | 772 | ) |
773 | 773 | ); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
77 | 77 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
78 | - 'attributes' => array( |
|
78 | + 'attributes' => array( |
|
79 | 79 | 'placeholder' => give_format_decimal( '1.00' ), |
80 | 80 | 'value' => give_format_decimal( $price ), |
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
111 | 111 | 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
112 | 112 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
113 | - 'attributes' => array( |
|
113 | + 'attributes' => array( |
|
114 | 114 | 'placeholder' => give_format_decimal( '1.00' ), |
115 | 115 | 'class' => 'cmb-type-text-small give-money-field', |
116 | 116 | ), |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,327 +48,327 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => esc_html__('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
61 | - 'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => esc_html__('Donation Option', 'give'), |
|
61 | + 'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
67 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => esc_html__('Set Donation', 'give'), |
|
67 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
72 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => esc_html__('Set Donation', 'give'), |
|
72 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
77 | 77 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
80 | - 'value' => give_format_decimal( $price ), |
|
79 | + 'placeholder' => give_format_decimal('1.00'), |
|
80 | + 'value' => give_format_decimal($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
95 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
96 | 96 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => esc_html__( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => esc_html__('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => esc_html__('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
113 | 113 | 'attributes' => array( |
114 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
114 | + 'placeholder' => give_format_decimal('1.00'), |
|
115 | 115 | 'class' => 'cmb-type-text-small give-money-field', |
116 | 116 | ), |
117 | 117 | 'before' => 'give_format_admin_multilevel_amount', |
118 | 118 | ), |
119 | 119 | array( |
120 | - 'name' => esc_html__( 'Text', 'give' ), |
|
121 | - 'id' => $prefix . 'text', |
|
120 | + 'name' => esc_html__('Text', 'give'), |
|
121 | + 'id' => $prefix.'text', |
|
122 | 122 | 'type' => 'text', |
123 | 123 | 'attributes' => array( |
124 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
124 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
125 | 125 | 'class' => 'give-multilevel-text-field', |
126 | 126 | ), |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Default', 'give' ), |
|
130 | - 'id' => $prefix . 'default', |
|
129 | + 'name' => esc_html__('Default', 'give'), |
|
130 | + 'id' => $prefix.'default', |
|
131 | 131 | 'type' => 'give_default_radio_inline' |
132 | 132 | ), |
133 | - ) ), |
|
133 | + )), |
|
134 | 134 | ), |
135 | 135 | //Display Style |
136 | 136 | array( |
137 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
138 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
139 | - 'id' => $prefix . 'display_style', |
|
137 | + 'name' => esc_html__('Display Style', 'give'), |
|
138 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
139 | + 'id' => $prefix.'display_style', |
|
140 | 140 | 'type' => 'radio_inline', |
141 | 141 | 'default' => 'buttons', |
142 | 142 | 'options' => array( |
143 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
144 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
145 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
143 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
144 | + 'radios' => esc_html__('Radios', 'give'), |
|
145 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
146 | 146 | ), |
147 | 147 | ), |
148 | 148 | //Custom Amount |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
151 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
152 | - 'id' => $prefix . 'custom_amount', |
|
150 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
151 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
152 | + 'id' => $prefix.'custom_amount', |
|
153 | 153 | 'type' => 'radio_inline', |
154 | 154 | 'default' => 'no', |
155 | 155 | 'options' => array( |
156 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
157 | - 'no' => esc_html__( 'No', 'give' ), |
|
156 | + 'yes' => esc_html__('Yes', 'give'), |
|
157 | + 'no' => esc_html__('No', 'give'), |
|
158 | 158 | ), |
159 | 159 | ), |
160 | 160 | array( |
161 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
162 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
163 | - 'id' => $prefix . 'custom_amount_minimum', |
|
161 | + 'name' => esc_html__('Custom Amount Minimum', 'give'), |
|
162 | + 'description' => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
163 | + 'id' => $prefix.'custom_amount_minimum', |
|
164 | 164 | 'type' => 'text_small', |
165 | 165 | 'row_classes' => 'give-subfield', |
166 | 166 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
167 | 167 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
168 | 168 | 'attributes' => array( |
169 | 169 | 'placeholder' => give_format_decimal('1.00'), |
170 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
170 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
171 | 171 | 'class' => 'cmb-type-text-small give-money-field', |
172 | 172 | ) |
173 | 173 | ), |
174 | 174 | array( |
175 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
176 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
177 | - 'id' => $prefix . 'custom_amount_text', |
|
175 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
176 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
177 | + 'id' => $prefix.'custom_amount_text', |
|
178 | 178 | 'type' => 'text', |
179 | 179 | 'row_classes' => 'give-subfield', |
180 | 180 | 'attributes' => array( |
181 | 181 | 'rows' => 3, |
182 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
182 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
183 | 183 | ), |
184 | 184 | ), |
185 | 185 | //Goals |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
188 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
189 | - 'id' => $prefix . 'goal_option', |
|
187 | + 'name' => esc_html__('Goal', 'give'), |
|
188 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
189 | + 'id' => $prefix.'goal_option', |
|
190 | 190 | 'type' => 'radio_inline', |
191 | 191 | 'default' => 'no', |
192 | 192 | 'options' => array( |
193 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
194 | - 'no' => esc_html__( 'No', 'give' ), |
|
193 | + 'yes' => esc_html__('Yes', 'give'), |
|
194 | + 'no' => esc_html__('No', 'give'), |
|
195 | 195 | ), |
196 | 196 | ), |
197 | 197 | array( |
198 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
199 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
200 | - 'id' => $prefix . 'set_goal', |
|
198 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
199 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
200 | + 'id' => $prefix.'set_goal', |
|
201 | 201 | 'type' => 'text_small', |
202 | 202 | 'row_classes' => 'give-subfield', |
203 | 203 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
204 | 204 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
205 | 205 | 'attributes' => array( |
206 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
207 | - 'value' => give_format_decimal( $goal ), |
|
206 | + 'placeholder' => give_format_decimal('0.00'), |
|
207 | + 'value' => give_format_decimal($goal), |
|
208 | 208 | 'class' => 'cmb-type-text-small give-money-field', |
209 | 209 | ), |
210 | 210 | ), |
211 | 211 | |
212 | 212 | array( |
213 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
214 | - 'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
215 | - 'id' => $prefix . 'goal_format', |
|
213 | + 'name' => esc_html__('Goal Format', 'give'), |
|
214 | + 'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
215 | + 'id' => $prefix.'goal_format', |
|
216 | 216 | 'type' => 'radio_inline', |
217 | 217 | 'default' => 'amount', |
218 | 218 | 'row_classes' => 'give-subfield', |
219 | 219 | 'options' => array( |
220 | - 'amount' => esc_html__( 'Amount ', 'give' ), |
|
221 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
220 | + 'amount' => esc_html__('Amount ', 'give'), |
|
221 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
222 | 222 | ), |
223 | 223 | ), |
224 | 224 | array( |
225 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
226 | - 'id' => $prefix . 'goal_color', |
|
225 | + 'name' => esc_html__('Goal Progress Bar Color', 'give'), |
|
226 | + 'id' => $prefix.'goal_color', |
|
227 | 227 | 'type' => 'colorpicker', |
228 | 228 | 'row_classes' => 'give-subfield', |
229 | 229 | 'default' => '#2bc253', |
230 | 230 | ), |
231 | 231 | |
232 | 232 | array( |
233 | - 'name' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
234 | - 'desc' => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
235 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
233 | + 'name' => esc_html__('Close Form when Goal Achieved', 'give'), |
|
234 | + 'desc' => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
235 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
236 | 236 | 'type' => 'radio_inline', |
237 | 237 | 'row_classes' => 'give-subfield', |
238 | 238 | 'options' => array( |
239 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
240 | - 'no' => esc_html__( 'No', 'give' ), |
|
239 | + 'yes' => esc_html__('Yes', 'give'), |
|
240 | + 'no' => esc_html__('No', 'give'), |
|
241 | 241 | ), |
242 | 242 | 'default' => 'no', |
243 | 243 | ), |
244 | 244 | array( |
245 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
246 | - 'desc' => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
247 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
245 | + 'name' => esc_html__('Goal Achieved Message', 'give'), |
|
246 | + 'desc' => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
247 | + 'id' => $prefix.'form_goal_achieved_message', |
|
248 | 248 | 'type' => 'textarea', |
249 | 249 | 'row_classes' => 'give-subfield', |
250 | 250 | 'attributes' => array( |
251 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
251 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
252 | 252 | ), |
253 | 253 | ) |
254 | 254 | ) |
255 | 255 | ) |
256 | - ) ); |
|
256 | + )); |
|
257 | 257 | |
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Content Field |
261 | 261 | */ |
262 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
262 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
263 | 263 | 'id' => 'form_content_options', |
264 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
265 | - 'object_types' => array( 'give_forms' ), |
|
264 | + 'title' => esc_html__('Form Content', 'give'), |
|
265 | + 'object_types' => array('give_forms'), |
|
266 | 266 | 'context' => 'normal', |
267 | 267 | 'priority' => 'high', //Show above Content WYSIWYG |
268 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
268 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
269 | 269 | //Donation Option |
270 | 270 | array( |
271 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
272 | - 'description' => esc_html__( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
273 | - 'id' => $prefix . 'content_option', |
|
271 | + 'name' => esc_html__('Display Content', 'give'), |
|
272 | + 'description' => esc_html__('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
273 | + 'id' => $prefix.'content_option', |
|
274 | 274 | 'type' => 'select', |
275 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
276 | - 'none' => esc_html__( 'No content', 'give' ), |
|
277 | - 'give_pre_form' => esc_html__( 'Yes, display content ABOVE the form fields', 'give' ), |
|
278 | - 'give_post_form' => esc_html__( 'Yes, display content BELOW the form fields', 'give' ), |
|
275 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
276 | + 'none' => esc_html__('No content', 'give'), |
|
277 | + 'give_pre_form' => esc_html__('Yes, display content ABOVE the form fields', 'give'), |
|
278 | + 'give_post_form' => esc_html__('Yes, display content BELOW the form fields', 'give'), |
|
279 | 279 | ) |
280 | 280 | ), |
281 | 281 | 'default' => 'none', |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'name' => esc_html__( 'Content', 'give' ), |
|
285 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
286 | - 'id' => $prefix . 'form_content', |
|
284 | + 'name' => esc_html__('Content', 'give'), |
|
285 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
286 | + 'id' => $prefix.'form_content', |
|
287 | 287 | 'row_classes' => 'give-subfield', |
288 | 288 | 'type' => 'wysiwyg' |
289 | 289 | ), |
290 | 290 | ) |
291 | 291 | ) |
292 | - ) ); |
|
292 | + )); |
|
293 | 293 | |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Display Options |
297 | 297 | */ |
298 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
298 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
299 | 299 | 'id' => 'form_display_options', |
300 | - 'title' => esc_html__( 'Form Display Options', 'give' ), |
|
301 | - 'object_types' => array( 'give_forms' ), |
|
300 | + 'title' => esc_html__('Form Display Options', 'give'), |
|
301 | + 'object_types' => array('give_forms'), |
|
302 | 302 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
303 | 303 | 'priority' => 'high', //Show above Content WYSIWYG |
304 | 304 | 'show_names' => true, // Show field names on the left |
305 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
305 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
306 | 306 | array( |
307 | - 'name' => esc_html__( 'Payment Fields', 'give' ), |
|
308 | - 'desc' => esc_html__( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
309 | - 'id' => $prefix . 'payment_display', |
|
307 | + 'name' => esc_html__('Payment Fields', 'give'), |
|
308 | + 'desc' => esc_html__('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
309 | + 'id' => $prefix.'payment_display', |
|
310 | 310 | 'type' => 'select', |
311 | 311 | 'options' => array( |
312 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
313 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
314 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
312 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
313 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
314 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
315 | 315 | ), |
316 | 316 | 'default' => 'onpage', |
317 | 317 | ), |
318 | 318 | array( |
319 | - 'id' => $prefix . 'reveal_label', |
|
320 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
321 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
319 | + 'id' => $prefix.'reveal_label', |
|
320 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'), |
|
321 | + 'desc' => esc_html__('The button label for completing the donation.', 'give'), |
|
322 | 322 | 'type' => 'text_small', |
323 | 323 | 'row_classes' => 'give-subfield', |
324 | 324 | 'attributes' => array( |
325 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
325 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
326 | 326 | ), |
327 | 327 | ), |
328 | 328 | array( |
329 | - 'id' => $prefix . 'checkout_label', |
|
330 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
331 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
329 | + 'id' => $prefix.'checkout_label', |
|
330 | + 'name' => esc_html__('Complete Donation Text', 'give'), |
|
331 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
332 | 332 | 'type' => 'text_small', |
333 | 333 | 'attributes' => array( |
334 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
334 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
335 | 335 | ), |
336 | 336 | ), |
337 | 337 | array( |
338 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
339 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
340 | - 'id' => $prefix . 'default_gateway', |
|
338 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
339 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
340 | + 'id' => $prefix.'default_gateway', |
|
341 | 341 | 'type' => 'default_gateway' |
342 | 342 | ), |
343 | 343 | array( |
344 | - 'name' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
345 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
346 | - 'id' => $prefix . 'logged_in_only', |
|
344 | + 'name' => esc_html__('Disable Guest Donations', 'give'), |
|
345 | + 'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'), |
|
346 | + 'id' => $prefix.'logged_in_only', |
|
347 | 347 | 'type' => 'checkbox' |
348 | 348 | ), |
349 | 349 | array( |
350 | - 'name' => esc_html__( 'Register / Login Form', 'give' ), |
|
351 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
352 | - 'id' => $prefix . 'show_register_form', |
|
350 | + 'name' => esc_html__('Register / Login Form', 'give'), |
|
351 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
352 | + 'id' => $prefix.'show_register_form', |
|
353 | 353 | 'type' => 'select', |
354 | 354 | 'options' => array( |
355 | - 'both' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
356 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
357 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
358 | - 'none' => esc_html__( 'None', 'give' ), |
|
355 | + 'both' => esc_html__('Registration and Login Forms', 'give'), |
|
356 | + 'registration' => esc_html__('Registration Form Only', 'give'), |
|
357 | + 'login' => esc_html__('Login Form Only', 'give'), |
|
358 | + 'none' => esc_html__('None', 'give'), |
|
359 | 359 | ), |
360 | 360 | 'default' => 'none', |
361 | 361 | ), |
362 | 362 | array( |
363 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
363 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
364 | 364 | /* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
365 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
366 | - 'id' => $prefix . 'form_floating_labels', |
|
365 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
366 | + 'id' => $prefix.'form_floating_labels', |
|
367 | 367 | 'type' => 'select', |
368 | 368 | 'options' => array( |
369 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
370 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
371 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
369 | + '' => esc_html__('Use the global setting', 'give'), |
|
370 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
371 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
372 | 372 | ), |
373 | 373 | 'default' => 'none', |
374 | 374 | ) |
@@ -380,47 +380,47 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * Terms & Conditions |
382 | 382 | */ |
383 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
383 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
384 | 384 | 'id' => 'form_terms_options', |
385 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
386 | - 'object_types' => array( 'give_forms' ), |
|
385 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
386 | + 'object_types' => array('give_forms'), |
|
387 | 387 | 'context' => 'normal', |
388 | 388 | 'priority' => 'high', //Show above Content WYSIWYG |
389 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
389 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
390 | 390 | //Donation Option |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
393 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
394 | - 'id' => $prefix . 'terms_option', |
|
392 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
393 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
394 | + 'id' => $prefix.'terms_option', |
|
395 | 395 | 'type' => 'select', |
396 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
397 | - 'none' => esc_html__( 'No', 'give' ), |
|
398 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
396 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
397 | + 'none' => esc_html__('No', 'give'), |
|
398 | + 'yes' => esc_html__('Yes', 'give'), |
|
399 | 399 | ) |
400 | 400 | ), |
401 | 401 | 'default' => 'none', |
402 | 402 | ), |
403 | 403 | array( |
404 | - 'id' => $prefix . 'agree_label', |
|
405 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
406 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
404 | + 'id' => $prefix.'agree_label', |
|
405 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
406 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
407 | 407 | 'type' => 'text', |
408 | 408 | 'row_classes' => 'give-subfield', |
409 | 409 | 'size' => 'regular', |
410 | 410 | 'attributes' => array( |
411 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
411 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
412 | 412 | ), |
413 | 413 | ), |
414 | 414 | array( |
415 | - 'id' => $prefix . 'agree_text', |
|
415 | + 'id' => $prefix.'agree_text', |
|
416 | 416 | 'row_classes' => 'give-subfield', |
417 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
418 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
417 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
418 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
419 | 419 | 'type' => 'wysiwyg' |
420 | 420 | ), |
421 | 421 | ) |
422 | 422 | ) |
423 | - ) ); |
|
423 | + )); |
|
424 | 424 | |
425 | 425 | return $meta_boxes; |
426 | 426 | |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | |
435 | 435 | <div class="table-container"> |
436 | 436 | <div class="table-row"> |
437 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
438 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
439 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
437 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div> |
|
438 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div> |
|
439 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div> |
|
440 | 440 | <?php |
441 | 441 | /** |
442 | 442 | * Fires in repeatable donation levels table head. |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @since 1.0 |
450 | 450 | */ |
451 | - do_action( 'give_donation_levels_table_head' ); |
|
451 | + do_action('give_donation_levels_table_head'); |
|
452 | 452 | ?> |
453 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
453 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div> |
|
454 | 454 | |
455 | 455 | </div> |
456 | 456 | </div> |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | <?php |
459 | 459 | } |
460 | 460 | |
461 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
461 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
462 | 462 | |
463 | 463 | |
464 | 464 | /** |
@@ -475,25 +475,25 @@ discard block |
||
475 | 475 | * @param $object_type |
476 | 476 | * @param $field_type_object |
477 | 477 | */ |
478 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
478 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
479 | 479 | |
480 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
480 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
481 | 481 | |
482 | 482 | $field_options_array = array( |
483 | 483 | 'class' => 'give-hidden give-level-id-input', |
484 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
485 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
484 | + 'name' => $field_type_object->_name('[level_id]'), |
|
485 | + 'id' => $field_type_object->_id('_level_id'), |
|
486 | 486 | 'value' => $escaped_value, |
487 | 487 | 'type' => 'number', |
488 | 488 | 'desc' => '', |
489 | 489 | ); |
490 | 490 | |
491 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
492 | - echo $field_type_object->input( $field_options_array ); |
|
491 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
492 | + echo $field_type_object->input($field_options_array); |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
496 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
497 | 497 | |
498 | 498 | |
499 | 499 | /** |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | * @param $object_type |
506 | 506 | * @param $field_type_object |
507 | 507 | */ |
508 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
509 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
510 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
508 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
509 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
510 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
511 | 511 | |
512 | 512 | } |
513 | 513 | |
514 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
514 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
515 | 515 | |
516 | 516 | |
517 | 517 | /** |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | */ |
522 | 522 | function give_add_shortcode_to_publish_metabox() { |
523 | 523 | |
524 | - if ( 'give_forms' !== get_post_type() ) { |
|
524 | + if ('give_forms' !== get_post_type()) { |
|
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | |
528 | 528 | global $post; |
529 | 529 | |
530 | 530 | //Only enqueue scripts for CPT on post type screen |
531 | - if ( 'give_forms' === $post->post_type ) { |
|
531 | + if ('give_forms' === $post->post_type) { |
|
532 | 532 | //Shortcode column with select all input |
533 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
534 | - echo '<div class="shortcode-wrap box-sizing"><label>' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
533 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
534 | + echo '<div class="shortcode-wrap box-sizing"><label>'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
535 | 535 | |
536 | 536 | } |
537 | 537 | |
538 | 538 | } |
539 | 539 | |
540 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
540 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id; |
|
71 | + return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id; |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway; |
|
73 | + return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Payment ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Payment ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | 'paged' => $paged |
181 | 181 | ); |
182 | 182 | |
183 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
183 | + $logs = $give_logs->get_connected_logs($log_query); |
|
184 | 184 | |
185 | - if ( $logs ) { |
|
186 | - foreach ( $logs as $log ) { |
|
185 | + if ($logs) { |
|
186 | + foreach ($logs as $log) { |
|
187 | 187 | |
188 | 188 | $logs_data[] = array( |
189 | 189 | 'ID' => $log->ID, |
190 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
190 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
191 | 191 | 'payment_id' => $log->post_parent, |
192 | 192 | 'error' => 'error', |
193 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
193 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
194 | 194 | 'date' => $log->post_date |
195 | 195 | ); |
196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $which |
214 | 214 | */ |
215 | - protected function display_tablenav( $which ) { |
|
216 | - if ( 'top' === $which ) { |
|
217 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
215 | + protected function display_tablenav($which) { |
|
216 | + if ('top' === $which) { |
|
217 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
220 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
221 | 221 | |
222 | 222 | <div class="alignleft actions bulkactions"> |
223 | - <?php $this->bulk_actions( $which ); ?> |
|
223 | + <?php $this->bulk_actions($which); ?> |
|
224 | 224 | </div> |
225 | 225 | <?php |
226 | - $this->extra_tablenav( $which ); |
|
227 | - $this->pagination( $which ); |
|
226 | + $this->extra_tablenav($which); |
|
227 | + $this->pagination($which); |
|
228 | 228 | ?> |
229 | 229 | |
230 | 230 | <br class="clear"/> |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | $columns = $this->get_columns(); |
252 | 252 | $hidden = array(); // No hidden columns |
253 | 253 | $sortable = $this->get_sortable_columns(); |
254 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
254 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
255 | 255 | $this->items = $this->get_logs(); |
256 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
256 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
257 | 257 | |
258 | - $this->set_pagination_args( array( |
|
258 | + $this->set_pagination_args(array( |
|
259 | 259 | 'total_items' => $total_items, |
260 | 260 | 'per_page' => $this->per_page, |
261 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
261 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | } |
@@ -10,61 +10,61 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file. |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types. |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies. |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms. |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies. |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages. |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | Give()->roles->remove_caps(); |
73 | 73 | |
74 | 74 | // Delete the Roles. |
75 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
76 | - foreach ( $give_roles as $role ) { |
|
77 | - remove_role( $role ); |
|
75 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
76 | + foreach ($give_roles as $role) { |
|
77 | + remove_role($role); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Remove all database tables. |
81 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
81 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
84 | 84 | |
85 | 85 | // Cleanup Cron Events. |
86 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
87 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
86 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
87 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
89 | 89 | |
90 | 90 | // Get all options. |
91 | 91 | $give_option_names = $wpdb->get_results( |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | ARRAY_A |
97 | 97 | ); |
98 | 98 | |
99 | - if ( ! empty( $give_option_names ) ) { |
|
99 | + if ( ! empty($give_option_names)) { |
|
100 | 100 | // Convert option name to transient or option name. |
101 | 101 | $new_give_option_names = array(); |
102 | 102 | |
103 | - foreach ( $give_option_names as $option ) { |
|
104 | - $new_give_option_names[] = ( false !== strpos( $option['option_name'], '_transient_' ) ) |
|
105 | - ? str_replace( '_transient_', '', $option['option_name'] ) |
|
103 | + foreach ($give_option_names as $option) { |
|
104 | + $new_give_option_names[] = (false !== strpos($option['option_name'], '_transient_')) |
|
105 | + ? str_replace('_transient_', '', $option['option_name']) |
|
106 | 106 | : $option['option_name']; |
107 | 107 | } |
108 | 108 | |
109 | 109 | $give_option_names = $new_give_option_names; |
110 | 110 | |
111 | 111 | // Delete all the Plugin Options. |
112 | - foreach ( $give_option_names as $option ) { |
|
113 | - if ( false !== strpos( $option, '_transient_' ) ) { |
|
114 | - delete_transient( $option ); |
|
112 | + foreach ($give_option_names as $option) { |
|
113 | + if (false !== strpos($option, '_transient_')) { |
|
114 | + delete_transient($option); |
|
115 | 115 | } else { |
116 | - delete_option( $option ); |
|
116 | + delete_option($option); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | * @global $wp_version |
25 | 25 | * @return void |
26 | 26 | */ |
27 | -function give_install( $network_wide = false ) { |
|
27 | +function give_install($network_wide = false) { |
|
28 | 28 | |
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - if ( is_multisite() && $network_wide ) { |
|
31 | + if (is_multisite() && $network_wide) { |
|
32 | 32 | |
33 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
33 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
34 | 34 | |
35 | - switch_to_blog( $blog_id ); |
|
35 | + switch_to_blog($blog_id); |
|
36 | 36 | give_run_install(); |
37 | 37 | restore_current_blog(); |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
49 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Run the Give Install process. |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | give_setup_post_types(); |
63 | 63 | |
64 | 64 | // Clear the permalinks. |
65 | - flush_rewrite_rules( false ); |
|
65 | + flush_rewrite_rules(false); |
|
66 | 66 | |
67 | 67 | // Add Upgraded From Option. |
68 | - $current_version = get_option( 'give_version' ); |
|
69 | - if ( $current_version ) { |
|
70 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
68 | + $current_version = get_option('give_version'); |
|
69 | + if ($current_version) { |
|
70 | + update_option('give_version_upgraded_from', $current_version); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Setup some default options. |
74 | 74 | $options = array(); |
75 | 75 | |
76 | 76 | // Checks if the Success Page option exists AND that the page exists. |
77 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
77 | + if ( ! get_post(give_get_option('success_page'))) { |
|
78 | 78 | |
79 | 79 | // Donations Confirmation (Success) Page. |
80 | 80 | $success = wp_insert_post( |
81 | 81 | array( |
82 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
82 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
83 | 83 | 'post_content' => '[give_receipt]', |
84 | 84 | 'post_status' => 'publish', |
85 | 85 | 'post_author' => 1, |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Checks if the Failure Page option exists AND that the page exists. |
96 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
96 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
97 | 97 | |
98 | 98 | // Failed Donation Page. |
99 | 99 | $failed = wp_insert_post( |
100 | 100 | array( |
101 | - 'post_title' => esc_html__( 'Transaction Failed', 'give' ), |
|
102 | - 'post_content' => esc_html__( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ), |
|
101 | + 'post_title' => esc_html__('Transaction Failed', 'give'), |
|
102 | + 'post_content' => esc_html__('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'), |
|
103 | 103 | 'post_status' => 'publish', |
104 | 104 | 'post_author' => 1, |
105 | 105 | 'post_type' => 'page', |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | // Checks if the History Page option exists AND that the page exists. |
114 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
114 | + if ( ! get_post(give_get_option('history_page'))) { |
|
115 | 115 | // Purchase History (History) Page. |
116 | 116 | $history = wp_insert_post( |
117 | 117 | array( |
118 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
118 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
119 | 119 | 'post_content' => '[donation_history]', |
120 | 120 | 'post_status' => 'publish', |
121 | 121 | 'post_author' => 1, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
131 | - if ( empty( $current_version ) ) { |
|
131 | + if (empty($current_version)) { |
|
132 | 132 | $options['base_country'] = 'US'; |
133 | 133 | $options['test_mode'] = 1; |
134 | 134 | $options['currency'] = 'USD'; |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Populate the default values. |
155 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
156 | - update_option( 'give_version', GIVE_VERSION ); |
|
155 | + update_option('give_settings', array_merge($give_options, $options)); |
|
156 | + update_option('give_version', GIVE_VERSION); |
|
157 | 157 | |
158 | 158 | // Create Give roles. |
159 | 159 | $roles = new Give_Roles(); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $roles->add_caps(); |
162 | 162 | |
163 | 163 | $api = new Give_API(); |
164 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
164 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
165 | 165 | |
166 | 166 | // Create the customers databases. |
167 | 167 | @Give()->customers->create_table(); |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | Give()->session->use_php_sessions(); |
172 | 172 | |
173 | 173 | // Add a temporary option to note that Give pages have been created. |
174 | - set_transient( '_give_installed', $options, 30 ); |
|
174 | + set_transient('_give_installed', $options, 30); |
|
175 | 175 | |
176 | - if ( ! $current_version ) { |
|
176 | + if ( ! $current_version) { |
|
177 | 177 | |
178 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
178 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
179 | 179 | |
180 | 180 | // When new upgrade routines are added, mark them as complete on fresh install. |
181 | 181 | $upgrade_routines = array( |
@@ -184,22 +184,22 @@ discard block |
||
184 | 184 | 'upgrade_give_offline_status' |
185 | 185 | ); |
186 | 186 | |
187 | - foreach ( $upgrade_routines as $upgrade ) { |
|
188 | - give_set_upgrade_complete( $upgrade ); |
|
187 | + foreach ($upgrade_routines as $upgrade) { |
|
188 | + give_set_upgrade_complete($upgrade); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | 192 | // Bail if activating from network, or bulk. |
193 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
193 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Add the transient to redirect. |
198 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
198 | + set_transient('_give_activation_redirect', true, 30); |
|
199 | 199 | |
200 | 200 | } |
201 | 201 | |
202 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
202 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Network Activated New Site Setup. |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | * @param int $site_id The Site ID. |
216 | 216 | * @param array $meta Blog Meta. |
217 | 217 | */ |
218 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
218 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
219 | 219 | |
220 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
220 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
221 | 221 | |
222 | - switch_to_blog( $blog_id ); |
|
222 | + switch_to_blog($blog_id); |
|
223 | 223 | give_install(); |
224 | 224 | restore_current_blog(); |
225 | 225 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
230 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
231 | 231 | |
232 | 232 | |
233 | 233 | /** |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return array The tables to drop. |
242 | 242 | */ |
243 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
243 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
244 | 244 | |
245 | - switch_to_blog( $blog_id ); |
|
245 | + switch_to_blog($blog_id); |
|
246 | 246 | $customers_db = new Give_DB_Customers(); |
247 | 247 | $customer_meta_db = new Give_DB_Customer_Meta(); |
248 | 248 | |
249 | - if ( $customers_db->installed() ) { |
|
249 | + if ($customers_db->installed()) { |
|
250 | 250 | $tables[] = $customers_db->table_name; |
251 | 251 | $tables[] = $customer_meta_db->table_name; |
252 | 252 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | } |
258 | 258 | |
259 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
259 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Post-installation |
@@ -268,16 +268,16 @@ discard block |
||
268 | 268 | */ |
269 | 269 | function give_after_install() { |
270 | 270 | |
271 | - if ( ! is_admin() ) { |
|
271 | + if ( ! is_admin()) { |
|
272 | 272 | return; |
273 | 273 | } |
274 | 274 | |
275 | - $give_options = get_transient( '_give_installed' ); |
|
276 | - $give_table_check = get_option( '_give_table_check', false ); |
|
275 | + $give_options = get_transient('_give_installed'); |
|
276 | + $give_table_check = get_option('_give_table_check', false); |
|
277 | 277 | |
278 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
278 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
279 | 279 | |
280 | - if ( ! @Give()->customer_meta->installed() ) { |
|
280 | + if ( ! @Give()->customer_meta->installed()) { |
|
281 | 281 | |
282 | 282 | // Create the customer meta database |
283 | 283 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -285,27 +285,27 @@ discard block |
||
285 | 285 | |
286 | 286 | } |
287 | 287 | |
288 | - if ( ! @Give()->customers->installed() ) { |
|
288 | + if ( ! @Give()->customers->installed()) { |
|
289 | 289 | // Create the customers database |
290 | 290 | // (this ensures it creates it on multisite instances where it is network activated). |
291 | 291 | @Give()->customers->create_table(); |
292 | 292 | |
293 | - do_action( 'give_after_install', $give_options ); |
|
293 | + do_action('give_after_install', $give_options); |
|
294 | 294 | } |
295 | 295 | |
296 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
296 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
297 | 297 | |
298 | 298 | } |
299 | 299 | |
300 | 300 | // Delete the transient |
301 | - if ( false !== $give_options ) { |
|
302 | - delete_transient( '_give_installed' ); |
|
301 | + if (false !== $give_options) { |
|
302 | + delete_transient('_give_installed'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | 306 | } |
307 | 307 | |
308 | -add_action( 'admin_init', 'give_after_install' ); |
|
308 | +add_action('admin_init', 'give_after_install'); |
|
309 | 309 | |
310 | 310 | |
311 | 311 | /** |
@@ -320,11 +320,11 @@ discard block |
||
320 | 320 | |
321 | 321 | global $wp_roles; |
322 | 322 | |
323 | - if ( ! is_object( $wp_roles ) ) { |
|
323 | + if ( ! is_object($wp_roles)) { |
|
324 | 324 | return; |
325 | 325 | } |
326 | 326 | |
327 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
327 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
328 | 328 | |
329 | 329 | // Create Give plugin roles |
330 | 330 | $roles = new Give_Roles(); |
@@ -335,4 +335,4 @@ discard block |
||
335 | 335 | |
336 | 336 | } |
337 | 337 | |
338 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
339 | 338 | \ No newline at end of file |
339 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
340 | 340 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param $_banner_details |
28 | 28 | */ |
29 | - function __construct( $_banner_details ) { |
|
29 | + function __construct($_banner_details) { |
|
30 | 30 | |
31 | 31 | global $current_user; |
32 | 32 | $this->banner_details = $_banner_details; |
33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
35 | 35 | |
36 | 36 | //Get current user |
37 | 37 | $this->user_id = $current_user->ID; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | public function init() { |
51 | 51 | |
52 | 52 | //Testing? |
53 | - if ( $this->test_mode ) { |
|
54 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
53 | + if ($this->test_mode) { |
|
54 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | //Get the current page to add the notice to |
58 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
59 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
58 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
59 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | global $pagenow; |
71 | 71 | |
72 | 72 | //Make sure we're on the plugins page. |
73 | - if ( $pagenow !== 'plugins.php' ) { |
|
73 | + if ($pagenow !== 'plugins.php') { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | |
77 | 77 | // If the user hasn't already dismissed our alert, |
78 | 78 | // Output the activation banner |
79 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
79 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
80 | 80 | |
81 | 81 | <style> |
82 | 82 | div.give-addon-alert.updated { |
@@ -155,43 +155,43 @@ discard block |
||
155 | 155 | <h3><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: Add-on name */ |
158 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
159 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
158 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
159 | + '<span>'.$this->banner_details['name'].'</span>' |
|
160 | 160 | ); |
161 | 161 | ?></h3> |
162 | 162 | |
163 | 163 | <a href="<?php |
164 | 164 | //The Dismiss Button. |
165 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
166 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span |
|
165 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
166 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span |
|
167 | 167 | class="dashicons dashicons-dismiss"></span></a> |
168 | 168 | |
169 | 169 | <div class="alert-actions"> |
170 | 170 | |
171 | 171 | <?php //Point them to your settings page. |
172 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
172 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
173 | 173 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
174 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?></a> |
|
174 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?></a> |
|
175 | 175 | <?php } ?> |
176 | 176 | |
177 | 177 | <?php |
178 | 178 | // Show them how to configure the Addon. |
179 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
179 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
180 | 180 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
181 | 181 | <span class="dashicons dashicons-media-text"></span><?php |
182 | 182 | printf( |
183 | 183 | /* translators: %s: Add-on name */ |
184 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
184 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
185 | 185 | $this->banner_details['name'] |
186 | 186 | ); |
187 | 187 | ?></a> |
188 | 188 | <?php } ?> |
189 | 189 | <?php |
190 | 190 | //Let them signup for plugin updates |
191 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
191 | + if (isset($this->banner_details['support_url'])) { ?> |
|
192 | 192 | |
193 | 193 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
194 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
194 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
195 | 195 | </a> |
196 | 196 | |
197 | 197 | <?php } ?> |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
216 | 216 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
217 | 217 | */ |
218 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
218 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
219 | 219 | |
220 | 220 | //Get the global user |
221 | 221 | global $current_user; |
222 | 222 | $user_id = $current_user->ID; |
223 | 223 | |
224 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
224 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |