Completed
Push — master ( 769d6a...384538 )
by Devin
18:36 queued 15:05
created
includes/admin/settings/class-settings-addon.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Addon' ) ) :
16
+if ( ! class_exists('Give_Settings_Addon')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Addon.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		 */
27 27
 		public function __construct() {
28 28
 			$this->id    = 'addons';
29
-			$this->label = esc_html__( 'Add-ons', 'give' );
29
+			$this->label = esc_html__('Add-ons', 'give');
30 30
 
31 31
 			parent::__construct();
32 32
 		}
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 		 * @param  $setting_tab
39 39
 		 * @return string
40 40
 		 */
41
-		function set_default_setting_tab( $setting_tab ) {
41
+		function set_default_setting_tab($setting_tab) {
42 42
 			$default_tab = '';
43 43
 
44 44
 			// Set default tab to first setting tab.
45
-			if( $sections = array_keys( $this->get_sections() ) ) {
46
-				$default_tab = current( $sections );
45
+			if ($sections = array_keys($this->get_sections())) {
46
+				$default_tab = current($sections);
47 47
 			}
48 48
 			return $default_tab;
49 49
 		}
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 		 * @param  array $pages Lst of pages.
56 56
 		 * @return array
57 57
 		 */
58
-		public function add_settings_page( $pages ) {
58
+		public function add_settings_page($pages) {
59 59
 			$setting = $this->get_settings();
60 60
 			// Bailout: Do not add addons setting tab if it does not contain any setting fields.
61
-			if( ! empty( $setting ) ) {
62
-				$pages[ $this->id ] = $this->label;
61
+			if ( ! empty($setting)) {
62
+				$pages[$this->id] = $this->label;
63 63
 			}
64 64
 
65 65
 			return $pages;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			 * Filter the addons settings.
79 79
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
80 80
 			 */
81
-			$settings = apply_filters( 'give_settings_addons', $settings );
81
+			$settings = apply_filters('give_settings_addons', $settings);
82 82
 
83 83
 			/**
84 84
 			 * Filter the settings.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @since  1.8
87 87
 			 * @param  array $settings
88 88
 			 */
89
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
89
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
90 90
 
91 91
 			// Output.
92 92
 			return $settings;
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return  mixed
28 28
  */
29
-function _give_sanitize_number_decimals_setting_field( $value ) {
30
-	return absint( $value );
29
+function _give_sanitize_number_decimals_setting_field($value) {
30
+	return absint($value);
31 31
 }
32
-add_filter( 'give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10 );
33 32
\ No newline at end of file
33
+add_filter('give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10);
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_add_shortcode_to_publish_metabox() {
24 24
 
25
-	if ( 'give_forms' !== get_post_type() ) {
25
+	if ('give_forms' !== get_post_type()) {
26 26
 		return false;
27 27
 	}
28 28
 	global $post;
29 29
 
30 30
 	//Only enqueue scripts for CPT on post type screen
31
-	if ( 'give_forms' === $post->post_type ) {
31
+	if ('give_forms' === $post->post_type) {
32 32
 		//Shortcode column with select all input
33
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
34
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
33
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
34
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
35 35
 
36 36
 	}
37 37
 
38 38
 }
39 39
 
40
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
40
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => esc_html__( 'Name', 'give' ),
36
-		'form_category' => esc_html__( 'Categories', 'give' ),
37
-		'form_tag'      => esc_html__( 'Tags', 'give' ),
38
-		'price'         => esc_html__( 'Amount', 'give' ),
39
-		'goal'          => esc_html__( 'Goal', 'give' ),
40
-		'donations'     => esc_html__( 'Donations', 'give' ),
41
-		'earnings'      => esc_html__( 'Income', 'give' ),
42
-		'shortcode'     => esc_html__( 'Shortcode', 'give' ),
43
-		'date'          => esc_html__( 'Date', 'give' ),
35
+		'title'         => esc_html__('Name', 'give'),
36
+		'form_category' => esc_html__('Categories', 'give'),
37
+		'form_tag'      => esc_html__('Tags', 'give'),
38
+		'price'         => esc_html__('Amount', 'give'),
39
+		'goal'          => esc_html__('Goal', 'give'),
40
+		'donations'     => esc_html__('Donations', 'give'),
41
+		'earnings'      => esc_html__('Income', 'give'),
42
+		'shortcode'     => esc_html__('Shortcode', 'give'),
43
+		'date'          => esc_html__('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
83
+					echo give_price($post_id, false);
84
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( get_post_meta( $post_id, '_give_goal_option', true ) ) ) {
89
-					echo give_goal( $post_id, false );
88
+				if (give_is_setting_enabled(get_post_meta($post_id, '_give_goal_option', true))) {
89
+					echo give_goal($post_id, false);
90 90
 				} else {
91
-					esc_html_e( 'No Goal Set', 'give' );
91
+					esc_html_e('No Goal Set', 'give');
92 92
 				}
93 93
 
94
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
94
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
95 95
 				break;
96 96
 			case 'donations':
97
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
98
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">';
99
-					echo give_get_form_sales_stats( $post_id );
97
+				if (current_user_can('view_give_form_stats', $post_id)) {
98
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">';
99
+					echo give_get_form_sales_stats($post_id);
100 100
 					echo '</a>';
101 101
 				} else {
102 102
 					echo '-';
103 103
 				}
104 104
 				break;
105 105
 			case 'earnings':
106
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
107
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">';
108
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) );
106
+				if (current_user_can('view_give_form_stats', $post_id)) {
107
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">';
108
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id)));
109 109
 					echo '</a>';
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'shortcode':
115
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
115
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
116 116
 				break;
117 117
 		}
118 118
 	}
119 119
 }
120 120
 
121
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
121
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
122 122
 
123 123
 /**
124 124
  * Registers the sortable columns in the list table
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @return array $columns Array of sortable columns
131 131
  */
132
-function give_sortable_form_columns( $columns ) {
132
+function give_sortable_form_columns($columns) {
133 133
 	$columns['price']     = 'amount';
134 134
 	$columns['sales']     = 'sales';
135 135
 	$columns['earnings']  = 'earnings';
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	return $columns;
140 140
 }
141 141
 
142
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
142
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
143 143
 
144 144
 /**
145 145
  * Sorts Columns in the Forms List Table
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
  *
151 151
  * @return array $vars Array of all the sort variables
152 152
  */
153
-function give_sort_forms( $vars ) {
153
+function give_sort_forms($vars) {
154 154
 	// Check if we're viewing the "give_forms" post type
155
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
155
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
156 156
 		return $vars;
157 157
 	}
158 158
 
159
-	switch ( $vars['orderby'] ) {
159
+	switch ($vars['orderby']) {
160 160
 		// Check if 'orderby' is set to "sales"
161 161
 		case 'sales':
162 162
 			$vars = array_merge(
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
  *
226 226
  * @return array       Array of all sort variables
227 227
  */
228
-function give_filter_forms( $vars ) {
229
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
228
+function give_filter_forms($vars) {
229
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
230 230
 
231 231
 		// If an author ID was passed, use it
232
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
232
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
233 233
 
234 234
 			$author_id = $_REQUEST['author'];
235
-			if ( (int) $author_id !== get_current_user_id() ) {
235
+			if ((int) $author_id !== get_current_user_id()) {
236 236
 				// Tried to view the products of another person, sorry
237
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
237
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
238 238
 			}
239 239
 			$vars = array_merge(
240 240
 				$vars,
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
  * @return void
259 259
  */
260 260
 function give_forms_load() {
261
-	add_filter( 'request', 'give_sort_forms' );
262
-	add_filter( 'request', 'give_filter_forms' );
261
+	add_filter('request', 'give_sort_forms');
262
+	add_filter('request', 'give_filter_forms');
263 263
 }
264 264
 
265
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
265
+add_action('load-edit.php', 'give_forms_load', 9999);
266 266
 
267 267
 /**
268 268
  * Remove Forms Month Filter
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
  * @global      $typenow The post type we are viewing
277 277
  * @return array Empty array disables the dropdown
278 278
  */
279
-function give_remove_month_filter( $dates ) {
279
+function give_remove_month_filter($dates) {
280 280
 	global $typenow;
281 281
 
282
-	if ( $typenow == 'give_forms' ) {
282
+	if ($typenow == 'give_forms') {
283 283
 		$dates = array();
284 284
 	}
285 285
 
286 286
 	return $dates;
287 287
 }
288 288
 
289
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
289
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
290 290
 
291 291
 /**
292 292
  * Updates price when saving post
@@ -297,23 +297,23 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return int|null
299 299
  */
300
-function give_price_save_quick_edit( $post_id ) {
301
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
300
+function give_price_save_quick_edit($post_id) {
301
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
302 302
 		return;
303 303
 	}
304
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
304
+	if ( ! current_user_can('edit_post', $post_id)) {
305 305
 		return $post_id;
306 306
 	}
307
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
307
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
308 308
 		return $post_id;
309 309
 	}
310 310
 
311
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
312
-		update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) );
311
+	if (isset($_REQUEST['_give_regprice'])) {
312
+		update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice'])));
313 313
 	}
314 314
 }
315 315
 
316
-add_action( 'save_post', 'give_price_save_quick_edit' );
316
+add_action('save_post', 'give_price_save_quick_edit');
317 317
 
318 318
 /**
319 319
  * Process bulk edit actions via AJAX
@@ -323,18 +323,18 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function give_save_bulk_edit() {
325 325
 
326
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
326
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
327 327
 
328
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
329
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
330
-		foreach ( $post_ids as $post_id ) {
328
+	if ( ! empty($post_ids) && is_array($post_ids)) {
329
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
330
+		foreach ($post_ids as $post_id) {
331 331
 
332
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
332
+			if ( ! current_user_can('edit_post', $post_id)) {
333 333
 				continue;
334 334
 			}
335 335
 
336
-			if ( ! empty( $price ) ) {
337
-				update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) );
336
+			if ( ! empty($price)) {
337
+				update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price));
338 338
 			}
339 339
 		}
340 340
 	}
@@ -342,4 +342,4 @@  discard block
 block discarded – undo
342 342
 	die();
343 343
 }
344 344
 
345
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
345
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
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,15 +118,15 @@  discard block
 block discarded – undo
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.
124
-			'ajax'     => false,                              // Does this table support ajax?
125
-		) );
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
+			'ajax'     => false, // Does this table support ajax?
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
 	/**
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 	 * @return void
136 136
 	 */
137 137
 	public function advanced_filters() {
138
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
139
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
140
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
138
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
139
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
140
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
141 141
 		?>
142 142
 		<div id="give-payment-filters">
143 143
 			<span id="give-payment-date-filters">
144
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
144
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
145 145
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
146
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
146
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
147 147
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
148
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
148
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
149 149
 			</span>
150
-			<?php if ( ! empty( $status ) ) : ?>
151
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
150
+			<?php if ( ! empty($status)) : ?>
151
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
152 152
 			<?php endif; ?>
153
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
154
-				<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>
153
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
154
+				<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>
155 155
 			<?php endif; ?>
156
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
156
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
157 157
 		</div>
158 158
 
159 159
 		<?php
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return void
172 172
 	 */
173
-	public function search_box( $text, $input_id ) {
174
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
173
+	public function search_box($text, $input_id) {
174
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
175 175
 			return;
176 176
 		}
177 177
 
178
-		$input_id = $input_id . '-search-input';
178
+		$input_id = $input_id.'-search-input';
179 179
 
180
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
181
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
180
+		if ( ! empty($_REQUEST['orderby'])) {
181
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
182 182
 		}
183
-		if ( ! empty( $_REQUEST['order'] ) ) {
184
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
183
+		if ( ! empty($_REQUEST['order'])) {
184
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
185 185
 		}
186 186
 		?>
187 187
 		<p class="search-box" role="search">
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 			 *
194 194
 			 * @since 1.7
195 195
 			 */
196
-			do_action( 'give_payment_history_search' );
196
+			do_action('give_payment_history_search');
197 197
 			?>
198 198
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
199 199
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
200
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
200
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
201 201
 		</p>
202 202
 		<?php
203 203
 	}
@@ -211,52 +211,52 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function get_views() {
213 213
 
214
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
215
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
216
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
217
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
218
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
219
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
220
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
221
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
222
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
214
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
215
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
216
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
217
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
218
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
219
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
220
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
221
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
222
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
223 223
 
224 224
 		$views = array(
225
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
225
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
226 226
 				'status',
227 227
 				'paged',
228
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
229
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
228
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
229
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
230 230
 				'status' => 'publish',
231 231
 				'paged'  => false,
232
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
233
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
232
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
233
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
234 234
 				'status' => 'pending',
235 235
 				'paged'  => false,
236
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
237
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
236
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
237
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
238 238
 				'status' => 'refunded',
239 239
 				'paged'  => false,
240
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
241
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
240
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
241
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
242 242
 				'status' => 'revoked',
243 243
 				'paged'  => false,
244
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
245
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
244
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
245
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
246 246
 				'status' => 'failed',
247 247
 				'paged'  => false,
248
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
249
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
248
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
249
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
250 250
 				'status' => 'cancelled',
251 251
 				'paged'  => false,
252
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
253
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
252
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
253
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
254 254
 				'status' => 'abandoned',
255 255
 				'paged'  => false,
256
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ),
256
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count),
257 257
 		);
258 258
 
259
-		return apply_filters( 'give_payments_table_views', $views );
259
+		return apply_filters('give_payments_table_views', $views);
260 260
 	}
261 261
 
262 262
 	/**
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
 	public function get_columns() {
270 270
 		$columns = array(
271 271
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
272
-			'donation'      => esc_html__( 'Donation', 'give' ),
273
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
274
-			'status'        => esc_html__( 'Status', 'give' ),
275
-			'date'          => esc_html__( 'Date', 'give' ),
276
-			'amount'        => esc_html__( 'Amount', 'give' ),
277
-			'details'       => esc_html__( 'Details', 'give' ),
272
+			'donation'      => esc_html__('Donation', 'give'),
273
+			'donation_form' => esc_html__('Donation Form', 'give'),
274
+			'status'        => esc_html__('Status', 'give'),
275
+			'date'          => esc_html__('Date', 'give'),
276
+			'amount'        => esc_html__('Amount', 'give'),
277
+			'details'       => esc_html__('Details', 'give'),
278 278
 		);
279 279
 
280
-		return apply_filters( 'give_payments_table_columns', $columns );
280
+		return apply_filters('give_payments_table_columns', $columns);
281 281
 	}
282 282
 
283 283
 	/**
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function get_sortable_columns() {
291 291
 		$columns = array(
292
-			'donation'      => array( 'ID', true ),
293
-			'donation_form' => array( 'donation_form', false ),
294
-			'status'        => array( 'status', false ),
295
-			'amount'        => array( 'amount', false ),
296
-			'date'          => array( 'date', false ),
292
+			'donation'      => array('ID', true),
293
+			'donation_form' => array('donation_form', false),
294
+			'status'        => array('status', false),
295
+			'amount'        => array('amount', false),
296
+			'date'          => array('date', false),
297 297
 		);
298 298
 
299
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
299
+		return apply_filters('give_payments_table_sortable_columns', $columns);
300 300
 	}
301 301
 
302 302
 	/**
@@ -322,65 +322,65 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return string Column Name
324 324
 	 */
325
-	public function column_default( $payment, $column_name ) {
325
+	public function column_default($payment, $column_name) {
326 326
 
327
-		$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' ) ) );
328
-		$row_actions         = $this->get_row_actions( $payment );
327
+		$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')));
328
+		$row_actions         = $this->get_row_actions($payment);
329 329
 
330
-		switch ( $column_name ) {
330
+		switch ($column_name) {
331 331
 			case 'donation' :
332 332
 				$value = sprintf(
333 333
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
334 334
 					$single_donation_url,
335
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ),
335
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID),
336 336
 					$payment->ID,
337
-					esc_html__( 'by', 'give' ),
338
-					$this->get_donor( $payment )
337
+					esc_html__('by', 'give'),
338
+					$this->get_donor($payment)
339 339
 				);
340
-				$value .= $this->get_donor_email( $payment );
341
-				$value .= $this->row_actions( $row_actions );
340
+				$value .= $this->get_donor_email($payment);
341
+				$value .= $this->row_actions($row_actions);
342 342
 				break;
343 343
 
344 344
 			case 'amount' :
345
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
346
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
345
+				$amount = ! empty($payment->total) ? $payment->total : 0;
346
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
347 347
 				break;
348 348
 
349 349
 			case 'donation_form' :
350
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
351
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
352
-				$level      = give_get_payment_form_title( $payment->meta, true );
350
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
351
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
352
+				$level      = give_get_payment_form_title($payment->meta, true);
353 353
 
354
-				if ( ! empty( $level ) ) {
354
+				if ( ! empty($level)) {
355 355
 					$value .= $level;
356 356
 				}
357 357
 
358 358
 				break;
359 359
 
360 360
 			case 'date' :
361
-				$date  = strtotime( $payment->date );
362
-				$value = date_i18n( give_date_format(), $date );
361
+				$date  = strtotime($payment->date);
362
+				$value = date_i18n(give_date_format(), $date);
363 363
 				break;
364 364
 
365 365
 			case 'status' :
366
-				$value = $this->get_payment_status( $payment );
366
+				$value = $this->get_payment_status($payment);
367 367
 				break;
368 368
 
369 369
 			case 'details' :
370 370
 				$value = sprintf(
371 371
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
372 372
 					$single_donation_url,
373
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID )
373
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID)
374 374
 				);
375 375
 				break;
376 376
 
377 377
 			default:
378
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
378
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
379 379
 				break;
380 380
 
381 381
 		}
382 382
 
383
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
383
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
384 384
 	}
385 385
 
386 386
 	/**
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string                Data shown in the Email column
395 395
 	 */
396
-	public function get_donor_email( $payment ) {
396
+	public function get_donor_email($payment) {
397 397
 
398
-		$email = give_get_payment_user_email( $payment->ID );
398
+		$email = give_get_payment_user_email($payment->ID);
399 399
 
400
-		if ( empty( $email ) ) {
401
-			$email = esc_html__( '(unknown)', 'give' );
400
+		if (empty($email)) {
401
+			$email = esc_html__('(unknown)', 'give');
402 402
 		}
403 403
 
404
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
404
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
405 405
 
406
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
406
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
407 407
 	}
408 408
 
409 409
 	/**
@@ -415,18 +415,18 @@  discard block
 block discarded – undo
415 415
 	 *
416 416
 	 * @return mixed|void
417 417
 	 */
418
-	function get_row_actions( $payment ) {
418
+	function get_row_actions($payment) {
419 419
 
420 420
 		$actions = array();
421
-		$email   = give_get_payment_user_email( $payment->ID );
421
+		$email   = give_get_payment_user_email($payment->ID);
422 422
 
423 423
 		// Add search term string back to base URL.
424
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
425
-		if ( ! empty( $search_terms ) ) {
426
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
424
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
425
+		if ( ! empty($search_terms)) {
426
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
427 427
 		}
428 428
 
429
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
429
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
430 430
 
431 431
 			$actions['email_links'] = sprintf(
432 432
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 					),
441 441
 					'give_payment_nonce'
442 442
 				),
443
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
444
-				esc_html__( 'Resend Receipt', 'give' )
443
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
444
+				esc_html__('Resend Receipt', 'give')
445 445
 			);
446 446
 
447 447
 		}
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 				),
459 459
 				'give_donation_nonce'
460 460
 			),
461
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
462
-			esc_html__( 'Delete', 'give' )
461
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
462
+			esc_html__('Delete', 'give')
463 463
 		);
464 464
 
465
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
465
+		return apply_filters('give_payment_row_actions', $actions, $payment);
466 466
 	}
467 467
 
468 468
 
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * @return string                Data shown in the Email column
478 478
 	 */
479
-	function get_payment_status( $payment ) {
480
-		$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>';
481
-		if ( $payment->mode == 'test' ) {
482
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
479
+	function get_payment_status($payment) {
480
+		$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>';
481
+		if ($payment->mode == 'test') {
482
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
483 483
 		}
484 484
 
485 485
 		return $value;
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @return string Displays a checkbox.
497 497
 	 */
498
-	public function column_cb( $payment ) {
498
+	public function column_cb($payment) {
499 499
 		return sprintf(
500 500
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
501 501
 			'payment',
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 	 *
514 514
 	 * @return string Displays a checkbox.
515 515
 	 */
516
-	public function get_payment_id( $payment ) {
517
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
516
+	public function get_payment_id($payment) {
517
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,19 +527,19 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return string Data shown in the User column
529 529
 	 */
530
-	public function get_donor( $payment ) {
530
+	public function get_donor($payment) {
531 531
 
532
-		$customer_id = give_get_payment_customer_id( $payment->ID );
532
+		$customer_id = give_get_payment_customer_id($payment->ID);
533 533
 
534
-		if ( ! empty( $customer_id ) ) {
535
-			$customer = new Give_Customer( $customer_id );
536
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
534
+		if ( ! empty($customer_id)) {
535
+			$customer = new Give_Customer($customer_id);
536
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
537 537
 		} else {
538
-			$email = give_get_payment_user_email( $payment->ID );
539
-			$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>';
538
+			$email = give_get_payment_user_email($payment->ID);
539
+			$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>';
540 540
 		}
541 541
 
542
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
542
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
543 543
 	}
544 544
 
545 545
 	/**
@@ -551,18 +551,18 @@  discard block
 block discarded – undo
551 551
 	 */
552 552
 	public function get_bulk_actions() {
553 553
 		$actions = array(
554
-			'delete'               => esc_html__( 'Delete', 'give' ),
555
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
556
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
557
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
558
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
559
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
560
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
561
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
562
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' ),
554
+			'delete'               => esc_html__('Delete', 'give'),
555
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
556
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
557
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
558
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
559
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
560
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
561
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
562
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give'),
563 563
 		);
564 564
 
565
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
565
+		return apply_filters('give_payments_table_bulk_actions', $actions);
566 566
 	}
567 567
 
568 568
 	/**
@@ -573,59 +573,59 @@  discard block
 block discarded – undo
573 573
 	 * @return void
574 574
 	 */
575 575
 	public function process_bulk_action() {
576
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
576
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
577 577
 		$action = $this->current_action();
578 578
 
579
-		if ( ! is_array( $ids ) ) {
580
-			$ids = array( $ids );
579
+		if ( ! is_array($ids)) {
580
+			$ids = array($ids);
581 581
 		}
582 582
 
583
-		if ( empty( $action ) ) {
583
+		if (empty($action)) {
584 584
 			return;
585 585
 		}
586 586
 
587
-		foreach ( $ids as $id ) {
587
+		foreach ($ids as $id) {
588 588
 
589 589
 			// Detect when a bulk action is being triggered.
590
-			switch ( $this->current_action() ) {
590
+			switch ($this->current_action()) {
591 591
 
592 592
 				case'delete':
593
-					give_delete_purchase( $id );
593
+					give_delete_purchase($id);
594 594
 					break;
595 595
 
596 596
 				case 'set-status-publish':
597
-					give_update_payment_status( $id, 'publish' );
597
+					give_update_payment_status($id, 'publish');
598 598
 					break;
599 599
 
600 600
 				case 'set-status-pending':
601
-					give_update_payment_status( $id, 'pending' );
601
+					give_update_payment_status($id, 'pending');
602 602
 					break;
603 603
 
604 604
 				case 'set-status-refunded':
605
-					give_update_payment_status( $id, 'refunded' );
605
+					give_update_payment_status($id, 'refunded');
606 606
 					break;
607 607
 				case 'set-status-revoked':
608
-					give_update_payment_status( $id, 'revoked' );
608
+					give_update_payment_status($id, 'revoked');
609 609
 					break;
610 610
 
611 611
 				case 'set-status-failed':
612
-					give_update_payment_status( $id, 'failed' );
612
+					give_update_payment_status($id, 'failed');
613 613
 					break;
614 614
 
615 615
 				case 'set-status-cancelled':
616
-					give_update_payment_status( $id, 'cancelled' );
616
+					give_update_payment_status($id, 'cancelled');
617 617
 					break;
618 618
 
619 619
 				case 'set-status-abandoned':
620
-					give_update_payment_status( $id, 'abandoned' );
620
+					give_update_payment_status($id, 'abandoned');
621 621
 					break;
622 622
 
623 623
 				case 'set-status-preapproval':
624
-					give_update_payment_status( $id, 'preapproval' );
624
+					give_update_payment_status($id, 'preapproval');
625 625
 					break;
626 626
 
627 627
 				case 'resend-receipt':
628
-					give_email_donation_receipt( $id, false );
628
+					give_email_donation_receipt($id, false);
629 629
 					break;
630 630
 			}
631 631
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 			 * @param int    $id             The ID of the payment.
638 638
 			 * @param string $current_action The action that is being triggered.
639 639
 			 */
640
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
640
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
641 641
 		}
642 642
 
643 643
 	}
@@ -653,27 +653,27 @@  discard block
 block discarded – undo
653 653
 
654 654
 		$args = array();
655 655
 
656
-		if ( isset( $_GET['user'] ) ) {
657
-			$args['user'] = urldecode( $_GET['user'] );
658
-		} elseif ( isset( $_GET['s'] ) ) {
659
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
660
-			if ( $is_user ) {
661
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
662
-				unset( $args['s'] );
656
+		if (isset($_GET['user'])) {
657
+			$args['user'] = urldecode($_GET['user']);
658
+		} elseif (isset($_GET['s'])) {
659
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
660
+			if ($is_user) {
661
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
662
+				unset($args['s']);
663 663
 			} else {
664
-				$args['s'] = sanitize_text_field( $_GET['s'] );
664
+				$args['s'] = sanitize_text_field($_GET['s']);
665 665
 			}
666 666
 		}
667 667
 
668
-		if ( ! empty( $_GET['start-date'] ) ) {
669
-			$args['start-date'] = urldecode( $_GET['start-date'] );
668
+		if ( ! empty($_GET['start-date'])) {
669
+			$args['start-date'] = urldecode($_GET['start-date']);
670 670
 		}
671 671
 
672
-		if ( ! empty( $_GET['end-date'] ) ) {
673
-			$args['end-date'] = urldecode( $_GET['end-date'] );
672
+		if ( ! empty($_GET['end-date'])) {
673
+			$args['end-date'] = urldecode($_GET['end-date']);
674 674
 		}
675 675
 
676
-		$payment_count         = give_count_payments( $args );
676
+		$payment_count         = give_count_payments($args);
677 677
 		$this->complete_count  = $payment_count->publish;
678 678
 		$this->pending_count   = $payment_count->pending;
679 679
 		$this->refunded_count  = $payment_count->refunded;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 		$this->cancelled_count = $payment_count->cancelled;
683 683
 		$this->abandoned_count = $payment_count->abandoned;
684 684
 
685
-		foreach ( $payment_count as $count ) {
685
+		foreach ($payment_count as $count) {
686 686
 			$this->total_count += $count;
687 687
 		}
688 688
 	}
@@ -697,26 +697,26 @@  discard block
 block discarded – undo
697 697
 	public function payments_data() {
698 698
 
699 699
 		$per_page   = $this->per_page;
700
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
701
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
702
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
703
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
704
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
705
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
706
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
707
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
708
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
709
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
710
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
711
-
712
-		if ( ! empty( $search ) ) {
700
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
701
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
702
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
703
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
704
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
705
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
706
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
707
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
708
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
709
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
710
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
711
+
712
+		if ( ! empty($search)) {
713 713
 			$status = 'any'; // Force all payment statuses when searching.
714 714
 		}
715 715
 
716 716
 		$args = array(
717 717
 			'output'     => 'payments',
718 718
 			'number'     => $per_page,
719
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
719
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
720 720
 			'orderby'    => $orderby,
721 721
 			'order'      => $order,
722 722
 			'user'       => $user,
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
 			'end_date'   => $end_date,
731 731
 		);
732 732
 
733
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
733
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
734 734
 
735 735
 			$args['search_in_notes'] = true;
736
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
736
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
737 737
 
738 738
 		}
739 739
 
740
-		$p_query = new Give_Payments_Query( $args );
740
+		$p_query = new Give_Payments_Query($args);
741 741
 
742 742
 		return $p_query->get_payments();
743 743
 
@@ -757,17 +757,17 @@  discard block
 block discarded – undo
757 757
 	 */
758 758
 	public function prepare_items() {
759 759
 
760
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
760
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
761 761
 
762 762
 		$columns  = $this->get_columns();
763 763
 		$hidden   = array(); // No hidden columns.
764 764
 		$sortable = $this->get_sortable_columns();
765 765
 		$data     = $this->payments_data();
766
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
766
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
767 767
 
768
-		$this->_column_headers = array( $columns, $hidden, $sortable );
768
+		$this->_column_headers = array($columns, $hidden, $sortable);
769 769
 
770
-		switch ( $status ) {
770
+		switch ($status) {
771 771
 			case 'publish':
772 772
 				$total_items = $this->complete_count;
773 773
 				break;
@@ -794,19 +794,19 @@  discard block
 block discarded – undo
794 794
 				break;
795 795
 			default:
796 796
 				// Retrieve the count of the non-default-Give status.
797
-				$count       = wp_count_posts( 'give_payment' );
797
+				$count       = wp_count_posts('give_payment');
798 798
 				$total_items = $count->{$status};
799 799
 				break;
800 800
 		}
801 801
 
802 802
 		$this->items = $data;
803 803
 
804
-		$this->set_pagination_args( array(
804
+		$this->set_pagination_args(array(
805 805
 				'total_items' => $total_items,
806 806
 				// We have to calculate the total number of items.
807 807
 				'per_page'    => $this->per_page,
808 808
 				// We have to determine how many items to show on a page.
809
-				'total_pages' => ceil( $total_items / $this->per_page ),
809
+				'total_pages' => ceil($total_items / $this->per_page),
810 810
 				// We have to calculate the total number of pages.
811 811
 			)
812 812
 		);
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 *                               'testing'           => false, // (required) Never leave as "true" in production!!!
33 33
 	 *                               }
34 34
 	 */
35
-	function __construct( $_banner_details ) {
35
+	function __construct($_banner_details) {
36 36
 		$current_user = wp_get_current_user();
37 37
 
38 38
 		$this->plugin_activate_by   = 0;
39 39
 		$this->banner_details       = $_banner_details;
40
-		$this->test_mode            = ( $this->banner_details['testing'] == 'true' ) ? true : false;
41
-		$this->nag_meta_key         = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
42
-		$this->activate_by_meta_key = 'give_addon_' . sanitize_title( $this->banner_details['name'] ) . '_active_by_user';
40
+		$this->test_mode            = ($this->banner_details['testing'] == 'true') ? true : false;
41
+		$this->nag_meta_key         = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
42
+		$this->activate_by_meta_key = 'give_addon_'.sanitize_title($this->banner_details['name']).'_active_by_user';
43 43
 
44 44
 		//Get current user
45 45
 		$this->user_id = $current_user->ID;
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
 	public function init() {
63 63
 
64 64
 		//Testing?
65
-		if ( $this->test_mode ) {
66
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
65
+		if ($this->test_mode) {
66
+			delete_user_meta($this->user_id, $this->nag_meta_key);
67 67
 		}
68 68
 
69 69
 		//Get the current page to add the notice to
70
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
71
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
70
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
71
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
72 72
 
73 73
 		// File path of addon must be included in banner detail other addon activate meta will not delete.
74
-		add_action( 'deactivate_' . $this->get_plugin_file_name(), array( $this, 'remove_addon_activate_meta' ) );
74
+		add_action('deactivate_'.$this->get_plugin_file_name(), array($this, 'remove_addon_activate_meta'));
75 75
 	}
76 76
 
77 77
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	private function is_plugin_page() {
86 86
 		$screen = get_current_screen();
87 87
 
88
-		return ( $screen->parent_file === 'plugins.php' );
88
+		return ($screen->parent_file === 'plugins.php');
89 89
 	}
90 90
 
91 91
 
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	public function give_addon_activation_admin_notice() {
99 99
 
100 100
 		// Bailout.
101
-		if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by ) {
101
+		if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// If the user hasn't already dismissed the alert, output activation banner.
106
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) {
106
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) {
107 107
 
108 108
 			// Output inline styles here because there's no reason
109 109
 			// to enqueued them after the alert is dismissed.
@@ -185,44 +185,44 @@  discard block
 block discarded – undo
185 185
 					<h3><?php
186 186
 						printf(
187 187
 						/* translators: %s: Add-on name */
188
-							esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ),
189
-							'<span>' . $this->banner_details['name'] . '</span>'
188
+							esc_html__("Thank you for installing Give's %s Add-on!", 'give'),
189
+							'<span>'.$this->banner_details['name'].'</span>'
190 190
 						);
191 191
 						?></h3>
192 192
 
193 193
 					<a href="<?php
194 194
 					//The Dismiss Button.
195
-					$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
196
-					echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span
195
+					$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
196
+					echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span
197 197
 							class="dashicons dashicons-dismiss"></span></a>
198 198
 
199 199
 					<div class="alert-actions">
200 200
 
201 201
 						<?php //Point them to your settings page.
202
-						if ( isset( $this->banner_details['settings_url'] ) ) { ?>
202
+						if (isset($this->banner_details['settings_url'])) { ?>
203 203
 							<a href="<?php echo $this->banner_details['settings_url']; ?>">
204
-								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?>
204
+								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?>
205 205
 							</a>
206 206
 						<?php } ?>
207 207
 
208 208
 						<?php
209 209
 						// Show them how to configure the Addon.
210
-						if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
210
+						if (isset($this->banner_details['documentation_url'])) { ?>
211 211
 							<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
212 212
 								<span class="dashicons dashicons-media-text"></span><?php
213 213
 								printf(
214 214
 								/* translators: %s: Add-on name */
215
-									esc_html__( 'Documentation: %s Add-on', 'give' ),
215
+									esc_html__('Documentation: %s Add-on', 'give'),
216 216
 									$this->banner_details['name']
217 217
 								);
218 218
 								?></a>
219 219
 						<?php } ?>
220 220
 						<?php
221 221
 						//Let them signup for plugin updates
222
-						if ( isset( $this->banner_details['support_url'] ) ) { ?>
222
+						if (isset($this->banner_details['support_url'])) { ?>
223 223
 
224 224
 							<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
225
-								<span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?>
225
+								<span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?>
226 226
 							</a>
227 227
 
228 228
 						<?php } ?>
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
250 250
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
251 251
 		 */
252
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
252
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
253 253
 
254 254
 			//Get the global user
255 255
 			$current_user = wp_get_current_user();
256 256
 			$user_id      = $current_user->ID;
257 257
 
258
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
258
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
259 259
 		}
260 260
 	}
261 261
 
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	 * @access private
267 267
 	 */
268 268
 	private function add_addon_activate_meta() {
269
-		$user_id                  = get_option( $this->activate_by_meta_key );
269
+		$user_id                  = get_option($this->activate_by_meta_key);
270 270
 		$this->plugin_activate_by = (int) $user_id;
271 271
 
272
-		if ( ! $user_id ) {
273
-			add_option( $this->activate_by_meta_key, $this->user_id, '', 'no' );
272
+		if ( ! $user_id) {
273
+			add_option($this->activate_by_meta_key, $this->user_id, '', 'no');
274 274
 			$this->plugin_activate_by = (int) $this->user_id;
275 275
 		}
276 276
 	}
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 	 * @access public
284 284
 	 */
285 285
 	public function remove_addon_activate_meta() {
286
-		$user_id = get_option( $this->activate_by_meta_key );
286
+		$user_id = get_option($this->activate_by_meta_key);
287 287
 
288
-		if ( $user_id ) {
289
-			delete_option( $this->activate_by_meta_key );
288
+		if ($user_id) {
289
+			delete_option($this->activate_by_meta_key);
290 290
 		}
291 291
 	}
292 292
 
@@ -299,35 +299,35 @@  discard block
 block discarded – undo
299 299
 	 * @return mixed
300 300
 	 */
301 301
 	private function get_plugin_file_name() {
302
-		$active_plugins = get_option( 'active_plugins' );
302
+		$active_plugins = get_option('active_plugins');
303 303
 		$file_name      = '';
304 304
 
305 305
 		try {
306 306
 
307 307
 			// Check addon file path.
308
-			if ( ! empty( $this->banner_details['file'] ) ) {
308
+			if ( ! empty($this->banner_details['file'])) {
309 309
 				$file_name = '';
310
-				if ( $file_path = explode( '/plugins/', $this->banner_details['file'] ) ) {
311
-					$file_path = array_pop( $file_path );
312
-					$file_name = current( explode( '/', $file_path ) );
310
+				if ($file_path = explode('/plugins/', $this->banner_details['file'])) {
311
+					$file_path = array_pop($file_path);
312
+					$file_name = current(explode('/', $file_path));
313 313
 				}
314 314
 
315
-				foreach ( $active_plugins as $plugin ) {
316
-					if ( false !== strpos( $plugin, $file_name ) ) {
315
+				foreach ($active_plugins as $plugin) {
316
+					if (false !== strpos($plugin, $file_name)) {
317 317
 						$file_name = $plugin;
318 318
 						break;
319 319
 					}
320 320
 				}
321 321
 			} else {
322
-				throw new Exception( __( "File path must be added of {$this->banner_details['name']} addon in banner details.", 'give' ) );
322
+				throw new Exception(__("File path must be added of {$this->banner_details['name']} addon in banner details.", 'give'));
323 323
 			}
324 324
 
325 325
 			// Check plugin path calculated by addon file path.
326
-			if ( empty( $file_name ) ) {
327
-				throw new Exception( __( "Empty Addon plugin path for {$this->banner_details['name']} addon.", 'give' ) );
326
+			if (empty($file_name)) {
327
+				throw new Exception(__("Empty Addon plugin path for {$this->banner_details['name']} addon.", 'give'));
328 328
 			}
329 329
 
330
-		} catch ( Exception $e ) {
330
+		} catch (Exception $e) {
331 331
 			echo $e->getMessage();
332 332
 		}
333 333
 
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
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
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
59
-			'ajax'     => false,// Does this table support ajax?
60
-		) );
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59
+			'ajax'     => false, // Does this table support ajax?
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250
-		<?php wp_nonce_field( 'give-api-nonce' ); ?>
250
+		<?php wp_nonce_field('give-api-nonce'); ?>
251 251
 		<?php echo Give()->html->ajax_user_search(); ?>
252
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
252
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
253 253
 		<?php
254 254
 		$give_api_is_bottom = true;
255 255
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int Current page number
263 263
 	 */
264 264
 	public function get_paged() {
265
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
265
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
266 266
 	}
267 267
 
268 268
 	/**
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
 	 * @return array
274 274
 	 */
275 275
 	public function query() {
276
-		$users = get_users( array(
276
+		$users = get_users(array(
277 277
 			'meta_value' => 'give_user_secret_key',
278 278
 			'number'     => $this->per_page,
279
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
280
-		) );
281
-		$keys  = array();
282
-
283
-		foreach ( $users as $user ) {
284
-			$keys[ $user->ID ]['id']    = $user->ID;
285
-			$keys[ $user->ID ]['email'] = $user->user_email;
286
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
287
-
288
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
289
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
290
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
279
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
280
+		));
281
+		$keys = array();
282
+
283
+		foreach ($users as $user) {
284
+			$keys[$user->ID]['id']    = $user->ID;
285
+			$keys[$user->ID]['email'] = $user->user_email;
286
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
287
+
288
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
289
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
290
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
291 291
 		}
292 292
 
293 293
 		return $keys;
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
 	public function total_items() {
305 305
 		global $wpdb;
306 306
 
307
-		if ( ! get_transient( 'give_total_api_keys' ) ) {
308
-			$total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" );
307
+		if ( ! get_transient('give_total_api_keys')) {
308
+			$total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'");
309 309
 
310
-			set_transient( 'give_total_api_keys', $total_items, 60 * 60 );
310
+			set_transient('give_total_api_keys', $total_items, 60 * 60);
311 311
 		}
312 312
 
313
-		return get_transient( 'give_total_api_keys' );
313
+		return get_transient('give_total_api_keys');
314 314
 	}
315 315
 
316 316
 	/**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		$hidden   = array(); // No hidden columns
327 327
 		$sortable = array(); // Not sortable... for now
328 328
 
329
-		$this->_column_headers = array( $columns, $hidden, $sortable );
329
+		$this->_column_headers = array($columns, $hidden, $sortable);
330 330
 
331 331
 		$data = $this->query();
332 332
 
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 
335 335
 		$this->items = $data;
336 336
 
337
-		$this->set_pagination_args( array(
337
+		$this->set_pagination_args(array(
338 338
 				'total_items' => $total_items,
339 339
 				'per_page'    => $this->per_page,
340
-				'total_pages' => ceil( $total_items / $this->per_page ),
340
+				'total_pages' => ceil($total_items / $this->per_page),
341 341
 			)
342 342
 		);
343 343
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/tools/tools-actions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
  * @since  1.5
21 21
  */
22 22
 function give_register_batch_recount_export_classes() {
23
-	add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 );
23
+	add_action('give_batch_export_class_include', 'give_include_batch_export_class', 10, 1);
24 24
 }
25 25
 
26
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 );
26
+add_action('give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10);
27 27
 
28 28
 
29 29
 /**
@@ -35,31 +35,31 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return void
37 37
  */
38
-function give_include_batch_export_class( $class ) {
39
-	switch ( $class ) {
38
+function give_include_batch_export_class($class) {
39
+	switch ($class) {
40 40
 
41 41
 		case 'Give_Tools_Delete_Test_Transactions':
42
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
42
+			require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
43 43
 			break;
44 44
 
45 45
 		case 'Give_Tools_Recount_Customer_Stats':
46
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
46
+			require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
47 47
 			break;
48 48
 
49 49
 		case 'Give_Tools_Reset_Stats':
50
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
50
+			require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
51 51
 			break;
52 52
 
53 53
 		case 'Give_Tools_Recount_All_Stats':
54
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
54
+			require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
55 55
 			break;
56 56
 
57 57
 		case 'Give_Tools_Recount_Form_Stats':
58
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
58
+			require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
59 59
 			break;
60 60
 
61 61
 		case 'Give_Tools_Recount_Income':
62
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-income.php';
62
+			require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-income.php';
63 63
 			break;
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.