Test Failed
Push — master ( 9a7225...07651e )
by Ravinder
05:42
created
includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 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
 
@@ -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
 	}
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 	 * @return array|bool $data The data for the CSV file
63 63
 	 */
64 64
 	public function get_data() {
65
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids' );
65
+		$items = $this->get_stored_data('give_temp_delete_test_ids');
66 66
 
67
-		if ( ! is_array( $items ) ) {
67
+		if ( ! is_array($items)) {
68 68
 			return false;
69 69
 		}
70 70
 
71
-		$offset     = ( $this->step - 1 ) * $this->per_step;
72
-		$step_items = array_slice( $items, $offset, $this->per_step );
73
-		$meta_table = __give_v20_bc_table_details( 'payment' );
71
+		$offset     = ($this->step - 1) * $this->per_step;
72
+		$step_items = array_slice($items, $offset, $this->per_step);
73
+		$meta_table = __give_v20_bc_table_details('payment');
74 74
 
75
-		if ( $step_items ) {
76
-			foreach ( $step_items as $item ) {
75
+		if ($step_items) {
76
+			foreach ($step_items as $item) {
77 77
 				// Delete the main payment.
78
-				give_delete_donation( absint( $item['id'] ) );
78
+				give_delete_donation(absint($item['id']));
79 79
 			}
80 80
 			return true;
81 81
 		}
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_percentage_complete() {
93 93
 
94
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids', false );
95
-		$total = count( $items );
94
+		$items = $this->get_stored_data('give_temp_delete_test_ids', false);
95
+		$total = count($items);
96 96
 
97 97
 		$percentage = 100;
98 98
 
99
-		if ( $total > 0 ) {
100
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
99
+		if ($total > 0) {
100
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
101 101
 		}
102 102
 
103
-		if ( $percentage > 100 ) {
103
+		if ($percentage > 100) {
104 104
 			$percentage = 100;
105 105
 		}
106 106
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $request The Form Data passed into the batch processing
116 116
 	 */
117
-	public function set_properties( $request ) {
117
+	public function set_properties($request) {
118 118
 	}
119 119
 
120 120
 	/**
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function process_step() {
127 127
 
128
-		if ( ! $this->can_export() ) {
129
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
128
+		if ( ! $this->can_export()) {
129
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
130 130
 		}
131 131
 
132 132
 		$had_data = $this->get_data();
133 133
 
134
-		if ( $had_data ) {
134
+		if ($had_data) {
135 135
 			$this->done = false;
136 136
 
137 137
 			return true;
138 138
 		} else {
139
-			update_option( 'give_earnings_total', give_get_total_earnings( true ), false );
140
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
139
+			update_option('give_earnings_total', give_get_total_earnings(true), false);
140
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
141 141
 
142
-			$this->delete_data( 'give_temp_delete_test_ids' );
142
+			$this->delete_data('give_temp_delete_test_ids');
143 143
 
144 144
 			$this->done    = true;
145
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
145
+			$this->message = __('Test transactions successfully deleted.', 'give');
146 146
 
147 147
 			return false;
148 148
 		}
@@ -175,27 +175,27 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function pre_fetch() {
177 177
 
178
-		if ( $this->step == 1 ) {
179
-			$this->delete_data( 'give_temp_delete_test_ids' );
178
+		if ($this->step == 1) {
179
+			$this->delete_data('give_temp_delete_test_ids');
180 180
 		}
181 181
 
182
-		$items = get_option( 'give_temp_delete_test_ids', false );
182
+		$items = get_option('give_temp_delete_test_ids', false);
183 183
 
184
-		if ( false === $items ) {
184
+		if (false === $items) {
185 185
 			$items = array();
186 186
 
187
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
187
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
188 188
 				'post_status' => 'any',
189
-				'number'      => - 1,
189
+				'number'      => -1,
190 190
 				'meta_key'    => '_give_payment_mode',
191 191
 				'meta_value'  => 'test'
192
-			) );
192
+			));
193 193
 
194
-			$posts    = new Give_Payments_Query( $args );
194
+			$posts    = new Give_Payments_Query($args);
195 195
 			$payments = $posts->get_payments();
196 196
 
197 197
 			/* @var Give_Payment $payment */
198
-			foreach ( $payments as $payment ) {
198
+			foreach ($payments as $payment) {
199 199
 				$items[] = array(
200 200
 					'id'   => (int) $payment->ID,
201 201
 					'type' => 'give_payment',
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 			// Allow filtering of items to remove with an unassociative array for each item.
206 206
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
207
-			$items = apply_filters( 'give_delete_test_items', $items );
207
+			$items = apply_filters('give_delete_test_items', $items);
208 208
 
209
-			$this->store_data( 'give_temp_delete_test_ids', $items );
209
+			$this->store_data('give_temp_delete_test_ids', $items);
210 210
 		}
211 211
 
212 212
 	}
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return mixed       Returns the data from the database
222 222
 	 */
223
-	private function get_stored_data( $key ) {
223
+	private function get_stored_data($key) {
224 224
 		global $wpdb;
225
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
225
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
226 226
 
227
-		if ( empty( $value ) ) {
227
+		if (empty($value)) {
228 228
 			return false;
229 229
 		}
230 230
 
231
-		$maybe_json = json_decode( $value );
232
-		if ( ! is_null( $maybe_json ) ) {
233
-			$value = json_decode( $value, true );
231
+		$maybe_json = json_decode($value);
232
+		if ( ! is_null($maybe_json)) {
233
+			$value = json_decode($value, true);
234 234
 		}
235 235
 
236 236
 		return $value;
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return void
248 248
 	 */
249
-	private function store_data( $key, $value ) {
249
+	private function store_data($key, $value) {
250 250
 		global $wpdb;
251 251
 
252
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
252
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
253 253
 
254 254
 		$data = array(
255 255
 			'option_name'  => $key,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			'%s',
264 264
 		);
265 265
 
266
-		$wpdb->replace( $wpdb->options, $data, $formats );
266
+		$wpdb->replace($wpdb->options, $data, $formats);
267 267
 	}
268 268
 
269 269
 	/**
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return void
277 277
 	 */
278
-	private function delete_data( $key ) {
278
+	private function delete_data($key) {
279 279
 		global $wpdb;
280
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
280
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
281 281
 	}
282 282
 
283 283
 }
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-core-settings.php 1 patch
Spacing   +75 added lines, -75 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.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		 * @return static
78 78
 		 */
79 79
 		public static function get_instance() {
80
-			if ( null === static::$instance ) {
80
+			if (null === static::$instance) {
81 81
 				self::$instance = new static();
82 82
 			}
83 83
 
@@ -104,26 +104,26 @@  discard block
 block discarded – undo
104 104
 		 * @return void
105 105
 		 */
106 106
 		private function setup_hooks() {
107
-			if ( ! $this->is_donations_import_page() ) {
107
+			if ( ! $this->is_donations_import_page()) {
108 108
 				return;
109 109
 			}
110 110
 
111 111
 			// Do not render main import tools page.
112
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
112
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
113 113
 
114 114
 			// Render donation import page
115
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
115
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
116 116
 
117 117
 			// Print the HTML.
118
-			add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 );
118
+			add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10);
119 119
 
120 120
 			// Run when form submit.
121
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
121
+			add_action('give-tools_save_import', array($this, 'save'));
122 122
 
123
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
123
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
124 124
 
125 125
 			// Used to add submit button.
126
-			add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 );
126
+			add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10);
127 127
 		}
128 128
 
129 129
 		/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 		 *
136 136
 		 * @return mixed
137 137
 		 */
138
-		public function update_notices( $messages ) {
139
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
140
-				unset( $messages['give-setting-updated'] );
138
+		public function update_notices($messages) {
139
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
140
+				unset($messages['give-setting-updated']);
141 141
 			}
142 142
 
143 143
 			return $messages;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @since 1.8.17
150 150
 		 */
151 151
 		public function submit() {
152
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
152
+			wp_nonce_field('give-save-settings', '_give-save-settings');
153 153
 			?>
154 154
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
155 155
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 			?>
170 170
 			<section>
171 171
 				<table
172
-					class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_json_valid ) ? 'give-hidden' : '' ); ?> "
172
+					class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_json_valid) ? 'give-hidden' : ''); ?> "
173 173
 					id="<?php echo "step-{$step}"; ?>">
174 174
 					<tbody>
175 175
 					<?php
176
-					switch ( $step ) {
176
+					switch ($step) {
177 177
 						case 1:
178 178
 							$this->render_upload_html();
179 179
 							break;
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		public function import_success() {
201 201
 			// Imported successfully
202 202
 
203
-			$success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false );
204
-			$undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false );
203
+			$success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false);
204
+			$undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false);
205 205
 			$query_arg_setting = array(
206 206
 				'post_type' => 'give_forms',
207 207
 				'page'      => 'give-settings',
208 208
 			);
209 209
 
210
-			if ( $undo ) {
210
+			if ($undo) {
211 211
 				$success = false;
212 212
 			}
213 213
 
@@ -220,30 +220,30 @@  discard block
 block discarded – undo
220 220
 				'undo'      => 'true',
221 221
 			);
222 222
 
223
-			$title = __( 'Settings Importing Completed!', 'give' );
224
-			if ( $success ) {
223
+			$title = __('Settings Importing Completed!', 'give');
224
+			if ($success) {
225 225
 				$query_arg_success['undo'] = '1';
226 226
 				$query_arg_success['step'] = '3';
227 227
 				$query_arg_success['success'] = '1';
228
-				$text = __( 'Undo Importing', 'give' );
228
+				$text = __('Undo Importing', 'give');
229 229
 			} else {
230
-				if ( $undo ) {
231
-					$host_give_options = get_option( 'give_settings_old', array() );
232
-					update_option( 'give_settings', $host_give_options, false );
233
-					$title = __( 'Undo of Setting Imported Completed!', 'give' );
230
+				if ($undo) {
231
+					$host_give_options = get_option('give_settings_old', array());
232
+					update_option('give_settings', $host_give_options, false);
233
+					$title = __('Undo of Setting Imported Completed!', 'give');
234 234
 				} else {
235
-					$title = __( 'Failed to import', 'give' );
235
+					$title = __('Failed to import', 'give');
236 236
 				}
237 237
 
238
-				$text = __( 'Importing Again', 'give' );
238
+				$text = __('Importing Again', 'give');
239 239
 			}
240 240
 			?>
241 241
 			<tr valign="top" class="give-import-dropdown">
242 242
 				<th colspan="2">
243 243
 					<h2><?php echo $title; ?></h2>
244 244
 					<p>
245
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
246
-						<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>
245
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
246
+						<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>
247 247
 					</p>
248 248
 				</th>
249 249
 			</tr>
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 		 * @since 1.8.17
257 257
 		 */
258 258
 		public function start_import() {
259
-			$type      = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' );
260
-			$file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' );
259
+			$type      = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace');
260
+			$file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : '');
261 261
 
262 262
 			?>
263 263
 			<tr valign="top" class="give-import-dropdown">
264 264
 				<th colspan="2">
265
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
266
-					<p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p>
265
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
266
+					<p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p>
267 267
 				</th>
268 268
 			</tr>
269 269
 
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 			$step = $this->get_step();
291 291
 			?>
292 292
 			<ol class="give-progress-steps">
293
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
294
-					<?php esc_html_e( 'Upload JSON file', 'give' ); ?>
293
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
294
+					<?php esc_html_e('Upload JSON file', 'give'); ?>
295 295
 				</li>
296
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
297
-					<?php esc_html_e( 'Import', 'give' ); ?>
296
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
297
+					<?php esc_html_e('Import', 'give'); ?>
298 298
 				</li>
299
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
300
-					<?php esc_html_e( 'Done!', 'give' ); ?>
299
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
300
+					<?php esc_html_e('Done!', 'give'); ?>
301 301
 				</li>
302 302
 			</ol>
303 303
 			<?php
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 		 * @return int $step on which step doest the import is on.
312 312
 		 */
313 313
 		public function get_step() {
314
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
314
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
315 315
 			$on_step = 1;
316 316
 
317
-			if ( empty( $step ) || 1 === $step ) {
317
+			if (empty($step) || 1 === $step) {
318 318
 				$on_step = 1;
319
-			} elseif ( 2 === $step ) {
319
+			} elseif (2 === $step) {
320 320
 				$on_step = 2;
321
-			} elseif ( 3 === $step ) {
321
+			} elseif (3 === $step) {
322 322
 				$on_step = 3;
323 323
 			}
324 324
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		 * @since 1.8.17
332 332
 		 */
333 333
 		public function render_page() {
334
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php';
334
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php';
335 335
 		}
336 336
 
337 337
 		/**
@@ -343,28 +343,28 @@  discard block
 block discarded – undo
343 343
 		 * @return void
344 344
 		 */
345 345
 		public function render_upload_html() {
346
-			$json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' );
347
-			$type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' );
346
+			$json = (isset($_POST['json']) ? give_clean($_POST['json']) : '');
347
+			$type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge');
348 348
 			$step = $this->get_step();
349 349
 
350 350
 			?>
351 351
 			<tr valign="top">
352 352
 				<th colspan="2">
353
-					<h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2>
354
-					<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>
353
+					<h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2>
354
+					<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>
355 355
 				</th>
356 356
 			</tr>
357 357
 
358 358
 			<tr valign="top">
359 359
 				<th scope="row" class="titledesc">
360
-					<label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label>
360
+					<label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label>
361 361
 				</th>
362 362
 				<td class="give-forminp">
363 363
 					<div class="give-field-wrap">
364 364
 						<label for="json">
365 365
 							<input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>"
366 366
 							       accept=".json">
367
-							<p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p>
367
+							<p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p>
368 368
 						</label>
369 369
 					</div>
370 370
 				</td>
@@ -373,21 +373,21 @@  discard block
 block discarded – undo
373 373
 			$settings = array(
374 374
 				array(
375 375
 					'id'          => 'type',
376
-					'name'        => __( 'Merge Type:', 'give' ),
377
-					'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ),
376
+					'name'        => __('Merge Type:', 'give'),
377
+					'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'),
378 378
 					'default'     => $type,
379 379
 					'type'        => 'radio_inline',
380 380
 					'options'     => array(
381
-						'merge'   => __( 'Merge', 'give' ),
382
-						'replace' => __( 'Replace', 'give' ),
381
+						'merge'   => __('Merge', 'give'),
382
+						'replace' => __('Replace', 'give'),
383 383
 					),
384 384
 				),
385 385
 			);
386 386
 
387
-			$settings = apply_filters( 'give_import_core_setting_html', $settings );
387
+			$settings = apply_filters('give_import_core_setting_html', $settings);
388 388
 
389
-			if ( empty( $this->is_json_valid ) ) {
390
-				Give_Admin_Settings::output_fields( $settings, 'give_settings' );
389
+			if (empty($this->is_json_valid)) {
390
+				Give_Admin_Settings::output_fields($settings, 'give_settings');
391 391
 				?>
392 392
 				<tr valign="top">
393 393
 					<th></th>
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						<input type="submit"
396 396
 						       class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
397 397
 						       id="recount-stats-submit"
398
-						       value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
398
+						       value="<?php esc_attr_e('Submit', 'give'); ?>"/>
399 399
 					</th>
400 400
 				</tr>
401 401
 				<?php
@@ -417,20 +417,20 @@  discard block
 block discarded – undo
417 417
 			$step = $this->get_step();
418 418
 
419 419
 			// Validation for first step.
420
-			if ( 1 === $step ) {
421
-				$type          = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' );
420
+			if (1 === $step) {
421
+				$type          = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace');
422 422
 				$core_settings = self::upload_widget_settings_file();
423
-				if ( ! empty( $core_settings['error'] ) ) {
424
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) );
423
+				if ( ! empty($core_settings['error'])) {
424
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give'));
425 425
 				} else {
426
-					$file_path = explode( '/', $core_settings['file'] );
427
-					$count     = ( count( $file_path ) - 1 );
428
-					$url       = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array(
426
+					$file_path = explode('/', $core_settings['file']);
427
+					$count     = (count($file_path) - 1);
428
+					$url       = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array(
429 429
 						'step'          => '2',
430 430
 						'importer-type' => $this->importer_type,
431 431
 						'type'          => $type,
432
-						'file_name'     => $file_path[ $count ],
433
-					) ) );
432
+						'file_name'     => $file_path[$count],
433
+					)));
434 434
 
435 435
 
436 436
 					$this->is_json_valid = $url;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		 * @return bool
446 446
 		 */
447 447
 		private function is_donations_import_page() {
448
-			return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] );
448
+			return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']);
449 449
 		}
450 450
 
451 451
 		/**
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 		 */
455 455
 		public static function upload_widget_settings_file() {
456 456
 			$upload = false;
457
-			if ( isset( $_FILES['json'] ) ) {
458
-				add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
457
+			if (isset($_FILES['json'])) {
458
+				add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
459 459
 
460
-				$upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) );
460
+				$upload = wp_handle_upload($_FILES['json'], array('test_form' => false));
461 461
 
462
-				remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
462
+				remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
463 463
 			} else {
464
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
464
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
465 465
 			}
466 466
 
467 467
 			return $upload;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		 *
473 473
 		 * @param array $existing_mimes
474 474
 		 */
475
-		public static function json_upload_mimes( $existing_mimes = array() ) {
475
+		public static function json_upload_mimes($existing_mimes = array()) {
476 476
 			$existing_mimes['json'] = 'application/json';
477 477
 
478 478
 			return $existing_mimes;
Please login to merge, or discard this patch.
includes/admin/tools/export/give-export-donations-exporter.php 1 patch
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param array $request The Form Data passed into the batch processing.
87 87
 	 */
88
-	public function set_properties( $request ) {
88
+	public function set_properties($request) {
89 89
 
90 90
 		// Set data from form submission
91
-		if ( isset( $_POST['form'] ) ) {
92
-			$this->data = give_clean( wp_parse_args( $_POST['form'] ) );
91
+		if (isset($_POST['form'])) {
92
+			$this->data = give_clean(wp_parse_args($_POST['form']));
93 93
 		}
94 94
 
95 95
 		$this->form       = $this->data['forms'];
96
-		$this->categories = ! empty( $request['give_forms_categories'] ) ? (array) $request['give_forms_categories'] : array();
97
-		$this->tags       = ! empty( $request['give_forms_tags'] ) ? (array) $request['give_forms_tags'] : array();
98
-		$this->form_id    = $this->get_form_ids( $request );
99
-		$this->price_id   = isset( $request['give_price_option'] ) && ( 'all' !== $request['give_price_option'] && '' !== $request['give_price_option'] ) ? absint( $request['give_price_option'] ) : null;
100
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
101
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
102
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
96
+		$this->categories = ! empty($request['give_forms_categories']) ? (array) $request['give_forms_categories'] : array();
97
+		$this->tags       = ! empty($request['give_forms_tags']) ? (array) $request['give_forms_tags'] : array();
98
+		$this->form_id    = $this->get_form_ids($request);
99
+		$this->price_id   = isset($request['give_price_option']) && ('all' !== $request['give_price_option'] && '' !== $request['give_price_option']) ? absint($request['give_price_option']) : null;
100
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
101
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
102
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
103 103
 
104 104
 		/**
105 105
 		 * Hook to use after setting properties.
106 106
 		 *
107 107
 		 * @since 2.1.3
108 108
 		 */
109
-		do_action( 'give_export_donations_form_data', $this->data );
109
+		do_action('give_export_donations_form_data', $this->data);
110 110
 	}
111 111
 
112 112
 	/**
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return array|boolean|null $form get all the donation id that need to be exported
120 120
 	 */
121
-	public function get_form_ids( $request = array() ) {
122
-		$form = ! empty( $request['forms'] ) && 0 !== $request['forms'] ? absint( $request['forms'] ) : null;
121
+	public function get_form_ids($request = array()) {
122
+		$form = ! empty($request['forms']) && 0 !== $request['forms'] ? absint($request['forms']) : null;
123 123
 
124
-		$form_ids = ! empty( $request['form_ids'] ) ? sanitize_text_field( $request['form_ids'] ) : null;
124
+		$form_ids = ! empty($request['form_ids']) ? sanitize_text_field($request['form_ids']) : null;
125 125
 
126
-		if ( empty( $form ) && ! empty( $form_ids ) && ( ! empty( $this->categories ) || ! empty( $this->tags ) ) ) {
127
-			$form = explode( ',', $form_ids );
126
+		if (empty($form) && ! empty($form_ids) && ( ! empty($this->categories) || ! empty($this->tags))) {
127
+			$form = explode(',', $form_ids);
128 128
 		}
129 129
 
130 130
 		return $form;
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function csv_cols() {
143 143
 
144
-		$columns = isset( $this->data['give_give_donations_export_option'] ) ? $this->data['give_give_donations_export_option'] : array();
144
+		$columns = isset($this->data['give_give_donations_export_option']) ? $this->data['give_give_donations_export_option'] : array();
145 145
 
146 146
 		// We need columns.
147
-		if ( empty( $columns ) ) {
147
+		if (empty($columns)) {
148 148
 			return false;
149 149
 		}
150 150
 
151
-		$this->cols = $this->get_cols( $columns );
151
+		$this->cols = $this->get_cols($columns);
152 152
 
153 153
 		return $this->cols;
154 154
 	}
@@ -163,88 +163,88 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array
165 165
 	 */
166
-	private function get_cols( $columns ) {
166
+	private function get_cols($columns) {
167 167
 
168 168
 		$cols = array();
169 169
 
170
-		foreach ( $columns as $key => $value ) {
170
+		foreach ($columns as $key => $value) {
171 171
 
172
-			switch ( $key ) {
172
+			switch ($key) {
173 173
 				case 'donation_id':
174
-					$cols['donation_id'] = __( 'Donation ID', 'give' );
174
+					$cols['donation_id'] = __('Donation ID', 'give');
175 175
 					break;
176 176
 				case 'seq_id':
177
-					$cols['seq_id'] = __( 'Donation Number', 'give' );
177
+					$cols['seq_id'] = __('Donation Number', 'give');
178 178
 					break;
179 179
 				case 'title_prefix':
180
-					$cols['title_prefix'] = __( 'Title Prefix', 'give' );
180
+					$cols['title_prefix'] = __('Title Prefix', 'give');
181 181
 					break;
182 182
 				case 'first_name':
183
-					$cols['first_name'] = __( 'First Name', 'give' );
183
+					$cols['first_name'] = __('First Name', 'give');
184 184
 					break;
185 185
 				case 'last_name':
186
-					$cols['last_name'] = __( 'Last Name', 'give' );
186
+					$cols['last_name'] = __('Last Name', 'give');
187 187
 					break;
188 188
 				case 'email':
189
-					$cols['email'] = __( 'Email Address', 'give' );
189
+					$cols['email'] = __('Email Address', 'give');
190 190
 					break;
191 191
 				case 'company':
192
-					$cols['company'] = __( 'Company Name', 'give' );
192
+					$cols['company'] = __('Company Name', 'give');
193 193
 					break;
194 194
 				case 'address':
195
-					$cols['address_line1']   = __( 'Address 1', 'give' );
196
-					$cols['address_line2']   = __( 'Address 2', 'give' );
197
-					$cols['address_city']    = __( 'City', 'give' );
198
-					$cols['address_state']   = __( 'State', 'give' );
199
-					$cols['address_zip']     = __( 'Zip', 'give' );
200
-					$cols['address_country'] = __( 'Country', 'give' );
195
+					$cols['address_line1']   = __('Address 1', 'give');
196
+					$cols['address_line2']   = __('Address 2', 'give');
197
+					$cols['address_city']    = __('City', 'give');
198
+					$cols['address_state']   = __('State', 'give');
199
+					$cols['address_zip']     = __('Zip', 'give');
200
+					$cols['address_country'] = __('Country', 'give');
201 201
 					break;
202 202
 				case 'donation_total':
203
-					$cols['donation_total'] = __( 'Donation Total', 'give' );
203
+					$cols['donation_total'] = __('Donation Total', 'give');
204 204
 					break;
205 205
 				case 'currency_code':
206
-					$cols['currency_code'] = __( 'Currency Code', 'give' );
206
+					$cols['currency_code'] = __('Currency Code', 'give');
207 207
 					break;
208 208
 				case 'currency_symbol':
209
-					$cols['currency_symbol'] = __( 'Currency Symbol', 'give' );
209
+					$cols['currency_symbol'] = __('Currency Symbol', 'give');
210 210
 					break;
211 211
 				case 'donation_status':
212
-					$cols['donation_status'] = __( 'Donation Status', 'give' );
212
+					$cols['donation_status'] = __('Donation Status', 'give');
213 213
 					break;
214 214
 				case 'payment_gateway':
215
-					$cols['payment_gateway'] = __( 'Payment Gateway', 'give' );
215
+					$cols['payment_gateway'] = __('Payment Gateway', 'give');
216 216
 				case 'payment_mode':
217
-					$cols['payment_mode'] = __( 'Payment Mode', 'give' );
217
+					$cols['payment_mode'] = __('Payment Mode', 'give');
218 218
 					break;
219 219
 				case 'form_id':
220
-					$cols['form_id'] = __( 'Form ID', 'give' );
220
+					$cols['form_id'] = __('Form ID', 'give');
221 221
 					break;
222 222
 				case 'form_title':
223
-					$cols['form_title'] = __( 'Form Title', 'give' );
223
+					$cols['form_title'] = __('Form Title', 'give');
224 224
 					break;
225 225
 				case 'form_level_id':
226
-					$cols['form_level_id'] = __( 'Level ID', 'give' );
226
+					$cols['form_level_id'] = __('Level ID', 'give');
227 227
 					break;
228 228
 				case 'form_level_title':
229
-					$cols['form_level_title'] = __( 'Level Title', 'give' );
229
+					$cols['form_level_title'] = __('Level Title', 'give');
230 230
 					break;
231 231
 				case 'donation_date':
232
-					$cols['donation_date'] = __( 'Donation Date', 'give' );
232
+					$cols['donation_date'] = __('Donation Date', 'give');
233 233
 					break;
234 234
 				case 'donation_time':
235
-					$cols['donation_time'] = __( 'Donation Time', 'give' );
235
+					$cols['donation_time'] = __('Donation Time', 'give');
236 236
 					break;
237 237
 				case 'userid':
238
-					$cols['userid'] = __( 'User ID', 'give' );
238
+					$cols['userid'] = __('User ID', 'give');
239 239
 					break;
240 240
 				case 'donorid':
241
-					$cols['donorid'] = __( 'Donor ID', 'give' );
241
+					$cols['donorid'] = __('Donor ID', 'give');
242 242
 					break;
243 243
 				case 'donor_ip':
244
-					$cols['donor_ip'] = __( 'Donor IP Address', 'give' );
244
+					$cols['donor_ip'] = __('Donor IP Address', 'give');
245 245
 					break;
246 246
 				default:
247
-					$cols[ $key ] = $key;
247
+					$cols[$key] = $key;
248 248
 
249 249
 			}
250 250
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 * @param array $cols columns name for CSV
258 258
 		 * @param array $columns columns select by admin to export
259 259
 		 */
260
-		return (array) apply_filters( 'give_export_donation_get_columns_name', $cols, $columns );
260
+		return (array) apply_filters('give_export_donation_get_columns_name', $cols, $columns);
261 261
 	}
262 262
 
263 263
 	/**
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return array $args donation argument
271 271
 	 */
272
-	public function get_donation_argument( $args = array() ) {
272
+	public function get_donation_argument($args = array()) {
273 273
 		$defaults = array(
274 274
 			'number' => 30,
275 275
 			'page'   => $this->step,
276 276
 			'status' => $this->status,
277 277
 		);
278 278
 		// Date query.
279
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
280
-			if ( ! empty( $this->start ) ) {
281
-				$defaults['date_query'][0]['after'] = date( 'Y-n-d 00:00:00', strtotime( $this->start ) );
279
+		if ( ! empty($this->start) || ! empty($this->end)) {
280
+			if ( ! empty($this->start)) {
281
+				$defaults['date_query'][0]['after'] = date('Y-n-d 00:00:00', strtotime($this->start));
282 282
 			}
283
-			if ( ! empty( $this->end ) ) {
284
-				$defaults['date_query'][0]['before'] = date( 'Y-n-d 00:00:00', strtotime( $this->end ) );
283
+			if ( ! empty($this->end)) {
284
+				$defaults['date_query'][0]['before'] = date('Y-n-d 00:00:00', strtotime($this->end));
285 285
 			}
286 286
 		}
287 287
 
288
-		if ( ! empty( $this->form_id ) ) {
289
-			$defaults['give_forms'] = is_array( $this->form_id ) ? $this->form_id : array( $this->form_id );
288
+		if ( ! empty($this->form_id)) {
289
+			$defaults['give_forms'] = is_array($this->form_id) ? $this->form_id : array($this->form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 2.1.3
297 297
 		 */
298
-		return apply_filters( 'give_export_donations_donation_query_args', wp_parse_args( $args, $defaults ) );
298
+		return apply_filters('give_export_donations_donation_query_args', wp_parse_args($args, $defaults));
299 299
 	}
300 300
 
301 301
 	/**
@@ -314,130 +314,130 @@  discard block
 block discarded – undo
314 314
 		$data = array();
315 315
 		$i    = 0;
316 316
 		// Payment query.
317
-		$payments = give_get_payments( $this->get_donation_argument() );
317
+		$payments = give_get_payments($this->get_donation_argument());
318 318
 
319
-		if ( $payments ) {
319
+		if ($payments) {
320 320
 
321
-			foreach ( $payments as $payment ) {
321
+			foreach ($payments as $payment) {
322 322
 
323 323
 				$columns      = $this->csv_cols();
324
-				$payment      = new Give_Payment( $payment->ID );
324
+				$payment      = new Give_Payment($payment->ID);
325 325
 				$payment_meta = $payment->payment_meta;
326 326
 				$address      = $payment->address;
327 327
 
328 328
 				// Set columns.
329
-				if ( ! empty( $columns['donation_id'] ) ) {
330
-					$data[ $i ]['donation_id'] = $payment->ID;
329
+				if ( ! empty($columns['donation_id'])) {
330
+					$data[$i]['donation_id'] = $payment->ID;
331 331
 				}
332 332
 
333
-				if ( ! empty( $columns['seq_id'] ) ) {
334
-					$data[ $i ]['seq_id'] = Give()->seq_donation_number->get_serial_code( $payment->ID );
333
+				if ( ! empty($columns['seq_id'])) {
334
+					$data[$i]['seq_id'] = Give()->seq_donation_number->get_serial_code($payment->ID);
335 335
 				}
336 336
 
337
-				if ( ! empty( $columns['title_prefix'] ) ) {
338
-					$data[ $i ]['title_prefix'] = ! empty( $payment->title_prefix ) ? $payment->title_prefix : '';
337
+				if ( ! empty($columns['title_prefix'])) {
338
+					$data[$i]['title_prefix'] = ! empty($payment->title_prefix) ? $payment->title_prefix : '';
339 339
 				}
340 340
 
341
-				if ( ! empty( $columns['first_name'] ) ) {
342
-					$data[ $i ]['first_name'] = isset( $payment->first_name ) ? $payment->first_name : '';
341
+				if ( ! empty($columns['first_name'])) {
342
+					$data[$i]['first_name'] = isset($payment->first_name) ? $payment->first_name : '';
343 343
 				}
344 344
 
345
-				if ( ! empty( $columns['last_name'] ) ) {
346
-					$data[ $i ]['last_name'] = isset( $payment->last_name ) ? $payment->last_name : '';
345
+				if ( ! empty($columns['last_name'])) {
346
+					$data[$i]['last_name'] = isset($payment->last_name) ? $payment->last_name : '';
347 347
 				}
348 348
 
349
-				if ( ! empty( $columns['email'] ) ) {
350
-					$data[ $i ]['email'] = $payment->email;
349
+				if ( ! empty($columns['email'])) {
350
+					$data[$i]['email'] = $payment->email;
351 351
 				}
352 352
 
353
-				if ( ! empty( $columns['company'] ) ) {
354
-					$data[ $i ]['company'] = empty( $payment_meta['_give_donation_company'] ) ? '' : str_replace( "\'", "'", $payment_meta['_give_donation_company'] );
353
+				if ( ! empty($columns['company'])) {
354
+					$data[$i]['company'] = empty($payment_meta['_give_donation_company']) ? '' : str_replace("\'", "'", $payment_meta['_give_donation_company']);
355 355
 				}
356 356
 
357
-				if ( ! empty( $columns['address_line1'] ) ) {
358
-					$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
359
-					$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
360
-					$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
361
-					$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
362
-					$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
363
-					$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
357
+				if ( ! empty($columns['address_line1'])) {
358
+					$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
359
+					$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
360
+					$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
361
+					$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
362
+					$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
363
+					$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
364 364
 				}
365 365
 
366
-				if ( ! empty( $columns['donation_total'] ) ) {
367
-					$data[ $i ]['donation_total'] = give_format_amount( give_donation_amount( $payment->ID ) );
366
+				if ( ! empty($columns['donation_total'])) {
367
+					$data[$i]['donation_total'] = give_format_amount(give_donation_amount($payment->ID));
368 368
 				}
369 369
 
370
-				if ( ! empty( $columns['currency_code'] ) ) {
371
-					$data[ $i ]['currency_code'] = empty( $payment_meta['_give_payment_currency'] ) ? give_get_currency() : $payment_meta['_give_payment_currency'];
370
+				if ( ! empty($columns['currency_code'])) {
371
+					$data[$i]['currency_code'] = empty($payment_meta['_give_payment_currency']) ? give_get_currency() : $payment_meta['_give_payment_currency'];
372 372
 				}
373 373
 
374
-				if ( ! empty( $columns['currency_symbol'] ) ) {
375
-					$currency_code                 = $data[ $i ]['currency_code'];
376
-					$data[ $i ]['currency_symbol'] = give_currency_symbol( $currency_code, true );
374
+				if ( ! empty($columns['currency_symbol'])) {
375
+					$currency_code                 = $data[$i]['currency_code'];
376
+					$data[$i]['currency_symbol'] = give_currency_symbol($currency_code, true);
377 377
 				}
378 378
 
379
-				if ( ! empty( $columns['donation_status'] ) ) {
380
-					$data[ $i ]['donation_status'] = give_get_payment_status( $payment, true );
379
+				if ( ! empty($columns['donation_status'])) {
380
+					$data[$i]['donation_status'] = give_get_payment_status($payment, true);
381 381
 				}
382 382
 
383
-				if ( ! empty( $columns['payment_gateway'] ) ) {
384
-					$data[ $i ]['payment_gateway'] = $payment->gateway;
383
+				if ( ! empty($columns['payment_gateway'])) {
384
+					$data[$i]['payment_gateway'] = $payment->gateway;
385 385
 				}
386 386
 
387
-				if ( ! empty( $columns['payment_mode'] ) ) {
388
-					$data[ $i ]['payment_mode'] = $payment->mode;
387
+				if ( ! empty($columns['payment_mode'])) {
388
+					$data[$i]['payment_mode'] = $payment->mode;
389 389
 				}
390 390
 
391
-				if ( ! empty( $columns['form_id'] ) ) {
392
-					$data[ $i ]['form_id'] = $payment->form_id;
391
+				if ( ! empty($columns['form_id'])) {
392
+					$data[$i]['form_id'] = $payment->form_id;
393 393
 				}
394 394
 
395
-				if ( ! empty( $columns['form_title'] ) ) {
396
-					$data[ $i ]['form_title'] = get_the_title( $payment->form_id );
395
+				if ( ! empty($columns['form_title'])) {
396
+					$data[$i]['form_title'] = get_the_title($payment->form_id);
397 397
 				}
398 398
 
399
-				if ( ! empty( $columns['form_level_id'] ) ) {
400
-					$data[ $i ]['form_level_id'] = $payment->price_id;
399
+				if ( ! empty($columns['form_level_id'])) {
400
+					$data[$i]['form_level_id'] = $payment->price_id;
401 401
 				}
402 402
 
403
-				if ( ! empty( $columns['form_level_title'] ) ) {
404
-					$var_prices = give_has_variable_prices( $payment->form_id );
405
-					if ( empty( $var_prices ) ) {
406
-						$data[ $i ]['form_level_title'] = '';
403
+				if ( ! empty($columns['form_level_title'])) {
404
+					$var_prices = give_has_variable_prices($payment->form_id);
405
+					if (empty($var_prices)) {
406
+						$data[$i]['form_level_title'] = '';
407 407
 					} else {
408
-						if ( 'custom' === $payment->price_id ) {
409
-							$custom_amount_text = give_get_meta( $payment->form_id, '_give_custom_amount_text', true );
408
+						if ('custom' === $payment->price_id) {
409
+							$custom_amount_text = give_get_meta($payment->form_id, '_give_custom_amount_text', true);
410 410
 
411
-							if ( empty( $custom_amount_text ) ) {
412
-								$custom_amount_text = esc_html__( 'Custom', 'give' );
411
+							if (empty($custom_amount_text)) {
412
+								$custom_amount_text = esc_html__('Custom', 'give');
413 413
 							}
414
-							$data[ $i ]['form_level_title'] = $custom_amount_text;
414
+							$data[$i]['form_level_title'] = $custom_amount_text;
415 415
 						} else {
416
-							$data[ $i ]['form_level_title'] = give_get_price_option_name( $payment->form_id, $payment->price_id );
416
+							$data[$i]['form_level_title'] = give_get_price_option_name($payment->form_id, $payment->price_id);
417 417
 						}
418 418
 					}
419 419
 				}
420 420
 
421
-				if ( ! empty( $columns['donation_date'] ) ) {
422
-					$payment_date                = strtotime( $payment->date );
423
-					$data[ $i ]['donation_date'] = date( give_date_format(), $payment_date );
421
+				if ( ! empty($columns['donation_date'])) {
422
+					$payment_date                = strtotime($payment->date);
423
+					$data[$i]['donation_date'] = date(give_date_format(), $payment_date);
424 424
 				}
425 425
 
426
-				if ( ! empty( $columns['donation_time'] ) ) {
427
-					$payment_date                = strtotime( $payment->date );
428
-					$data[ $i ]['donation_time'] = date_i18n( 'H', $payment_date ) . ':' . date( 'i', $payment_date );
426
+				if ( ! empty($columns['donation_time'])) {
427
+					$payment_date                = strtotime($payment->date);
428
+					$data[$i]['donation_time'] = date_i18n('H', $payment_date).':'.date('i', $payment_date);
429 429
 				}
430 430
 
431
-				if ( ! empty( $columns['userid'] ) ) {
432
-					$data[ $i ]['userid'] = $payment->user_id;
431
+				if ( ! empty($columns['userid'])) {
432
+					$data[$i]['userid'] = $payment->user_id;
433 433
 				}
434 434
 
435
-				if ( ! empty( $columns['donorid'] ) ) {
436
-					$data[ $i ]['donorid'] = $payment->customer_id;
435
+				if ( ! empty($columns['donorid'])) {
436
+					$data[$i]['donorid'] = $payment->customer_id;
437 437
 				}
438 438
 
439
-				if ( ! empty( $columns['donor_ip'] ) ) {
440
-					$data[ $i ]['donor_ip'] = give_get_payment_user_ip( $payment->ID );
439
+				if ( ! empty($columns['donor_ip'])) {
440
+					$data[$i]['donor_ip'] = give_get_payment_user_ip($payment->ID);
441 441
 				}
442 442
 
443 443
 				// Add custom field data.
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 				);
470 470
 
471 471
 				// Removing above keys...
472
-				foreach ( $remove_keys as $key ) {
473
-					unset( $columns[ $key ] );
472
+				foreach ($remove_keys as $key) {
473
+					unset($columns[$key]);
474 474
 				}
475 475
 
476 476
 				// Now loop through remaining meta fields.
477
-				foreach ( $columns as $col ) {
478
-					$field_data         = get_post_meta( $payment->ID, $col, true );
479
-					$data[ $i ][ $col ] = $field_data;
480
-					unset( $columns[ $col ] );
477
+				foreach ($columns as $col) {
478
+					$field_data         = get_post_meta($payment->ID, $col, true);
479
+					$data[$i][$col] = $field_data;
480
+					unset($columns[$col]);
481 481
 				}
482 482
 
483 483
 				/**
@@ -492,27 +492,27 @@  discard block
 block discarded – undo
492 492
 				 *
493 493
 				 * @return array Donation data
494 494
 				 */
495
-				$data[ $i ] = apply_filters( 'give_export_donation_data', $data[ $i ], $payment, $columns, $this );
495
+				$data[$i] = apply_filters('give_export_donation_data', $data[$i], $payment, $columns, $this);
496 496
 
497 497
 				$new_data = array();
498
-				$old_data = $data[ $i ];
498
+				$old_data = $data[$i];
499 499
 
500 500
 				// sorting the columns bas on row
501
-				foreach ( $this->csv_cols() as $key => $value ) {
502
-					if ( array_key_exists( $key, $old_data ) ) {
503
-						$new_data[ $key ] = $old_data[ $key ];
501
+				foreach ($this->csv_cols() as $key => $value) {
502
+					if (array_key_exists($key, $old_data)) {
503
+						$new_data[$key] = $old_data[$key];
504 504
 					}
505 505
 				}
506 506
 
507
-				$data[ $i ] = $new_data;
507
+				$data[$i] = $new_data;
508 508
 
509 509
 				// Increment iterator.
510
-				$i ++;
510
+				$i++;
511 511
 
512 512
 			}
513 513
 
514
-			$data = apply_filters( 'give_export_get_data', $data );
515
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
514
+			$data = apply_filters('give_export_get_data', $data);
515
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
516 516
 
517 517
 			return $data;
518 518
 
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
 	 * @return int
531 531
 	 */
532 532
 	public function get_percentage_complete() {
533
-		$args = $this->get_donation_argument( array( 'number' => - 1 ) );
534
-		if ( isset( $args['page'] ) ) {
535
-			unset( $args['page'] );
533
+		$args = $this->get_donation_argument(array('number' => -1));
534
+		if (isset($args['page'])) {
535
+			unset($args['page']);
536 536
 		}
537
-		$query      = give_get_payments( $args );
538
-		$total      = count( $query );
537
+		$query      = give_get_payments($args);
538
+		$total      = count($query);
539 539
 		$percentage = 100;
540
-		if ( $total > 0 ) {
541
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
540
+		if ($total > 0) {
541
+			$percentage = ((30 * $this->step) / $total) * 100;
542 542
 		}
543
-		if ( $percentage > 100 ) {
543
+		if ($percentage > 100) {
544 544
 			$percentage = 100;
545 545
 		}
546 546
 
@@ -562,23 +562,23 @@  discard block
 block discarded – undo
562 562
 		$data     = $this->get_data();
563 563
 		$cols     = $this->get_csv_cols();
564 564
 
565
-		if ( $data ) {
565
+		if ($data) {
566 566
 
567 567
 			// Output each row
568
-			foreach ( $data as $row ) {
568
+			foreach ($data as $row) {
569 569
 				$i = 1;
570
-				foreach ( $row as $col_id => $column ) {
570
+				foreach ($row as $col_id => $column) {
571 571
 					// Make sure the column is valid
572
-					if ( array_key_exists( $col_id, $cols ) ) {
573
-						$row_data .= '"' . preg_replace( '/"/', "'", $column ) . '"';
574
-						$row_data .= $i == count( $cols ) ? '' : ',';
575
-						$i ++;
572
+					if (array_key_exists($col_id, $cols)) {
573
+						$row_data .= '"'.preg_replace('/"/', "'", $column).'"';
574
+						$row_data .= $i == count($cols) ? '' : ',';
575
+						$i++;
576 576
 					}
577 577
 				}
578 578
 				$row_data .= "\r\n";
579 579
 			}
580 580
 
581
-			$this->stash_step_data( $row_data );
581
+			$this->stash_step_data($row_data);
582 582
 
583 583
 			return $row_data;
584 584
 		}
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 1 patch
Spacing   +158 added lines, -158 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
 
@@ -25,136 +25,136 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
-		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
38
+	if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) {
39
+		wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403));
40 40
 	}
41 41
 
42
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
42
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php';
43 43
 
44 44
 	$daterange = utf8_decode(
45 45
 		sprintf(
46 46
 		/* translators: 1: start date 2: end date */
47
-			__( '%1$s to %2$s', 'give' ),
48
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
49
-			date_i18n( give_date_format() )
47
+			__('%1$s to %2$s', 'give'),
48
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
49
+			date_i18n(give_date_format())
50 50
 		)
51 51
 	);
52 52
 
53
-	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
54
-	$tags_enabled       = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
53
+	$categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
54
+	$tags_enabled       = give_is_setting_enabled(give_get_option('tags', 'disabled'));
55 55
 
56
-	$pdf          = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false );
57
-	$default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' );
56
+	$pdf          = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false);
57
+	$default_font = apply_filters('give_pdf_default_font', 'Helvetica');
58 58
 	$custom_font  = 'dejavusans';
59 59
 	$font_style   = '';
60 60
 
61 61
 	if (
62
-		file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) &&
62
+		file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') &&
63 63
 
64 64
 		// RIAL exist for backward compatibility.
65
-		in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) )
65
+		in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR'))
66 66
 	) {
67
-		TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' );
67
+		TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', '');
68 68
 		$custom_font = 'CODE2000';
69 69
 		$font_style  = 'B';
70 70
 	}
71 71
 
72
-	$pdf->AddPage( 'L', 'A4' );
73
-	$pdf->setImageScale( 1.5 );
74
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
75
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
76
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
72
+	$pdf->AddPage('L', 'A4');
73
+	$pdf->setImageScale(1.5);
74
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
75
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
76
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
77 77
 
78 78
 	// Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/.
79
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/dist/images/give-logo-small.png' ), 247, 8 );
79
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/dist/images/give-logo-small.png'), 247, 8);
80 80
 
81
-	$pdf->SetMargins( 8, 8, 8 );
82
-	$pdf->SetX( 8 );
81
+	$pdf->SetMargins(8, 8, 8);
82
+	$pdf->SetX(8);
83 83
 
84
-	$pdf->SetFont( $default_font, '', 16 );
85
-	$pdf->SetTextColor( 50, 50, 50 );
86
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
84
+	$pdf->SetFont($default_font, '', 16);
85
+	$pdf->SetTextColor(50, 50, 50);
86
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
87 87
 
88
-	$pdf->SetFont( $default_font, '', 13 );
89
-	$pdf->SetTextColor( 150, 150, 150 );
90
-	$pdf->Ln( 1 );
91
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
88
+	$pdf->SetFont($default_font, '', 13);
89
+	$pdf->SetTextColor(150, 150, 150);
90
+	$pdf->Ln(1);
91
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
92 92
 	$pdf->Ln();
93
-	$pdf->SetTextColor( 50, 50, 50 );
94
-	$pdf->SetFont( $default_font, '', 14 );
95
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
96
-	$pdf->SetFont( $default_font, '', 12 );
93
+	$pdf->SetTextColor(50, 50, 50);
94
+	$pdf->SetFont($default_font, '', 14);
95
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
96
+	$pdf->SetFont($default_font, '', 12);
97 97
 
98
-	$pdf->SetFillColor( 238, 238, 238 );
99
-	$pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color.
100
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
101
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
98
+	$pdf->SetFillColor(238, 238, 238);
99
+	$pdf->SetTextColor(0, 0, 0, 100); // Set Black color.
100
+	$pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
101
+	$pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
102 102
 
103 103
 	// Display Categories Heading only, if user has opted for it.
104
-	if ( $categories_enabled ) {
105
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
104
+	if ($categories_enabled) {
105
+		$pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
106 106
 	}
107 107
 
108 108
 	// Display Tags Heading only, if user has opted for it.
109
-	if ( $tags_enabled ) {
110
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
109
+	if ($tags_enabled) {
110
+		$pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
111 111
 	}
112 112
 
113
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
114
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
113
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
114
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
115 115
 
116 116
 	// Set Custom Font to support various currencies.
117
-	$pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 );
117
+	$pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12);
118 118
 
119 119
 	// Object for getting stats.
120 120
 	$donation_stats = new Give_Payment_Stats();
121 121
 
122
-	$give_forms = get_posts( array(
122
+	$give_forms = get_posts(array(
123 123
 		'post_type'        => 'give_forms',
124
-		'posts_per_page'   => - 1,
124
+		'posts_per_page'   => -1,
125 125
 		'suppress_filters' => false,
126
-	) );
126
+	));
127 127
 
128
-	if ( $give_forms ) {
129
-		$pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) );
128
+	if ($give_forms) {
129
+		$pdf->SetWidths(array(50, 50, 45, 45, 45, 45));
130 130
 
131
-		foreach ( $give_forms as $form ):
132
-			$pdf->SetFillColor( 255, 255, 255 );
131
+		foreach ($give_forms as $form):
132
+			$pdf->SetFillColor(255, 255, 255);
133 133
 
134 134
 			$title = $form->post_title;
135 135
 
136
-			if ( give_has_variable_prices( $form->ID ) ) {
137
-				$price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' );
136
+			if (give_has_variable_prices($form->ID)) {
137
+				$price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8');
138 138
 			} else {
139
-				$price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) );
139
+				$price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true));
140 140
 			}
141 141
 
142 142
 			// Display Categories Data only, if user has opted for it.
143 143
 			$categories = array();
144
-			if ( $categories_enabled ) {
145
-				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
146
-				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
144
+			if ($categories_enabled) {
145
+				$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
146
+				$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
147 147
 			}
148 148
 
149 149
 			// Display Tags Data only, if user has opted for it.
150 150
 			$tags = array();
151
-			if ( $tags_enabled ) {
152
-				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
153
-				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
151
+			if ($tags_enabled) {
152
+				$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
153
+				$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
154 154
 			}
155 155
 
156
-			$sales    = $donation_stats->get_sales( $form->ID, 'this_year' );
157
-			$earnings = give_currency_filter( give_format_amount( $donation_stats->get_earnings( $form->ID, 'this_year' ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) );
156
+			$sales    = $donation_stats->get_sales($form->ID, 'this_year');
157
+			$earnings = give_currency_filter(give_format_amount($donation_stats->get_earnings($form->ID, 'this_year'), array('sanitize' => false,)), array('decode_currency' => true));
158 158
 
159 159
 			// This will help filter data before appending it to PDF Receipt.
160 160
 			$prepare_pdf_data   = array();
@@ -162,54 +162,54 @@  discard block
 block discarded – undo
162 162
 			$prepare_pdf_data[] = $price;
163 163
 
164 164
 			// Append Categories Data only, if user has opted for it.
165
-			if ( $categories_enabled ) {
165
+			if ($categories_enabled) {
166 166
 				$prepare_pdf_data[] = $categories;
167 167
 			}
168 168
 
169 169
 			// Append Tags Data only, if user has opted for it.
170
-			if ( $tags_enabled ) {
170
+			if ($tags_enabled) {
171 171
 				$prepare_pdf_data[] = $tags;
172 172
 			}
173 173
 
174 174
 			$prepare_pdf_data[] = $sales;
175 175
 			$prepare_pdf_data[] = $earnings;
176 176
 
177
-			$pdf->Row( $prepare_pdf_data );
177
+			$pdf->Row($prepare_pdf_data);
178 178
 
179 179
 		endforeach;
180 180
 	} else {
181 181
 
182 182
 		// Fix: Minor Styling Alignment Issue for PDF.
183
-		if ( $categories_enabled && $tags_enabled ) {
183
+		if ($categories_enabled && $tags_enabled) {
184 184
 			$no_found_width = 280;
185
-		} elseif ( $categories_enabled || $tags_enabled ) {
185
+		} elseif ($categories_enabled || $tags_enabled) {
186 186
 			$no_found_width = 235;
187 187
 		} else {
188 188
 			$no_found_width = 190;
189 189
 		}
190
-		$title = utf8_decode( __( 'No forms found.', 'give' ) );
191
-		$pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false );
190
+		$title = utf8_decode(__('No forms found.', 'give'));
191
+		$pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false);
192 192
 	}// End if().
193 193
 	$pdf->Ln();
194
-	$pdf->SetTextColor( 50, 50, 50 );
195
-	$pdf->SetFont( $default_font, '', 14 );
194
+	$pdf->SetTextColor(50, 50, 50);
195
+	$pdf->SetFont($default_font, '', 14);
196 196
 
197 197
 	// Output Graph on a new page.
198
-	$pdf->AddPage( 'L', 'A4' );
199
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
200
-	$pdf->SetFont( $default_font, '', 12 );
198
+	$pdf->AddPage('L', 'A4');
199
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
200
+	$pdf->SetFont($default_font, '', 12);
201 201
 
202
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
203
-	$image = str_replace( ' ', '%20', $image );
202
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
203
+	$image = str_replace(' ', '%20', $image);
204 204
 
205
-	$pdf->SetX( 25 );
206
-	$pdf->Image( $image . '&file=.png' );
207
-	$pdf->Ln( 7 );
208
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
205
+	$pdf->SetX(25);
206
+	$pdf->Image($image.'&file=.png');
207
+	$pdf->Ln(7);
208
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
209 209
 	exit();
210 210
 }
211 211
 
212
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
212
+add_action('give_generate_pdf', 'give_generate_pdf');
213 213
 
214 214
 /**
215 215
  * Draws Chart for PDF Report.
@@ -226,38 +226,38 @@  discard block
 block discarded – undo
226 226
  * @return string $chart->getUrl() URL for the Google Chart
227 227
  */
228 228
 function give_draw_chart_image() {
229
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
230
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
231
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
229
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
230
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
231
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
232 232
 
233
-	$chart = new GoogleChart( 'lc', 900, 330 );
233
+	$chart = new GoogleChart('lc', 900, 330);
234 234
 
235 235
 	$i        = 1;
236 236
 	$earnings = "";
237 237
 	$sales    = "";
238 238
 
239
-	while ( $i <= 12 ) :
240
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
241
-		$sales    .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
242
-		$i ++;
239
+	while ($i <= 12) :
240
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
241
+		$sales    .= give_get_sales_by_date(null, $i, date('Y')).",";
242
+		$i++;
243 243
 	endwhile;
244 244
 
245
-	$earnings_array = explode( ",", $earnings );
246
-	$sales_array    = explode( ",", $sales );
245
+	$earnings_array = explode(",", $earnings);
246
+	$sales_array    = explode(",", $sales);
247 247
 
248 248
 	$i = 0;
249
-	while ( $i <= 11 ) {
250
-		if ( empty( $sales_array[ $i ] ) ) {
251
-			$sales_array[ $i ] = 0;
249
+	while ($i <= 11) {
250
+		if (empty($sales_array[$i])) {
251
+			$sales_array[$i] = 0;
252 252
 		}
253
-		$i ++;
253
+		$i++;
254 254
 	}
255 255
 
256 256
 	$min_earnings   = 0;
257
-	$max_earnings   = max( $earnings_array );
258
-	$earnings_scale = round( $max_earnings, - 1 );
257
+	$max_earnings   = max($earnings_array);
258
+	$earnings_scale = round($max_earnings, - 1);
259 259
 
260
-	$data = new GoogleChartData( array(
260
+	$data = new GoogleChartData(array(
261 261
 		$earnings_array[0],
262 262
 		$earnings_array[1],
263 263
 		$earnings_array[2],
@@ -270,25 +270,25 @@  discard block
 block discarded – undo
270 270
 		$earnings_array[9],
271 271
 		$earnings_array[10],
272 272
 		$earnings_array[11],
273
-	) );
273
+	));
274 274
 
275
-	$data->setLegend( __( 'Income', 'give' ) );
276
-	$data->setColor( '1b58a3' );
277
-	$chart->addData( $data );
275
+	$data->setLegend(__('Income', 'give'));
276
+	$data->setColor('1b58a3');
277
+	$chart->addData($data);
278 278
 
279
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
280
-	$shape_marker->setColor( '000000' );
281
-	$shape_marker->setSize( 7 );
282
-	$shape_marker->setBorder( 2 );
283
-	$shape_marker->setData( $data );
284
-	$chart->addMarker( $shape_marker );
279
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
280
+	$shape_marker->setColor('000000');
281
+	$shape_marker->setSize(7);
282
+	$shape_marker->setBorder(2);
283
+	$shape_marker->setData($data);
284
+	$chart->addMarker($shape_marker);
285 285
 
286
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
287
-	$value_marker->setColor( '000000' );
288
-	$value_marker->setData( $data );
289
-	$chart->addMarker( $value_marker );
286
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
287
+	$value_marker->setColor('000000');
288
+	$value_marker->setData($data);
289
+	$chart->addMarker($value_marker);
290 290
 
291
-	$data = new GoogleChartData( array(
291
+	$data = new GoogleChartData(array(
292 292
 		$sales_array[0],
293 293
 		$sales_array[1],
294 294
 		$sales_array[2],
@@ -301,46 +301,46 @@  discard block
 block discarded – undo
301 301
 		$sales_array[9],
302 302
 		$sales_array[10],
303 303
 		$sales_array[11],
304
-	) );
305
-	$data->setLegend( __( 'Donations', 'give' ) );
306
-	$data->setColor( 'ff6c1c' );
307
-	$chart->addData( $data );
308
-
309
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
310
-
311
-	$chart->setScale( 0, $max_earnings );
312
-
313
-	$y_axis = new GoogleChartAxis( 'y' );
314
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
315
-	$chart->addAxis( $y_axis );
316
-
317
-	$x_axis = new GoogleChartAxis( 'x' );
318
-	$x_axis->setTickMarks( 5 );
319
-	$x_axis->setLabels( array(
320
-		__( 'Jan', 'give' ),
321
-		__( 'Feb', 'give' ),
322
-		__( 'Mar', 'give' ),
323
-		__( 'Apr', 'give' ),
324
-		__( 'May', 'give' ),
325
-		__( 'June', 'give' ),
326
-		__( 'July', 'give' ),
327
-		__( 'Aug', 'give' ),
328
-		__( 'Sept', 'give' ),
329
-		__( 'Oct', 'give' ),
330
-		__( 'Nov', 'give' ),
331
-		__( 'Dec', 'give' ),
332
-	) );
333
-	$chart->addAxis( $x_axis );
334
-
335
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
336
-	$shape_marker->setSize( 6 );
337
-	$shape_marker->setBorder( 2 );
338
-	$shape_marker->setData( $data );
339
-	$chart->addMarker( $shape_marker );
340
-
341
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
342
-	$value_marker->setData( $data );
343
-	$chart->addMarker( $value_marker );
304
+	));
305
+	$data->setLegend(__('Donations', 'give'));
306
+	$data->setColor('ff6c1c');
307
+	$chart->addData($data);
308
+
309
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
310
+
311
+	$chart->setScale(0, $max_earnings);
312
+
313
+	$y_axis = new GoogleChartAxis('y');
314
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
315
+	$chart->addAxis($y_axis);
316
+
317
+	$x_axis = new GoogleChartAxis('x');
318
+	$x_axis->setTickMarks(5);
319
+	$x_axis->setLabels(array(
320
+		__('Jan', 'give'),
321
+		__('Feb', 'give'),
322
+		__('Mar', 'give'),
323
+		__('Apr', 'give'),
324
+		__('May', 'give'),
325
+		__('June', 'give'),
326
+		__('July', 'give'),
327
+		__('Aug', 'give'),
328
+		__('Sept', 'give'),
329
+		__('Oct', 'give'),
330
+		__('Nov', 'give'),
331
+		__('Dec', 'give'),
332
+	));
333
+	$chart->addAxis($x_axis);
334
+
335
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
336
+	$shape_marker->setSize(6);
337
+	$shape_marker->setBorder(2);
338
+	$shape_marker->setData($data);
339
+	$chart->addMarker($shape_marker);
340
+
341
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
342
+	$value_marker->setData($data);
343
+	$chart->addMarker($value_marker);
344 344
 
345 345
 	return $chart->getUrl();
346 346
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 2 patches
Spacing   +36 added lines, -36 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
 
@@ -18,70 +18,70 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
25
-		<?php if ( ! empty( $db_updates ) ) : ?>
25
+		<?php if ( ! empty($db_updates)) : ?>
26 26
 			<?php
27 27
 			$is_doing_updates = $give_updates->is_doing_updates();
28
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
29
-			$resume_updates   = get_option( 'give_doing_upgrade' );
30
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
28
+			$db_update_url    = add_query_arg(array('type' => 'database',));
29
+			$resume_updates   = get_option('give_doing_upgrade');
30
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
31 31
 			?>
32 32
 			<div class="give-update-panel-content">
33
-				<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
33
+				<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
34 34
 			</div>
35 35
 
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43 43
 									<?php
44
-									if( ! give_test_ajax_works() ) {
44
+									if ( ! give_test_ajax_works()) {
45 45
 										echo sprintf(
46 46
 											'<div class="notice notice-warning inline"><p>%s</p></div>',
47
-											__( 'Give is currently updating the database. Please do not refresh or leave this page while the update is in progress.', 'give' )
47
+											__('Give is currently updating the database. Please do not refresh or leave this page while the update is in progress.', 'give')
48 48
 										);
49 49
 									}
50 50
 									?>
51 51
 									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
52 52
 										<?php
53 53
 										echo sprintf(
54
-											__( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ),
54
+											__('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'),
55 55
 											$is_doing_updates
56 56
 												? sprintf(
57 57
 													'%s%s',
58
-													__( 'Give is currently updating the database', 'give' ),
59
-													give_test_ajax_works() ?  ' ' . __( 'in the background.', 'give' ) : '.'
58
+													__('Give is currently updating the database', 'give'),
59
+													give_test_ajax_works() ? ' '.__('in the background.', 'give') : '.'
60 60
 												)
61
-												: __( 'Give needs to update the database.', 'give' ),
61
+												: __('Give needs to update the database.', 'give'),
62 62
 											$db_update_url,
63
-											( $is_doing_updates ? 'give-hidden' : '' ),
64
-											__( 'Update now', 'give' )
63
+											($is_doing_updates ? 'give-hidden' : ''),
64
+											__('Update now', 'give')
65 65
 										);
66 66
 										?>
67 67
 									</span>
68 68
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
69
-										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
70
-											&nbsp<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
69
+										<?php if (get_option('give_upgrade_error')) : ?>
70
+											&nbsp<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
71 71
 										<?php else : ?>
72
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
72
+											<?php _e('The updates have been paused.', 'give'); ?>
73 73
 										<?php endif; ?>
74 74
 									</span>
75 75
 
76
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
77
-										<?php $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?>
76
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
77
+										<?php $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?>
78 78
 										<button id="give-restart-upgrades" class="button button-primary alignright"
79
-										        data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button>
80
-									<?php elseif ( $give_updates->is_doing_updates() ): ?>
81
-										<?php $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?>
79
+										        data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button>
80
+									<?php elseif ($give_updates->is_doing_updates()): ?>
81
+										<?php $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?>
82 82
 										<button id="give-pause-upgrades" class="button button-primary alignright"
83
-										        data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>>
84
-											<?php _e( 'Pause Upgrades', 'give' ); ?>
83
+										        data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>>
84
+											<?php _e('Pause Upgrades', 'give'); ?>
85 85
 										</button>
86 86
 									<?php endif; ?>
87 87
 								</p>
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 									<strong>
92 92
 										<?php
93 93
 										echo sprintf(
94
-											__( 'Update %s of %s', 'give' ),
94
+											__('Update %s of %s', 'give'),
95 95
 											$give_updates->get_running_db_update(),
96 96
 											$give_updates->get_total_new_db_update_count()
97 97
 										);
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 									</strong>
100 100
 								</p>
101 101
 								<div class="progress-content">
102
-									<?php if ( $is_doing_updates ) : ?>
102
+									<?php if ($is_doing_updates) : ?>
103 103
 										<div class="notice-wrap give-clearfix">
104 104
 
105
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?>
105
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?>
106 106
 												<span class="spinner is-active"></span>
107 107
 											<?php endif; ?>
108 108
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 									<?php endif; ?>
114 114
 								</div>
115 115
 							</div>
116
-							<?php if ( ! $is_doing_updates ) : ?>
116
+							<?php if ( ! $is_doing_updates) : ?>
117 117
 								<div class="give-run-database-update"></div>
118 118
 							<?php endif; ?>
119 119
 						</div>
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 					</div><!-- .postbox -->
122 122
 				</div> <!-- .post-container -->
123 123
 			</div>
124
-		<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
124
+		<?php else: include GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
125 125
 		<?php endif; ?>
126 126
 
127 127
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
128
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
129
-			<?php $plugin_update_url = add_query_arg( array(
128
+		<?php if ( ! empty($plugin_updates)) : ?>
129
+			<?php $plugin_update_url = add_query_arg(array(
130 130
 				'plugin_status' => 'give',
131
-			), admin_url( '/plugins.php' ) ); ?>
131
+			), admin_url('/plugins.php')); ?>
132 132
 			<div id="give-plugin-updates">
133 133
 				<div class="postbox-container">
134 134
 					<div class="postbox">
135
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
135
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
136 136
 						<div class="inside">
137 137
 							<div class="panel-content">
138 138
 								<p>
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,8 +68,11 @@  discard block
 block discarded – undo
68 68
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
69 69
 										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
70 70
 											&nbsp<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
71
-										<?php else : ?>
72
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
71
+										<?php else {
72
+	: ?>
73
+											<?php _e( 'The updates have been paused.', 'give' );
74
+}
75
+?>
73 76
 										<?php endif; ?>
74 77
 									</span>
75 78
 
@@ -121,7 +124,10 @@  discard block
 block discarded – undo
121 124
 					</div><!-- .postbox -->
122 125
 				</div> <!-- .post-container -->
123 126
 			</div>
124
-		<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
127
+		<?php else {
128
+	: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';
129
+}
130
+?>
125 131
 		<?php endif; ?>
126 132
 
127 133
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * Class constructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'admin_init', array( $this, 'init'), 999 );
35
+		add_action('admin_init', array($this, 'init'), 999);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @since 2.1.0
42 42
 	 * @access public
43 43
 	 */
44
-	public function init(){
45
-		if ( $this->is_add_button() ) {
46
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
44
+	public function init() {
45
+		if ($this->is_add_button()) {
46
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
47 47
 
48
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
49
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
50
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
48
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
49
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
50
+			add_action('media_buttons', array($this, 'shortcode_button'));
51 51
 		}
52 52
 
53
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
54
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
53
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
54
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	public function mce_external_plugins( $plugin_array ) {
66
+	public function mce_external_plugins($plugin_array) {
67 67
 
68
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
68
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
69 69
 			return false;
70 70
 		}
71 71
 
72
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'includes/admin/shortcodes/mce-plugin.js';
72
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'includes/admin/shortcodes/mce-plugin.js';
73 73
 
74 74
 		return $plugin_array;
75 75
 	}
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @since 1.0
83 83
 	 */
84 84
 	public function admin_enqueue_assets() {
85
-		$direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
85
+		$direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
86 86
 
87 87
 		wp_enqueue_script(
88 88
 			'give_shortcode',
89
-			GIVE_PLUGIN_URL . 'assets/dist/js/admin-shortcodes.js',
90
-			array( 'jquery' ),
89
+			GIVE_PLUGIN_URL.'assets/dist/js/admin-shortcodes.js',
90
+			array('jquery'),
91 91
 			GIVE_VERSION,
92 92
 			true
93 93
 		);
94 94
 
95 95
 		wp_enqueue_style(
96 96
 			'give-admin-shortcode-button-style',
97
-			GIVE_PLUGIN_URL . 'assets/dist/css/admin-shortcode-button' . $direction . '.css',
97
+			GIVE_PLUGIN_URL.'assets/dist/css/admin-shortcode-button'.$direction.'.css',
98 98
 			array(),
99 99
 			GIVE_VERSION
100 100
 		);
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function admin_localize_scripts() {
111 111
 
112
-		if ( ! empty( self::$shortcodes ) ) {
112
+		if ( ! empty(self::$shortcodes)) {
113 113
 
114 114
 			$variables = array();
115 115
 
116
-			foreach ( self::$shortcodes as $shortcode => $values ) {
117
-				if ( ! empty( $values['required'] ) ) {
118
-					$variables[ $shortcode ] = $values['required'];
116
+			foreach (self::$shortcodes as $shortcode => $values) {
117
+				if ( ! empty($values['required'])) {
118
+					$variables[$shortcode] = $values['required'];
119 119
 				}
120 120
 			}
121 121
 
122
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
122
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
123 123
 		}
124 124
 	}
125 125
 
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$shortcodes = array();
136 136
 
137
-		foreach ( self::$shortcodes as $shortcode => $values ) {
137
+		foreach (self::$shortcodes as $shortcode => $values) {
138 138
 
139 139
 			/**
140 140
 			 * Filters the condition for including the current shortcode
141 141
 			 *
142 142
 			 * @since 1.0
143 143
 			 */
144
-			if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
144
+			if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
145 145
 
146
-				$shortcodes[ $shortcode ] = sprintf(
146
+				$shortcodes[$shortcode] = sprintf(
147 147
 					'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>',
148 148
 					$shortcode,
149 149
 					$shortcode,
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 		}
154 154
 
155
-		if ( ! empty( $shortcodes ) ) {
155
+		if ( ! empty($shortcodes)) {
156 156
 
157 157
 			// check current WP version
158
-			$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
159
-				? '<img src="' . GIVE_PLUGIN_URL . 'assets/dist/images/give-media.png" />'
160
-				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
158
+			$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
159
+				? '<img src="'.GIVE_PLUGIN_URL.'assets/dist/images/give-media.png" />'
160
+				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
161 161
 
162
-			reset( $shortcodes );
162
+			reset($shortcodes);
163 163
 
164
-			if ( 1 === count( $shortcodes ) ) {
164
+			if (1 === count($shortcodes)) {
165 165
 
166
-				$shortcode = key( $shortcodes );
166
+				$shortcode = key($shortcodes);
167 167
 
168 168
 				printf(
169 169
 					'<button type="button" class="button sc-shortcode" data-shortcode="%s">%s</button>',
170 170
 					$shortcode,
171
-					sprintf( '%s %s %s',
171
+					sprintf('%s %s %s',
172 172
 						$img,
173
-						__( 'Insert', 'give' ),
174
-						self::$shortcodes[ $shortcode ]['label']
173
+						__('Insert', 'give'),
174
+						self::$shortcodes[$shortcode]['label']
175 175
 					)
176 176
 				);
177 177
 			} else {
178 178
 				printf(
179
-					'<div class="sc-wrap">' .
180
-					'<button class="button sc-button" type="button">%s %s</button>' .
181
-					'<div class="sc-menu mce-menu">%s</div>' .
179
+					'<div class="sc-wrap">'.
180
+					'<button class="button sc-button" type="button">%s %s</button>'.
181
+					'<div class="sc-menu mce-menu">%s</div>'.
182 182
 					'</div>',
183 183
 					$img,
184
-					__( 'Give Shortcodes', 'give' ),
185
-					implode( '', array_values( $shortcodes ) )
184
+					__('Give Shortcodes', 'give'),
185
+					implode('', array_values($shortcodes))
186 186
 				);
187 187
 			}
188 188
 		}
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function shortcode_ajax() {
199 199
 
200
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
200
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
201 201
 		$response  = false;
202 202
 
203
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
203
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
204 204
 
205
-			$data = self::$shortcodes[ $shortcode ];
205
+			$data = self::$shortcodes[$shortcode];
206 206
 
207
-			if ( ! empty( $data['errors'] ) ) {
208
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
207
+			if ( ! empty($data['errors'])) {
208
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
209 209
 			}
210 210
 
211 211
 			$response = array(
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 			);
218 218
 		} else {
219 219
 			// todo: handle error
220
-			error_log( print_r( 'AJAX error!', 1 ) );
220
+			error_log(print_r('AJAX error!', 1));
221 221
 		}
222 222
 
223
-		wp_send_json( $response );
223
+		wp_send_json($response);
224 224
 	}
225 225
 
226 226
 
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 	private function is_add_button() {
235 235
 		global $pagenow;
236 236
 
237
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
237
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
238 238
 			'post.php',
239 239
 			'page.php',
240 240
 			'post-new.php',
241 241
 			'post-edit.php',
242 242
 			'edit.php',
243 243
 			'edit.php?post_type=page',
244
-		) );
244
+		));
245 245
 
246 246
 		$setting_page = give_get_current_setting_page();
247 247
 
248 248
 		// Only run in admin post/page creation and edit screens
249 249
 		if (
250 250
 			! is_admin()
251
-			|| ! in_array( $pagenow, $shortcode_button_pages )
252
-			|| ( 'give-settings' === $setting_page )
251
+			|| ! in_array($pagenow, $shortcode_button_pages)
252
+			|| ('give-settings' === $setting_page)
253 253
 
254 254
 			/**
255 255
 			 * Fire the filter
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 			 * @since 1.0
259 259
 			 *
260 260
 			 */
261
-			|| ! apply_filters( 'give_shortcode_button_condition', true )
262
-			|| empty( self::$shortcodes )
261
+			|| ! apply_filters('give_shortcode_button_condition', true)
262
+			|| empty(self::$shortcodes)
263 263
 		) {
264 264
 			return false;
265 265
 		}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donor-wall.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title'] = esc_html__( 'Donor Wall', 'give' );
28
-		$this->shortcode['label'] = esc_html__( 'Donor Wall', 'give' );
27
+		$this->shortcode['title'] = esc_html__('Donor Wall', 'give');
28
+		$this->shortcode['label'] = esc_html__('Donor Wall', 'give');
29 29
 
30
-		parent::__construct( 'give_donor_wall' );
30
+		parent::__construct('give_donor_wall');
31 31
 	}
32 32
 
33 33
 	/**
@@ -43,90 +43,90 @@  discard block
 block discarded – undo
43 43
 					'post_type' => 'give_forms',
44 44
 				),
45 45
 				'name'        => 'form_id',
46
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
47
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
46
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
47
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
48 48
 			),
49 49
 			array(
50 50
 				'type'        => 'textbox',
51 51
 				'name'        => 'donors_per_page',
52
-				'label'       => esc_attr__( 'Donors Per Page', 'give' ),
52
+				'label'       => esc_attr__('Donors Per Page', 'give'),
53 53
 				'placeholder' => '20',
54 54
 			),
55 55
 			array(
56 56
 				'type'        => 'textbox',
57 57
 				'name'        => 'comment_length',
58
-				'label'       => esc_attr__( 'Comment Length', 'give' ),
58
+				'label'       => esc_attr__('Comment Length', 'give'),
59 59
 				'placeholder' => '20',
60 60
 			),
61 61
 			array(
62 62
 				'type'        => 'textbox',
63 63
 				'name'        => 'readmore_text',
64
-				'label'       => esc_attr__( 'Read More Text', 'give' ),
65
-				'placeholder' => esc_html__( 'Read More', 'give' ),
64
+				'label'       => esc_attr__('Read More Text', 'give'),
65
+				'placeholder' => esc_html__('Read More', 'give'),
66 66
 			),
67 67
 			array(
68 68
 				'type'        => 'textbox',
69 69
 				'name'        => 'loadmore_text',
70
-				'label'       => esc_attr__( 'Load More Text', 'give' ),
71
-				'placeholder' => esc_html__( 'Load More', 'give' ),
70
+				'label'       => esc_attr__('Load More Text', 'give'),
71
+				'placeholder' => esc_html__('Load More', 'give'),
72 72
 			),
73 73
 			array(
74 74
 				'type'        => 'listbox',
75 75
 				'name'        => 'columns',
76
-				'label'       => esc_attr__( 'Columns:', 'give' ),
77
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
76
+				'label'       => esc_attr__('Columns:', 'give'),
77
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
78 78
 				'options'     => array(
79
-					'1' => esc_html__( '1', 'give' ),
80
-					'2' => esc_html__( '2', 'give' ),
81
-					'3' => esc_html__( '3', 'give' ),
82
-					'4' => esc_html__( '4', 'give' ),
79
+					'1' => esc_html__('1', 'give'),
80
+					'2' => esc_html__('2', 'give'),
81
+					'3' => esc_html__('3', 'give'),
82
+					'4' => esc_html__('4', 'give'),
83 83
 				),
84
-				'placeholder' => esc_html__( 'Best Fit', 'give' ),
84
+				'placeholder' => esc_html__('Best Fit', 'give'),
85 85
 			),
86 86
 			array(
87 87
 				'type'        => 'listbox',
88 88
 				'name'        => 'show_avatar',
89
-				'label'       => esc_attr__( 'Show Avatar', 'give' ),
89
+				'label'       => esc_attr__('Show Avatar', 'give'),
90 90
 				'options'     => array(
91
-					'false' => esc_html__( 'Hide', 'give' ),
91
+					'false' => esc_html__('Hide', 'give'),
92 92
 				),
93
-				'placeholder' => esc_html__( 'Show', 'give' ),
93
+				'placeholder' => esc_html__('Show', 'give'),
94 94
 			),
95 95
 			array(
96 96
 				'type'        => 'listbox',
97 97
 				'name'        => 'show_name',
98
-				'label'       => esc_attr__( 'Show Name', 'give' ),
98
+				'label'       => esc_attr__('Show Name', 'give'),
99 99
 				'options'     => array(
100
-					'false' => esc_html__( 'Hide', 'give' ),
100
+					'false' => esc_html__('Hide', 'give'),
101 101
 				),
102
-				'placeholder' => esc_html__( 'Show', 'give' ),
102
+				'placeholder' => esc_html__('Show', 'give'),
103 103
 			),
104 104
 			array(
105 105
 				'type'        => 'listbox',
106 106
 				'name'        => 'show_total',
107
-				'label'       => esc_attr__( 'Show Total', 'give' ),
107
+				'label'       => esc_attr__('Show Total', 'give'),
108 108
 				'options'     => array(
109
-					'false' => esc_html__( 'Hide', 'give' ),
109
+					'false' => esc_html__('Hide', 'give'),
110 110
 				),
111
-				'placeholder' => esc_html__( 'Show', 'give' ),
111
+				'placeholder' => esc_html__('Show', 'give'),
112 112
 			),
113 113
 			array(
114 114
 				'type'        => 'listbox',
115 115
 				'name'        => 'show_time',
116
-				'label'       => esc_attr__( 'Show Date', 'give' ),
116
+				'label'       => esc_attr__('Show Date', 'give'),
117 117
 				'options'     => array(
118
-					'false' => esc_html__( 'Hide', 'give' ),
118
+					'false' => esc_html__('Hide', 'give'),
119 119
 				),
120
-				'placeholder' => esc_html__( 'Show', 'give' ),
120
+				'placeholder' => esc_html__('Show', 'give'),
121 121
 			),
122 122
 			array(
123 123
 				'type'        => 'listbox',
124 124
 				'name'        => 'show_comments',
125
-				'label'       => esc_attr__( 'Show Comments', 'give' ),
125
+				'label'       => esc_attr__('Show Comments', 'give'),
126 126
 				'options'     => array(
127
-					'false' => esc_html__( 'Hide', 'give' ),
127
+					'false' => esc_html__('Hide', 'give'),
128 128
 				),
129
-				'placeholder' => esc_html__( 'Show', 'give' ),
129
+				'placeholder' => esc_html__('Show', 'give'),
130 130
 			)
131 131
 		);
132 132
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-grid.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Grid', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Grid', 'give');
28 28
 
29
-		parent::__construct( 'give_form_grid' );
29
+		parent::__construct('give_form_grid');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,80 +39,80 @@  discard block
 block discarded – undo
39 39
 		return array(
40 40
 			array(
41 41
 				'type' => 'container',
42
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
42
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
43 43
 			),
44 44
 			array(
45 45
 				'type'        => 'textbox',
46 46
 				'name'        => 'ids',
47
-				'label'       => esc_attr__( 'Form IDs:', 'give' ),
48
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ),
49
-				'placeholder' => esc_html__( 'All Forms', 'give' )
47
+				'label'       => esc_attr__('Form IDs:', 'give'),
48
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'),
49
+				'placeholder' => esc_html__('All Forms', 'give')
50 50
 			),
51 51
 			array(
52 52
 				'type'        => 'textbox',
53 53
 				'name'        => 'exclude',
54
-				'label'       => esc_attr__( 'Excluded Form IDs:', 'give' ),
55
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs to exclude those from the grid.', 'give' ),
56
-				'placeholder' => esc_html__( 'Excluded Forms', 'give' )
54
+				'label'       => esc_attr__('Excluded Form IDs:', 'give'),
55
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs to exclude those from the grid.', 'give'),
56
+				'placeholder' => esc_html__('Excluded Forms', 'give')
57 57
 			),
58 58
 			array(
59 59
 				'type'        => 'listbox',
60 60
 				'name'        => 'columns',
61
-				'label'       => esc_attr__( 'Columns:', 'give' ),
62
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
61
+				'label'       => esc_attr__('Columns:', 'give'),
62
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
63 63
 				'options'     => array(
64
-					'1' => esc_html__( '1', 'give' ),
65
-					'2' => esc_html__( '2', 'give' ),
66
-					'3' => esc_html__( '3', 'give' ),
67
-					'4' => esc_html__( '4', 'give' ),
64
+					'1' => esc_html__('1', 'give'),
65
+					'2' => esc_html__('2', 'give'),
66
+					'3' => esc_html__('3', 'give'),
67
+					'4' => esc_html__('4', 'give'),
68 68
 				),
69
-				'placeholder' => esc_html__( 'Best Fit', 'give' )
69
+				'placeholder' => esc_html__('Best Fit', 'give')
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
75
-				'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ),
74
+				'label'   => esc_attr__('Show Goal:', 'give'),
75
+				'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html__( 'Show', 'give' ),
78
-					'false' => esc_html__( 'Hide', 'give' ),
77
+					'true'  => esc_html__('Show', 'give'),
78
+					'false' => esc_html__('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_excerpt',
84
-				'label'   => esc_attr__( 'Show Excerpt:', 'give' ),
85
-				'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ),
84
+				'label'   => esc_attr__('Show Excerpt:', 'give'),
85
+				'tooltip' => esc_attr__('Do you want to display the excerpt?', 'give'),
86 86
 				'options' => array(
87
-					'true'  => esc_html__( 'Show', 'give' ),
88
-					'false' => esc_html__( 'Hide', 'give' ),
87
+					'true'  => esc_html__('Show', 'give'),
88
+					'false' => esc_html__('Hide', 'give'),
89 89
 				),
90 90
 			),
91 91
 			array(
92 92
 				'type'    => 'listbox',
93 93
 				'name'    => 'show_featured_image',
94
-				'label'   => esc_attr__( 'Show Featured Image:', 'give' ),
95
-				'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ),
94
+				'label'   => esc_attr__('Show Featured Image:', 'give'),
95
+				'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'),
96 96
 				'options' => array(
97
-					'true'  => esc_html__( 'Show', 'give' ),
98
-					'false' => esc_html__( 'Hide', 'give' ),
97
+					'true'  => esc_html__('Show', 'give'),
98
+					'false' => esc_html__('Hide', 'give'),
99 99
 				),
100 100
 			),
101 101
 			array(
102 102
 				'type'    => 'listbox',
103 103
 				'name'    => 'display_style',
104
-				'label'   => esc_attr__( 'Display Style:', 'give' ),
105
-				'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ),
104
+				'label'   => esc_attr__('Display Style:', 'give'),
105
+				'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'),
106 106
 				'options' => array(
107
-					'redirect'     => esc_html__( 'Redirect', 'give' ),
108
-					'modal_reveal' => esc_html__( 'Modal', 'give' ),
107
+					'redirect'     => esc_html__('Redirect', 'give'),
108
+					'modal_reveal' => esc_html__('Modal', 'give'),
109 109
 				),
110 110
 			),
111 111
 			array(
112 112
 				'type'    => 'textbox',
113 113
 				'name'    => 'forms_per_page',
114
-				'label'   => esc_attr__( 'Forms Per Page:', 'give' ),
115
-				'tooltip' => esc_attr__( 'Sets the number of forms to display per page.', 'give' ),
114
+				'label'   => esc_attr__('Forms Per Page:', 'give'),
115
+				'tooltip' => esc_attr__('Sets the number of forms to display per page.', 'give'),
116 116
 				'value'   => 12,
117 117
 			),
118 118
 		);
Please login to merge, or discard this patch.
includes/class-give-donor-wall-widget.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		// widget settings
35 35
 		$widget_ops = array(
36 36
 			'classname'   => 'give-donors-gravatars',
37
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
37
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
38 38
 		);
39 39
 
40 40
 		// widget control settings
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		// create the widget
48 48
 		parent::__construct(
49 49
 			'give_donors_gravatars_widget',
50
-			esc_html__( 'Give Donors Gravatars', 'give' ),
50
+			esc_html__('Give Donors Gravatars', 'give'),
51 51
 			$widget_ops,
52 52
 			$control_ops
53 53
 		);
@@ -67,29 +67,29 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return void
69 69
 	 */
70
-	public function widget( $args, $instance ) {
70
+	public function widget($args, $instance) {
71 71
 
72 72
 		//@TODO: Don't extract it!!!
73
-		extract( $args );
73
+		extract($args);
74 74
 
75
-		if ( ! is_singular( 'give_forms' ) ) {
75
+		if ( ! is_singular('give_forms')) {
76 76
 			return;
77 77
 		}
78 78
 
79 79
 		// Variables from widget settings
80
-		$title = apply_filters( 'widget_title', $instance['title'] );
80
+		$title = apply_filters('widget_title', $instance['title']);
81 81
 
82 82
 		// Used by themes. Opens the widget
83 83
 		echo $before_widget;
84 84
 
85 85
 		// Display the widget title
86
-		if ( $title ) {
87
-			echo $before_title . $title . $after_title;
86
+		if ($title) {
87
+			echo $before_title.$title.$after_title;
88 88
 		}
89 89
 
90 90
 		$gravatars = new Give_Donor_Wall();
91 91
 
92
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
92
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
93 93
 
94 94
 		// Used by themes. Closes the widget
95 95
 		echo $after_widget;
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return array Updated settings to save.
111 111
 	 */
112
-	public function update( $new_instance, $old_instance ) {
112
+	public function update($new_instance, $old_instance) {
113 113
 
114 114
 		$instance = $old_instance;
115 115
 
116
-		$instance['title'] = strip_tags( $new_instance['title'] );
116
+		$instance['title'] = strip_tags($new_instance['title']);
117 117
 
118 118
 		return $instance;
119 119
 
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return void
133 133
 	 */
134
-	public function form( $instance ) {
134
+	public function form($instance) {
135 135
 
136 136
 		// Set up some default widget settings.
137 137
 		$defaults = array(
138 138
 			'title' => '',
139 139
 		);
140 140
 
141
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
141
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
142 142
 
143 143
 		<!-- Title -->
144 144
 		<p>
145
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
146
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
145
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
146
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
147 147
 		</p>
148 148
 
149 149
 		<?php
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 *
155 155
 	 * @return void
156 156
 	 */
157
-	function widget_init(){
158
-		register_widget( $this->self );
157
+	function widget_init() {
158
+		register_widget($this->self);
159 159
 	}
160 160
 
161 161
 }
Please login to merge, or discard this patch.