Test Failed
Push — master ( f098b0...602e9b )
by Devin
10:54 queued 05:19
created
includes/admin/tools/logs/logs.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_get_logs_tab() {
24 24
 
25
-	require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' );
25
+	require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php');
26 26
 
27 27
 	// Get current section.
28 28
 	$current_section = $_GET['section'] = give_get_current_setting_section();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( "give_logs_view_{$current_section}" );
35
+	do_action("give_logs_view_{$current_section}");
36 36
 }
37 37
 
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function give_logs_view_sales() {
48 48
 
49
-	include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php';
49
+	include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php';
50 50
 
51 51
 	$logs_table = new Give_Sales_Log_Table();
52 52
 	$logs_table->prepare_items();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 1.8.12
61 61
 		 */
62
-		do_action( 'give_logs_donations_top' );
62
+		do_action('give_logs_donations_top');
63 63
 
64 64
 		$logs_table->display(); ?>
65 65
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @since 1.8.12
75 75
 		 */
76
-		do_action( 'give_logs_donations_bottom' );
76
+		do_action('give_logs_donations_bottom');
77 77
 		?>
78 78
 
79 79
 	</div>
80 80
 	<?php
81 81
 }
82 82
 
83
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
83
+add_action('give_logs_view_sales', 'give_logs_view_sales');
84 84
 
85 85
 /**
86 86
  * Update Logs
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_logs_view_updates() {
93
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' );
93
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php');
94 94
 
95 95
 	$logs_table = new Give_Update_Log_Table();
96 96
 	$logs_table->prepare_items();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 2.0.1
105 105
 		 */
106
-		do_action( 'give_logs_update_top' );
106
+		do_action('give_logs_update_top');
107 107
 
108 108
 		$logs_table->display(); ?>
109 109
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 		 *
118 118
 		 * @since 2.0.1
119 119
 		 */
120
-		do_action( 'give_logs_update_bottom' );
120
+		do_action('give_logs_update_bottom');
121 121
 		?>
122 122
 
123 123
 	</div>
124 124
 	<?php
125 125
 }
126 126
 
127
-add_action( 'give_logs_view_updates', 'give_logs_view_updates' );
127
+add_action('give_logs_view_updates', 'give_logs_view_updates');
128 128
 
129 129
 /**
130 130
  * Gateway Error Logs
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @return void
136 136
  */
137 137
 function give_logs_view_gateway_errors() {
138
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' );
138
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php');
139 139
 
140 140
 	$logs_table = new Give_Gateway_Error_Log_Table();
141 141
 	$logs_table->prepare_items();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.8.12
150 150
 		 */
151
-		do_action( 'give_logs_payment_error_top' );
151
+		do_action('give_logs_payment_error_top');
152 152
 
153 153
 		$logs_table->display(); ?>
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		 *
163 163
 		 * @since 1.8.12
164 164
 		 */
165
-		do_action( 'give_logs_payment_error_bottom' );
165
+		do_action('give_logs_payment_error_bottom');
166 166
 		?>
167 167
 
168 168
 	</div>
169 169
 	<?php
170 170
 }
171 171
 
172
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
172
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
173 173
 
174 174
 /**
175 175
  * API Request Logs
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
  * @return void
181 181
  */
182 182
 function give_logs_view_api_requests() {
183
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' );
183
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php');
184 184
 
185 185
 	$logs_table = new Give_API_Request_Log_Table();
186 186
 	$logs_table->prepare_items();
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @since 1.0
192 192
 	 */
193
-	do_action( 'give_logs_api_requests_top' );
193
+	do_action('give_logs_api_requests_top');
194 194
 
195
-	$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
195
+	$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
196 196
 	$logs_table->display();
197 197
 	?>
198 198
 	<input type="hidden" name="post_type" value="give_forms"/>
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @since 1.0
208 208
 	 */
209
-	do_action( 'give_logs_api_requests_bottom' );
209
+	do_action('give_logs_api_requests_bottom');
210 210
 }
211
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
211
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
212 212
 
213 213
 /**
214 214
  * Renders the log views drop down.
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	$current_section = give_get_current_setting_section();
221 221
 
222 222
 	// If there are not any event attach to action then do not show form.
223
-	if ( ! has_action( 'give_log_view_actions' ) ) {
223
+	if ( ! has_action('give_log_view_actions')) {
224 224
 		return;
225 225
 	}
226 226
 	?>
227
-	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section=' . $current_section; ?>">
227
+	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section='.$current_section; ?>">
228 228
 		<?php
229 229
 		/**
230 230
 		 * Fires after displaying the reports page views drop down.
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		 *
234 234
 		 * @since 1.0
235 235
 		 */
236
-		do_action( 'give_log_view_actions' );
236
+		do_action('give_log_view_actions');
237 237
 		?>
238 238
 
239 239
 		<input type="hidden" name="post_type" value="give_forms"/>
240 240
 		<input type="hidden" name="page" value="give-tools"/>
241 241
 		<input type="hidden" name="tab" value="logs"/>
242 242
 
243
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
243
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
244 244
 	</form>
245 245
 	<?php
246 246
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return string
254 254
  */
255
-function give_tools_set_form_method( $method ) {
255
+function give_tools_set_form_method($method) {
256 256
 	return 'get';
257 257
 }
258
-add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 );
258
+add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10);
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-update-logs-list-table.php 1 patch
Spacing   +39 added lines, -39 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
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
51
-			'ajax'     => false,// Does this table support ajax?
52
-		) );
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51
+			'ajax'     => false, // Does this table support ajax?
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
66
+	public function search_box($text, $input_id) {
67 67
 	}
