Completed
Pull Request — master (#770)
by Devin
20:03
created
includes/admin/reporting/tools/tools-actions.php 1 patch
Spacing   +31 added lines, -31 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
 
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @since  1.5
20 20
  */
21 21
 function give_register_batch_recount_store_earnings_tool() {
22
-	add_action( 'give_batch_export_class_include', 'give_include_recount_income_tool_batch_processor', 10, 1 );
22
+	add_action('give_batch_export_class_include', 'give_include_recount_income_tool_batch_processor', 10, 1);
23 23
 }
24 24
 
25
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_store_earnings_tool', 10 );
25
+add_action('give_register_batch_exporter', 'give_register_batch_recount_store_earnings_tool', 10);
26 26
 
27 27
 /**
28 28
  * Loads the tools batch processing class for recounting store earnings
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return void
35 35
  */
36
-function give_include_recount_income_tool_batch_processor( $class ) {
36
+function give_include_recount_income_tool_batch_processor($class) {
37 37
 
38
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-income.php';
38
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-income.php';
39 39
 
40
-	if ( 'Give_Tools_Recount_Income' === $class && file_exists( $file_path ) ) {
40
+	if ('Give_Tools_Recount_Income' === $class && file_exists($file_path)) {
41 41
 		require_once $file_path;
42 42
 	}
43 43
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
  * @since  1.5
50 50
  */
51 51
 function give_register_batch_recount_form_tool() {
52
-	add_action( 'give_batch_export_class_include', 'give_include_recount_form_tool_batch_processor', 10, 1 );
52
+	add_action('give_batch_export_class_include', 'give_include_recount_form_tool_batch_processor', 10, 1);
53 53
 }
54 54
 
55
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_form_tool', 10 );
55
+add_action('give_register_batch_exporter', 'give_register_batch_recount_form_tool', 10);
56 56
 
57 57
 /**
58 58
  * Loads the tools batch processing class for recounting download stats
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
  *
64 64
  * @return void
65 65
  */
66
-function give_include_recount_form_tool_batch_processor( $class ) {
66
+function give_include_recount_form_tool_batch_processor($class) {
67 67
 
68
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
68
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
69 69
 
70
-	if ( 'Give_Tools_Recount_Form_Stats' === $class && file_exists( $file_path ) ) {
70
+	if ('Give_Tools_Recount_Form_Stats' === $class && file_exists($file_path)) {
71 71
 		require_once $file_path;
72 72
 	}
73 73
 
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
  * @since  1.5
79 79
  */
80 80
 function give_register_batch_recount_all_tool() {
81
-	add_action( 'give_batch_export_class_include', 'give_include_recount_all_tool_batch_processor', 10, 1 );
81
+	add_action('give_batch_export_class_include', 'give_include_recount_all_tool_batch_processor', 10, 1);
82 82
 }
83 83
 
84
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_all_tool', 10 );
84
+add_action('give_register_batch_exporter', 'give_register_batch_recount_all_tool', 10);
85 85
 
86 86
 /**
87 87
  * Loads the tools batch processing class for recounting all stats
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return void
94 94
  */
95
-function give_include_recount_all_tool_batch_processor( $class ) {
96
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
97
-	if ( 'Give_Tools_Recount_All_Stats' === $class && file_exists( $file_path ) ) {
95
+function give_include_recount_all_tool_batch_processor($class) {
96
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
97
+	if ('Give_Tools_Recount_All_Stats' === $class && file_exists($file_path)) {
98 98
 		require_once $file_path;
99 99
 	}
100 100
 
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
  * @since  1.5
107 107
  */
108 108
 function give_register_batch_reset_tool() {
109
-	add_action( 'give_batch_export_class_include', 'give_include_reset_tool_batch_processor', 10, 1 );
109
+	add_action('give_batch_export_class_include', 'give_include_reset_tool_batch_processor', 10, 1);
110 110
 }
111 111
 
112
-add_action( 'give_register_batch_exporter', 'give_register_batch_reset_tool', 10 );
112
+add_action('give_register_batch_exporter', 'give_register_batch_reset_tool', 10);
113 113
 
114 114
 /**
115 115
  * Loads the tools batch processing class for resetting store and product earnings
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return void
122 122
  */
123
-function give_include_reset_tool_batch_processor( $class ) {
123
+function give_include_reset_tool_batch_processor($class) {
124 124
 
125
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
125
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
126 126
 
127
-	if ( 'Give_Tools_Reset_Stats' === $class && file_exists( $file_path ) ) {
127
+	if ('Give_Tools_Reset_Stats' === $class && file_exists($file_path)) {
128 128
 		require_once $file_path;
129 129
 	}
130 130
 
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  * @since  1.5
136 136
  */
137 137
 function give_register_batch_customer_recount_tool() {
138
-	add_action( 'give_batch_export_class_include', 'give_include_customer_recount_tool_batch_processor', 10, 1 );
138
+	add_action('give_batch_export_class_include', 'give_include_customer_recount_tool_batch_processor', 10, 1);
139 139
 }
140 140
 
141
-add_action( 'give_register_batch_exporter', 'give_register_batch_customer_recount_tool', 10 );
141
+add_action('give_register_batch_exporter', 'give_register_batch_customer_recount_tool', 10);
142 142
 
143 143
 /**
144 144
  * Loads the tools batch processing class for resetting all customer stats
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
  *
150 150
  * @return void
151 151
  */
152
-function give_include_customer_recount_tool_batch_processor( $class ) {
152
+function give_include_customer_recount_tool_batch_processor($class) {
153 153
 
154
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
154
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
155 155
 
156
-	if ( 'Give_Tools_Recount_Customer_Stats' === $class && file_exists( $file_path ) ) {
156
+	if ('Give_Tools_Recount_Customer_Stats' === $class && file_exists($file_path)) {
157 157
 		require_once $file_path;
158 158
 	}
159 159
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
  * @since  1.5
165 165
  */
166 166
 function give_register_batch_delete_test_transactions_tool() {
167
-	add_action( 'give_batch_export_class_include', 'give_include_delete_test_transactions_batch_processor', 10, 1 );
167
+	add_action('give_batch_export_class_include', 'give_include_delete_test_transactions_batch_processor', 10, 1);
168 168
 }
169 169
 
170
-add_action( 'give_register_batch_exporter', 'give_register_batch_delete_test_transactions_tool', 10 );
170
+add_action('give_register_batch_exporter', 'give_register_batch_delete_test_transactions_tool', 10);
171 171
 
172 172
 /**
173 173
  * Loads the tools batch processing class for resetting all customer stats
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
  *
179 179
  * @return void
180 180
  */
181
-function give_include_delete_test_transactions_batch_processor( $class ) {
181
+function give_include_delete_test_transactions_batch_processor($class) {
182 182
 
183
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
183
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
184 184
 
185
-	if ( 'Give_Tools_Delete_Test_Transactions' === $class && file_exists( $file_path ) ) {
185
+	if ('Give_Tools_Delete_Test_Transactions' === $class && file_exists($file_path)) {
186 186
 		require_once $file_path;
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-form-reports-table.php 1 patch
Spacing   +55 added lines, -55 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
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . __( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99 99
 			'title'            => give_get_forms_label_singular(),
100
-			'sales'            => __( 'Donations', 'give' ),
101
-			'earnings'         => __( 'Income', 'give' ),
102
-			'average_sales'    => __( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => __( 'Monthly Average Income', 'give' ),
104
-			'details'          => __( 'Detailed Report', 'give' )
100
+			'sales'            => __('Donations', 'give'),
101
+			'earnings'         => __('Income', 'give'),
102
+			'average_sales'    => __('Monthly Average Donations', 'give'),
103
+			'average_earnings' => __('Monthly Average Income', 'give'),
104
+			'details'          => __('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 		// These aren't really bulk actions but this outputs the markup in the right place
175 175
 		give_report_views();
176 176
 	}
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @param string $which
185 185
 	 */
186
-	protected function display_tablenav( $which ) {
186
+	protected function display_tablenav($which) {
187 187
 
188
-		if ( 'top' == $which ) {
189
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
188
+		if ('top' == $which) {
189
+			wp_nonce_field('bulk-'.$this->_args['plural']);
190 190
 		}
191 191
 		?>
192
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
192
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
193 193
 
194
-			<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donation Forms Report', 'give' ); ?></span></h3>
194
+			<h3 class="alignleft reports-earnings-title"><span><?php _e('Donation Forms Report', 'give'); ?></span></h3>
195 195
 
196 196
 			<div class="alignright tablenav-right">
197 197
 				<div class="actions bulkactions">
198
-					<?php $this->bulk_actions( $which ); ?>
198
+					<?php $this->bulk_actions($which); ?>
199 199
 				</div>
200 200
 				<?php
201
-				$this->extra_tablenav( $which );
202
-				$this->pagination( $which );
201
+				$this->extra_tablenav($which);
202
+				$this->pagination($which);
203 203
 				?>
204 204
 			</div>
205 205
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function category_filter() {
221 221
 
222
-		$categories = get_terms( 'form_category' );
223
-		if ( $categories && ! is_wp_error( $categories ) ) {
224
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
222
+		$categories = get_terms('form_category');
223
+		if ($categories && ! is_wp_error($categories)) {
224
+			echo Give()->html->category_dropdown('category', $this->get_category());
225 225
 		}
226 226
 	}
227 227
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function query() {
237 237
 
238
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
239
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
238
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
239
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
240 240
 		$category = $this->get_category();
241 241
 
242 242
 		$args = array(
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			'suppress_filters' => true
250 250
 		);
251 251
 
252
-		if ( ! empty( $category ) ) {
252
+		if ( ! empty($category)) {
253 253
 			$args['tax_query'] = array(
254 254
 				array(
255 255
 					'taxonomy' => 'form_category',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		}
260 260
 
261
-		switch ( $orderby ) :
261
+		switch ($orderby) :
262 262
 			case 'title' :
263 263
 				$args['orderby'] = 'title';
264 264
 				break;
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 				break;
275 275
 		endswitch;
276 276
 
277
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
277
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
278 278
 
279
-		$this->products = new WP_Query( $args );
279
+		$this->products = new WP_Query($args);
280 280
 
281 281
 	}
282 282
 
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 
293 293
 		$give_forms = $this->products->posts;
294 294
 
295
-		if ( $give_forms ) {
296
-			foreach ( $give_forms as $form ) {
295
+		if ($give_forms) {
296
+			foreach ($give_forms as $form) {
297 297
 				$reports_data[] = array(
298 298
 					'ID'               => $form,
299
-					'title'            => get_the_title( $form ),
300
-					'sales'            => give_get_form_sales_stats( $form ),
301
-					'earnings'         => give_get_form_earnings_stats( $form ),
302
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
303
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
299
+					'title'            => get_the_title($form),
300
+					'sales'            => give_get_form_sales_stats($form),
301
+					'earnings'         => give_get_form_earnings_stats($form),
302
+					'average_sales'    => give_get_average_monthly_form_sales($form),
303
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
304 304
 				);
305 305
 			}
306 306
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$sortable = $this->get_sortable_columns();
330 330
 
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 
333 333
 		$data = $this->reports_data();
334 334
 
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 
337 337
 		$this->items = $data;
338 338
 
339
-		$this->set_pagination_args( array(
339
+		$this->set_pagination_args(array(
340 340
 				'total_items' => $total_items,
341 341
 				'per_page'    => $this->per_page,
342
-				'total_pages' => ceil( $total_items / $this->per_page )
342
+				'total_pages' => ceil($total_items / $this->per_page)
343 343
 			)
344 344
 		);
345 345
 	}
Please login to merge, or discard this patch.
includes/class-give-db.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 } // Exit if accessed directly
15 15
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 * @since   1.0
81 81
 	 * @return  object
82 82
 	 */
83
-	public function get( $row_id ) {
83
+	public function get($row_id) {
84 84
 		global $wpdb;
85 85
 
86
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
86
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 * @since   1.0
94 94
 	 * @return  object
95 95
 	 */
96
-	public function get_by( $column, $row_id ) {
96
+	public function get_by($column, $row_id) {
97 97
 		global $wpdb;
98
-		$column = esc_sql( $column );
99
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
98
+		$column = esc_sql($column);
99
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 * @since   1.0
107 107
 	 * @return  string
108 108
 	 */
109
-	public function get_column( $column, $row_id ) {
109
+	public function get_column($column, $row_id) {
110 110
 		global $wpdb;
111
-		$column = esc_sql( $column );
112
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
111
+		$column = esc_sql($column);
112
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @since   1.0
120 120
 	 * @return  string
121 121
 	 */
122
-	public function get_column_by( $column, $column_where, $column_value ) {
122
+	public function get_column_by($column, $column_where, $column_value) {
123 123
 		global $wpdb;
124
-		$column_where = esc_sql( $column_where );
125
-		$column       = esc_sql( $column );
126
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
124
+		$column_where = esc_sql($column_where);
125
+		$column       = esc_sql($column);
126
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
127 127
 	}
128 128
 
129 129
 	/**
@@ -133,30 +133,30 @@  discard block
 block discarded – undo
133 133
 	 * @since   1.0
134 134
 	 * @return  int
135 135
 	 */
136
-	public function insert( $data, $type = '' ) {
136
+	public function insert($data, $type = '') {
137 137
 		global $wpdb;
138 138
 
139 139
 		// Set default values
140
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
140
+		$data = wp_parse_args($data, $this->get_column_defaults());
141 141
 
142
-		do_action( 'give_pre_insert_' . $type, $data );
142
+		do_action('give_pre_insert_'.$type, $data);
143 143
 
144 144
 		// Initialise column format array
145 145
 		$column_formats = $this->get_columns();
146 146
 
147 147
 		// Force fields to lower case
148
-		$data = array_change_key_case( $data );
148
+		$data = array_change_key_case($data);
149 149
 
150 150
 		// White list columns
151
-		$data = array_intersect_key( $data, $column_formats );
151
+		$data = array_intersect_key($data, $column_formats);
152 152
 
153 153
 		// Reorder $column_formats to match the order of columns given in $data
154
-		$data_keys      = array_keys( $data );
155
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
154
+		$data_keys      = array_keys($data);
155
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
156 156
 
157
-		$wpdb->insert( $this->table_name, $data, $column_formats );
157
+		$wpdb->insert($this->table_name, $data, $column_formats);
158 158
 
159
-		do_action( 'give_post_insert_' . $type, $wpdb->insert_id, $data );
159
+		do_action('give_post_insert_'.$type, $wpdb->insert_id, $data);
160 160
 
161 161
 		return $wpdb->insert_id;
162 162
 	}
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
 	 * @since   1.0
169 169
 	 * @return  bool
170 170
 	 */
171
-	public function update( $row_id, $data = array(), $where = '' ) {
171
+	public function update($row_id, $data = array(), $where = '') {
172 172
 
173 173
 		global $wpdb;
174 174
 
175 175
 		// Row ID must be positive integer
176
-		$row_id = absint( $row_id );
176
+		$row_id = absint($row_id);
177 177
 
178
-		if ( empty( $row_id ) ) {
178
+		if (empty($row_id)) {
179 179
 			return false;
180 180
 		}
181 181
 
182
-		if ( empty( $where ) ) {
182
+		if (empty($where)) {
183 183
 			$where = $this->primary_key;
184 184
 		}
185 185
 
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 		$column_formats = $this->get_columns();
188 188
 
189 189
 		// Force fields to lower case
190
-		$data = array_change_key_case( $data );
190
+		$data = array_change_key_case($data);
191 191
 
192 192
 		// White list columns
193
-		$data = array_intersect_key( $data, $column_formats );
193
+		$data = array_intersect_key($data, $column_formats);
194 194
 
195 195
 		// Reorder $column_formats to match the order of columns given in $data
196
-		$data_keys      = array_keys( $data );
197
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
196
+		$data_keys      = array_keys($data);
197
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
198 198
 
199
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
199
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
200 200
 			return false;
201 201
 		}
202 202
 
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
 	 * @since   1.0
211 211
 	 * @return  bool
212 212
 	 */
213
-	public function delete( $row_id = 0 ) {
213
+	public function delete($row_id = 0) {
214 214
 
215 215
 		global $wpdb;
216 216
 
217 217
 		// Row ID must be positive integer
218
-		$row_id = absint( $row_id );
218
+		$row_id = absint($row_id);
219 219
 
220
-		if ( empty( $row_id ) ) {
220
+		if (empty($row_id)) {
221 221
 			return false;
222 222
 		}
223 223
 
224
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
224
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
225 225
 			return false;
226 226
 		}
227 227
 
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 * @param  string $table The table name
236 236
 	 * @return bool          If the table name exists
237 237
 	 */
238
-	public function table_exists( $table ) {
238
+	public function table_exists($table) {
239 239
 		global $wpdb;
240
-		$table = sanitize_text_field( $table );
240
+		$table = sanitize_text_field($table);
241 241
 
242
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
242
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
243 243
 	}
244 244
 
245 245
 }
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 * Retrieve a row by a specific column / value
96 96
 	 *
97 97
 	 * @access  public
98
-     *
98
+	 *
99 99
 	 * @since   1.0
100 100
 	 *
101
-     * @param int $column Column ID
102
-     * @param int $row_id Row ID
103
-     *
104
-     * @return  object
101
+	 * @param int $column Column ID
102
+	 * @param int $row_id Row ID
103
+	 *
104
+	 * @return  object
105 105
 	 */
106 106
 	public function get_by( $column, $row_id ) {
107
-        /* @var WPDB $wpdb */
108
-        global $wpdb;
107
+		/* @var WPDB $wpdb */
108
+		global $wpdb;
109 109
 
110 110
 		$column = esc_sql( $column );
111 111
 		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 	 * Retrieve a specific column's value by the primary key
116 116
 	 *
117 117
 	 * @access  public
118
-     *
118
+	 *
119 119
 	 * @since   1.0
120
-     *
121
-     * @param int $column Column ID
122
-     * @param int $row_id Row ID
123
-     *
120
+	 *
121
+	 * @param int $column Column ID
122
+	 * @param int $row_id Row ID
123
+	 *
124 124
 	 * @return  string
125 125
 	 */
126 126
 	public function get_column( $column, $row_id ) {
127
-        /* @var WPDB $wpdb */
128
-        global $wpdb;
127
+		/* @var WPDB $wpdb */
128
+		global $wpdb;
129 129
 
130 130
 		$column = esc_sql( $column );
131 131
 		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 	 * Retrieve a specific column's value by the the specified column / value
136 136
 	 *
137 137
 	 * @access  public
138
-     *
138
+	 *
139 139
 	 * @since   1.0
140
-     *
141
-     * @param int       $column         Column ID
142
-     * @param string    $column_where   Column name
143
-     * @param string    $column_value   Column value
144
-     *
140
+	 *
141
+	 * @param int       $column         Column ID
142
+	 * @param string    $column_where   Column name
143
+	 * @param string    $column_value   Column value
144
+	 *
145 145
 	 * @return  string
146 146
 	 */
147 147
 	public function get_column_by( $column, $column_where, $column_value ) {
148
-        /* @var WPDB $wpdb */
149
-        global $wpdb;
148
+		/* @var WPDB $wpdb */
149
+		global $wpdb;
150 150
 
151 151
 		$column_where = esc_sql( $column_where );
152 152
 		$column       = esc_sql( $column );
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 	 * Insert a new row
158 158
 	 *
159 159
 	 * @access  public
160
-     *
160
+	 *
161 161
 	 * @since   1.0
162
-     *
163
-     * @param array  $data
164
-     * @param string $type
165
-     *
162
+	 *
163
+	 * @param array  $data
164
+	 * @param string $type
165
+	 *
166 166
 	 * @return  int
167 167
 	 */
168 168
 	public function insert( $data, $type = '' ) {
169
-        /* @var WPDB $wpdb */
170
-        global $wpdb;
169
+		/* @var WPDB $wpdb */
170
+		global $wpdb;
171 171
 
172 172
 		// Set default values
173 173
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
 	 * Update a row
199 199
 	 *
200 200
 	 * @access  public
201
-     *
201
+	 *
202 202
 	 * @since   1.0
203
-     *
204
-     * @param int       $row_id     Column ID
205
-     * @param array     $data
206
-     * @param string    $where      Column value
207
-     *
203
+	 *
204
+	 * @param int       $row_id     Column ID
205
+	 * @param array     $data
206
+	 * @param string    $where      Column value
207
+	 *
208 208
 	 * @return  bool
209 209
 	 */
210 210
 	public function update( $row_id, $data = array(), $where = '' ) {
211
-        /* @var WPDB $wpdb */
212
-        global $wpdb;
211
+		/* @var WPDB $wpdb */
212
+		global $wpdb;
213 213
 
214 214
 		// Row ID must be positive integer
215 215
 		$row_id = absint( $row_id );
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 	 * Delete a row identified by the primary key
247 247
 	 *
248 248
 	 * @access  public
249
-     *
249
+	 *
250 250
 	 * @since   1.0
251
-     *
252
-     * @param int $row_id Column ID
253
-     *
251
+	 *
252
+	 * @param int $row_id Column ID
253
+	 *
254 254
 	 * @return  bool
255 255
 	 */
256 256
 	public function delete( $row_id = 0 ) {
257
-        /* @var WPDB $wpdb */
258
-        global $wpdb;
257
+		/* @var WPDB $wpdb */
258
+		global $wpdb;
259 259
 
260 260
 		// Row ID must be positive integer
261 261
 		$row_id = absint( $row_id );
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return bool          If the table name exists
280 280
 	 */
281 281
 	public function table_exists( $table ) {
282
-        /* @var WPDB $wpdb */
282
+		/* @var WPDB $wpdb */
283 283
 		global $wpdb;
284 284
 
285 285
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_predefined_dates() {
78 78
 		$predefined = array(
79
-			'today'        => __( 'Today', 'give' ),
80
-			'yesterday'    => __( 'Yesterday', 'give' ),
81
-			'this_week'    => __( 'This Week', 'give' ),
82
-			'last_week'    => __( 'Last Week', 'give' ),
83
-			'this_month'   => __( 'This Month', 'give' ),
84
-			'last_month'   => __( 'Last Month', 'give' ),
85
-			'this_quarter' => __( 'This Quarter', 'give' ),
86
-			'last_quarter' => __( 'Last Quarter', 'give' ),
87
-			'this_year'    => __( 'This Year', 'give' ),
88
-			'last_year'    => __( 'Last Year', 'give' )
79
+			'today'        => __('Today', 'give'),
80
+			'yesterday'    => __('Yesterday', 'give'),
81
+			'this_week'    => __('This Week', 'give'),
82
+			'last_week'    => __('Last Week', 'give'),
83
+			'this_month'   => __('This Month', 'give'),
84
+			'last_month'   => __('Last Month', 'give'),
85
+			'this_quarter' => __('This Quarter', 'give'),
86
+			'last_quarter' => __('Last Quarter', 'give'),
87
+			'this_year'    => __('This Year', 'give'),
88
+			'last_year'    => __('Last Year', 'give')
89 89
 		);
90 90
 
91
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
91
+		return apply_filters('give_stats_predefined_dates', $predefined);
92 92
 	}
93 93
 
94 94
 	/**
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return void
106 106
 	 */
107
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
107
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
108 108
 
109
-		if ( empty( $_start_date ) ) {
109
+		if (empty($_start_date)) {
110 110
 			$_start_date = 'this_month';
111 111
 		}
112 112
 
113
-		if ( empty( $_end_date ) ) {
113
+		if (empty($_end_date)) {
114 114
 			$_end_date = $_start_date;
115 115
 		}
116 116
 
117
-		$this->start_date = $this->convert_date( $_start_date );
118
-		$this->end_date   = $this->convert_date( $_end_date, true );
117
+		$this->start_date = $this->convert_date($_start_date);
118
+		$this->end_date   = $this->convert_date($_end_date, true);
119 119
 	}
120 120
 
121 121
 	/**
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 * @since  1.0
126 126
 	 * @return array|WP_Error If the date is invalid, a WP_Error object will be returned
127 127
 	 */
128
-	public function convert_date( $date, $end_date = false ) {
128
+	public function convert_date($date, $end_date = false) {
129 129
 
130 130
 		$this->timestamp = false;
131 131
 		$second          = $end_date ? 59 : 0;
132 132
 		$minute          = $end_date ? 59 : 0;
133 133
 		$hour            = $end_date ? 23 : 0;
134 134
 		$day             = 1;
135
-		$month           = date( 'n', current_time( 'timestamp' ) );
136
-		$year            = date( 'Y', current_time( 'timestamp' ) );
135
+		$month           = date('n', current_time('timestamp'));
136
+		$year            = date('Y', current_time('timestamp'));
137 137
 
138
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
138
+		if (array_key_exists($date, $this->get_predefined_dates())) {
139 139
 
140 140
 			// This is a predefined date rate, such as last_week
141
-			switch ( $date ) {
141
+			switch ($date) {
142 142
 
143 143
 				case 'this_month' :
144 144
 
145
-					if ( $end_date ) {
145
+					if ($end_date) {
146 146
 
147
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
147
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
148 148
 						$hour   = 23;
149 149
 						$minute = 59;
150 150
 						$second = 59;
@@ -154,28 +154,28 @@  discard block
 block discarded – undo
154 154
 
155 155
 				case 'last_month' :
156 156
 
157
-					if ( $month == 1 ) {
157
+					if ($month == 1) {
158 158
 
159 159
 						$month = 12;
160
-						$year --;
160
+						$year--;
161 161
 
162 162
 					} else {
163 163
 
164
-						$month --;
164
+						$month--;
165 165
 
166 166
 					}
167 167
 
168
-					if ( $end_date ) {
169
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
168
+					if ($end_date) {
169
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
170 170
 					}
171 171
 
172 172
 					break;
173 173
 
174 174
 				case 'today' :
175 175
 
176
-					$day = date( 'd', current_time( 'timestamp' ) );
176
+					$day = date('d', current_time('timestamp'));
177 177
 
178
-					if ( $end_date ) {
178
+					if ($end_date) {
179 179
 						$hour   = 23;
180 180
 						$minute = 59;
181 181
 						$second = 59;
@@ -185,23 +185,23 @@  discard block
 block discarded – undo
185 185
 
186 186
 				case 'yesterday' :
187 187
 
188
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
188
+					$day = date('d', current_time('timestamp')) - 1;
189 189
 
190 190
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
191
-					if ( $day < 1 ) {
191
+					if ($day < 1) {
192 192
 
193 193
 						// If current month is 1
194
-						if ( 1 == $month ) {
194
+						if (1 == $month) {
195 195
 
196 196
 							$year -= 1; // Today is January 1, so skip back to last day of December
197 197
 							$month = 12;
198
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
198
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
199 199
 
200 200
 						} else {
201 201
 
202 202
 							// Go back one month and get the last day of the month
203 203
 							$month -= 1;
204
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
204
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
205 205
 
206 206
 						}
207 207
 					}
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 
211 211
 				case 'this_week' :
212 212
 
213
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
214
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
213
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
214
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
215 215
 
216
-					if ( $today < $days_to_week_start ) {
216
+					if ($today < $days_to_week_start) {
217 217
 
218
-						if ( $month > 1 ) {
218
+						if ($month > 1) {
219 219
 							$month -= 1;
220 220
 						} else {
221 221
 							$month = 12;
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 
224 224
 					}
225 225
 
226
-					if ( ! $end_date ) {
226
+					if ( ! $end_date) {
227 227
 
228 228
 						// Getting the start day
229 229
 
230
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
231
-						$day += get_option( 'start_of_week' );
230
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
231
+						$day += get_option('start_of_week');
232 232
 
233 233
 					} else {
234 234
 
235 235
 						// Getting the end day
236 236
 
237
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
238
-						$day += get_option( 'start_of_week' ) + 6;
237
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
238
+						$day += get_option('start_of_week') + 6;
239 239
 
240 240
 					}
241 241
 
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 
244 244
 				case 'last_week' :
245 245
 
246
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
247
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
246
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
247
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
248 248
 
249
-					if ( $today < $days_to_week_start ) {
249
+					if ($today < $days_to_week_start) {
250 250
 
251
-						if ( $month > 1 ) {
251
+						if ($month > 1) {
252 252
 							$month -= 1;
253 253
 						} else {
254 254
 							$month = 12;
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 
257 257
 					}
258 258
 
259
-					if ( ! $end_date ) {
259
+					if ( ! $end_date) {
260 260
 
261 261
 						// Getting the start day
262 262
 
263
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
264
-						$day += get_option( 'start_of_week' );
263
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
264
+						$day += get_option('start_of_week');
265 265
 
266 266
 					} else {
267 267
 
268 268
 						// Getting the end day
269 269
 
270
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
271
-						$day += get_option( 'start_of_week' ) + 6;
270
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
271
+						$day += get_option('start_of_week') + 6;
272 272
 
273 273
 					}
274 274
 
@@ -276,39 +276,39 @@  discard block
 block discarded – undo
276 276
 
277 277
 				case 'this_quarter' :
278 278
 
279
-					$month_now = date( 'n', current_time( 'timestamp' ) );
279
+					$month_now = date('n', current_time('timestamp'));
280 280
 
281
-					if ( $month_now <= 3 ) {
281
+					if ($month_now <= 3) {
282 282
 
283
-						if ( ! $end_date ) {
283
+						if ( ! $end_date) {
284 284
 							$month = 1;
285 285
 						} else {
286 286
 							$month  = 3;
287
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
287
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
288 288
 							$hour   = 23;
289 289
 							$minute = 59;
290 290
 							$second = 59;
291 291
 						}
292 292
 
293
-					} else if ( $month_now <= 6 ) {
293
+					} else if ($month_now <= 6) {
294 294
 
295
-						if ( ! $end_date ) {
295
+						if ( ! $end_date) {
296 296
 							$month = 4;
297 297
 						} else {
298 298
 							$month  = 6;
299
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
299
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
300 300
 							$hour   = 23;
301 301
 							$minute = 59;
302 302
 							$second = 59;
303 303
 						}
304 304
 
305
-					} else if ( $month_now <= 9 ) {
305
+					} else if ($month_now <= 9) {
306 306
 
307
-						if ( ! $end_date ) {
307
+						if ( ! $end_date) {
308 308
 							$month = 7;
309 309
 						} else {
310 310
 							$month  = 9;
311
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
311
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
312 312
 							$hour   = 23;
313 313
 							$minute = 59;
314 314
 							$second = 59;
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 
317 317
 					} else {
318 318
 
319
-						if ( ! $end_date ) {
319
+						if ( ! $end_date) {
320 320
 							$month = 10;
321 321
 						} else {
322 322
 							$month  = 12;
323
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
323
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
324 324
 							$hour   = 23;
325 325
 							$minute = 59;
326 326
 							$second = 59;
@@ -332,40 +332,40 @@  discard block
 block discarded – undo
332 332
 
333 333
 				case 'last_quarter' :
334 334
 
335
-					$month_now = date( 'n', current_time( 'timestamp' ) );
335
+					$month_now = date('n', current_time('timestamp'));
336 336
 
337
-					if ( $month_now <= 3 ) {
337
+					if ($month_now <= 3) {
338 338
 
339
-						if ( ! $end_date ) {
339
+						if ( ! $end_date) {
340 340
 							$month = 10;
341 341
 						} else {
342 342
 							$year -= 1;
343 343
 							$month  = 12;
344
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
344
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
345 345
 							$hour   = 23;
346 346
 							$minute = 59;
347 347
 							$second = 59;
348 348
 						}
349 349
 
350
-					} else if ( $month_now <= 6 ) {
350
+					} else if ($month_now <= 6) {
351 351
 
352
-						if ( ! $end_date ) {
352
+						if ( ! $end_date) {
353 353
 							$month = 1;
354 354
 						} else {
355 355
 							$month  = 3;
356
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
356
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
357 357
 							$hour   = 23;
358 358
 							$minute = 59;
359 359
 							$second = 59;
360 360
 						}
361 361
 
362
-					} else if ( $month_now <= 9 ) {
362
+					} else if ($month_now <= 9) {
363 363
 
364
-						if ( ! $end_date ) {
364
+						if ( ! $end_date) {
365 365
 							$month = 4;
366 366
 						} else {
367 367
 							$month  = 6;
368
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
368
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
369 369
 							$hour   = 23;
370 370
 							$minute = 59;
371 371
 							$second = 59;
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
 
374 374
 					} else {
375 375
 
376
-						if ( ! $end_date ) {
376
+						if ( ! $end_date) {
377 377
 							$month = 7;
378 378
 						} else {
379 379
 							$month  = 9;
380
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
380
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
381 381
 							$hour   = 23;
382 382
 							$minute = 59;
383 383
 							$second = 59;
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 
390 390
 				case 'this_year' :
391 391
 
392
-					if ( ! $end_date ) {
392
+					if ( ! $end_date) {
393 393
 						$month = 1;
394 394
 					} else {
395 395
 						$month  = 12;
396
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
396
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
397 397
 						$hour   = 23;
398 398
 						$minute = 59;
399 399
 						$second = 59;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 				case 'last_year' :
405 405
 
406 406
 					$year -= 1;
407
-					if ( ! $end_date ) {
407
+					if ( ! $end_date) {
408 408
 						$month = 1;
409 409
 					} else {
410 410
 						$month  = 12;
411
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
411
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
412 412
 						$hour   = 23;
413 413
 						$minute = 59;
414 414
 						$second = 59;
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 			}
420 420
 
421 421
 
422
-		} else if ( is_numeric( $date ) ) {
422
+		} else if (is_numeric($date)) {
423 423
 
424 424
 			// return $date unchanged since it is a timestamp
425 425
 			$this->timestamp = true;
426 426
 
427
-		} else if ( false !== strtotime( $date ) ) {
427
+		} else if (false !== strtotime($date)) {
428 428
 
429
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
430
-			$year  = date( 'Y', $date );
431
-			$month = date( 'm', $date );
432
-			$day   = date( 'd', $date );
429
+			$date  = strtotime($date, current_time('timestamp'));
430
+			$year  = date('Y', $date);
431
+			$month = date('m', $date);
432
+			$day   = date('d', $date);
433 433
 
434 434
 		} else {
435 435
 
436
-			return new WP_Error( 'invalid_date', __( 'Improper date provided.', 'give' ) );
436
+			return new WP_Error('invalid_date', __('Improper date provided.', 'give'));
437 437
 
438 438
 		}
439 439
 
440
-		if ( false === $this->timestamp ) {
440
+		if (false === $this->timestamp) {
441 441
 			// Create an exact timestamp
442
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
442
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
443 443
 		}
444 444
 
445
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
445
+		return apply_filters('give_stats_date', $date, $end_date, $this);
446 446
 
447 447
 	}
448 448
 
@@ -453,33 +453,33 @@  discard block
 block discarded – undo
453 453
 	 * @since  1.0
454 454
 	 * @return string
455 455
 	 */
456
-	public function count_where( $where = '' ) {
456
+	public function count_where($where = '') {
457 457
 		// Only get payments in our date range
458 458
 
459 459
 		$start_where = '';
460 460
 		$end_where   = '';
461 461
 
462
-		if ( $this->start_date ) {
462
+		if ($this->start_date) {
463 463
 
464
-			if ( $this->timestamp ) {
464
+			if ($this->timestamp) {
465 465
 				$format = 'Y-m-d H:i:s';
466 466
 			} else {
467 467
 				$format = 'Y-m-d 00:00:00';
468 468
 			}
469 469
 
470
-			$start_date  = date( $format, $this->start_date );
470
+			$start_date  = date($format, $this->start_date);
471 471
 			$start_where = " AND p.post_date >= '{$start_date}'";
472 472
 		}
473 473
 
474
-		if ( $this->end_date ) {
474
+		if ($this->end_date) {
475 475
 
476
-			if ( $this->timestamp ) {
476
+			if ($this->timestamp) {
477 477
 				$format = 'Y-m-d H:i:s';
478 478
 			} else {
479 479
 				$format = 'Y-m-d 23:59:59';
480 480
 			}
481 481
 
482
-			$end_date = date( $format, $this->end_date );
482
+			$end_date = date($format, $this->end_date);
483 483
 
484 484
 			$end_where = " AND p.post_date <= '{$end_date}'";
485 485
 		}
@@ -499,34 +499,34 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return string
501 501
 	 */
502
-	public function payments_where( $where = '' ) {
502
+	public function payments_where($where = '') {
503 503
 
504 504
 		global $wpdb;
505 505
 
506 506
 		$start_where = '';
507 507
 		$end_where   = '';
508 508
 
509
-		if ( ! is_wp_error( $this->start_date ) ) {
509
+		if ( ! is_wp_error($this->start_date)) {
510 510
 
511
-			if ( $this->timestamp ) {
511
+			if ($this->timestamp) {
512 512
 				$format = 'Y-m-d H:i:s';
513 513
 			} else {
514 514
 				$format = 'Y-m-d 00:00:00';
515 515
 			}
516 516
 
517
-			$start_date  = date( $format, $this->start_date );
517
+			$start_date  = date($format, $this->start_date);
518 518
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
519 519
 		}
520 520
 
521
-		if ( ! is_wp_error( $this->end_date ) ) {
521
+		if ( ! is_wp_error($this->end_date)) {
522 522
 
523
-			if ( $this->timestamp ) {
523
+			if ($this->timestamp) {
524 524
 				$format = 'Y-m-d 00:00:00';
525 525
 			} else {
526 526
 				$format = 'Y-m-d 23:59:59';
527 527
 			}
528 528
 
529
-			$end_date = date( $format, $this->end_date );
529
+			$end_date = date($format, $this->end_date);
530 530
 
531 531
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
532 532
 		}
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param $url
83 83
 	 *
84
-	 * @return mixed
84
+	 * @return string
85 85
 	 */
86 86
 	public function give_update_cmb_meta_box_url( $url ) {
87 87
 		//Path to Give's CMB
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  * @since 1.0
768 768
  *
769 769
  * @param string $key The Key to update
770
- * @param string|bool|int $value The value to set the key to
770
+ * @param integer $value The value to set the key to
771 771
  *
772 772
  * @return boolean True if updated, false if not.
773 773
  */
Please login to merge, or discard this patch.
Spacing   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -46,26 +46,26 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __construct() {
48 48
 
49
-		add_action( 'admin_init', array( $this, 'init' ) );
49
+		add_action('admin_init', array($this, 'init'));
50 50
 
51 51
 		//Customize CMB2 URL
52
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
52
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
53 53
 
54 54
 		//Custom CMB2 Settings Fields
55
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
56
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
57
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
58
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
59
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
60
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
61
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
62
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
63
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
55
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
56
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
57
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
58
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
59
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
60
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
61
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
62
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
63
+		add_action('admin_notices', array($this, 'settings_notices'));
64 64
 
65 65
 		// Include CMB CSS in the head to avoid FOUC
66
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
66
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
67 67
 
68
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
68
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
69 69
 
70 70
 	}
71 71
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @since  1.0
77 77
 	 */
78 78
 	public function init() {
79
-		register_setting( $this->key, $this->key );
79
+		register_setting($this->key, $this->key);
80 80
 
81 81
 	}
82 82
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return mixed
92 92
 	 */
93
-	public function give_update_cmb_meta_box_url( $url ) {
93
+	public function give_update_cmb_meta_box_url($url) {
94 94
 		//Path to Give's CMB
95
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
95
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
96 96
 	}
97 97
 
98 98
 
@@ -104,27 +104,27 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function give_get_settings_tabs() {
106 106
 
107
-		$settings = $this->give_settings( null );
107
+		$settings = $this->give_settings(null);
108 108
 
109 109
 		$tabs             = array();
110
-		$tabs['general']  = __( 'General', 'give' );
111
-		$tabs['gateways'] = __( 'Payment Gateways', 'give' );
112
-		$tabs['display']  = __( 'Display Options', 'give' );
113
-		$tabs['emails']   = __( 'Emails', 'give' );
110
+		$tabs['general']  = __('General', 'give');
111
+		$tabs['gateways'] = __('Payment Gateways', 'give');
112
+		$tabs['display']  = __('Display Options', 'give');
113
+		$tabs['emails']   = __('Emails', 'give');
114 114
 
115
-		if ( ! empty( $settings['addons']['fields'] ) ) {
116
-			$tabs['addons'] = __( 'Add-ons', 'give' );
115
+		if ( ! empty($settings['addons']['fields'])) {
116
+			$tabs['addons'] = __('Add-ons', 'give');
117 117
 		}
118 118
 
119
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
120
-			$tabs['licenses'] = __( 'Licenses', 'give' );
119
+		if ( ! empty($settings['licenses']['fields'])) {
120
+			$tabs['licenses'] = __('Licenses', 'give');
121 121
 		}
122 122
 
123
-		$tabs['advanced']    = __( 'Advanced', 'give' );
124
-		$tabs['api']         = __( 'API', 'give' );
125
-		$tabs['system_info'] = __( 'System Info', 'give' );
123
+		$tabs['advanced']    = __('Advanced', 'give');
124
+		$tabs['api']         = __('API', 'give');
125
+		$tabs['system_info'] = __('System Info', 'give');
126 126
 
127
-		return apply_filters( 'give_settings_tabs', $tabs );
127
+		return apply_filters('give_settings_tabs', $tabs);
128 128
 	}
129 129
 
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function admin_page_display() {
136 136
 
137
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
137
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
138 138
 
139 139
 		?>
140 140
 
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 
143 143
 			<h1 class="nav-tab-wrapper">
144 144
 				<?php
145
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
145
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
146 146
 
147 147
 					//Support legacy tab creation conditions based off $_GET parameter
148 148
 					//We pass the $_GET['tab'] to conditions executed later
149 149
 					$_GET['tab'] = $tab_id;
150 150
 
151
-					$tab_url = esc_url( add_query_arg( array(
151
+					$tab_url = esc_url(add_query_arg(array(
152 152
 						'settings-updated' => false,
153 153
 						'tab'              => $tab_id
154
-					) ) );
154
+					)));
155 155
 
156 156
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
157 157
 
158
-					echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
158
+					echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
159 159
 
160 160
 				}
161 161
 				?>
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
 
164 164
 			<?php
165 165
 			//Loop through and output settings
166
-			foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
166
+			foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
167 167
 
168 168
 				//Support legacy tab creation conditions based off $_GET parameter
169 169
 				//We 'trick' the conditions into thinking this is the tab
170 170
 				$_GET['tab'] = $tab_id;
171 171
 
172
-				$tab_settings = $this->give_settings( $tab_id );
172
+				$tab_settings = $this->give_settings($tab_id);
173 173
 
174 174
 				//Pass active tab within $tab_settings so we can hide with CSS via PHP
175
-				if ( $active_tab == $tab_id ) {
175
+				if ($active_tab == $tab_id) {
176 176
 					$tab_settings['active_tab'] = true;
177 177
 				}
178 178
 
179
-				cmb2_metabox_form( $tab_settings, $this->key );
179
+				cmb2_metabox_form($tab_settings, $this->key);
180 180
 
181 181
 			} ?>
182 182
 
@@ -194,34 +194,34 @@  discard block
 block discarded – undo
194 194
 	 * @since 1.5 Modified to CSS hide non-active tabs
195 195
 	 * @since 1.0
196 196
 	 */
197
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
197
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
198 198
 
199 199
 
200
-		$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
200
+		$pagenow = isset($_GET['page']) ? $_GET['page'] : '';
201 201
 
202 202
 		//only modify the give settings form
203
-		if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) {
203
+		if ('give_settings' == $object_id && $pagenow == 'give-settings') {
204 204
 
205 205
 			$style = '';
206
-			if ( ! isset( $cmb->meta_box['active_tab'] ) ) {
206
+			if ( ! isset($cmb->meta_box['active_tab'])) {
207 207
 				$style = 'style="display:none;"';
208 208
 			}
209 209
 
210 210
 			//Set ID based off tab name - protects backwards compatibility
211
-			$tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id'];
211
+			$tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id'];
212 212
 
213
-			$save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div>' );
213
+			$save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div>');
214 214
 
215 215
 			//Filter so some tabs won't have save settings
216
-			$no_save_button = apply_filters( 'give_settings_no_save_output', array(
216
+			$no_save_button = apply_filters('give_settings_no_save_output', array(
217 217
 				'system_info'
218
-			) );
218
+			));
219 219
 
220
-			if ( in_array( $tab_id, $no_save_button ) ) {
220
+			if (in_array($tab_id, $no_save_button)) {
221 221
 				$save_button = '';
222 222
 			}
223 223
 
224
-			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>';
224
+			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>';
225 225
 
226 226
 		}
227 227
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return array
240 240
 	 */
241
-	public function give_settings( $active_tab ) {
241
+	public function give_settings($active_tab) {
242 242
 
243 243
 		$give_settings = array(
244 244
 			/**
@@ -246,62 +246,62 @@  discard block
 block discarded – undo
246 246
 			 */
247 247
 			'general'     => array(
248 248
 				'id'         => 'general_settings',
249
-				'give_title' => __( 'General Settings', 'give' ),
250
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
251
-				'fields'     => apply_filters( 'give_settings_general', array(
249
+				'give_title' => __('General Settings', 'give'),
250
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
251
+				'fields'     => apply_filters('give_settings_general', array(
252 252
 						array(
253
-							'name' => __( 'General Settings', 'give' ),
253
+							'name' => __('General Settings', 'give'),
254 254
 							'desc' => '',
255 255
 							'type' => 'give_title',
256 256
 							'id'   => 'give_title_general_settings_1'
257 257
 						),
258 258
 						array(
259
-							'name'    => __( 'Success Page', 'give' ),
259
+							'name'    => __('Success Page', 'give'),
260 260
 							/* translators: %s: [give_receipt] */
261
-							'desc'    => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
261
+							'desc'    => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
262 262
 							'id'      => 'success_page',
263 263
 							'type'    => 'select',
264
-							'options' => give_cmb2_get_post_options( array(
264
+							'options' => give_cmb2_get_post_options(array(
265 265
 								'post_type'   => 'page',
266
-								'numberposts' => - 1
267
-							) ),
266
+								'numberposts' => -1
267
+							)),
268 268
 						),
269 269
 						array(
270
-							'name'    => __( 'Failed Transaction Page', 'give' ),
271
-							'desc'    => __( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ),
270
+							'name'    => __('Failed Transaction Page', 'give'),
271
+							'desc'    => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'),
272 272
 							'id'      => 'failure_page',
273 273
 							'type'    => 'select',
274
-							'options' => give_cmb2_get_post_options( array(
274
+							'options' => give_cmb2_get_post_options(array(
275 275
 								'post_type'   => 'page',
276
-								'numberposts' => - 1
277
-							) ),
276
+								'numberposts' => -1
277
+							)),
278 278
 						),
279 279
 						array(
280
-							'name'    => __( 'Donation History Page', 'give' ),
280
+							'name'    => __('Donation History Page', 'give'),
281 281
 							/* translators: %s: [donation_history] */
282
-							'desc'    => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
282
+							'desc'    => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
283 283
 							'id'      => 'history_page',
284 284
 							'type'    => 'select',
285
-							'options' => give_cmb2_get_post_options( array(
285
+							'options' => give_cmb2_get_post_options(array(
286 286
 								'post_type'   => 'page',
287
-								'numberposts' => - 1
288
-							) ),
287
+								'numberposts' => -1
288
+							)),
289 289
 						),
290 290
 						array(
291
-							'name'    => __( 'Base Country', 'give' ),
292
-							'desc'    => __( 'Where does your site operate from?', 'give' ),
291
+							'name'    => __('Base Country', 'give'),
292
+							'desc'    => __('Where does your site operate from?', 'give'),
293 293
 							'id'      => 'base_country',
294 294
 							'type'    => 'select',
295 295
 							'options' => give_get_country_list(),
296 296
 						),
297 297
 						array(
298
-							'name' => __( 'Currency Settings', 'give' ),
298
+							'name' => __('Currency Settings', 'give'),
299 299
 							'desc' => '',
300 300
 							'type' => 'give_title',
301 301
 							'id'   => 'give_title_general_settings_2'
302 302
 						),
303 303
 						array(
304
-							'name'    => __( 'Currency', 'give' ),
304
+							'name'    => __('Currency', 'give'),
305 305
 							'desc'    => 'Choose your currency. Note that some payment gateways have currency restrictions.',
306 306
 							'id'      => 'currency',
307 307
 							'type'    => 'select',
@@ -309,28 +309,28 @@  discard block
 block discarded – undo
309 309
 							'default' => 'USD',
310 310
 						),
311 311
 						array(
312
-							'name'    => __( 'Currency Position', 'give' ),
312
+							'name'    => __('Currency Position', 'give'),
313 313
 							'desc'    => 'Choose the position of the currency sign.',
314 314
 							'id'      => 'currency_position',
315 315
 							'type'    => 'select',
316 316
 							'options' => array(
317 317
 								/* translators: %s: currency symbol */
318
-								'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
318
+								'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
319 319
 								/* translators: %s: currency symbol */
320
-								'after'  => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
320
+								'after'  => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
321 321
 							),
322 322
 							'default' => 'before',
323 323
 						),
324 324
 						array(
325
-							'name'    => __( 'Thousands Separator', 'give' ),
326
-							'desc'    => __( 'The symbol (typically , or .) to separate thousands.', 'give' ),
325
+							'name'    => __('Thousands Separator', 'give'),
326
+							'desc'    => __('The symbol (typically , or .) to separate thousands.', 'give'),
327 327
 							'id'      => 'thousands_separator',
328 328
 							'type'    => 'text_small',
329 329
 							'default' => ',',
330 330
 						),
331 331
 						array(
332
-							'name'    => __( 'Decimal Separator', 'give' ),
333
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
332
+							'name'    => __('Decimal Separator', 'give'),
333
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
334 334
 							'id'      => 'decimal_separator',
335 335
 							'type'    => 'text_small',
336 336
 							'default' => '.',
@@ -343,83 +343,83 @@  discard block
 block discarded – undo
343 343
 			 */
344 344
 			'gateways'    => array(
345 345
 				'id'         => 'payment_gateways',
346
-				'give_title' => __( 'Payment Gateways', 'give' ),
347
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
348
-				'fields'     => apply_filters( 'give_settings_gateways', array(
346
+				'give_title' => __('Payment Gateways', 'give'),
347
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
348
+				'fields'     => apply_filters('give_settings_gateways', array(
349 349
 						array(
350
-							'name' => __( 'Gateways Settings', 'give' ),
350
+							'name' => __('Gateways Settings', 'give'),
351 351
 							'desc' => '',
352 352
 							'id'   => 'give_title_gateway_settings_1',
353 353
 							'type' => 'give_title'
354 354
 						),
355 355
 						array(
356
-							'name' => __( 'Test Mode', 'give' ),
357
-							'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
356
+							'name' => __('Test Mode', 'give'),
357
+							'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
358 358
 							'id'   => 'test_mode',
359 359
 							'type' => 'checkbox'
360 360
 						),
361 361
 						array(
362
-							'name' => __( 'Enabled Gateways', 'give' ),
363
-							'desc' => __( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ),
362
+							'name' => __('Enabled Gateways', 'give'),
363
+							'desc' => __('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'),
364 364
 							'id'   => 'gateways',
365 365
 							'type' => 'enabled_gateways'
366 366
 						),
367 367
 						array(
368
-							'name' => __( 'Default Gateway', 'give' ),
369
-							'desc' => __( 'This is the gateway that will be selected by default.', 'give' ),
368
+							'name' => __('Default Gateway', 'give'),
369
+							'desc' => __('This is the gateway that will be selected by default.', 'give'),
370 370
 							'id'   => 'default_gateway',
371 371
 							'type' => 'default_gateway'
372 372
 						),
373 373
 						array(
374
-							'name' => __( 'PayPal Standard', 'give' ),
374
+							'name' => __('PayPal Standard', 'give'),
375 375
 							'desc' => '',
376 376
 							'type' => 'give_title',
377 377
 							'id'   => 'give_title_gateway_settings_2',
378 378
 						),
379 379
 						array(
380
-							'name' => __( 'PayPal Email', 'give' ),
381
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
380
+							'name' => __('PayPal Email', 'give'),
381
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
382 382
 							'id'   => 'paypal_email',
383 383
 							'type' => 'text_email',
384 384
 						),
385 385
 						array(
386
-							'name' => __( 'PayPal Page Style', 'give' ),
387
-							'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
386
+							'name' => __('PayPal Page Style', 'give'),
387
+							'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
388 388
 							'id'   => 'paypal_page_style',
389 389
 							'type' => 'text',
390 390
 						),
391 391
 						array(
392
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
393
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
392
+							'name'    => __('PayPal Transaction Type', 'give'),
393
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
394 394
 							'id'      => 'paypal_button_type',
395 395
 							'type'    => 'radio_inline',
396 396
 							'options' => array(
397
-								'donation' => __( 'Donation', 'give' ),
398
-								'standard' => __( 'Standard Transaction', 'give' )
397
+								'donation' => __('Donation', 'give'),
398
+								'standard' => __('Standard Transaction', 'give')
399 399
 							),
400 400
 							'default' => 'donation',
401 401
 						),
402 402
 						array(
403
-							'name' => __( 'Disable PayPal IPN Verification', 'give' ),
404
-							'desc' => __( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
403
+							'name' => __('Disable PayPal IPN Verification', 'give'),
404
+							'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
405 405
 							'id'   => 'disable_paypal_verification',
406 406
 							'type' => 'checkbox'
407 407
 						),
408 408
 						array(
409
-							'name' => __( 'Offline Donations', 'give' ),
409
+							'name' => __('Offline Donations', 'give'),
410 410
 							'desc' => '',
411 411
 							'type' => 'give_title',
412 412
 							'id'   => 'give_title_gateway_settings_3',
413 413
 						),
414 414
 						array(
415
-							'name' => __( 'Collect Billing Details', 'give' ),
416
-							'desc' => __( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ),
415
+							'name' => __('Collect Billing Details', 'give'),
416
+							'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'),
417 417
 							'id'   => 'give_offline_donation_enable_billing_fields',
418 418
 							'type' => 'checkbox'
419 419
 						),
420 420
 						array(
421
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
422
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
421
+							'name'    => __('Offline Donation Instructions', 'give'),
422
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
423 423
 							'id'      => 'global_offline_donation_content',
424 424
 							'default' => give_get_default_offline_donation_content(),
425 425
 							'type'    => 'wysiwyg',
@@ -428,15 +428,15 @@  discard block
 block discarded – undo
428 428
 							)
429 429
 						),
430 430
 						array(
431
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
432
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
431
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
432
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
433 433
 							'id'      => 'offline_donation_subject',
434
-							'default' => __( '{donation} - Offline Donation Instructions', 'give' ),
434
+							'default' => __('{donation} - Offline Donation Instructions', 'give'),
435 435
 							'type'    => 'text'
436 436
 						),
437 437
 						array(
438
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
439
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
438
+							'name'    => __('Offline Donation Email Instructions', 'give'),
439
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
440 440
 							'id'      => 'global_offline_donation_email',
441 441
 							'default' => give_get_default_offline_donation_email_content(),
442 442
 							'type'    => 'wysiwyg',
@@ -450,95 +450,95 @@  discard block
 block discarded – undo
450 450
 			/** Display Settings */
451 451
 			'display'     => array(
452 452
 				'id'         => 'display_settings',
453
-				'give_title' => __( 'Display Settings', 'give' ),
454
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
455
-				'fields'     => apply_filters( 'give_settings_display', array(
453
+				'give_title' => __('Display Settings', 'give'),
454
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
455
+				'fields'     => apply_filters('give_settings_display', array(
456 456
 						array(
457
-							'name' => __( 'Display Settings', 'give' ),
457
+							'name' => __('Display Settings', 'give'),
458 458
 							'desc' => '',
459 459
 							'id'   => 'give_title_display_settings_1',
460 460
 							'type' => 'give_title'
461 461
 						),
462 462
 						array(
463
-							'name' => __( 'Disable CSS', 'give' ),
464
-							'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
463
+							'name' => __('Disable CSS', 'give'),
464
+							'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
465 465
 							'id'   => 'disable_css',
466 466
 							'type' => 'checkbox'
467 467
 						),
468 468
 						array(
469
-							'name' => __( 'Enable Floating Labels', 'give' ),
469
+							'name' => __('Enable Floating Labels', 'give'),
470 470
 							/* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */
471
-							'desc' => sprintf( esc_html__( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' ) ),
471
+							'desc' => sprintf(esc_html__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://bradfrost.com/blog/post/float-label-pattern/')),
472 472
 							'id'   => 'enable_floatlabels',
473 473
 							'type' => 'checkbox'
474 474
 						),
475 475
 						array(
476
-							'name' => __( 'Disable Welcome Screen', 'give' ),
476
+							'name' => __('Disable Welcome Screen', 'give'),
477 477
 							/* translators: %s: about page URL */
478
-							'desc' => sprintf( esc_html__( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
478
+							'desc' => sprintf(esc_html__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), esc_url(admin_url('index.php?page=give-about'))),
479 479
 							'id'   => 'disable_welcome',
480 480
 							'type' => 'checkbox'
481 481
 						),
482 482
 						array(
483
-							'name' => __( 'Post Types', 'give' ),
483
+							'name' => __('Post Types', 'give'),
484 484
 							'desc' => '',
485 485
 							'id'   => 'give_title_display_settings_2',
486 486
 							'type' => 'give_title'
487 487
 						),
488 488
 						array(
489
-							'name' => __( 'Disable Form Single Views', 'give' ),
490
-							'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
489
+							'name' => __('Disable Form Single Views', 'give'),
490
+							'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
491 491
 							'id'   => 'disable_forms_singular',
492 492
 							'type' => 'checkbox'
493 493
 						),
494 494
 						array(
495
-							'name' => __( 'Disable Form Archives', 'give' ),
496
-							'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
495
+							'name' => __('Disable Form Archives', 'give'),
496
+							'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
497 497
 							'id'   => 'disable_forms_archives',
498 498
 							'type' => 'checkbox'
499 499
 						),
500 500
 						array(
501
-							'name' => __( 'Disable Form Excerpts', 'give' ),
502
-							'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
501
+							'name' => __('Disable Form Excerpts', 'give'),
502
+							'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
503 503
 							'id'   => 'disable_forms_excerpt',
504 504
 							'type' => 'checkbox'
505 505
 						),
506 506
 
507 507
 						array(
508
-							'name'    => __( 'Featured Image Size', 'give' ),
509
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
508
+							'name'    => __('Featured Image Size', 'give'),
509
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
510 510
 							'id'      => 'featured_image_size',
511 511
 							'type'    => 'select',
512 512
 							'default' => 'large',
513 513
 							'options' => give_get_featured_image_sizes()
514 514
 						),
515 515
 						array(
516
-							'name' => __( 'Disable Form Featured Image', 'give' ),
517
-							'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
516
+							'name' => __('Disable Form Featured Image', 'give'),
517
+							'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
518 518
 							'id'   => 'disable_form_featured_img',
519 519
 							'type' => 'checkbox'
520 520
 						),
521 521
 						array(
522
-							'name' => __( 'Disable Single Form Sidebar', 'give' ),
523
-							'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
522
+							'name' => __('Disable Single Form Sidebar', 'give'),
523
+							'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
524 524
 							'id'   => 'disable_form_sidebar',
525 525
 							'type' => 'checkbox'
526 526
 						),
527 527
 						array(
528
-							'name' => __( 'Taxonomies', 'give' ),
528
+							'name' => __('Taxonomies', 'give'),
529 529
 							'desc' => '',
530 530
 							'id'   => 'give_title_display_settings_3',
531 531
 							'type' => 'give_title'
532 532
 						),
533 533
 						array(
534
-							'name' => __( 'Enable Form Categories', 'give' ),
535
-							'desc' => __( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ),
534
+							'name' => __('Enable Form Categories', 'give'),
535
+							'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'),
536 536
 							'id'   => 'enable_categories',
537 537
 							'type' => 'checkbox'
538 538
 						),
539 539
 						array(
540
-							'name' => __( 'Enable Form Tags', 'give' ),
541
-							'desc' => __( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ),
540
+							'name' => __('Enable Form Tags', 'give'),
541
+							'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'),
542 542
 							'id'   => 'enable_tags',
543 543
 							'type' => 'checkbox'
544 544
 						),
@@ -551,95 +551,95 @@  discard block
 block discarded – undo
551 551
 			 */
552 552
 			'emails'      => array(
553 553
 				'id'         => 'email_settings',
554
-				'give_title' => __( 'Email Settings', 'give' ),
555
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
556
-				'fields'     => apply_filters( 'give_settings_emails', array(
554
+				'give_title' => __('Email Settings', 'give'),
555
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
556
+				'fields'     => apply_filters('give_settings_emails', array(
557 557
 						array(
558
-							'name' => __( 'Email Settings', 'give' ),
558
+							'name' => __('Email Settings', 'give'),
559 559
 							'desc' => '',
560 560
 							'id'   => 'give_title_email_settings_1',
561 561
 							'type' => 'give_title'
562 562
 						),
563 563
 						array(
564 564
 							'id'      => 'email_template',
565
-							'name'    => __( 'Email Template', 'give' ),
566
-							'desc'    => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
565
+							'name'    => __('Email Template', 'give'),
566
+							'desc'    => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
567 567
 							'type'    => 'select',
568 568
 							'options' => give_get_email_templates()
569 569
 						),
570 570
 						array(
571 571
 							'id'   => 'email_logo',
572
-							'name' => __( 'Logo', 'give' ),
573
-							'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
572
+							'name' => __('Logo', 'give'),
573
+							'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
574 574
 							'type' => 'file'
575 575
 						),
576 576
 						array(
577 577
 							'id'      => 'from_name',
578
-							'name'    => __( 'From Name', 'give' ),
579
-							'desc'    => __( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ),
580
-							'default' => get_bloginfo( 'name' ),
578
+							'name'    => __('From Name', 'give'),
579
+							'desc'    => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'),
580
+							'default' => get_bloginfo('name'),
581 581
 							'type'    => 'text'
582 582
 						),
583 583
 						array(
584 584
 							'id'      => 'from_email',
585
-							'name'    => __( 'From Email', 'give' ),
586
-							'desc'    => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
587
-							'default' => get_bloginfo( 'admin_email' ),
585
+							'name'    => __('From Email', 'give'),
586
+							'desc'    => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
587
+							'default' => get_bloginfo('admin_email'),
588 588
 							'type'    => 'text'
589 589
 						),
590 590
 						array(
591
-							'name' => __( 'Donation Receipt', 'give' ),
591
+							'name' => __('Donation Receipt', 'give'),
592 592
 							'desc' => '',
593 593
 							'id'   => 'give_title_email_settings_2',
594 594
 							'type' => 'give_title'
595 595
 						),
596 596
 						array(
597 597
 							'id'      => 'donation_subject',
598
-							'name'    => __( 'Donation Email Subject', 'give' ),
599
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
600
-							'default' => __( 'Donation Receipt', 'give' ),
598
+							'name'    => __('Donation Email Subject', 'give'),
599
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
600
+							'default' => __('Donation Receipt', 'give'),
601 601
 							'type'    => 'text'
602 602
 						),
603 603
 						array(
604 604
 							'id'      => 'donation_receipt',
605
-							'name'    => __( 'Donation Receipt', 'give' ),
605
+							'name'    => __('Donation Receipt', 'give'),
606 606
 							/* translators: %s: emails tags list */
607
-							'desc'    => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
607
+							'desc'    => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
608 608
 							'type'    => 'wysiwyg',
609 609
 							'default' => give_get_default_donation_receipt_email()
610 610
 						),
611 611
 						array(
612
-							'name' => __( 'New Donation Notification', 'give' ),
612
+							'name' => __('New Donation Notification', 'give'),
613 613
 							'desc' => '',
614 614
 							'id'   => 'give_title_email_settings_3',
615 615
 							'type' => 'give_title'
616 616
 						),
617 617
 						array(
618 618
 							'id'      => 'donation_notification_subject',
619
-							'name'    => __( 'Donation Notification Subject', 'give' ),
620
-							'desc'    => __( 'Enter the subject line for the donation notification email.', 'give' ),
619
+							'name'    => __('Donation Notification Subject', 'give'),
620
+							'desc'    => __('Enter the subject line for the donation notification email.', 'give'),
621 621
 							'type'    => 'text',
622
-							'default' => __( 'New Donation - #{payment_id}', 'give' )
622
+							'default' => __('New Donation - #{payment_id}', 'give')
623 623
 						),
624 624
 						array(
625 625
 							'id'      => 'donation_notification',
626
-							'name'    => __( 'Donation Notification', 'give' ),
626
+							'name'    => __('Donation Notification', 'give'),
627 627
 							/* translators: %s: emails tags list */
628
-							'desc'    => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
628
+							'desc'    => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
629 629
 							'type'    => 'wysiwyg',
630 630
 							'default' => give_get_default_donation_notification_email()
631 631
 						),
632 632
 						array(
633 633
 							'id'      => 'admin_notice_emails',
634
-							'name'    => __( 'Donation Notification Emails', 'give' ),
635
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and not separated by commas.', 'give' ),
634
+							'name'    => __('Donation Notification Emails', 'give'),
635
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and not separated by commas.', 'give'),
636 636
 							'type'    => 'textarea',
637
-							'default' => get_bloginfo( 'admin_email' )
637
+							'default' => get_bloginfo('admin_email')
638 638
 						),
639 639
 						array(
640 640
 							'id'   => 'disable_admin_notices',
641
-							'name' => __( 'Disable Admin Notifications', 'give' ),
642
-							'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
641
+							'name' => __('Disable Admin Notifications', 'give'),
642
+							'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'),
643 643
 							'type' => 'checkbox'
644 644
 						)
645 645
 					)
@@ -648,99 +648,99 @@  discard block
 block discarded – undo
648 648
 			/** Extension Settings */
649 649
 			'addons'      => array(
650 650
 				'id'         => 'addons',
651
-				'give_title' => __( 'Give Add-ons Settings', 'give' ),
652
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
653
-				'fields'     => apply_filters( 'give_settings_addons', array()
651
+				'give_title' => __('Give Add-ons Settings', 'give'),
652
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
653
+				'fields'     => apply_filters('give_settings_addons', array()
654 654
 				)
655 655
 			),
656 656
 			/** Licenses Settings */
657 657
 			'licenses'    => array(
658 658
 				'id'         => 'licenses',
659
-				'give_title' => __( 'Give Licenses', 'give' ),
660
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
661
-				'fields'     => apply_filters( 'give_settings_licenses', array()
659
+				'give_title' => __('Give Licenses', 'give'),
660
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
661
+				'fields'     => apply_filters('give_settings_licenses', array()
662 662
 				)
663 663
 			),
664 664
 			/** Advanced Options */
665 665
 			'advanced'    => array(
666 666
 				'id'         => 'advanced_options',
667
-				'give_title' => __( 'Advanced Options', 'give' ),
668
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
669
-				'fields'     => apply_filters( 'give_settings_advanced', array(
667
+				'give_title' => __('Advanced Options', 'give'),
668
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
669
+				'fields'     => apply_filters('give_settings_advanced', array(
670 670
 						array(
671
-							'name' => __( 'Access Control', 'give' ),
671
+							'name' => __('Access Control', 'give'),
672 672
 							'desc' => '',
673 673
 							'id'   => 'give_title_session_control_1',
674 674
 							'type' => 'give_title'
675 675
 						),
676 676
 						array(
677 677
 							'id'      => 'session_lifetime',
678
-							'name'    => __( 'Session Lifetime', 'give' ),
679
-							'desc'    => __( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ),
678
+							'name'    => __('Session Lifetime', 'give'),
679
+							'desc'    => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'),
680 680
 							'type'    => 'select',
681 681
 							'options' => array(
682
-								'86400'  => __( '24 Hours', 'give' ),
683
-								'172800' => __( '48 Hours', 'give' ),
684
-								'259200' => __( '72 Hours', 'give' ),
685
-								'604800' => __( '1 Week', 'give' ),
682
+								'86400'  => __('24 Hours', 'give'),
683
+								'172800' => __('48 Hours', 'give'),
684
+								'259200' => __('72 Hours', 'give'),
685
+								'604800' => __('1 Week', 'give'),
686 686
 							)
687 687
 						),
688 688
 						array(
689
-							'name' => __( 'Email Access', 'give' ),
690
-							'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
689
+							'name' => __('Email Access', 'give'),
690
+							'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
691 691
 							'id'   => 'email_access',
692 692
 							'type' => 'checkbox',
693 693
 						),
694 694
 						array(
695 695
 							'id'      => 'recaptcha_key',
696
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
696
+							'name'    => __('reCAPTCHA Site Key', 'give'),
697 697
 							/* translators: %s: https://www.google.com/recaptcha/ */
698
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
698
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
699 699
 							'default' => '',
700 700
 							'type'    => 'text'
701 701
 						),
702 702
 						array(
703 703
 							'id'      => 'recaptcha_secret',
704
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
705
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
704
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
705
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
706 706
 							'default' => '',
707 707
 							'type'    => 'text'
708 708
 						),
709 709
 						array(
710
-							'name' => __( 'Data Control', 'give' ),
710
+							'name' => __('Data Control', 'give'),
711 711
 							'desc' => '',
712 712
 							'id'   => 'give_title_data_control_2',
713 713
 							'type' => 'give_title'
714 714
 						),
715 715
 						array(
716
-							'name' => __( 'Remove All Data on Uninstall?', 'give' ),
717
-							'desc' => __( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ),
716
+							'name' => __('Remove All Data on Uninstall?', 'give'),
717
+							'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'),
718 718
 							'id'   => 'uninstall_on_delete',
719 719
 							'type' => 'checkbox'
720 720
 						),
721 721
 						array(
722
-							'name' => __( 'Filter Control', 'give' ),
722
+							'name' => __('Filter Control', 'give'),
723 723
 							'desc' => '',
724 724
 							'id'   => 'give_title_filter_control',
725 725
 							'type' => 'give_title'
726 726
 						),
727 727
 						array(
728 728
 							/* translators: %s: the_content */
729
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
729
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
730 730
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
731
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
731
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
732 732
 							'id'   => 'disable_the_content_filter',
733 733
 							'type' => 'checkbox'
734 734
 						),
735 735
 						array(
736
-							'name' => __( 'Script Loading', 'give' ),
736
+							'name' => __('Script Loading', 'give'),
737 737
 							'desc' => '',
738 738
 							'id'   => 'give_title_script_control',
739 739
 							'type' => 'give_title'
740 740
 						),
741 741
 						array(
742
-							'name' => __( 'Load Scripts in Footer?', 'give' ),
743
-							'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
742
+							'name' => __('Load Scripts in Footer?', 'give'),
743
+							'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
744 744
 							'id'   => 'scripts_footer',
745 745
 							'type' => 'checkbox'
746 746
 						)
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 			/** API Settings */
751 751
 			'api'         => array(
752 752
 				'id'         => 'api',
753
-				'give_title' => __( 'API', 'give' ),
754
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
753
+				'give_title' => __('API', 'give'),
754
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
755 755
 				'show_names' => false, // Hide field names on the left
756
-				'fields'     => apply_filters( 'give_settings_system', array(
756
+				'fields'     => apply_filters('give_settings_system', array(
757 757
 						array(
758 758
 							'id'   => 'api',
759
-							'name' => __( 'API', 'give' ),
759
+							'name' => __('API', 'give'),
760 760
 							'type' => 'api'
761 761
 						)
762 762
 					)
@@ -765,13 +765,13 @@  discard block
 block discarded – undo
765 765
 			/** Licenses Settings */
766 766
 			'system_info' => array(
767 767
 				'id'         => 'system_info',
768
-				'give_title' => __( 'System Info', 'give' ),
769
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
770
-				'fields'     => apply_filters( 'give_settings_system', array(
768
+				'give_title' => __('System Info', 'give'),
769
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
770
+				'fields'     => apply_filters('give_settings_system', array(
771 771
 						array(
772 772
 							'id'   => 'system_info',
773
-							'name' => __( 'System Info', 'give' ),
774
-							'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
773
+							'name' => __('System Info', 'give'),
774
+							'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'),
775 775
 							'type' => 'system_info'
776 776
 						)
777 777
 					)
@@ -780,15 +780,15 @@  discard block
 block discarded – undo
780 780
 		);
781 781
 
782 782
 		//Return all settings array if no active tab
783
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
783
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
784 784
 
785
-			return apply_filters( 'give_registered_settings', $give_settings );
785
+			return apply_filters('give_registered_settings', $give_settings);
786 786
 
787 787
 		}
788 788
 
789 789
 
790 790
 		// Add other tabs and settings fields as needed
791
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
791
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
792 792
 
793 793
 	}
794 794
 
@@ -797,11 +797,11 @@  discard block
 block discarded – undo
797 797
 	 */
798 798
 	public function settings_notices() {
799 799
 
800
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
800
+		if ( ! isset($_POST['give_settings_saved'])) {
801 801
 			return;
802 802
 		}
803 803
 
804
-		add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' );
804
+		add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated');
805 805
 
806 806
 	}
807 807
 
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 	 *
816 816
 	 * @return mixed          Field value or exception is thrown
817 817
 	 */
818
-	public function __get( $field ) {
818
+	public function __get($field) {
819 819
 
820 820
 		// Allowed fields to retrieve
821
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
821
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
822 822
 			return $this->{$field};
823 823
 		}
824
-		if ( 'option_metabox' === $field ) {
824
+		if ('option_metabox' === $field) {
825 825
 			return $this->option_metabox();
826 826
 		}
827 827
 
828
-		throw new Exception( 'Invalid property: ' . $field );
828
+		throw new Exception('Invalid property: '.$field);
829 829
 	}
830 830
 
831 831
 
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
  *
843 843
  * @return mixed        Option value
844 844
  */
845
-function give_get_option( $key = '', $default = false ) {
845
+function give_get_option($key = '', $default = false) {
846 846
 	global $give_options;
847
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
848
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
847
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
848
+	$value = apply_filters('give_get_option', $value, $key, $default);
849 849
 
850
-	return apply_filters( 'give_get_option_' . $key, $value, $key, $default );
850
+	return apply_filters('give_get_option_'.$key, $value, $key, $default);
851 851
 }
852 852
 
853 853
 
@@ -865,33 +865,33 @@  discard block
 block discarded – undo
865 865
  *
866 866
  * @return boolean True if updated, false if not.
867 867
  */
868
-function give_update_option( $key = '', $value = false ) {
868
+function give_update_option($key = '', $value = false) {
869 869
 
870 870
 	// If no key, exit
871
-	if ( empty( $key ) ) {
871
+	if (empty($key)) {
872 872
 		return false;
873 873
 	}
874 874
 
875
-	if ( empty( $value ) ) {
876
-		$remove_option = give_delete_option( $key );
875
+	if (empty($value)) {
876
+		$remove_option = give_delete_option($key);
877 877
 
878 878
 		return $remove_option;
879 879
 	}
880 880
 
881 881
 	// First let's grab the current settings
882
-	$options = get_option( 'give_settings' );
882
+	$options = get_option('give_settings');
883 883
 
884 884
 	// Let's let devs alter that value coming in
885
-	$value = apply_filters( 'give_update_option', $value, $key );
885
+	$value = apply_filters('give_update_option', $value, $key);
886 886
 
887 887
 	// Next let's try to update the value
888
-	$options[ $key ] = $value;
889
-	$did_update      = update_option( 'give_settings', $options );
888
+	$options[$key] = $value;
889
+	$did_update      = update_option('give_settings', $options);
890 890
 
891 891
 	// If it updated, let's update the global variable
892
-	if ( $did_update ) {
892
+	if ($did_update) {
893 893
 		global $give_options;
894
-		$give_options[ $key ] = $value;
894
+		$give_options[$key] = $value;
895 895
 	}
896 896
 
897 897
 	return $did_update;
@@ -908,27 +908,27 @@  discard block
 block discarded – undo
908 908
  *
909 909
  * @return boolean True if updated, false if not.
910 910
  */
911
-function give_delete_option( $key = '' ) {
911
+function give_delete_option($key = '') {
912 912
 
913 913
 	// If no key, exit
914
-	if ( empty( $key ) ) {
914
+	if (empty($key)) {
915 915
 		return false;
916 916
 	}
917 917
 
918 918
 	// First let's grab the current settings
919
-	$options = get_option( 'give_settings' );
919
+	$options = get_option('give_settings');
920 920
 
921 921
 	// Next let's try to update the value
922
-	if ( isset( $options[ $key ] ) ) {
922
+	if (isset($options[$key])) {
923 923
 
924
-		unset( $options[ $key ] );
924
+		unset($options[$key]);
925 925
 
926 926
 	}
927 927
 
928
-	$did_update = update_option( 'give_settings', $options );
928
+	$did_update = update_option('give_settings', $options);
929 929
 
930 930
 	// If it updated, let's update the global variable
931
-	if ( $did_update ) {
931
+	if ($did_update) {
932 932
 		global $give_options;
933 933
 		$give_options = $options;
934 934
 	}
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
  */
948 948
 function give_get_settings() {
949 949
 
950
-	$settings = get_option( 'give_settings' );
950
+	$settings = get_option('give_settings');
951 951
 
952
-	return (array) apply_filters( 'give_get_settings', $settings );
952
+	return (array) apply_filters('give_get_settings', $settings);
953 953
 
954 954
 }
955 955
 
@@ -967,25 +967,25 @@  discard block
 block discarded – undo
967 967
  *
968 968
  * @return array
969 969
  */
970
-function give_settings_array_insert( $array, $position, $insert ) {
971
-	if ( is_int( $position ) ) {
972
-		array_splice( $array, $position, 0, $insert );
970
+function give_settings_array_insert($array, $position, $insert) {
971
+	if (is_int($position)) {
972
+		array_splice($array, $position, 0, $insert);
973 973
 	} else {
974 974
 
975
-		foreach ( $array as $index => $subarray ) {
976
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
975
+		foreach ($array as $index => $subarray) {
976
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
977 977
 				$pos = $index;
978 978
 			}
979 979
 		}
980 980
 
981
-		if ( ! isset( $pos ) ) {
981
+		if ( ! isset($pos)) {
982 982
 			return $array;
983 983
 		}
984 984
 
985 985
 		$array = array_merge(
986
-			array_slice( $array, 0, $pos ),
986
+			array_slice($array, 0, $pos),
987 987
 			$insert,
988
-			array_slice( $array, $pos )
988
+			array_slice($array, $pos)
989 989
 		);
990 990
 	}
991 991
 
@@ -1008,31 +1008,31 @@  discard block
 block discarded – undo
1008 1008
  *
1009 1009
  * @return void
1010 1010
  */
1011
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1011
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1012 1012
 
1013 1013
 	$id                = $field_type_object->field->args['id'];
1014 1014
 	$field_description = $field_type_object->field->args['desc'];
1015
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1015
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1016 1016
 
1017 1017
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1018 1018
 
1019
-	foreach ( $gateways as $key => $option ) :
1019
+	foreach ($gateways as $key => $option) :
1020 1020
 
1021
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1021
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1022 1022
 			$enabled = '1';
1023 1023
 		} else {
1024 1024
 			$enabled = null;
1025 1025
 		}
1026 1026
 
1027
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1028
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1027
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1028
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1029 1029
 
1030 1030
 	endforeach;
1031 1031
 
1032 1032
 	echo '</ul>';
1033 1033
 
1034
-	if ( $field_description ) {
1035
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1034
+	if ($field_description) {
1035
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1036 1036
 	}
1037 1037
 
1038 1038
 }
@@ -1048,31 +1048,31 @@  discard block
 block discarded – undo
1048 1048
  *
1049 1049
  * @return void
1050 1050
  */
1051
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1051
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1052 1052
 
1053 1053
 	$id                = $field_type_object->field->args['id'];
1054 1054
 	$field_description = $field_type_object->field->args['desc'];
1055 1055
 	$gateways          = give_get_enabled_payment_gateways();
1056 1056
 
1057
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1057
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1058 1058
 
1059 1059
 	//Add a field to the Give Form admin single post view of this field
1060
-	if ( $field_type_object->field->object_type === 'post' ) {
1061
-		echo '<option value="global">' . __( 'Global Default', 'give' ) . '</option>';
1060
+	if ($field_type_object->field->object_type === 'post') {
1061
+		echo '<option value="global">'.__('Global Default', 'give').'</option>';
1062 1062
 	}
1063 1063
 
1064
-	foreach ( $gateways as $key => $option ) :
1064
+	foreach ($gateways as $key => $option) :
1065 1065
 
1066
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1066
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1067 1067
 
1068 1068
 
1069
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1069
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1070 1070
 
1071 1071
 	endforeach;
1072 1072
 
1073 1073
 	echo '</select>';
1074 1074
 
1075
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1075
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1076 1076
 
1077 1077
 }
1078 1078
 
@@ -1087,13 +1087,13 @@  discard block
 block discarded – undo
1087 1087
  *
1088 1088
  * @return void
1089 1089
  */
1090
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1090
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1091 1091
 
1092 1092
 	$id                = $field_type_object->field->args['id'];
1093 1093
 	$title             = $field_type_object->field->args['name'];
1094 1094
 	$field_description = $field_type_object->field->args['desc'];
1095 1095
 
1096
-	echo '<hr>' . $field_description;
1096
+	echo '<hr>'.$field_description;
1097 1097
 
1098 1098
 }
1099 1099
 
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
  *
1109 1109
  * @return void
1110 1110
  */
1111
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1111
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1112 1112
 
1113 1113
 	$id                = $field_type_object->field->args['id'];
1114 1114
 	$title             = $field_type_object->field->args['name'];
@@ -1128,25 +1128,25 @@  discard block
 block discarded – undo
1128 1128
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1129 1129
  * @return array An array of options that matches the CMB2 options array
1130 1130
  */
1131
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1131
+function give_cmb2_get_post_options($query_args, $force = false) {
1132 1132
 
1133
-	$post_options = array( '' => '' ); // Blank option
1133
+	$post_options = array('' => ''); // Blank option
1134 1134
 
1135
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1135
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1136 1136
 		return $post_options;
1137 1137
 	}
1138 1138
 
1139
-	$args = wp_parse_args( $query_args, array(
1139
+	$args = wp_parse_args($query_args, array(
1140 1140
 		'post_type'   => 'page',
1141 1141
 		'numberposts' => 10,
1142
-	) );
1142
+	));
1143 1143
 
1144
-	$posts = get_posts( $args );
1144
+	$posts = get_posts($args);
1145 1145
 
1146
-	if ( $posts ) {
1147
-		foreach ( $posts as $post ) {
1146
+	if ($posts) {
1147
+		foreach ($posts as $post) {
1148 1148
 
1149
-			$post_options[ $post->ID ] = $post->post_title;
1149
+			$post_options[$post->ID] = $post->post_title;
1150 1150
 
1151 1151
 		}
1152 1152
 	}
@@ -1166,17 +1166,17 @@  discard block
 block discarded – undo
1166 1166
 	global $_wp_additional_image_sizes;
1167 1167
 	$sizes = array();
1168 1168
 
1169
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1169
+	foreach (get_intermediate_image_sizes() as $_size) {
1170 1170
 
1171
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1172
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1173
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1174
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1171
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1172
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1173
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1174
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1175 1175
 		}
1176 1176
 
1177 1177
 	}
1178 1178
 
1179
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1179
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1180 1180
 }
1181 1181
 
1182 1182
 
@@ -1191,34 +1191,34 @@  discard block
 block discarded – undo
1191 1191
  *
1192 1192
  * @return void
1193 1193
  */
1194
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1194
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1195 1195
 
1196 1196
 	$id                = $field_type_object->field->args['id'];
1197 1197
 	$field_description = $field_type_object->field->args['desc'];
1198
-	$license_status    = get_option( $field_type_object->field->args['options']['is_valid_license_option'] );
1198
+	$license_status    = get_option($field_type_object->field->args['options']['is_valid_license_option']);
1199 1199
 	$field_classes     = 'regular-text give-license-field';
1200
-	$type              = empty( $escaped_value ) ? 'text' : 'password';
1200
+	$type              = empty($escaped_value) ? 'text' : 'password';
1201 1201
 
1202
-	if ( $license_status === 'valid' ) {
1202
+	if ($license_status === 'valid') {
1203 1203
 		$field_classes .= ' give-license-active';
1204 1204
 	}
1205 1205
 
1206
-	$html = $field_type_object->input( array(
1206
+	$html = $field_type_object->input(array(
1207 1207
 		'class' => $field_classes,
1208 1208
 		'type'  => $type
1209
-	) );
1209
+	));
1210 1210
 
1211 1211
 	//License is active so show deactivate button
1212
-	if ( $license_status === 'valid' ) {
1213
-		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . __( 'Deactivate License', 'give' ) . '"/>';
1212
+	if ($license_status === 'valid') {
1213
+		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.__('Deactivate License', 'give').'"/>';
1214 1214
 	} else {
1215 1215
 		//This license is not valid so delete it
1216
-		give_delete_option( $id );
1216
+		give_delete_option($id);
1217 1217
 	}
1218 1218
 
1219
-	$html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1219
+	$html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1220 1220
 
1221
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1221
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1222 1222
 
1223 1223
 	echo $html;
1224 1224
 }
@@ -1232,13 +1232,13 @@  discard block
 block discarded – undo
1232 1232
  */
1233 1233
 function give_api_callback() {
1234 1234
 
1235
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1235
+	if ( ! current_user_can('manage_give_settings')) {
1236 1236
 		return;
1237 1237
 	}
1238 1238
 
1239
-	do_action( 'give_tools_api_keys_before' );
1239
+	do_action('give_tools_api_keys_before');
1240 1240
 
1241
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1241
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1242 1242
 
1243 1243
 	$api_keys_table = new Give_API_Keys_Table();
1244 1244
 	$api_keys_table->prepare_items();
@@ -1247,17 +1247,17 @@  discard block
 block discarded – undo
1247 1247
 	<span class="cmb2-metabox-description api-description">
1248 1248
 		<?php echo sprintf(
1249 1249
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1250
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1251
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1252
-			esc_url( 'https://givewp.com/addons/zapier/' )
1250
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1251
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1252
+			esc_url('https://givewp.com/addons/zapier/')
1253 1253
 		); ?>
1254 1254
 	</span>
1255 1255
 	<?php
1256 1256
 
1257
-	do_action( 'give_tools_api_keys_after' );
1257
+	do_action('give_tools_api_keys_after');
1258 1258
 }
1259 1259
 
1260
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1260
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1261 1261
 
1262 1262
 /**
1263 1263
  * Hook Callback
@@ -1270,8 +1270,8 @@  discard block
 block discarded – undo
1270 1270
  *
1271 1271
  * @return void
1272 1272
  */
1273
-function give_hook_callback( $args ) {
1274
-	do_action( 'give_' . $args['id'] );
1273
+function give_hook_callback($args) {
1274
+	do_action('give_'.$args['id']);
1275 1275
 }
1276 1276
 
1277 1277
 /**
@@ -1282,10 +1282,10 @@  discard block
 block discarded – undo
1282 1282
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1283 1283
  */
1284 1284
 
1285
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1286
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1287
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1288
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1289
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1290
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1285
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1286
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1287
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1288
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1289
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1290
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1291 1291
 }
1292 1292
\ No newline at end of file
Please login to merge, or discard this patch.
admin/reporting/tools/class-give-tools-delete-test-transactions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $wpdb;
57 57
 
58
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
58
+		$items = $this->get_stored_data('give_temp_reset_ids');
59 59
 
60
-		if ( ! is_array( $items ) ) {
60
+		if ( ! is_array($items)) {
61 61
 			return false;
62 62
 		}
63 63
 
64
-		$offset     = ( $this->step - 1 ) * $this->per_step;
65
-		$step_items = array_slice( $items, $offset, $this->per_step );
64
+		$offset     = ($this->step - 1) * $this->per_step;
65
+		$step_items = array_slice($items, $offset, $this->per_step);
66 66
 
67
-		if ( $step_items ) {
67
+		if ($step_items) {
68 68
 
69 69
 			$step_ids = array(
70 70
 				'other' => array(),
71 71
 			);
72 72
 
73
-			foreach ( $step_items as $item ) {
73
+			foreach ($step_items as $item) {
74 74
 
75 75
 				$step_ids['other'][] = $item['id'];
76 76
 
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 
79 79
 			$sql = array();
80 80
 
81
-			foreach ( $step_ids as $type => $ids ) {
81
+			foreach ($step_ids as $type => $ids) {
82 82
 
83
-				if ( empty( $ids ) ) {
83
+				if (empty($ids)) {
84 84
 					continue;
85 85
 				}
86 86
 
87
-				$ids = implode( ',', $ids );
87
+				$ids = implode(',', $ids);
88 88
 
89
-				switch ( $type ) {
89
+				switch ($type) {
90 90
 					case 'other':
91 91
 						$sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)";
92 92
 						$sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)";
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 
98 98
 			}
99 99
 
100
-			if ( ! empty( $sql ) ) {
101
-				foreach ( $sql as $query ) {
102
-					$wpdb->query( $query );
100
+			if ( ! empty($sql)) {
101
+				foreach ($sql as $query) {
102
+					$wpdb->query($query);
103 103
 				}
104 104
 			}
105 105
 
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function get_percentage_complete() {
121 121
 
122
-		$items = $this->get_stored_data( 'give_temp_reset_ids', false );
123
-		$total = count( $items );
122
+		$items = $this->get_stored_data('give_temp_reset_ids', false);
123
+		$total = count($items);
124 124
 
125 125
 		$percentage = 100;
126 126
 
127
-		if ( $total > 0 ) {
128
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
127
+		if ($total > 0) {
128
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
129 129
 		}
130 130
 
131
-		if ( $percentage > 100 ) {
131
+		if ($percentage > 100) {
132 132
 			$percentage = 100;
133 133
 		}
134 134
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @param array $request The Form Data passed into the batch processing
144 144
 	 */
145
-	public function set_properties( $request ) {
145
+	public function set_properties($request) {
146 146
 	}
147 147
 
148 148
 	/**
@@ -153,30 +153,30 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function process_step() {
155 155
 
156
-		if ( ! $this->can_export() ) {
157
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
156
+		if ( ! $this->can_export()) {
157
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
158 158
 		}
159 159
 
160 160
 		$had_data = $this->get_data();
161 161
 
162
-		if ( $had_data ) {
162
+		if ($had_data) {
163 163
 			$this->done = false;
164 164
 
165 165
 			return true;
166 166
 		} else {
167
-			update_option( 'give_earnings_total', 0 );
168
-			delete_transient( 'give_earnings_total' );
169
-			delete_transient( 'give_estimated_monthly_stats' . true );
170
-			delete_transient( 'give_estimated_monthly_stats' . false );
171
-			$this->delete_data( 'give_temp_reset_ids' );
167
+			update_option('give_earnings_total', 0);
168
+			delete_transient('give_earnings_total');
169
+			delete_transient('give_estimated_monthly_stats'.true);
170
+			delete_transient('give_estimated_monthly_stats'.false);
171
+			$this->delete_data('give_temp_reset_ids');
172 172
 
173 173
 			// Reset the sequential order numbers
174
-			if ( give_get_option( 'enable_sequential' ) ) {
175
-				delete_option( 'give_last_payment_number' );
174
+			if (give_get_option('enable_sequential')) {
175
+				delete_option('give_last_payment_number');
176 176
 			}
177 177
 
178 178
 			$this->done    = true;
179
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
179
+			$this->message = __('Test transactions successfully deleted.', 'give');
180 180
 
181 181
 			return false;
182 182
 		}
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 	 * Headers
187 187
 	 */
188 188
 	public function headers() {
189
-		ignore_user_abort( true );
189
+		ignore_user_abort(true);
190 190
 
191
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
192
-			set_time_limit( 0 );
191
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
192
+			set_time_limit(0);
193 193
 		}
194 194
 	}
195 195
 
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public function pre_fetch() {
215 215
 
216
-		if ( $this->step == 1 ) {
217
-			$this->delete_data( 'give_temp_reset_ids' );
216
+		if ($this->step == 1) {
217
+			$this->delete_data('give_temp_reset_ids');
218 218
 		}
219 219
 
220
-		$items = get_option( 'give_temp_reset_ids', false );
220
+		$items = get_option('give_temp_reset_ids', false);
221 221
 
222
-		if ( false === $items ) {
222
+		if (false === $items) {
223 223
 			$items = array();
224 224
 
225
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
225
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
226 226
 				'post_type'      => 'give_payment',
227 227
 				'post_status'    => 'any',
228
-				'posts_per_page' => - 1,
228
+				'posts_per_page' => -1,
229 229
 				//ONLY TEST MODE TRANSACTIONS!!!
230 230
 				'meta_key'   => '_give_payment_mode',
231 231
 				'meta_value' => 'test'
232
-			) );
232
+			));
233 233
 
234
-			$posts = get_posts( $args );
235
-			foreach ( $posts as $post ) {
234
+			$posts = get_posts($args);
235
+			foreach ($posts as $post) {
236 236
 				$items[] = array(
237 237
 					'id'   => (int) $post->ID,
238 238
 					'type' => $post->post_type,
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 
242 242
 			// Allow filtering of items to remove with an unassociative array for each item
243 243
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
244
-			$items = apply_filters( 'give_reset_store_items', $items );
244
+			$items = apply_filters('give_reset_store_items', $items);
245 245
 
246
-			$this->store_data( 'give_temp_reset_ids', $items );
246
+			$this->store_data('give_temp_reset_ids', $items);
247 247
 		}
248 248
 
249 249
 	}
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return mixed       Returns the data from the database
259 259
 	 */
260
-	private function get_stored_data( $key ) {
260
+	private function get_stored_data($key) {
261 261
 		global $wpdb;
262
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
262
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
263 263
 
264
-		return empty( $value ) ? false : maybe_unserialize( $value );
264
+		return empty($value) ? false : maybe_unserialize($value);
265 265
 	}
266 266
 
267 267
 	/**
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return void
276 276
 	 */
277
-	private function store_data( $key, $value ) {
277
+	private function store_data($key, $value) {
278 278
 		global $wpdb;
279 279
 
280
-		$value = maybe_serialize( $value );
280
+		$value = maybe_serialize($value);
281 281
 
282 282
 		$data = array(
283 283
 			'option_name'  => $key,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			'%s',
292 292
 		);
293 293
 
294
-		$wpdb->replace( $wpdb->options, $data, $formats );
294
+		$wpdb->replace($wpdb->options, $data, $formats);
295 295
 	}
296 296
 
297 297
 	/**
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return void
305 305
 	 */
306
-	private function delete_data( $key ) {
306
+	private function delete_data($key) {
307 307
 		global $wpdb;
308
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
308
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
309 309
 	}
310 310
 
311 311
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-all-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -55,26 +55,26 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $give_logs, $wpdb;
57 57
 
58
-		$totals             = $this->get_stored_data( 'give_temp_recount_all_stats' );
59
-		$payment_items      = $this->get_stored_data( 'give_temp_payment_items' );
60
-		$processed_payments = $this->get_stored_data( 'give_temp_processed_payments' );
61
-		$accepted_statuses  = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
58
+		$totals             = $this->get_stored_data('give_temp_recount_all_stats');
59
+		$payment_items      = $this->get_stored_data('give_temp_payment_items');
60
+		$processed_payments = $this->get_stored_data('give_temp_processed_payments');
61
+		$accepted_statuses  = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
62 62
 
63
-		if ( false === $totals ) {
63
+		if (false === $totals) {
64 64
 			$totals = array();
65 65
 		}
66 66
 
67
-		if ( false === $payment_items ) {
67
+		if (false === $payment_items) {
68 68
 			$payment_items = array();
69 69
 		}
70 70
 
71
-		if ( false === $processed_payments ) {
71
+		if (false === $processed_payments) {
72 72
 			$processed_payments = array();
73 73
 		}
74 74
 
75
-		$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
75
+		$all_forms = $this->get_stored_data('give_temp_form_ids');
76 76
 
77
-		$args = apply_filters( 'give_recount_form_stats_args', array(
77
+		$args = apply_filters('give_recount_form_stats_args', array(
78 78
 			'post_parent__in' => $all_forms,
79 79
 			'post_type'       => 'give_log',
80 80
 			'posts_per_page'  => $this->per_step,
@@ -82,73 +82,73 @@  discard block
 block discarded – undo
82 82
 			'paged'           => $this->step,
83 83
 			'log_type'        => 'sale',
84 84
 			'fields'          => 'ids',
85
-		) );
85
+		));
86 86
 
87
-		$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
87
+		$log_ids = $give_logs->get_connected_logs($args, 'sale');
88 88
 
89
-		if ( $log_ids ) {
90
-			$log_ids = implode( ',', $log_ids );
89
+		if ($log_ids) {
90
+			$log_ids = implode(',', $log_ids);
91 91
 
92
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
93
-			unset( $log_ids );
92
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
93
+			unset($log_ids);
94 94
 
95
-			$payment_ids = implode( ',', $payment_ids );
96
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
97
-			unset( $payment_ids );
95
+			$payment_ids = implode(',', $payment_ids);
96
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
97
+			unset($payment_ids);
98 98
 
99 99
 			//Loop through payments
100
-			foreach ( $payments as $payment ) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Prevent payments that have all ready been retrieved from a previous sales log from counting again.
103
-				if ( in_array( $payment->ID, $processed_payments ) ) {
103
+				if (in_array($payment->ID, $processed_payments)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				//Verify accepted status'
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					$processed_payments[] = $payment->ID;
110 110
 					continue;
111 111
 				}
112 112
 
113
-				$payment_item = $payment_items[ $payment->ID ];
113
+				$payment_item = $payment_items[$payment->ID];
114 114
 
115 115
 
116
-				$form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : '';
116
+				$form_id = isset($payment_item['id']) ? $payment_item['id'] : '';
117 117
 
118 118
 				//Must have a form ID
119
-				if ( empty( $form_id ) ) {
119
+				if (empty($form_id)) {
120 120
 					continue;
121 121
 				}
122 122
 
123 123
 				//Form ID must be within $all_forms array to be validated
124
-				if ( ! in_array( $form_id, $all_forms ) ) {
124
+				if ( ! in_array($form_id, $all_forms)) {
125 125
 					continue;
126 126
 				}
127 127
 
128 128
 				//If array key doesn't exist, create it
129
-				if ( ! array_key_exists( $form_id, $totals ) ) {
130
-					$totals[ $form_id ] = array(
129
+				if ( ! array_key_exists($form_id, $totals)) {
130
+					$totals[$form_id] = array(
131 131
 						'sales'    => (int) 0,
132 132
 						'earnings' => (float) 0,
133 133
 					);
134 134
 				}
135 135
 
136
-				$totals[ $form_id ]['sales'] ++;
137
-				$totals[ $form_id ]['earnings'] += $payment_item['price'];
136
+				$totals[$form_id]['sales']++;
137
+				$totals[$form_id]['earnings'] += $payment_item['price'];
138 138
 
139 139
 				$processed_payments[] = $payment->ID;
140 140
 
141 141
 			}
142 142
 
143
-			$this->store_data( 'give_temp_processed_payments', $processed_payments );
144
-			$this->store_data( 'give_temp_recount_all_stats', $totals );
143
+			$this->store_data('give_temp_processed_payments', $processed_payments);
144
+			$this->store_data('give_temp_recount_all_stats', $totals);
145 145
 
146 146
 			return true;
147 147
 		}
148 148
 
149
-		foreach ( $totals as $key => $stats ) {
150
-			update_post_meta( $key, '_give_form_sales', $stats['sales'] );
151
-			update_post_meta( $key, '_give_form_earnings', $stats['earnings'] );
149
+		foreach ($totals as $key => $stats) {
150
+			update_post_meta($key, '_give_form_sales', $stats['sales']);
151
+			update_post_meta($key, '_give_form_earnings', $stats['earnings']);
152 152
 		}
153 153
 
154 154
 		return false;
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function get_percentage_complete() {
165 165
 
166
-		$total = $this->get_stored_data( 'give_recount_all_total', false );
166
+		$total = $this->get_stored_data('give_recount_all_total', false);
167 167
 
168
-		if ( false === $total ) {
168
+		if (false === $total) {
169 169
 			$this->pre_fetch();
170
-			$total = $this->get_stored_data( 'give_recount_all_total', 0 );
170
+			$total = $this->get_stored_data('give_recount_all_total', 0);
171 171
 		}
172 172
 
173 173
 		$percentage = 100;
174 174
 
175
-		if ( $total > 0 ) {
176
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
175
+		if ($total > 0) {
176
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
177 177
 		}
178 178
 
179
-		if ( $percentage > 100 ) {
179
+		if ($percentage > 100) {
180 180
 			$percentage = 100;
181 181
 		}
182 182
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @param array $request The Form Data passed into the batch processing
192 192
 	 */
193
-	public function set_properties( $request ) {
194
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
193
+	public function set_properties($request) {
194
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
195 195
 	}
196 196
 
197 197
 	/**
@@ -202,34 +202,34 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function process_step() {
204 204
 
205
-		if ( ! $this->can_export() ) {
206
-			wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
205
+		if ( ! $this->can_export()) {
206
+			wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403));
207 207
 		}
208 208
 
209 209
 		$had_data = $this->get_data();
210 210
 
211
-		if ( $had_data ) {
211
+		if ($had_data) {
212 212
 			$this->done = false;
213 213
 
214 214
 			return true;
215 215
 		} else {
216
-			$this->delete_data( 'give_recount_all_total' );
217
-			$this->delete_data( 'give_temp_recount_all_stats' );
218
-			$this->delete_data( 'give_temp_payment_items' );
219
-			$this->delete_data( 'give_temp_form_ids' );
220
-			$this->delete_data( 'give_temp_processed_payments' );
216
+			$this->delete_data('give_recount_all_total');
217
+			$this->delete_data('give_temp_recount_all_stats');
218
+			$this->delete_data('give_temp_payment_items');
219
+			$this->delete_data('give_temp_form_ids');
220
+			$this->delete_data('give_temp_processed_payments');
221 221
 			$this->done    = true;
222
-			$this->message = __( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' );
222
+			$this->message = __('Donation form income amounts and donation counts stats successfully recounted.', 'give');
223 223
 
224 224
 			return false;
225 225
 		}
226 226
 	}
227 227
 
228 228
 	public function headers() {
229
-		ignore_user_abort( true );
229
+		ignore_user_abort(true);
230 230
 
231
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
232
-			set_time_limit( 0 );
231
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
232
+			set_time_limit(0);
233 233
 		}
234 234
 	}
235 235
 
@@ -258,76 +258,76 @@  discard block
 block discarded – undo
258 258
 
259 259
 		global $give_logs, $wpdb;
260 260
 
261
-		if ( $this->step == 1 ) {
262
-			$this->delete_data( 'give_temp_recount_all_total' );
263
-			$this->delete_data( 'give_temp_recount_all_stats' );
264
-			$this->delete_data( 'give_temp_payment_items' );
265
-			$this->delete_data( 'give_temp_processed_payments' );
261
+		if ($this->step == 1) {
262
+			$this->delete_data('give_temp_recount_all_total');
263
+			$this->delete_data('give_temp_recount_all_stats');
264
+			$this->delete_data('give_temp_payment_items');
265
+			$this->delete_data('give_temp_processed_payments');
266 266
 		}
267 267
 
268
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
269
-		$total             = $this->get_stored_data( 'give_temp_recount_all_total' );
268
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
269
+		$total             = $this->get_stored_data('give_temp_recount_all_total');
270 270
 
271
-		if ( false === $total ) {
271
+		if (false === $total) {
272 272
 			$total         = 0;
273
-			$payment_items = $this->get_stored_data( 'give_temp_payment_items' );
273
+			$payment_items = $this->get_stored_data('give_temp_payment_items');
274 274
 
275
-			if ( false === $payment_items ) {
275
+			if (false === $payment_items) {
276 276
 				$payment_items = array();
277
-				$this->store_data( 'give_temp_payment_items', $payment_items );
277
+				$this->store_data('give_temp_payment_items', $payment_items);
278 278
 			}
279 279
 
280
-			$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
280
+			$all_forms = $this->get_stored_data('give_temp_form_ids');
281 281
 
282
-			if ( false === $all_forms ) {
282
+			if (false === $all_forms) {
283 283
 				$args = array(
284 284
 					'post_status'    => 'any',
285 285
 					'post_type'      => 'give_forms',
286
-					'posts_per_page' => - 1,
286
+					'posts_per_page' => -1,
287 287
 					'fields'         => 'ids',
288 288
 				);
289 289
 
290
-				$all_forms = get_posts( $args );
291
-				$this->store_data( 'give_temp_form_ids', $all_forms );
290
+				$all_forms = get_posts($args);
291
+				$this->store_data('give_temp_form_ids', $all_forms);
292 292
 			}
293 293
 
294
-			$args = apply_filters( 'give_recount_form_stats_total_args', array(
294
+			$args = apply_filters('give_recount_form_stats_total_args', array(
295 295
 				'post_parent__in' => $all_forms,
296 296
 				'post_type'       => 'give_log',
297 297
 				'post_status'     => 'publish',
298 298
 				'log_type'        => 'sale',
299 299
 				'fields'          => 'ids',
300 300
 				'nopaging'        => true,
301
-			) );
301
+			));
302 302
 
303
-			$all_logs = $give_logs->get_connected_logs( $args, 'sale' );
303
+			$all_logs = $give_logs->get_connected_logs($args, 'sale');
304 304
 
305
-			if ( $all_logs ) {
306
-				$log_ids     = implode( ',', $all_logs );
307
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
308
-				unset( $log_ids );
305
+			if ($all_logs) {
306
+				$log_ids     = implode(',', $all_logs);
307
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
308
+				unset($log_ids);
309 309
 
310
-				$payment_ids = implode( ',', $payment_ids );
311
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
312
-				unset( $payment_ids );
310
+				$payment_ids = implode(',', $payment_ids);
311
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
312
+				unset($payment_ids);
313 313
 
314
-				foreach ( $payments as $payment ) {
314
+				foreach ($payments as $payment) {
315 315
 
316
-					$payment = new Give_Payment( $payment->ID );
316
+					$payment = new Give_Payment($payment->ID);
317 317
 					$form_id = $payment->form_id;
318 318
 
319 319
 					//If for some reason somehow the form_ID isn't set check payment meta
320
-					if ( empty( $payment->form_id ) ) {
320
+					if (empty($payment->form_id)) {
321 321
 						$payment_meta = $payment->get_meta();
322
-						$form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
322
+						$form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
323 323
 					}
324 324
 
325
-					if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
325
+					if ( ! in_array($payment->post_status, $accepted_statuses)) {
326 326
 						continue;
327 327
 					}
328 328
 
329
-					if ( ! array_key_exists( $payment->ID, $payment_items ) ) {
330
-						$payment_items[ $payment->ID ] = array(
329
+					if ( ! array_key_exists($payment->ID, $payment_items)) {
330
+						$payment_items[$payment->ID] = array(
331 331
 							'id'         => $form_id,
332 332
 							'payment_id' => $payment->ID,
333 333
 							'price'      => $payment->total
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 
337 337
 				}
338 338
 
339
-				$total = count( $all_logs );
339
+				$total = count($all_logs);
340 340
 			}
341 341
 
342
-			$this->store_data( 'give_temp_payment_items', $payment_items );
343
-			$this->store_data( 'give_recount_all_total', $total );
342
+			$this->store_data('give_temp_payment_items', $payment_items);
343
+			$this->store_data('give_recount_all_total', $total);
344 344
 		}
345 345
 
346 346
 	}
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return mixed       Returns the data from the database
356 356
 	 */
357
-	private function get_stored_data( $key ) {
357
+	private function get_stored_data($key) {
358 358
 		global $wpdb;
359
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
359
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
360 360
 
361
-		return empty( $value ) ? false : maybe_unserialize( $value );
361
+		return empty($value) ? false : maybe_unserialize($value);
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return void
373 373
 	 */
374
-	private function store_data( $key, $value ) {
374
+	private function store_data($key, $value) {
375 375
 		global $wpdb;
376 376
 
377
-		$value = maybe_serialize( $value );
377
+		$value = maybe_serialize($value);
378 378
 
379 379
 		$data = array(
380 380
 			'option_name'  => $key,
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			'%s',
389 389
 		);
390 390
 
391
-		$wpdb->replace( $wpdb->options, $data, $formats );
391
+		$wpdb->replace($wpdb->options, $data, $formats);
392 392
 	}
393 393
 
394 394
 	/**
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @return void
402 402
 	 */
403
-	private function delete_data( $key ) {
403
+	private function delete_data($key) {
404 404
 		global $wpdb;
405
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
405
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
406 406
 	}
407 407
 
408 408
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-form-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 	public function get_data() {
63 63
 		global $give_logs, $wpdb;
64 64
 
65
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
65
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
66 66
 
67
-		if ( $this->step == 1 ) {
68
-			$this->delete_data( 'give_temp_recount_form_stats' );
67
+		if ($this->step == 1) {
68
+			$this->delete_data('give_temp_recount_form_stats');
69 69
 		}
70 70
 
71
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
71
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
72 72
 
73
-		if ( false === $totals ) {
73
+		if (false === $totals) {
74 74
 			$totals = array(
75 75
 				'earnings' => (float) 0,
76 76
 				'sales'    => 0,
77 77
 			);
78
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
78
+			$this->store_data('give_temp_recount_form_stats', $totals);
79 79
 		}
80 80
 
81
-		$args = apply_filters( 'give_recount_form_stats_args', array(
81
+		$args = apply_filters('give_recount_form_stats_args', array(
82 82
 			'post_parent'    => $this->form_id,
83 83
 			'post_type'      => 'give_log',
84 84
 			'posts_per_page' => $this->per_step,
@@ -86,49 +86,49 @@  discard block
 block discarded – undo
86 86
 			'paged'          => $this->step,
87 87
 			'log_type'       => 'sale',
88 88
 			'fields'         => 'ids',
89
-		) );
89
+		));
90 90
 
91
-		$log_ids              = $give_logs->get_connected_logs( $args, 'sale' );
91
+		$log_ids              = $give_logs->get_connected_logs($args, 'sale');
92 92
 		$this->_log_ids_debug = array();
93 93
 
94
-		if ( $log_ids ) {
95
-			$log_ids     = implode( ',', $log_ids );
96
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
97
-			unset( $log_ids );
94
+		if ($log_ids) {
95
+			$log_ids     = implode(',', $log_ids);
96
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
97
+			unset($log_ids);
98 98
 
99
-			$payment_ids = implode( ',', $payment_ids );
100
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
101
-			unset( $payment_ids );
99
+			$payment_ids = implode(',', $payment_ids);
100
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
101
+			unset($payment_ids);
102 102
 
103
-			foreach ( $payments as $payment ) {
103
+			foreach ($payments as $payment) {
104 104
 
105
-				$payment = new Give_Payment( $payment->ID );
105
+				$payment = new Give_Payment($payment->ID);
106 106
 
107 107
 				//Ensure acceptible status only
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					continue;
110 110
 				}
111 111
 
112 112
 				//Ensure only payments for this form are counted
113
-				if ( $payment->form_id != $this->form_id ) {
113
+				if ($payment->form_id != $this->form_id) {
114 114
 					continue;
115 115
 				}
116 116
 
117 117
 				$this->_log_ids_debug[] = $payment->ID;
118 118
 
119
-				$totals['sales'] ++;
119
+				$totals['sales']++;
120 120
 				$totals['earnings'] += $payment->total;
121 121
 
122 122
 			}
123 123
 
124
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
124
+			$this->store_data('give_temp_recount_form_stats', $totals);
125 125
 
126 126
 			return true;
127 127
 		}
128 128
 
129 129
 
130
-		update_post_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
131
-		update_post_meta( $this->form_id, '_give_form_earnings', $totals['earnings'] );
130
+		update_post_meta($this->form_id, '_give_form_sales', $totals['sales']);
131
+		update_post_meta($this->form_id, '_give_form_earnings', $totals['earnings']);
132 132
 
133 133
 		return false;
134 134
 
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	public function get_percentage_complete() {
144 144
 		global $give_logs, $wpdb;
145 145
 
146
-		if ( $this->step == 1 ) {
147
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
146
+		if ($this->step == 1) {
147
+			$this->delete_data('give_recount_total_'.$this->form_id);
148 148
 		}
149 149
 
150
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
151
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
150
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
151
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
152 152
 
153
-		if ( false === $total ) {
153
+		if (false === $total) {
154 154
 			$total = 0;
155
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
155
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
156 156
 				'post_parent' => $this->form_id,
157 157
 				'post_type'   => 'give_log',
158 158
 				'post_status' => 'publish',
159 159
 				'log_type'    => 'sale',
160 160
 				'fields'      => 'ids',
161 161
 				'nopaging'    => true,
162
-			) );
162
+			));
163 163
 
164
-			$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
164
+			$log_ids = $give_logs->get_connected_logs($args, 'sale');
165 165
 
166
-			if ( $log_ids ) {
167
-				$log_ids     = implode( ',', $log_ids );
168
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
169
-				unset( $log_ids );
166
+			if ($log_ids) {
167
+				$log_ids     = implode(',', $log_ids);
168
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
169
+				unset($log_ids);
170 170
 
171
-				$payment_ids = implode( ',', $payment_ids );
172
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
173
-				unset( $payment_ids );
171
+				$payment_ids = implode(',', $payment_ids);
172
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
173
+				unset($payment_ids);
174 174
 
175
-				foreach ( $payments as $payment ) {
176
-					if ( in_array( $payment->post_status, $accepted_statuses ) ) {
175
+				foreach ($payments as $payment) {
176
+					if (in_array($payment->post_status, $accepted_statuses)) {
177 177
 						continue;
178 178
 					}
179 179
 
180
-					$total ++;
180
+					$total++;
181 181
 				}
182 182
 			}
183 183
 
184
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
184
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
185 185
 		}
186 186
 
187 187
 		$percentage = 100;
188 188
 
189
-		if ( $total > 0 ) {
190
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
189
+		if ($total > 0) {
190
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
191 191
 		}
192 192
 
193
-		if ( $percentage > 100 ) {
193
+		if ($percentage > 100) {
194 194
 			$percentage = 100;
195 195
 		}
196 196
 
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @param array $request The Form Data passed into the batch processing
206 206
 	 */
207
-	public function set_properties( $request ) {
208
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
207
+	public function set_properties($request) {
208
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
209 209
 	}
210 210
 
211 211
 	/**
@@ -216,31 +216,31 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function process_step() {
218 218
 
219
-		if ( ! $this->can_export() ) {
220
-			wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
219
+		if ( ! $this->can_export()) {
220
+			wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403));
221 221
 		}
222 222
 
223 223
 		$had_data = $this->get_data();
224 224
 
225
-		if ( $had_data ) {
225
+		if ($had_data) {
226 226
 			$this->done = false;
227 227
 
228 228
 			return true;
229 229
 		} else {
230
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
231
-			$this->delete_data( 'give_temp_recount_form_stats' );
230
+			$this->delete_data('give_recount_total_'.$this->form_id);
231
+			$this->delete_data('give_temp_recount_form_stats');
232 232
 			$this->done    = true;
233
-			$this->message = sprintf( __( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
233
+			$this->message = sprintf(__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
234 234
 
235 235
 			return false;
236 236
 		}
237 237
 	}
238 238
 
239 239
 	public function headers() {
240
-		ignore_user_abort( true );
240
+		ignore_user_abort(true);
241 241
 
242
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
243
-			set_time_limit( 0 );
242
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
243
+			set_time_limit(0);
244 244
 		}
245 245
 	}
246 246
 
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return mixed       Returns the data from the database
270 270
 	 */
271
-	private function get_stored_data( $key ) {
271
+	private function get_stored_data($key) {
272 272
 		global $wpdb;
273
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
273
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
274 274
 
275
-		return empty( $value ) ? false : maybe_unserialize( $value );
275
+		return empty($value) ? false : maybe_unserialize($value);
276 276
 	}
277 277
 
278 278
 	/**
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return void
287 287
 	 */
288
-	private function store_data( $key, $value ) {
288
+	private function store_data($key, $value) {
289 289
 		global $wpdb;
290 290
 
291
-		$value = maybe_serialize( $value );
291
+		$value = maybe_serialize($value);
292 292
 
293 293
 		$data = array(
294 294
 			'option_name'  => $key,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			'%s',
303 303
 		);
304 304
 
305
-		$wpdb->replace( $wpdb->options, $data, $formats );
305
+		$wpdb->replace($wpdb->options, $data, $formats);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return void
316 316
 	 */
317
-	private function delete_data( $key ) {
317
+	private function delete_data($key) {
318 318
 		global $wpdb;
319
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
319
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
320 320
 	}
321 321
 
322 322
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,50 +54,50 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		if ( $this->step == 1 ) {
58
-			$this->delete_data( 'give_temp_recount_income' );
57
+		if ($this->step == 1) {
58
+			$this->delete_data('give_temp_recount_income');
59 59
 		}
60 60
 
61
-		$total = get_option( 'give_temp_recount_income', false );
61
+		$total = get_option('give_temp_recount_income', false);
62 62
 
63
-		if ( false === $total ) {
63
+		if (false === $total) {
64 64
 			$total = (float) 0;
65
-			$this->store_data( 'give_temp_recount_income', $total );
65
+			$this->store_data('give_temp_recount_income', $total);
66 66
 		}
67 67
 
68
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
68
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
69 69
 
70
-		$args = apply_filters( 'give_recount_income_args', array(
70
+		$args = apply_filters('give_recount_income_args', array(
71 71
 			'number' => $this->per_step,
72 72
 			'page'   => $this->step,
73 73
 			'status' => $accepted_statuses,
74 74
 			'fields' => 'ids'
75
-		) );
75
+		));
76 76
 
77
-		$payments = give_get_payments( $args );
77
+		$payments = give_get_payments($args);
78 78
 
79
-		if ( ! empty( $payments ) ) {
79
+		if ( ! empty($payments)) {
80 80
 
81
-			foreach ( $payments as $payment ) {
81
+			foreach ($payments as $payment) {
82 82
 
83
-				$total += give_get_payment_amount( $payment );
83
+				$total += give_get_payment_amount($payment);
84 84
 
85 85
 			}
86 86
 
87
-			if ( $total < 0 ) {
87
+			if ($total < 0) {
88 88
 				$totals = 0;
89 89
 			}
90 90
 
91
-			$total = round( $total, give_currency_decimal_filter() );
91
+			$total = round($total, give_currency_decimal_filter());
92 92
 
93
-			$this->store_data( 'give_temp_recount_income', $total );
93
+			$this->store_data('give_temp_recount_income', $total);
94 94
 
95 95
 			return true;
96 96
 
97 97
 		}
98 98
 
99
-		update_option( 'give_income_total', $total );
100
-		set_transient( 'give_income_total', $total, 86400 );
99
+		update_option('give_income_total', $total);
100
+		set_transient('give_income_total', $total, 86400);
101 101
 
102 102
 		return false;
103 103
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get_percentage_complete() {
113 113
 
114
-		$total = $this->get_stored_data( 'give_recount_income_total' );
114
+		$total = $this->get_stored_data('give_recount_income_total');
115 115
 
116
-		if ( false === $total ) {
117
-			$args = apply_filters( 'give_recount_income_total_args', array() );
116
+		if (false === $total) {
117
+			$args = apply_filters('give_recount_income_total_args', array());
118 118
 
119
-			$counts = give_count_payments( $args );
120
-			$total  = absint( $counts->publish ) + absint( $counts->revoked );
121
-			$total  = apply_filters( 'give_recount_store_income_total', $total );
119
+			$counts = give_count_payments($args);
120
+			$total  = absint($counts->publish) + absint($counts->revoked);
121
+			$total  = apply_filters('give_recount_store_income_total', $total);
122 122
 
123
-			$this->store_data( 'give_recount_income_total', $total );
123
+			$this->store_data('give_recount_income_total', $total);
124 124
 		}
125 125
 
126 126
 		$percentage = 100;
127 127
 
128
-		if ( $total > 0 ) {
129
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
128
+		if ($total > 0) {
129
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
130 130
 		}
131 131
 
132
-		if ( $percentage > 100 ) {
132
+		if ($percentage > 100) {
133 133
 			$percentage = 100;
134 134
 		}
135 135
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param array $request The Form Data passed into the batch processing
145 145
 	 */
146
-	public function set_properties( $request ) {
146
+	public function set_properties($request) {
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function process_step() {
156 156
 
157
-		if ( ! $this->can_export() ) {
158
-			wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
157
+		if ( ! $this->can_export()) {
158
+			wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403));
159 159
 		}
160 160
 
161 161
 		$had_data = $this->get_data();
162 162
 
163
-		if ( $had_data ) {
163
+		if ($had_data) {
164 164
 			$this->done = false;
165 165
 
166 166
 			return true;
167 167
 		} else {
168
-			$this->delete_data( 'give_recount_income_total' );
169
-			$this->delete_data( 'give_temp_recount_income' );
168
+			$this->delete_data('give_recount_income_total');
169
+			$this->delete_data('give_temp_recount_income');
170 170
 			$this->done    = true;
171
-			$this->message = __( 'Give income successfully recounted.', 'give' );
171
+			$this->message = __('Give income successfully recounted.', 'give');
172 172
 
173 173
 			return false;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	public function headers() {
178
-		ignore_user_abort( true );
178
+		ignore_user_abort(true);
179 179
 
180
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
181
-			set_time_limit( 0 );
180
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
181
+			set_time_limit(0);
182 182
 		}
183 183
 	}
184 184
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return mixed       Returns the data from the database
208 208
 	 */
209
-	private function get_stored_data( $key ) {
209
+	private function get_stored_data($key) {
210 210
 		global $wpdb;
211
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
211
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
212 212
 
213
-		return empty( $value ) ? false : maybe_unserialize( $value );
213
+		return empty($value) ? false : maybe_unserialize($value);
214 214
 	}
215 215
 
216 216
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	private function store_data( $key, $value ) {
226
+	private function store_data($key, $value) {
227 227
 		global $wpdb;
228 228
 
229
-		$value = maybe_serialize( $value );
229
+		$value = maybe_serialize($value);
230 230
 
231 231
 		$data = array(
232 232
 			'option_name'  => $key,
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'%s',
241 241
 		);
242 242
 
243
-		$wpdb->replace( $wpdb->options, $data, $formats );
243
+		$wpdb->replace($wpdb->options, $data, $formats);
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function delete_data( $key ) {
255
+	private function delete_data($key) {
256 256
 		global $wpdb;
257
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
257
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
258 258
 	}
259 259
 
260 260
 }
Please login to merge, or discard this patch.