68 68
 
69 69
 	/**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_columns() {
78 78
 		$columns = array(
79
-			'ID'      => __( 'Log ID', 'give' ),
80
-			'date'    => __( 'Date', 'give' ),
81
-			'details' => __( 'Process Details', 'give' ),
79
+			'ID'      => __('Log ID', 'give'),
80
+			'date'    => __('Date', 'give'),
81
+			'details' => __('Process Details', 'give'),
82 82
 		);
83 83
 
84 84
 		return $columns;
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return string Column Name
97 97
 	 */
98
-	public function column_default( $item, $column_name ) {
99
-		switch ( $column_name ) {
98
+	public function column_default($item, $column_name) {
99
+		switch ($column_name) {
100 100
 			case 'ID':
101 101
 				return sprintf(
102 102
 					'<span class="give-item-label give-item-label-gray">%1$s</span> %2$s',
103
-					esc_attr( $item[ $column_name ] ),
104
-					esc_attr( $item['title'] )
103
+					esc_attr($item[$column_name]),
104
+					esc_attr($item['title'])
105 105
 				);
106 106
 
107 107
 			default:
108
-				return esc_attr( $item[ $column_name ] );
108
+				return esc_attr($item[$column_name]);
109 109
 		}
110 110
 	}
111 111
 
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return void
121 121
 	 */
122
-	public function column_details( $item ) {
123
-		echo Give()->tooltips->render_link( array(
124
-			'label'       => __( 'View Update Log', 'give' ),
122
+	public function column_details($item) {
123
+		echo Give()->tooltips->render_link(array(
124
+			'label'       => __('View Update Log', 'give'),
125 125
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
126 126
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-details-{$item['ID']}",
127 127
 			'attributes'  => array(
128 128
 				'class' => 'thickbox give-error-log-details-link button button-small',
129 129
 			),
130
-		) );
130
+		));
131 131
 		?>
132 132
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
133 133
 			<?php
134 134
 
135 135
 			// Print Log Content, if not empty.
136
-			if ( ! empty( $item['log_content'] ) ) {
136
+			if ( ! empty($item['log_content'])) {
137 137
 				echo sprintf(
138 138
 					'<p><pre>%1$s</pre></div>',
139
-					esc_html( $item['log_content'] )
139
+					esc_html($item['log_content'])
140 140
 				);
141 141
 			}
142 142
 			?>
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $which
159 159
 	 */
160
-	protected function display_tablenav( $which ) {
161
-		if ( 'top' === $which ) {
162
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
160
+	protected function display_tablenav($which) {
161
+		if ('top' === $which) {
162
+			wp_nonce_field('bulk-'.$this->_args['plural']);
163 163
 		}
164 164
 		?>
165
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
165
+		<div class="tablenav <?php echo esc_attr($which); ?>">
166 166
 
167 167
 			<div class="alignleft actions bulkactions">
168
-				<?php $this->bulk_actions( $which ); ?>
168
+				<?php $this->bulk_actions($which); ?>
169 169
 			</div>
170 170
 			<?php
171
-			$this->extra_tablenav( $which );
172
-			$this->pagination( $which );
171
+			$this->extra_tablenav($which);
172
+			$this->pagination($which);
173 173
 			?>
174 174
 
175 175
 			<br class="clear"/>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return int Current page number
187 187
 	 */
188 188
 	public function get_paged() {
189
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
189
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
190 190
 	}
191 191
 
192 192
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return void
201 201
 	 */
202
-	function bulk_actions( $which = '' ) {
202
+	function bulk_actions($which = '') {
203 203
 	}
204 204
 
205 205
 	/**
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 			'posts_per_page' => $this->per_page,
220 220
 		);
221 221
 
222
-		$logs = Give()->logs->get_connected_logs( $log_query );
222
+		$logs = Give()->logs->get_connected_logs($log_query);
223 223
 
224
-		if ( $logs ) {
225
-			foreach ( $logs as $log ) {
224
+		if ($logs) {
225
+			foreach ($logs as $log) {
226 226
 
227 227
 				$logs_data[] = array(
228 228
 					'ID'          => $log->ID,
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 		$columns               = $this->get_columns();
255 255
 		$hidden                = array(); // No hidden columns
256 256
 		$sortable              = $this->get_sortable_columns();
257
-		$this->_column_headers = array( $columns, $hidden, $sortable );
257
+		$this->_column_headers = array($columns, $hidden, $sortable);
258 258
 		$this->items           = $this->get_logs();
259
-		$total_items           = Give()->logs->get_log_count( 0, 'update' );
259
+		$total_items           = Give()->logs->get_log_count(0, 'update');
260 260
 
261
-		$this->set_pagination_args( array(
261
+		$this->set_pagination_args(array(
262 262
 				'total_items' => $total_items,
263 263
 				'per_page'    => $this->per_page,
264
-				'total_pages' => ceil( $total_items / $this->per_page ),
264
+				'total_pages' => ceil($total_items / $this->per_page),
265 265
 			)
266 266
 		);
267 267
 	}
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-core-settings.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.17
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Core_Settings' ) ) {
18
+if ( ! class_exists('Give_Import_Core_Settings')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Core_Settings.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		 * @return static
69 69
 		 */
70 70
 		public static function get_instance() {
71
-			if ( null === static::$instance ) {
71
+			if (null === static::$instance) {
72 72
 				self::$instance = new static();
73 73
 			}
74 74
 
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 		 * @return void
96 96
 		 */
97 97
 		private function setup_hooks() {
98
-			if ( ! $this->is_donations_import_page() ) {
98
+			if ( ! $this->is_donations_import_page()) {
99 99
 				return;
100 100
 			}
101 101
 
102 102
 			// Do not render main import tools page.
103
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
103
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
104 104
 
105 105
 			// Render donation import page
106
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
106
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
107 107
 
108 108
 			// Print the HTML.
109
-			add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 );
109
+			add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10);
110 110
 
111 111
 			// Run when form submit.
112
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
112
+			add_action('give-tools_save_import', array($this, 'save'));
113 113
 
114
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
114
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
115 115
 
116 116
 			// Used to add submit button.
117
-			add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 );
117
+			add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10);
118 118
 		}
119 119
 
120 120
 		/**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return mixed
128 128
 		 */
129
-		public function update_notices( $messages ) {
130
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
131
-				unset( $messages['give-setting-updated'] );
129
+		public function update_notices($messages) {
130
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
131
+				unset($messages['give-setting-updated']);
132 132
 			}
133 133
 
134 134
 			return $messages;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 * @since 1.8.17
141 141
 		 */
142 142
 		public function submit() {
143
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
143
+			wp_nonce_field('give-save-settings', '_give-save-settings');
144 144
 			?>
145 145
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
146 146
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				       id="<?php echo "step-{$step}"; ?>">
164 164
 					<tbody>
165 165
 					<?php
166
-					switch ( $this->get_step() ) {
166
+					switch ($this->get_step()) {
167 167
 						case 1:
168 168
 							$this->render_upload_html();
169 169
 							break;
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 		public function import_success() {
191 191
 			// Imported successfully
192 192
 
193
-			$success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false );
194
-			$undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false );
193
+			$success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false);
194
+			$undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false);
195 195
 			$query_arg_setting = array(
196 196
 				'post_type' => 'give_forms',
197 197
 				'page'      => 'give-settings',
198 198
 			);
199 199
 
200
-			if ( $undo ) {
200
+			if ($undo) {
201 201
 				$success = false;
202 202
 			}
203 203
 
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
 				'undo'      => 'true',
211 211
 			);
212 212
 
213
-			$title = __( 'Settings Importing Completed!', 'give' );
214
-			if ( $success ) {
213
+			$title = __('Settings Importing Completed!', 'give');
214
+			if ($success) {
215 215
 				$query_arg_success['undo'] = '1';
216 216
 				$query_arg_success['step'] = '3';
217 217
 				$query_arg_success['success'] = '1';
218
-				$text = __( 'Undo Importing', 'give' );
218
+				$text = __('Undo Importing', 'give');
219 219
 			} else {
220
-				if ( $undo ) {
221
-					$host_give_options = get_option( 'give_settings_old', array() );
222
-					update_option( 'give_settings', $host_give_options );
223
-					$title = __( 'Undo of Setting Imported Completed!', 'give' );
220
+				if ($undo) {
221
+					$host_give_options = get_option('give_settings_old', array());
222
+					update_option('give_settings', $host_give_options);
223
+					$title = __('Undo of Setting Imported Completed!', 'give');
224 224
 				} else {
225
-					$title = __( 'Failed to import', 'give' );
225
+					$title = __('Failed to import', 'give');
226 226
 				}
227 227
 
228
-				$text = __( 'Importing Again', 'give' );
228
+				$text = __('Importing Again', 'give');
229 229
 			}
230 230
 			?>
231 231
 			<tr valign="top" class="give-import-dropdown">
232 232
 				<th colspan="2">
233 233
 					<h2><?php echo $title; ?></h2>
234 234
 					<p>
235
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
236
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a>
235
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
236
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a>
237 237
 					</p>
238 238
 				</th>
239 239
 			</tr>
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 		 * @since 1.8.17
247 247
 		 */
248 248
 		public function start_import() {
249
-			$type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' );
250
-			$file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' );
249
+			$type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace');
250
+			$file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : '');
251 251
 
252 252
 			?>
253 253
 			<tr valign="top" class="give-import-dropdown">
254 254
 				<th colspan="2">
255
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
256
-					<p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p>
255
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
256
+					<p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p>
257 257
 				</th>
258 258
 			</tr>
259 259
 
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 			$step = $this->get_step();
287 287
 			?>
288 288
 			<ol class="give-progress-steps">
289
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
290
-					<?php esc_html_e( 'Upload JSON file', 'give' ); ?>
289
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
290
+					<?php esc_html_e('Upload JSON file', 'give'); ?>
291 291
 				</li>
292
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
293
-					<?php esc_html_e( 'Import', 'give' ); ?>
292
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
293
+					<?php esc_html_e('Import', 'give'); ?>
294 294
 				</li>
295
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
296
-					<?php esc_html_e( 'Done!', 'give' ); ?>
295
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
296
+					<?php esc_html_e('Done!', 'give'); ?>
297 297
 				</li>
298 298
 			</ol>
299 299
 			<?php
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 		 * @return int $step on which step doest the import is on.
308 308
 		 */
309 309
 		public function get_step() {
310
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
310
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
311 311
 			$on_step = 1;
312 312
 
313
-			if ( empty( $step ) || 1 === $step ) {
313
+			if (empty($step) || 1 === $step) {
314 314
 				$on_step = 1;
315
-			} elseif ( 2 === $step ) {
315
+			} elseif (2 === $step) {
316 316
 				$on_step = 2;
317
-			} elseif ( 3 === $step ) {
317
+			} elseif (3 === $step) {
318 318
 				$on_step = 3;
319 319
 			}
320 320
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		 * @since 1.8.17
328 328
 		 */
329 329
 		public function render_page() {
330
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php';
330
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php';
331 331
 		}
332 332
 
333 333
 		/**
@@ -339,28 +339,28 @@  discard block
 block discarded – undo
339 339
 		 * @return void
340 340
 		 */
341 341
 		public function render_upload_html() {
342
-			$json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' );
343
-			$type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' );
342
+			$json = (isset($_POST['json']) ? give_clean($_POST['json']) : '');
343
+			$type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge');
344 344
 			$step = $this->get_step();
345 345
 
346 346
 			?>
347 347
 			<tr valign="top">
348 348
 				<th colspan="2">
349
-					<h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2>
350
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p>
349
+					<h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2>
350
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p>
351 351
 				</th>
352 352
 			</tr>
353 353
 
354 354
 			<tr valign="top">
355 355
 				<th scope="row" class="titledesc">
356
-					<label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label>
356
+					<label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label>
357 357
 				</th>
358 358
 				<td class="give-forminp">
359 359
 					<div class="give-field-wrap">
360 360
 						<label for="json">
361 361
 							<input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>"
362 362
 							       accept=".json">
363
-							<p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p>
363
+							<p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p>
364 364
 						</label>
365 365
 					</div>
366 366
 				</td>
@@ -369,20 +369,20 @@  discard block
 block discarded – undo
369 369
 			$settings = array(
370 370
 				array(
371 371
 					'id'          => 'type',
372
-					'name'        => __( 'Merge Type:', 'give' ),
373
-					'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ),
372
+					'name'        => __('Merge Type:', 'give'),
373
+					'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'),
374 374
 					'default'     => $type,
375 375
 					'type'        => 'radio_inline',
376 376
 					'options'     => array(
377
-						'merge'   => __( 'Merge', 'give' ),
378
-						'replace' => __( 'Replace', 'give' ),
377
+						'merge'   => __('Merge', 'give'),
378
+						'replace' => __('Replace', 'give'),
379 379
 					),
380 380
 				),
381 381
 			);
382 382
 
383
-			$settings = apply_filters( 'give_import_core_setting_html', $settings );
383
+			$settings = apply_filters('give_import_core_setting_html', $settings);
384 384
 
385
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
385
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
386 386
 			?>
387 387
 			<tr valign="top">
388 388
 				<th></th>
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 					<input type="submit"
391 391
 					       class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
392 392
 					       id="recount-stats-submit"
393
-					       value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
393
+					       value="<?php esc_attr_e('Submit', 'give'); ?>"/>
394 394
 				</th>
395 395
 			</tr>
396 396
 			<?php
@@ -407,20 +407,20 @@  discard block
 block discarded – undo
407 407
 			$step = $this->get_step();
408 408
 
409 409
 			// Validation for first step.
410
-			if ( 1 === $step ) {
411
-				$type          = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' );
410
+			if (1 === $step) {
411
+				$type          = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace');
412 412
 				$core_settings = self::upload_widget_settings_file();
413
-				if ( ! empty( $core_settings['error'] ) ) {
414
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) );
413
+				if ( ! empty($core_settings['error'])) {
414
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give'));
415 415
 				} else {
416
-					$file_path = explode( '/', $core_settings['file'] );
417
-					$count     = ( count( $file_path ) - 1 );
418
-					$url       = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array(
416
+					$file_path = explode('/', $core_settings['file']);
417
+					$count     = (count($file_path) - 1);
418
+					$url       = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array(
419 419
 						'step'          => '2',
420 420
 						'importer-type' => $this->importer_type,
421 421
 						'type'          => $type,
422
-						'file_name'     => $file_path[ $count ],
423
-					) ) );
422
+						'file_name'     => $file_path[$count],
423
+					)));
424 424
 
425 425
 					?>
426 426
 					<script type="text/javascript">
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		 * @return bool
439 439
 		 */
440 440
 		private function is_donations_import_page() {
441
-			return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] );
441
+			return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']);
442 442
 		}
443 443
 
444 444
 		/**
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
 		 */
448 448
 		public static function upload_widget_settings_file() {
449 449
 			$upload = false;
450
-			if ( isset( $_FILES['json'] ) ) {
451
-				add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
450
+			if (isset($_FILES['json'])) {
451
+				add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
452 452
 
453
-				$upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) );
453
+				$upload = wp_handle_upload($_FILES['json'], array('test_form' => false));
454 454
 
455
-				remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
455
+				remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
456 456
 			} else {
457
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
457
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
458 458
 			}
459 459
 
460 460
 			return $upload;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		 *
466 466
 		 * @param array $existing_mimes
467 467
 		 */
468
-		public static function json_upload_mimes( $existing_mimes = array() ) {
468
+		public static function json_upload_mimes($existing_mimes = array()) {
469 469
 			$existing_mimes['json'] = 'application/json';
470 470
 
471 471
 			return $existing_mimes;
Please login to merge, or discard this patch.
includes/class-give-db-payment-meta.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta';
53
+		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	protected function is_custom_meta_table_active() {
87
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
87
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/class-give-db-logs-meta.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->logmeta     = $this->table_name = $wpdb->prefix . 'give_logmeta';
53
+		$wpdb->logmeta     = $this->table_name = $wpdb->prefix.'give_logmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return bool
88 88
 	 */
89
-	public function delete_row( $log_id = 0 ) {
89
+	public function delete_row($log_id = 0) {
90 90
 		/* @var WPDB $wpdb */
91 91
 		global $wpdb;
92 92
 
93 93
 		// Row ID must be positive integer
94
-		$log_id = absint( $log_id );
94
+		$log_id = absint($log_id);
95 95
 
96
-		if ( empty( $log_id ) ) {
96
+		if (empty($log_id)) {
97 97
 			return false;
98 98
 		}
99 99
 
100
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) {
100
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE log_id = %d", $log_id))) {
101 101
 			return false;
102 102
 		}
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return bool
116 116
 	 */
117
-	protected function is_valid_post_type( $ID ) {
117
+	protected function is_valid_post_type($ID) {
118 118
 		return $ID && true;
119 119
 	}
120 120
 }
Please login to merge, or discard this patch.
includes/class-give-db-donor-meta.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		/* @var WPDB $wpdb */
54 54
 		global $wpdb;
55 55
 
56
-		$wpdb->donormeta   = $this->table_name = $wpdb->prefix . 'give_donormeta';
56
+		$wpdb->donormeta   = $this->table_name = $wpdb->prefix.'give_donormeta';
57 57
 		$this->primary_key = 'meta_id';
58 58
 		$this->version     = '1.0';
59 59
 
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return  bool  False for failure. True for success.
92 92
 	 */
93
-	public function delete_all_meta( $donor_id = 0 ) {
93
+	public function delete_all_meta($donor_id = 0) {
94 94
 		global $wpdb;
95
-		$status = $wpdb->delete( $this->table_name, array( 'donor_id' => $donor_id ), array( '%d' ) );
95
+		$status = $wpdb->delete($this->table_name, array('donor_id' => $donor_id), array('%d'));
96 96
 
97
-		if( $status ) {
98
-			Give_Cache::delete_group( $donor_id, 'give-donors' );
97
+		if ($status) {
98
+			Give_Cache::delete_group($donor_id, 'give-donors');
99 99
 		}
100 100
 	}
101 101
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 		global $wpdb;
112 112
 
113 113
 		if (
114
-			! give_has_upgrade_completed( 'v20_rename_donor_tables' ) &&
115
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) )
114
+			! give_has_upgrade_completed('v20_rename_donor_tables') &&
115
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta"))
116 116
 		) {
117 117
 			$wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta";
118 118
 			$this->meta_type = 'customer';
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return bool
133 133
 	 */
134
-	protected function is_valid_post_type( $ID ) {
134
+	protected function is_valid_post_type($ID) {
135 135
 		return $ID && true;
136 136
 	}
137 137
 
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-donor-stats.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Constructor.
50 50
 	 */
51
-	public function __construct( $_step = 1 ) {
52
-		parent::__construct( $_step );
51
+	public function __construct($_step = 1) {
52
+		parent::__construct($_step);
53 53
 
54 54
 		$this->is_writable = true;
55 55
 	}
@@ -66,32 +66,32 @@  discard block
 block discarded – undo
66 66
 
67 67
 		$args = array(
68 68
 			'number'  => $this->per_step,
69
-			'offset'  => $this->per_step * ( $this->step - 1 ),
69
+			'offset'  => $this->per_step * ($this->step - 1),
70 70
 			'orderby' => 'id',
71 71
 			'order'   => 'DESC',
72 72
 		);
73 73
 
74
-		$donors = Give()->donors->get_donors( $args );
74
+		$donors = Give()->donors->get_donors($args);
75 75
 
76
-		if ( $donors ) {
76
+		if ($donors) {
77 77
 
78
-			$allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() );
78
+			$allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys());
79 79
 
80
-			foreach ( $donors as $donor ) {
80
+			foreach ($donors as $donor) {
81 81
 
82
-				$attached_payment_ids = explode( ',', $donor->payment_ids );
82
+				$attached_payment_ids = explode(',', $donor->payment_ids);
83 83
 
84 84
 				$attached_args = array(
85 85
 					'post__in' => $attached_payment_ids,
86
-					'number'   => - 1,
86
+					'number'   => -1,
87 87
 					'status'   => $allowed_payment_status,
88 88
 				);
89 89
 
90
-				$attached_payments = (array) give_get_payments( $attached_args );
90
+				$attached_payments = (array) give_get_payments($attached_args);
91 91
 
92 92
 				$unattached_args = array(
93 93
 					'post__not_in' => $attached_payment_ids,
94
-					'number'       => - 1,
94
+					'number'       => -1,
95 95
 					'status'       => $allowed_payment_status,
96 96
 					'meta_query'   => array(
97 97
 						array(
@@ -102,29 +102,29 @@  discard block
 block discarded – undo
102 102
 					),
103 103
 				);
104 104
 
105
-				$unattached_payments = give_get_payments( $unattached_args );
105
+				$unattached_payments = give_get_payments($unattached_args);
106 106
 
107
-				$payments = array_merge( $attached_payments, $unattached_payments );
107
+				$payments = array_merge($attached_payments, $unattached_payments);
108 108
 
109 109
 				$purchase_value = 0.00;
110 110
 				$purchase_count = 0;
111 111
 				$payment_ids    = array();
112 112
 
113
-				if ( $payments ) {
113
+				if ($payments) {
114 114
 
115
-					foreach ( $payments as $payment ) {
115
+					foreach ($payments as $payment) {
116 116
 
117 117
 						$should_process_payment = 'publish' == $payment->post_status ? true : false;
118
-						$should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment );
118
+						$should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment);
119 119
 
120
-						if ( true === $should_process_payment ) {
120
+						if (true === $should_process_payment) {
121 121
 
122
-							if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) {
123
-								$purchase_value += (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) );
122
+							if (apply_filters('give_donor_recount_should_increase_value', true, $payment)) {
123
+								$purchase_value += (float) give_donation_amount($payment->ID, array('type' => 'stats'));
124 124
 							}
125 125
 
126
-							if ( apply_filters( 'give_donor_recount_should_increase_count', true, $payment ) ) {
127
-								$purchase_count ++;
126
+							if (apply_filters('give_donor_recount_should_increase_count', true, $payment)) {
127
+								$purchase_count++;
128 128
 							}
129 129
 						}
130 130
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 					}
133 133
 				}
134 134
 
135
-				$payment_ids = implode( ',', $payment_ids );
135
+				$payment_ids = implode(',', $payment_ids);
136 136
 
137 137
 				$donor_update_data = array(
138 138
 					'purchase_count' => $purchase_count,
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 					'payment_ids'    => $payment_ids,
141 141
 				);
142 142
 
143
-				$donor_instance = new Give_Donor( $donor->id );
144
-				$donor_instance->update( $donor_update_data );
143
+				$donor_instance = new Give_Donor($donor->id);
144
+				$donor_instance->update($donor_update_data);
145 145
 
146 146
 			}// End foreach().
147 147
 
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 	public function get_percentage_complete() {
162 162
 
163 163
 		$args = array(
164
-			'number'  => - 1,
164
+			'number'  => -1,
165 165
 			'orderby' => 'id',
166 166
 			'order'   => 'DESC',
167 167
 		);
168 168
 
169
-		$donors = Give()->donors->get_donors( $args );
170
-		$total     = count( $donors );
169
+		$donors = Give()->donors->get_donors($args);
170
+		$total = count($donors);
171 171
 
172 172
 		$percentage = 100;
173 173
 
174
-		if ( $total > 0 ) {
175
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
174
+		if ($total > 0) {
175
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
176 176
 		}
177 177
 
178
-		if ( $percentage > 100 ) {
178
+		if ($percentage > 100) {
179 179
 			$percentage = 100;
180 180
 		}
181 181
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @param array $request The Form Data passed into the batch processing
191 191
 	 */
192
-	public function set_properties( $request ) {
192
+	public function set_properties($request) {
193 193
 	}
194 194
 
195 195
 	/**
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function process_step() {
202 202
 
203
-		if ( ! $this->can_export() ) {
204
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array(
203
+		if ( ! $this->can_export()) {
204
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array(
205 205
 				'response' => 403,
206
-			) );
206
+			));
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 216
 			$this->done    = true;
217
-			$this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' );
217
+			$this->message = esc_html__('Donor stats have been successfully recounted.', 'give');
218 218
 
219 219
 			return false;
220 220
 		}
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 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
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * Constructor.
55 55
 	 */
56
-	public function __construct( $_step = 1 ) {
57
-		parent::__construct( $_step );
56
+	public function __construct($_step = 1) {
57
+		parent::__construct($_step);
58 58
 
59 59
 		$this->is_writable = true;
60 60
 	}
@@ -69,59 +69,59 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function get_data() {
71 71
 
72
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
72
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
73 73
 
74
-		if ( $this->step == 1 ) {
75
-			$this->delete_data( 'give_temp_recount_form_stats' );
74
+		if ($this->step == 1) {
75
+			$this->delete_data('give_temp_recount_form_stats');
76 76
 		}
77 77
 
78
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
78
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
79 79
 
80
-		if ( false === $totals ) {
80
+		if (false === $totals) {
81 81
 			$totals = array(
82 82
 				'earnings' => (float) 0,
83 83
 				'sales'    => 0,
84 84
 			);
85
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
85
+			$this->store_data('give_temp_recount_form_stats', $totals);
86 86
 		}
87 87
 
88
-		$args = apply_filters( 'give_recount_form_stats_args', array(
88
+		$args = apply_filters('give_recount_form_stats_args', array(
89 89
 			'give_forms' => $this->form_id,
90 90
 			'number'     => $this->per_step,
91 91
 			'status'     => $accepted_statuses,
92 92
 			'paged'      => $this->step,
93 93
 			'fields'     => 'ids',
94
-		) );
94
+		));
95 95
 
96
-		$payments = new Give_Payments_Query( $args );
96
+		$payments = new Give_Payments_Query($args);
97 97
 		$payments = $payments->get_payments();
98 98
 
99
-		if ( $payments ) {
100
-			foreach ( $payments as $payment ) {
99
+		if ($payments) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Ensure acceptable status only.
103
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
103
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				// Ensure only payments for this form are counted.
108
-				if ( $payment->form_id != $this->form_id ) {
108
+				if ($payment->form_id != $this->form_id) {
109 109
 					continue;
110 110
 				}
111 111
 
112
-				$totals['sales'] ++;
112
+				$totals['sales']++;
113 113
 				$totals['earnings'] += $payment->total;
114 114
 
115 115
 			}
116 116
 
117
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
117
+			$this->store_data('give_temp_recount_form_stats', $totals);
118 118
 
119 119
 			return true;
120 120
 		}
121 121
 
122 122
 
123
-		give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
124
-		give_update_meta( $this->form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
123
+		give_update_meta($this->form_id, '_give_form_sales', $totals['sales']);
124
+		give_update_meta($this->form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
125 125
 
126 126
 		return false;
127 127
 	}
@@ -133,35 +133,35 @@  discard block
 block discarded – undo
133 133
 	 * @return int
134 134
 	 */
135 135
 	public function get_percentage_complete() {
136
-		if ( $this->step == 1 ) {
137
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
136
+		if ($this->step == 1) {
137
+			$this->delete_data('give_recount_total_'.$this->form_id);
138 138
 		}
139 139
 
140
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
141
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
140
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
141
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
142 142
 
143
-		if ( false === $total ) {
143
+		if (false === $total) {
144 144
 			$total = 0;
145
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
145
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
146 146
 				'give_forms' => $this->form_id,
147
-				'number'     => - 1,
147
+				'number'     => -1,
148 148
 				'status'     => $accepted_statuses,
149 149
 				'fields'     => 'ids',
150
-			) );
150
+			));
151 151
 
152
-			$payments = new Give_Payments_Query( $args );
153
-			$total    = count( $payments->get_payments() );
154
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
152
+			$payments = new Give_Payments_Query($args);
153
+			$total    = count($payments->get_payments());
154
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
155 155
 
156 156
 		}
157 157
 
158 158
 		$percentage = 100;
159 159
 
160
-		if ( $total > 0 ) {
161
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
160
+		if ($total > 0) {
161
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
162 162
 		}
163 163
 
164
-		if ( $percentage > 100 ) {
164
+		if ($percentage > 100) {
165 165
 			$percentage = 100;
166 166
 		}
167 167
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @param array $request The Form Data passed into the batch processing
177 177
 	 */
178
-	public function set_properties( $request ) {
179
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
178
+	public function set_properties($request) {
179
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
180 180
 	}
181 181
 
182 182
 	/**
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function process_step() {
189 189
 
190
-		if ( ! $this->can_export() ) {
191
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
190
+		if ( ! $this->can_export()) {
191
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
192 192
 		}
193 193
 
194 194
 		$had_data = $this->get_data();
195 195
 
196
-		if ( $had_data ) {
196
+		if ($had_data) {
197 197
 			$this->done = false;
198 198
 
199 199
 			return true;
200 200
 		} else {
201
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
202
-			$this->delete_data( 'give_temp_recount_form_stats' );
201
+			$this->delete_data('give_recount_total_'.$this->form_id);
202
+			$this->delete_data('give_temp_recount_form_stats');
203 203
 			$this->done    = true;
204
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
204
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
205 205
 
206 206
 			return false;
207 207
 		}
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return mixed       Returns the data from the database
237 237
 	 */
238
-	private function get_stored_data( $key ) {
238
+	private function get_stored_data($key) {
239 239
 		global $wpdb;
240
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
240
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
241 241
 
242
-		if ( empty( $value ) ) {
242
+		if (empty($value)) {
243 243
 			return false;
244 244
 		}
245 245
 
246
-		$maybe_json = json_decode( $value );
247
-		if ( ! is_null( $maybe_json ) ) {
248
-			$value = json_decode( $value, true );
246
+		$maybe_json = json_decode($value);
247
+		if ( ! is_null($maybe_json)) {
248
+			$value = json_decode($value, true);
249 249
 		}
250 250
 
251 251
 		return $value;
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return void
263 263
 	 */
264
-	private function store_data( $key, $value ) {
264
+	private function store_data($key, $value) {
265 265
 		global $wpdb;
266 266
 
267
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
267
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
268 268
 
269 269
 		$data = array(
270 270
 			'option_name'  => $key,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			'%s',
279 279
 		);
280 280
 
281
-		$wpdb->replace( $wpdb->options, $data, $formats );
281
+		$wpdb->replace($wpdb->options, $data, $formats);
282 282
 	}
283 283
 
284 284
 	/**
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return void
292 292
 	 */
293
-	private function delete_data( $key ) {
293
+	private function delete_data($key) {
294 294
 		global $wpdb;
295
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
295
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
296 296
 	}
297 297
 
298 298
 }
299 299
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-income.php 1 patch
Spacing   +47 added lines, -47 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
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -61,49 +61,49 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function get_data() {
63 63
 
64
-		if ( $this->step == 1 ) {
65
-			$this->delete_data( 'give_temp_recount_earnings' );
64
+		if ($this->step == 1) {
65
+			$this->delete_data('give_temp_recount_earnings');
66 66
 		}
67 67
 
68
-		$total = get_option( 'give_temp_recount_earnings', false );
68
+		$total = get_option('give_temp_recount_earnings', false);
69 69
 
70
-		if ( false === $total ) {
70
+		if (false === $total) {
71 71
 			$total = (float) 0;
72
-			$this->store_data( 'give_temp_recount_earnings', $total );
72
+			$this->store_data('give_temp_recount_earnings', $total);
73 73
 		}
74 74
 
75
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
75
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
76 76
 
77
-		$args = apply_filters( 'give_recount_earnings_args', array(
77
+		$args = apply_filters('give_recount_earnings_args', array(
78 78
 			'number' => $this->per_step,
79 79
 			'page'   => $this->step,
80 80
 			'status' => $accepted_statuses,
81 81
 			'fields' => 'ids'
82
-		) );
82
+		));
83 83
 
84
-		$payments = give_get_payments( $args );
84
+		$payments = give_get_payments($args);
85 85
 
86
-		if ( ! empty( $payments ) ) {
86
+		if ( ! empty($payments)) {
87 87
 
88
-			foreach ( $payments as $payment ) {
88
+			foreach ($payments as $payment) {
89 89
 
90
-				$total += (float) give_donation_amount( $payment, array( 'type' => 'stats' ) );
90
+				$total += (float) give_donation_amount($payment, array('type' => 'stats'));
91 91
 
92 92
 			}
93 93
 
94
-			if ( $total < 0 ) {
94
+			if ($total < 0) {
95 95
 				$totals = 0;
96 96
 			}
97 97
 
98
-			$total = round( $total, give_get_price_decimals() );
98
+			$total = round($total, give_get_price_decimals());
99 99
 
100
-			$this->store_data( 'give_temp_recount_earnings', $total );
100
+			$this->store_data('give_temp_recount_earnings', $total);
101 101
 
102 102
 			return true;
103 103
 
104 104
 		}
105 105
 
106
-		update_option( 'give_earnings_total', $total );
106
+		update_option('give_earnings_total', $total);
107 107
 
108 108
 		return false;
109 109
 
@@ -117,25 +117,25 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_percentage_complete() {
119 119
 
120
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
120
+		$total = $this->get_stored_data('give_recount_earnings_total');
121 121
 
122
-		if ( false === $total ) {
123
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
122
+		if (false === $total) {
123
+			$args = apply_filters('give_recount_earnings_total_args', array());
124 124
 
125
-			$counts = give_count_payments( $args );
126
-			$total  = absint( $counts->publish );
127
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
125
+			$counts = give_count_payments($args);
126
+			$total  = absint($counts->publish);
127
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
128 128
 
129
-			$this->store_data( 'give_recount_earnings_total', $total );
129
+			$this->store_data('give_recount_earnings_total', $total);
130 130
 		}
131 131
 
132 132
 		$percentage = 100;
133 133
 
134
-		if ( $total > 0 ) {
135
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
134
+		if ($total > 0) {
135
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
136 136
 		}
137 137
 
138
-		if ( $percentage > 100 ) {
138
+		if ($percentage > 100) {
139 139
 			$percentage = 100;
140 140
 		}
141 141
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @param array $request The Form Data passed into the batch processing
151 151
 	 */
152
-	public function set_properties( $request ) {
152
+	public function set_properties($request) {
153 153
 	}
154 154
 
155 155
 	/**
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function process_step() {
162 162
 
163
-		if ( ! $this->can_export() ) {
164
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
163
+		if ( ! $this->can_export()) {
164
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
165 165
 		}
166 166
 
167 167
 		$had_data = $this->get_data();
168 168
 
169
-		if ( $had_data ) {
169
+		if ($had_data) {
170 170
 			$this->done = false;
171 171
 
172 172
 			return true;
173 173
 		} else {
174
-			$this->delete_data( 'give_recount_earnings_total' );
175
-			$this->delete_data( 'give_temp_recount_earnings' );
174
+			$this->delete_data('give_recount_earnings_total');
175
+			$this->delete_data('give_temp_recount_earnings');
176 176
 			$this->done    = true;
177
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
177
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
178 178
 
179 179
 			return false;
180 180
 		}
@@ -211,17 +211,17 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return mixed       Returns the data from the database
213 213
 	 */
214
-	private function get_stored_data( $key ) {
214
+	private function get_stored_data($key) {
215 215
 		global $wpdb;
216
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
216
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
217 217
 
218
-		if ( empty( $value ) ) {
218
+		if (empty($value)) {
219 219
 			return false;
220 220
 		}
221 221
 
222
-		$maybe_json = json_decode( $value );
223
-		if ( ! is_null( $maybe_json ) ) {
224
-			$value = json_decode( $value, true );
222
+		$maybe_json = json_decode($value);
223
+		if ( ! is_null($maybe_json)) {
224
+			$value = json_decode($value, true);
225 225
 		}
226 226
 
227 227
 		return $value;
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	private function store_data( $key, $value ) {
240
+	private function store_data($key, $value) {
241 241
 		global $wpdb;
242 242
 
243
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
243
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
244 244
 
245 245
 		$data = array(
246 246
 			'option_name'  => $key,
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'%s',
255 255
 		);
256 256
 
257
-		$wpdb->replace( $wpdb->options, $data, $formats );
257
+		$wpdb->replace($wpdb->options, $data, $formats);
258 258
 	}
259 259
 
260 260
 	/**
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @return void
268 268
 	 */
269
-	private function delete_data( $key ) {
269
+	private function delete_data($key) {
270 270
 		global $wpdb;
271
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
271
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
272 272
 	}
273 273
 
274 274
 }
Please login to merge, or discard this patch.