Completed
Pull Request — master (#1749)
by Devin
06:21
created
includes/price-functions.php 1 patch
Spacing   +22 added lines, -22 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
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array|bool Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array Variable prices
67 67
  */
68
-function give_get_variable_price_ids( $form_id = 0 ) {
69
-	if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) {
68
+function give_get_variable_price_ids($form_id = 0) {
69
+	if ( ! ($prices = give_get_variable_prices($form_id))) {
70 70
 		return array();
71 71
 	}
72 72
 
73 73
 	$price_ids = array();
74
-	foreach ( $prices as $price ){
74
+	foreach ($prices as $price) {
75 75
 		$price_ids[] = $price['_give_id']['level_id'];
76 76
 	}
77 77
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string $default_price
91 91
  */
92
-function give_get_default_multilevel_amount( $form_id ) {
92
+function give_get_default_multilevel_amount($form_id) {
93 93
 	$default_price = '1.00';
94
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
94
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
95 95
 
96
-	foreach ( $prices as $price ) {
96
+	foreach ($prices as $price) {
97 97
 
98
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
98
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
99 99
 			$default_price = $price['_give_amount'];
100 100
 		}
101 101
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
  * @return string $default_price
117 117
  * @since      1.0
118 118
  */
119
-function give_get_default_form_amount( $form_id ) {
119
+function give_get_default_form_amount($form_id) {
120 120
 
121
-	if ( give_has_variable_prices( $form_id ) ) {
121
+	if (give_has_variable_prices($form_id)) {
122 122
 
123
-		$default_amount = give_get_default_multilevel_amount( $form_id );
123
+		$default_amount = give_get_default_multilevel_amount($form_id);
124 124
 
125 125
 	} else {
126 126
 
127
-		$default_amount = give_get_meta( $form_id, '_give_set_price', true );
127
+		$default_amount = give_get_meta($form_id, '_give_set_price', true);
128 128
 
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_default_form_amount', $default_amount );
131
+	return apply_filters('give_default_form_amount', $default_amount);
132 132
 
133 133
 }
134 134
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool
148 148
  */
149
-function give_is_custom_price_mode( $form_id = 0 ) {
149
+function give_is_custom_price_mode($form_id = 0) {
150 150
 
151
-	if ( empty( $form_id ) ) {
151
+	if (empty($form_id)) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$form = new Give_Donate_Form( $form_id );
155
+	$form = new Give_Donate_Form($form_id);
156 156
 
157 157
 	return $form->is_custom_price_mode();
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 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
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
         <h2 class="nav-tab-wrapper">
121 121
             <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
             </a>
125 125
             <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
             </a>
129 129
             <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
             </a>
133 133
             <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-               href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+               href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
             </a>
137 137
         </h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
         <div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             <p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: https://givewp.com/documenation/ */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'https://givewp.com/documenation/' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('https://givewp.com/documenation/')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             <div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
             <div class="feature-section clearfix introduction">
176 176
 
177 177
                 <div class="video feature-section-item">
178
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>"
179
-                         alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>"
179
+                         alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
                 </div>
181 181
 
182 182
                 <div class="content feature-section-item last-feature">
183 183
 
184
-                    <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+                    <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-                    <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+                    <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
                     <a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
                         <span class="dashicons dashicons-external"></span>
190 190
                     </a>
191 191
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
                 <div class="content feature-section-item">
200 200
 
201
-                    <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+                    <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-                    <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+                    <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
                     <h4>Find Out More:</h4>
206 206
                     <ul class="ul-disc">
207
-                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
-                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
209
-                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
207
+                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
208
+                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
209
+                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
210 210
                     </ul>
211 211
 
212 212
                 </div>
213 213
 
214 214
                 <div class="content  feature-section-item last-feature">
215
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>"
216
-                         alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
215
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>"
216
+                         alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
217 217
                 </div>
218 218
 
219 219
             </div>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function changelog_screen() {
235
-		list( $display_version ) = explode( '-', GIVE_VERSION );
235
+		list($display_version) = explode('-', GIVE_VERSION);
236 236
 		?>
237 237
         <div class="wrap about-wrap">
238 238
             <h1><?php echo get_admin_page_title(); ?></h1>
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
             <p class="about-text"><?php
241 241
 				printf(
242 242
 				/* translators: %s: Give version */
243
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
243
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
244 244
 					$display_version
245 245
 				);
246 246
 				?></p>
247 247
             <div class="give-badge"><?php
248 248
 				printf(
249 249
 				/* translators: %s: Give version */
250
-					esc_html__( 'Version %s', 'give' ),
250
+					esc_html__('Version %s', 'give'),
251 251
 					$display_version
252 252
 				);
253 253
 				?></div>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			<?php $this->tabs(); ?>
256 256
 
257 257
             <div class="changelog">
258
-                <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
258
+                <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
259 259
 
260 260
                 <div class="feature-section">
261 261
 					<?php echo $this->parse_readme(); ?>
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             </div>
264 264
 
265 265
             <div class="return-to-dashboard">
266
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array(
266
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array(
267 267
 					'post_type' => 'give_forms',
268 268
 					'page'      => 'give-settings'
269
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
269
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
270 270
             </div>
271 271
         </div>
272 272
 		<?php
@@ -280,36 +280,36 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function getting_started_screen() {
283
-		list( $display_version ) = explode( '-', GIVE_VERSION );
283
+		list($display_version) = explode('-', GIVE_VERSION);
284 284
 		?>
285 285
         <div class="wrap about-wrap get-started">
286 286
 
287 287
 			<?php $this->get_welcome_header() ?>
288 288
 
289
-            <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
289
+            <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
290 290
 
291 291
 			<?php give_get_newsletter(); ?>
292 292
 
293 293
             <div class="give-badge"><?php
294 294
 				printf(
295 295
 				/* translators: %s: Give version */
296
-					esc_html__( 'Version %s', 'give' ),
296
+					esc_html__('Version %s', 'give'),
297 297
 					$display_version
298 298
 				);
299 299
 				?></div>
300 300
 
301 301
 			<?php $this->tabs(); ?>
302 302
 
303
-            <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
303
+            <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
304 304
 
305 305
             <div class="feature-section clearfix">
306 306
 
307 307
                 <div class="content feature-section-item">
308
-                    <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
308
+                    <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
309 309
 
310
-                    <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
310
+                    <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
311 311
 
312
-                    <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
312
+                    <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
313 313
                 </div>
314 314
 
315 315
                 <div class="content feature-section-item last-feature">
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
                 </div>
327 327
 
328 328
                 <div class="content feature-section-item last-feature">
329
-                    <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
329
+                    <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
330 330
 
331
-                    <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
331
+                    <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
332 332
                 </div>
333 333
 
334 334
             </div>
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
             <div class="feature-section clearfix">
338 338
 
339 339
                 <div class="content feature-section-item add-content">
340
-                    <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
340
+                    <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
341 341
 
342
-                    <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
342
+                    <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
343 343
 
344
-                    <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
344
+                    <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
345 345
                 </div>
346 346
 
347 347
                 <div class="content feature-section-item last-feature">
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 </div>
359 359
 
360 360
                 <div class="content feature-section-item last-feature">
361
-                    <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
361
+                    <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
362 362
 
363
-                    <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
363
+                    <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
364 364
                 </div>
365 365
 
366 366
 
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function credits_screen() {
383
-		list( $display_version ) = explode( '-', GIVE_VERSION );
383
+		list($display_version) = explode('-', GIVE_VERSION);
384 384
 		?>
385 385
         <div class="wrap about-wrap">
386 386
 
387 387
 			<?php $this->get_welcome_header() ?>
388 388
 
389
-            <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
389
+            <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
390 390
 
391 391
 			<?php give_get_newsletter(); ?>
392 392
 
393 393
             <div class="give-badge"><?php
394 394
 				printf(
395 395
 				/* translators: %s: Give version */
396
-					esc_html__( 'Version %s', 'give' ),
396
+					esc_html__('Version %s', 'give'),
397 397
 					$display_version
398 398
 				);
399 399
 				?></div>
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             <p class="about-description"><?php
404 404
 				printf(
405 405
 				/* translators: %s: https://github.com/WordImpress/give */
406
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
407
-					esc_url( 'https://github.com/WordImpress/give' )
406
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
407
+					esc_url('https://github.com/WordImpress/give')
408 408
 				);
409 409
 				?></p>
410 410
 
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 	 * @return string $readme HTML formatted readme file
422 422
 	 */
423 423
 	public function parse_readme() {
424
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
424
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
425 425
 
426
-		if ( ! $file ) {
427
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
426
+		if ( ! $file) {
427
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
428 428
 		} else {
429
-			$readme = file_get_contents( $file );
430
-			$readme = nl2br( esc_html( $readme ) );
431
-			$readme = explode( '== Changelog ==', $readme );
432
-			$readme = end( $readme );
433
-
434
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
435
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
436
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
437
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
438
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
429
+			$readme = file_get_contents($file);
430
+			$readme = nl2br(esc_html($readme));
431
+			$readme = explode('== Changelog ==', $readme);
432
+			$readme = end($readme);
433
+
434
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
435
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
436
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
437
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
438
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
439 439
 		}
440 440
 
441 441
 		return $readme;
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 	public function contributors() {
453 453
 		$contributors = $this->get_contributors();
454 454
 
455
-		if ( empty( $contributors ) ) {
455
+		if (empty($contributors)) {
456 456
 			return '';
457 457
 		}
458 458
 
459 459
 		$contributor_list = '<ul class="wp-people-group">';
460 460
 
461
-		foreach ( $contributors as $contributor ) {
461
+		foreach ($contributors as $contributor) {
462 462
 			$contributor_list .= '<li class="wp-person">';
463 463
 			$contributor_list .= sprintf(
464 464
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
465
-				esc_url( 'https://github.com/' . $contributor->login ),
466
-				esc_url( $contributor->avatar_url ),
467
-				esc_attr( $contributor->login )
465
+				esc_url('https://github.com/'.$contributor->login),
466
+				esc_url($contributor->avatar_url),
467
+				esc_attr($contributor->login)
468 468
 			);
469 469
 			$contributor_list .= sprintf(
470 470
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
471
-				esc_url( 'https://github.com/' . $contributor->login ),
472
-				esc_html( $contributor->login )
471
+				esc_url('https://github.com/'.$contributor->login),
472
+				esc_html($contributor->login)
473 473
 			);
474 474
 			$contributor_list .= '</li>';
475 475
 		}
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 	 * @return array $contributors List of contributors
488 488
 	 */
489 489
 	public function get_contributors() {
490
-		$contributors = Give_Cache::get( 'give_contributors', true );
490
+		$contributors = Give_Cache::get('give_contributors', true);
491 491
 
492
-		if ( false !== $contributors ) {
492
+		if (false !== $contributors) {
493 493
 			return $contributors;
494 494
 		}
495 495
 
496
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
496
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
497 497
 
498
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
498
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
499 499
 			return array();
500 500
 		}
501 501
 
502
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
502
+		$contributors = json_decode(wp_remote_retrieve_body($response));
503 503
 
504
-		if ( ! is_array( $contributors ) ) {
504
+		if ( ! is_array($contributors)) {
505 505
 			return array();
506 506
 		}
507 507
 
508
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
508
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
509 509
 
510 510
 		return $contributors;
511 511
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function get_welcome_header() {
519 519
 		// Badge for welcome page
520
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
520
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
521 521
 		?>
522 522
         <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
523 523
 		<?php $this->social_media_elements(); ?>
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
611 611
 				printf(
612 612
 				/* translators: %s: Give twitter user @givewp */
613
-					esc_html_e( 'Follow %s', 'give' ),
613
+					esc_html_e('Follow %s', 'give'),
614 614
 					'@givewp'
615 615
 				);
616 616
 				?></a>
@@ -644,27 +644,27 @@  discard block
 block discarded – undo
644 644
 	public function welcome() {
645 645
 
646 646
 		// Bail if no activation redirect
647
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
647
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
648 648
 			return;
649 649
 		}
650 650
 
651 651
 		// Delete the redirect transient
652
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
652
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
653 653
 
654 654
 		// Bail if activating from network, or bulk
655
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
655
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
656 656
 			return;
657 657
 		}
658 658
 
659
-		$upgrade = get_option( 'give_version_upgraded_from' );
659
+		$upgrade = get_option('give_version_upgraded_from');
660 660
 
661
-		if ( ! $upgrade ) { // First time install
662
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
661
+		if ( ! $upgrade) { // First time install
662
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
663 663
 			exit;
664
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
664
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
665 665
 
666 666
 		} else { // Welcome is NOT disabled in settings
667
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
667
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
668 668
 			exit;
669 669
 		}
670 670
 	}
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -254,8 +254,8 @@
 block discarded – undo
254 254
 		$args = array(
255 255
 		  'id' => 'give-api-user-search',
256 256
 		  'name' => 'user_id',
257
-        );
258
-        echo Give()->html->ajax_user_search($args); ?>
257
+		);
258
+		echo Give()->html->ajax_user_search($args); ?>
259 259
 		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
260 260
 		<?php
261 261
 		$give_api_is_bottom = true;
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
59
-			'ajax'     => false,// Does this table support ajax?
60
-		) );
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59
+			'ajax'     => false, // Does this table support ajax?
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place.
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250
-		<?php wp_nonce_field( 'give-api-nonce' );
250
+		<?php wp_nonce_field('give-api-nonce');
251 251
 		/**
252 252
 		 * API Key user search.
253 253
 		 */
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		  'name' => 'user_id',
257 257
         );
258 258
         echo Give()->html->ajax_user_search($args); ?>
259
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
259
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
260 260
 		<?php
261 261
 		$give_api_is_bottom = true;
262 262
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * @return int Current page number
270 270
 	 */
271 271
 	public function get_paged() {
272
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
272
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
273 273
 	}
274 274
 
275 275
 	/**
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 	 * @return array
281 281
 	 */
282 282
 	public function query() {
283
-		$users = get_users( array(
283
+		$users = get_users(array(
284 284
 			'meta_value' => 'give_user_secret_key',
285 285
 			'number'     => $this->per_page,
286
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
287
-		) );
288
-		$keys  = array();
289
-
290
-		foreach ( $users as $user ) {
291
-			$keys[ $user->ID ]['id']    = $user->ID;
292
-			$keys[ $user->ID ]['email'] = $user->user_email;
293
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
294
-
295
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
296
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
297
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
286
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
287
+		));
288
+		$keys = array();
289
+
290
+		foreach ($users as $user) {
291
+			$keys[$user->ID]['id']    = $user->ID;
292
+			$keys[$user->ID]['email'] = $user->user_email;
293
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
294
+
295
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
296
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
297
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
298 298
 		}
299 299
 
300 300
 		return $keys;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	public function total_items() {
312 312
 		global $wpdb;
313 313
 
314
-		if ( ! ( $total_items = Give_Cache::get( 'give_total_api_keys', true ) ) ) {
314
+		if ( ! ($total_items = Give_Cache::get('give_total_api_keys', true))) {
315 315
 			$total_items = $wpdb->get_var(
316 316
 				$wpdb->prepare(
317 317
 					"SELECT count(user_id)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				)
321 321
 			);
322 322
 
323
-			Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true );
323
+			Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true);
324 324
 		}
325 325
 
326 326
 		return $total_items;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		$hidden   = array(); // No hidden columns
340 340
 		$sortable = array(); // Not sortable... for now
341 341
 
342
-		$this->_column_headers = array( $columns, $hidden, $sortable );
342
+		$this->_column_headers = array($columns, $hidden, $sortable);
343 343
 
344 344
 		$data = $this->query();
345 345
 
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
 
348 348
 		$this->items = $data;
349 349
 
350
-		$this->set_pagination_args( array(
350
+		$this->set_pagination_args(array(
351 351
 				'total_items' => $total_items,
352 352
 				'per_page'    => $this->per_page,
353
-				'total_pages' => ceil( $total_items / $this->per_page ),
353
+				'total_pages' => ceil($total_items / $this->per_page),
354 354
 			)
355 355
 		);
356 356
 	}
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +142 added lines, -142 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
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if donation ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $currency_code  = $payment->currency;
46 46
 $gateway        = $payment->gateway;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	<h1 id="transaction-details-heading"><?php
53 53
 		printf(
54 54
 			/* translators: %s: donation number */
55
-			esc_html__( 'Donation %s', 'give' ),
55
+			esc_html__('Donation %s', 'give'),
56 56
 			$number
57 57
 		);
58
-		if ( $payment_mode == 'test' ) {
59
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
58
+		if ($payment_mode == 'test') {
59
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
60 60
 		}
61 61
 		?></h1>
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param int $payment_id Payment id.
70 70
 	 */
71
-	do_action( 'give_view_order_details_before', $payment_id );
71
+	do_action('give_view_order_details_before', $payment_id);
72 72
 	?>
73 73
 	<form id="give-edit-order-form" method="post">
74 74
 		<?php
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @param int $payment_id Payment id.
81 81
 		 */
82
-		do_action( 'give_view_order_details_form_top', $payment_id );
82
+		do_action('give_view_order_details_form_top', $payment_id);
83 83
 		?>
84 84
 		<div id="poststuff">
85 85
 			<div id="give-dashboard-widgets-wrap">
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 							 *
96 96
 							 * @param int $payment_id Payment id.
97 97
 							 */
98
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
98
+							do_action('give_view_order_details_sidebar_before', $payment_id);
99 99
 							?>
100 100
 
101 101
 							<div id="give-order-update" class="postbox give-order-data">
102 102
 
103
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
103
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
104 104
 
105 105
 								<div class="inside">
106 106
 									<div class="give-admin-box">
@@ -113,33 +113,33 @@  discard block
 block discarded – undo
113 113
 										 *
114 114
 										 * @param int $payment_id Payment id.
115 115
 										 */
116
-										do_action( 'give_view_order_details_totals_before', $payment_id );
116
+										do_action('give_view_order_details_totals_before', $payment_id);
117 117
 										?>
118 118
 
119 119
 										<div class="give-admin-box-inside">
120 120
 											<p>
121
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
121
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
122 122
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
123
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
124
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
123
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
124
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
125 125
 													<?php endforeach; ?>
126 126
 												</select>
127
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
127
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
128 128
 											</p>
129 129
 										</div>
130 130
 
131 131
 										<div class="give-admin-box-inside">
132 132
 											<p>
133
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
134
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
133
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
134
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
135 135
 											</p>
136 136
 										</div>
137 137
 
138 138
 										<div class="give-admin-box-inside">
139 139
 											<p>
140
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
141
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
142
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
140
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
141
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
142
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
143 143
 											</p>
144 144
 										</div>
145 145
 
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 										 *
154 154
 										 * @param int $payment_id Payment id.
155 155
 										 */
156
-										do_action( 'give_view_order_details_update_inner', $payment_id );
156
+										do_action('give_view_order_details_update_inner', $payment_id);
157 157
 
158 158
 										// @TODO: Fees
159
-										$fees = give_get_payment_fees( $payment_id );
160
-										if ( ! empty( $fees ) ) : ?>
159
+										$fees = give_get_payment_fees($payment_id);
160
+										if ( ! empty($fees)) : ?>
161 161
 											<div class="give-order-fees give-admin-box-inside">
162
-												<p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p>
162
+												<p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p>
163 163
 												<ul class="give-payment-fees">
164
-													<?php foreach ( $fees as $fee ) : ?>
164
+													<?php foreach ($fees as $fee) : ?>
165 165
 														<li>
166 166
 															<span class="fee-label"><?php echo $fee['label']; ?>:</span>
167
-															<span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span>
167
+															<span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span>
168 168
 														</li>
169 169
 													<?php endforeach; ?>
170 170
 												</ul>
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 
174 174
 										<div class="give-order-payment give-admin-box-inside">
175 175
 											<p>
176
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
177
-												<?php echo give_currency_symbol( $payment->currency ); ?>
178
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
176
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
177
+												<?php echo give_currency_symbol($payment->currency); ?>
178
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
179 179
 											</p>
180 180
 										</div>
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 										 *
188 188
 										 * @param int $payment_id Payment id.
189 189
 										 */
190
-										do_action( 'give_view_order_details_totals_after', $payment_id );
190
+										do_action('give_view_order_details_totals_after', $payment_id);
191 191
 										?>
192 192
 
193 193
 									</div>
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
 									 *
206 206
 									 * @param int $payment_id Payment id.
207 207
 									 */
208
-									do_action( 'give_view_order_details_update_before', $payment_id );
208
+									do_action('give_view_order_details_update_before', $payment_id);
209 209
 									?>
210 210
 
211 211
 									<div id="major-publishing-actions">
212 212
 										<div id="publishing-action">
213
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
214
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
215
-												<a href="<?php echo esc_url( add_query_arg( array(
213
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
214
+											<?php if (give_is_payment_complete($payment_id)) : ?>
215
+												<a href="<?php echo esc_url(add_query_arg(array(
216 216
 													'give-action' => 'email_links',
217 217
 													'purchase_id' => $payment_id,
218
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
218
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
219 219
 											<?php endif; ?>
220 220
 										</div>
221 221
 										<div class="clear"></div>
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 									 *
230 230
 									 * @param int $payment_id Payment id.
231 231
 									 */
232
-									do_action( 'give_view_order_details_update_after', $payment_id );
232
+									do_action('give_view_order_details_update_after', $payment_id);
233 233
 									?>
234 234
 
235 235
 								</div>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 							<div id="give-order-details" class="postbox give-order-data">
242 242
 
243
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
243
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
244 244
 
245 245
 								<div class="inside">
246 246
 									<div class="give-admin-box">
@@ -253,44 +253,44 @@  discard block
 block discarded – undo
253 253
 										 *
254 254
 										 * @param int $payment_id Payment id.
255 255
 										 */
256
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
256
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
257 257
 
258
-										$gateway = give_get_payment_gateway( $payment_id );
259
-										if ( $gateway ) : ?>
258
+										$gateway = give_get_payment_gateway($payment_id);
259
+										if ($gateway) : ?>
260 260
 											<div class="give-order-gateway give-admin-box-inside">
261 261
 												<p>
262
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
263
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
262
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
263
+													<?php echo give_get_gateway_admin_label($gateway); ?>
264 264
 												</p>
265 265
 											</div>
266 266
 										<?php endif; ?>
267 267
 
268 268
 										<div class="give-order-payment-key give-admin-box-inside">
269 269
 											<p>
270
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
271
-												<?php echo give_get_payment_key( $payment_id ); ?>
270
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
271
+												<?php echo give_get_payment_key($payment_id); ?>
272 272
 											</p>
273 273
 										</div>
274 274
 
275 275
 										<div class="give-order-ip give-admin-box-inside">
276 276
 											<p>
277
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
278
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
277
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
278
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
279 279
 											</p>
280 280
 										</div>
281 281
 
282
-										<?php if ( $transaction_id ) : ?>
282
+										<?php if ($transaction_id) : ?>
283 283
 											<div class="give-order-tx-id give-admin-box-inside">
284 284
 												<p>
285
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
286
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
285
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
286
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
287 287
 												</p>
288 288
 											</div>
289 289
 										<?php endif; ?>
290 290
 
291 291
 										<div class="give-admin-box-inside">
292
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
293
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
292
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
293
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
294 294
 											</p>
295 295
 										</div>
296 296
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 										 *
303 303
 										 * @param int $payment_id Payment id.
304 304
 										 */
305
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
305
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
306 306
 										?>
307 307
 
308 308
 									</div>
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 							 *
323 323
 							 * @param int $payment_id Payment id.
324 324
 							 */
325
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
325
+							do_action('give_view_order_details_sidebar_after', $payment_id);
326 326
 							?>
327 327
 
328 328
 						</div>
@@ -342,56 +342,56 @@  discard block
 block discarded – undo
342 342
 							 *
343 343
 							 * @param int $payment_id Payment id.
344 344
 							 */
345
-							do_action( 'give_view_order_details_main_before', $payment_id );
345
+							do_action('give_view_order_details_main_before', $payment_id);
346 346
 							?>
347 347
 
348 348
 							<?php $column_count = 'columns-3'; ?>
349 349
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
350
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
350
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
351 351
 
352 352
 								<div class="inside">
353 353
 
354 354
 									<div class="column-container">
355 355
 										<div class="column">
356 356
 											<p>
357
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
357
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
358 358
 												<?php
359
-												if ( $payment_meta['form_id'] ) :
359
+												if ($payment_meta['form_id']) :
360 360
 													printf(
361 361
 														'<a href="%1$s" target="_blank">#%2$s</a>',
362
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
362
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
363 363
 														$payment_meta['form_id']
364 364
 													);
365 365
 												endif;
366 366
 												?>
367 367
 											</p>
368 368
 											<p>
369
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
370
-												<?php echo Give()->html->forms_dropdown( array(
369
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
370
+												<?php echo Give()->html->forms_dropdown(array(
371 371
 													'selected' => $payment_meta['form_id'],
372 372
 													'name'   => 'give-payment-form-select',
373 373
 													'id'     => 'give-payment-form-select',
374 374
 													'chosen' => true,
375
-												) ); ?>
375
+												)); ?>
376 376
 											</p>
377 377
 										</div>
378 378
 										<div class="column">
379 379
 											<p>
380
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
381
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
380
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
381
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
382 382
 											</p>
383 383
 											<p>
384
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
384
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
385 385
 												<span class="give-donation-level">
386 386
 													<?php
387
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
388
-													if ( empty( $var_prices ) ) {
389
-														esc_html_e( 'n/a', 'give' );
387
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
388
+													if (empty($var_prices)) {
389
+														esc_html_e('n/a', 'give');
390 390
 													} else {
391 391
 														$prices_atts = '';
392
-														if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
393
-															foreach ( $variable_prices as $variable_price ) {
394
-																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] );
392
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
393
+															foreach ($variable_prices as $variable_price) {
394
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']);
395 395
 															}
396 396
 														}
397 397
 														// Variable price dropdown options.
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 															'chosen'           => true,
402 402
 															'show_option_all'  => '',
403 403
 															'show_option_none' => '',
404
-															'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
404
+															'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
405 405
 															'selected'         => $payment_meta['price_id'],
406 406
 														);
407 407
 														// Render variable prices select tag html.
408
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
408
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
409 409
 													}
410 410
 													?>
411 411
 												</span>
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 										</div>
414 414
 										<div class="column">
415 415
 											<p>
416
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
417
-												<?php echo give_currency_filter( give_format_amount( $payment->total ), give_get_payment_currency_code( $payment->ID ) ); ?>
416
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
417
+												<?php echo give_currency_filter(give_format_amount($payment->total), give_get_payment_currency_code($payment->ID)); ?>
418 418
 											</p>
419 419
 											<p>
420 420
 												<?php
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 												 *
428 428
 												 * @param int $payment_id Payment id.
429 429
 												 */
430
-												do_action( 'give_donation_details_thead_before', $payment_id );
430
+												do_action('give_donation_details_thead_before', $payment_id);
431 431
 
432 432
 
433 433
 												/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 												 *
440 440
 												 * @param int $payment_id Payment id.
441 441
 												 */
442
-												do_action( 'give_donation_details_thead_after', $payment_id );
442
+												do_action('give_donation_details_thead_after', $payment_id);
443 443
 
444 444
 												/**
445 445
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 												 *
451 451
 												 * @param int $payment_id Payment id.
452 452
 												 */
453
-												do_action( 'give_donation_details_tbody_before', $payment_id );
453
+												do_action('give_donation_details_tbody_before', $payment_id);
454 454
 
455 455
 												/**
456 456
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 												 *
462 462
 												 * @param int $payment_id Payment id.
463 463
 												 */
464
-												do_action( 'give_donation_details_tbody_after', $payment_id );
464
+												do_action('give_donation_details_tbody_after', $payment_id);
465 465
 												?>
466 466
 											</p>
467 467
 										</div>
@@ -481,57 +481,57 @@  discard block
 block discarded – undo
481 481
 							 *
482 482
 							 * @param int $payment_id Payment id.
483 483
 							 */
484
-							do_action( 'give_view_order_details_files_after', $payment_id );
484
+							do_action('give_view_order_details_files_after', $payment_id);
485 485
 							?>
486 486
 
487 487
 							<div id="give-donor-details" class="postbox">
488
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
488
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
489 489
 
490 490
 								<div class="inside">
491 491
 
492
-									<?php $customer = new Give_Customer( $customer_id ); ?>
492
+									<?php $customer = new Give_Customer($customer_id); ?>
493 493
 
494 494
 									<div class="column-container customer-info">
495 495
 										<div class="column">
496 496
 											<p>
497
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
497
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
498 498
 												<?php
499
-												if ( ! empty( $customer->id ) ) {
499
+												if ( ! empty($customer->id)) {
500 500
 													printf(
501 501
 														'<a href="%1$s" target="_blank">#%2$s</a>',
502
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ),
502
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id),
503 503
 														$customer->id
504 504
 													);
505 505
 												}
506 506
 												?>
507 507
 											</p>
508 508
 											<p>
509
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
510
-												<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
509
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
510
+												<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
511 511
 											</p>
512 512
 										</div>
513 513
 										<div class="column">
514 514
 											<p>
515
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
515
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
516 516
 												<?php echo $customer->name; ?>
517 517
 											</p>
518 518
 											<p>
519
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
519
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
520 520
 												<?php echo $customer->email; ?>
521 521
 											</p>
522 522
 										</div>
523 523
 										<div class="column">
524 524
 											<p>
525
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
525
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
526 526
 												<?php
527
-												echo Give()->html->donor_dropdown( array(
527
+												echo Give()->html->donor_dropdown(array(
528 528
 													'selected' => $customer->id,
529 529
 													'name'     => 'customer-id',
530
-												) );
530
+												));
531 531
 												?>
532 532
 											</p>
533 533
 											<p>
534
-												<a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
534
+												<a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a>
535 535
 											</p>
536 536
 										</div>
537 537
 									</div>
@@ -539,13 +539,13 @@  discard block
 block discarded – undo
539 539
 									<div class="column-container new-customer" style="display: none">
540 540
 										<div class="column">
541 541
 											<p>
542
-												<label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
542
+												<label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
543 543
 												<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
544 544
 											</p>
545 545
 										</div>
546 546
 										<div class="column">
547 547
 											<p>
548
-												<label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
548
+												<label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
549 549
 												<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
550 550
 											</p>
551 551
 										</div>
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 											<p>
554 554
 												<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
555 555
 												<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
556
-												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
556
+												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
557 557
 												<br>
558
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
558
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
559 559
 											</p>
560 560
 										</div>
561 561
 									</div>
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 									 * @param array $payment_meta Payment meta.
572 572
 									 * @param array $user_info    User information.
573 573
 									 */
574
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
574
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
575 575
 
576 576
 									/**
577 577
 									 * Fires in order details page, in the donor-details metabox.
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 									 *
581 581
 									 * @param int $payment_id Payment id.
582 582
 									 */
583
-									do_action( 'give_payment_view_details', $payment_id );
583
+									do_action('give_payment_view_details', $payment_id);
584 584
 									?>
585 585
 
586 586
 								</div>
@@ -596,11 +596,11 @@  discard block
 block discarded – undo
596 596
 							 *
597 597
 							 * @param int $payment_id Payment id.
598 598
 							 */
599
-							do_action( 'give_view_order_details_billing_before', $payment_id );
599
+							do_action('give_view_order_details_billing_before', $payment_id);
600 600
 							?>
601 601
 
602 602
 							<div id="give-billing-details" class="postbox">
603
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
603
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
604 604
 
605 605
 								<div class="inside">
606 606
 
@@ -610,59 +610,59 @@  discard block
 block discarded – undo
610 610
 											<div class="data column-container">
611 611
 												<div class="column">
612 612
 													<div class="give-wrap-address-line1">
613
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
614
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
613
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
614
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
615 615
 													</div>
616 616
 													<div class="give-wrap-address-line2">
617
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
618
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
617
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
618
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
619 619
 													</div>
620 620
 												</div>
621 621
 												<div class="column">
622 622
 													<div class="give-wrap-address-city">
623
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
624
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
623
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
624
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
625 625
 													</div>
626 626
 													<div class="give-wrap-address-zip">
627
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
628
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
627
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
628
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
629 629
 
630 630
 													</div>
631 631
 												</div>
632 632
 												<div class="column">
633 633
 													<div id="give-order-address-country-wrap">
634
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
634
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
635 635
 														<?php
636
-														echo Give()->html->select( array(
636
+														echo Give()->html->select(array(
637 637
 															'options'          => give_get_country_list(),
638 638
 															'name'             => 'give-payment-address[0][country]',
639 639
 															'selected'         => $address['country'],
640 640
 															'show_option_all'  => false,
641 641
 															'show_option_none' => false,
642 642
 															'chosen'           => true,
643
-															'placeholder'      => esc_attr__( 'Select a country', 'give' ),
644
-															'data'             => array( 'search-type' => 'no_ajax' ),
645
-														) );
643
+															'placeholder'      => esc_attr__('Select a country', 'give'),
644
+															'data'             => array('search-type' => 'no_ajax'),
645
+														));
646 646
 														?>
647 647
 													</div>
648 648
 													<div id="give-order-address-state-wrap">
649
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label>
649
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label>
650 650
 														<?php
651
-														$states = give_get_states( $address['country'] );
652
-														if ( ! empty( $states ) ) {
653
-															echo Give()->html->select( array(
651
+														$states = give_get_states($address['country']);
652
+														if ( ! empty($states)) {
653
+															echo Give()->html->select(array(
654 654
 																'options'          => $states,
655 655
 																'name'             => 'give-payment-address[0][state]',
656 656
 																'selected'         => $address['state'],
657 657
 																'show_option_all'  => false,
658 658
 																'show_option_none' => false,
659 659
 																'chosen'           => true,
660
-																'placeholder'      => esc_attr__( 'Select a state', 'give' ),
661
-																'data'             => array( 'search-type' => 'no_ajax' ),
662
-															) );
660
+																'placeholder'      => esc_attr__('Select a state', 'give'),
661
+																'data'             => array('search-type' => 'no_ajax'),
662
+															));
663 663
 														} else {
664 664
 															?>
665
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
665
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
666 666
 															<?php
667 667
 														} ?>
668 668
 													</div>
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 									 *
683 683
 									 * @param int $payment_id Payment id.
684 684
 									 */
685
-									do_action( 'give_payment_billing_details', $payment_id );
685
+									do_action('give_payment_billing_details', $payment_id);
686 686
 									?>
687 687
 
688 688
 								</div>
@@ -698,32 +698,32 @@  discard block
 block discarded – undo
698 698
 							 *
699 699
 							 * @param int $payment_id Payment id.
700 700
 							 */
701
-							do_action( 'give_view_order_details_billing_after', $payment_id );
701
+							do_action('give_view_order_details_billing_after', $payment_id);
702 702
 							?>
703 703
 
704 704
 							<div id="give-payment-notes" class="postbox">
705
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
705
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
706 706
 
707 707
 								<div class="inside">
708 708
 									<div id="give-payment-notes-inner">
709 709
 										<?php
710
-										$notes = give_get_payment_notes( $payment_id );
711
-										if ( ! empty( $notes ) ) {
710
+										$notes = give_get_payment_notes($payment_id);
711
+										if ( ! empty($notes)) {
712 712
 											$no_notes_display = ' style="display:none;"';
713
-											foreach ( $notes as $note ) :
713
+											foreach ($notes as $note) :
714 714
 
715
-												echo give_get_payment_note_html( $note, $payment_id );
715
+												echo give_get_payment_note_html($note, $payment_id);
716 716
 
717 717
 											endforeach;
718 718
 										} else {
719 719
 											$no_notes_display = '';
720 720
 										}
721
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
721
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?>
722 722
 									</div>
723 723
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
724 724
 
725 725
 									<div class="give-clearfix">
726
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
726
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
727 727
 									</div>
728 728
 
729 729
 								</div>
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 							 *
740 740
 							 * @param int $payment_id Payment id.
741 741
 							 */
742
-							do_action( 'give_view_order_details_main_after', $payment_id );
742
+							do_action('give_view_order_details_main_after', $payment_id);
743 743
 							?>
744 744
 
745 745
 						</div>
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 		 *
762 762
 		 * @param int $payment_id Payment id.
763 763
 		 */
764
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
764
+		do_action('give_view_order_details_form_bottom', $payment_id);
765 765
 
766
-		wp_nonce_field( 'give_update_payment_details_nonce' );
766
+		wp_nonce_field('give_update_payment_details_nonce');
767 767
 		?>
768
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
768
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
769 769
 		<input type="hidden" name="give_action" value="update_payment_details"/>
770 770
 	</form>
771 771
 	<?php
@@ -776,6 +776,6 @@  discard block
 block discarded – undo
776 776
 	 *
777 777
 	 * @param int $payment_id Payment id.
778 778
 	 */
779
-	do_action( 'give_view_order_details_after', $payment_id );
779
+	do_action('give_view_order_details_after', $payment_id);
780 780
 	?>
781 781
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +119 added lines, -119 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,52 +25,52 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	// Retrieve existing payment meta.
43 43
 	$meta      = $payment->get_meta();
44 44
 	$user_info = $payment->user_info;
45 45
 
46 46
 	$status = $data['give-payment-status'];
47
-	$date   = sanitize_text_field( $data['give-payment-date'] );
48
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
47
+	$date   = sanitize_text_field($data['give-payment-date']);
48
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
49 49
 
50 50
 	// Restrict to our high and low.
51
-	if ( $hour > 23 ) {
51
+	if ($hour > 23) {
52 52
 		$hour = 23;
53
-	} elseif ( $hour < 0 ) {
53
+	} elseif ($hour < 0) {
54 54
 		$hour = 00;
55 55
 	}
56 56
 
57
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
57
+	$minute = sanitize_text_field($data['give-payment-time-min']);
58 58
 
59 59
 	// Restrict to our high and low.
60
-	if ( $minute > 59 ) {
60
+	if ($minute > 59) {
61 61
 		$minute = 59;
62
-	} elseif ( $minute < 0 ) {
62
+	} elseif ($minute < 0) {
63 63
 		$minute = 00;
64 64
 	}
65 65
 
66
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
66
+	$address = array_map('trim', $data['give-payment-address'][0]);
67 67
 
68
-	$curr_total = give_sanitize_amount( $payment->total );
69
-	$new_total  = give_sanitize_amount( $data['give-payment-total'] );
70
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
68
+	$curr_total = give_sanitize_amount($payment->total);
69
+	$new_total  = give_sanitize_amount($data['give-payment-total']);
70
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
71 71
 
72
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
73
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
72
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
73
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
74 74
 
75 75
 	/**
76 76
 	 * Fires before updating edited donation.
@@ -79,98 +79,98 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @param int $payment_id The ID of the payment.
81 81
 	 */
82
-	do_action( 'give_update_edited_purchase', $payment_id );
82
+	do_action('give_update_edited_purchase', $payment_id);
83 83
 
84 84
 	$payment->date = $date;
85 85
 	$updated       = $payment->save();
86 86
 
87
-	if ( 0 === $updated ) {
88
-		wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
87
+	if (0 === $updated) {
88
+		wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
89 89
 	}
90 90
 
91 91
 	$customer_changed = false;
92 92
 
93
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
93
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
94 94
 
95
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
96
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
95
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
96
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
97 97
 
98
-		if ( empty( $email ) || empty( $names ) ) {
99
-			wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
98
+		if (empty($email) || empty($names)) {
99
+			wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
100 100
 		}
101 101
 
102
-		$customer = new Give_Customer( $email );
103
-		if ( empty( $customer->id ) ) {
104
-			$customer_data = array( 'name' => $names, 'email' => $email );
105
-			$user_id       = email_exists( $email );
106
-			if ( false !== $user_id ) {
102
+		$customer = new Give_Customer($email);
103
+		if (empty($customer->id)) {
104
+			$customer_data = array('name' => $names, 'email' => $email);
105
+			$user_id       = email_exists($email);
106
+			if (false !== $user_id) {
107 107
 				$customer_data['user_id'] = $user_id;
108 108
 			}
109 109
 
110
-			if ( ! $customer->create( $customer_data ) ) {
110
+			if ( ! $customer->create($customer_data)) {
111 111
 				// Failed to crete the new donor, assume the previous donor.
112 112
 				$customer_changed = false;
113
-				$customer         = new Give_Customer( $curr_customer_id );
114
-				give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) );
113
+				$customer         = new Give_Customer($curr_customer_id);
114
+				give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give'));
115 115
 			}
116 116
 		}
117 117
 
118 118
 		$new_customer_id = $customer->id;
119 119
 
120
-		$previous_customer = new Give_Customer( $curr_customer_id );
120
+		$previous_customer = new Give_Customer($curr_customer_id);
121 121
 
122 122
 		$customer_changed = true;
123 123
 
124
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
124
+	} elseif ($curr_customer_id !== $new_customer_id) {
125 125
 
126
-		$customer = new Give_Customer( $new_customer_id );
126
+		$customer = new Give_Customer($new_customer_id);
127 127
 		$email    = $customer->email;
128 128
 		$names    = $customer->name;
129 129
 
130
-		$previous_customer = new Give_Customer( $curr_customer_id );
130
+		$previous_customer = new Give_Customer($curr_customer_id);
131 131
 
132 132
 		$customer_changed = true;
133 133
 
134 134
 	} else {
135 135
 
136
-		$customer = new Give_Customer( $curr_customer_id );
136
+		$customer = new Give_Customer($curr_customer_id);
137 137
 		$email    = $customer->email;
138 138
 		$names    = $customer->name;
139 139
 
140 140
 	}
141 141
 
142 142
 	// Setup first and last name from input values.
143
-	$names      = explode( ' ', $names );
144
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
143
+	$names      = explode(' ', $names);
144
+	$first_name = ! empty($names[0]) ? $names[0] : '';
145 145
 	$last_name  = '';
146
-	if ( ! empty( $names[1] ) ) {
147
-		unset( $names[0] );
148
-		$last_name = implode( ' ', $names );
146
+	if ( ! empty($names[1])) {
147
+		unset($names[0]);
148
+		$last_name = implode(' ', $names);
149 149
 	}
150 150
 
151
-	if ( $customer_changed ) {
151
+	if ($customer_changed) {
152 152
 
153 153
 		// Remove the stats and payment from the previous customer and attach it to the new customer.
154
-		$previous_customer->remove_payment( $payment_id, false );
155
-		$customer->attach_payment( $payment_id, false );
154
+		$previous_customer->remove_payment($payment_id, false);
155
+		$customer->attach_payment($payment_id, false);
156 156
 
157
-		if ( 'publish' == $status ) {
157
+		if ('publish' == $status) {
158 158
 
159 159
 			// Reduce previous user donation count and amount.
160 160
 			$previous_customer->decrease_purchase_count();
161
-			$previous_customer->decrease_value( $curr_total );
161
+			$previous_customer->decrease_value($curr_total);
162 162
 
163 163
 			// If donation was completed adjust stats of new customers.
164 164
 			$customer->increase_purchase_count();
165
-			$customer->increase_value( $new_total );
165
+			$customer->increase_value($new_total);
166 166
 		}
167 167
 
168 168
 		$payment->customer_id = $customer->id;
169 169
 	} else {
170 170
 
171
-		if ( 'publish' === $status ) {
171
+		if ('publish' === $status) {
172 172
 			// Update user donation stat.
173
-			$customer->update_donation_value( $curr_total, $new_total );
173
+			$customer->update_donation_value($curr_total, $new_total);
174 174
 		}
175 175
 	}
176 176
 
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 	$payment->total      = $new_total;
184 184
 
185 185
 	// Check for payment notes.
186
-	if ( ! empty( $data['give-payment-note'] ) ) {
186
+	if ( ! empty($data['give-payment-note'])) {
187 187
 
188
-		$note = wp_kses( $data['give-payment-note'], array() );
189
-		give_insert_payment_note( $payment_id, $note );
188
+		$note = wp_kses($data['give-payment-note'], array());
189
+		give_insert_payment_note($payment_id, $note);
190 190
 
191 191
 	}
192 192
 
@@ -194,17 +194,17 @@  discard block
 block discarded – undo
194 194
 	$payment->status = $status;
195 195
 
196 196
 	// Adjust total store earnings if the payment total has been changed.
197
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
197
+	if ($new_total !== $curr_total && 'publish' == $status) {
198 198
 
199
-		if ( $new_total > $curr_total ) {
199
+		if ($new_total > $curr_total) {
200 200
 			// Increase if our new total is higher.
201 201
 			$difference = $new_total - $curr_total;
202
-			give_increase_total_earnings( $difference );
202
+			give_increase_total_earnings($difference);
203 203
 
204
-		} elseif ( $curr_total > $new_total ) {
204
+		} elseif ($curr_total > $new_total) {
205 205
 			// Decrease if our new total is lower.
206 206
 			$difference = $curr_total - $new_total;
207
-			give_decrease_total_earnings( $difference );
207
+			give_decrease_total_earnings($difference);
208 208
 
209 209
 		}
210 210
 	}
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
 	$payment->save();
213 213
 
214 214
 	// Get new give form ID.
215
-	$new_form_id     = absint( $data['give-payment-form-select'] );
216
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
215
+	$new_form_id     = absint($data['give-payment-form-select']);
216
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
217 217
 
218 218
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
219 219
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
220 220
 	// Check if user want to transfer current payment to new give form id.
221
-	if ( $new_form_id != $current_form_id ) {
221
+	if ($new_form_id != $current_form_id) {
222 222
 
223 223
 		// Get new give form title.
224
-		$new_form_title = get_the_title( $new_form_id );
224
+		$new_form_title = get_the_title($new_form_id);
225 225
 
226 226
 		// Update new give form data in payment data.
227 227
 		$payment_meta               = $payment->get_meta();
@@ -229,56 +229,56 @@  discard block
 block discarded – undo
229 229
 		$payment_meta['form_id']    = $new_form_id;
230 230
 
231 231
 		// Update price id post meta data for set donation form.
232
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
232
+		if ( ! give_has_variable_prices($new_form_id)) {
233 233
 			$payment_meta['price_id'] = '';
234 234
 		}
235 235
 
236 236
 		// Update payment give form meta data.
237
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
238
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
239
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
237
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
238
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
239
+		$payment->update_meta('_give_payment_meta', $payment_meta);
240 240
 
241 241
 		// Update price id payment metadata.
242
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
243
-			$payment->update_meta( '_give_payment_price_id', '' );
242
+		if ( ! give_has_variable_prices($new_form_id)) {
243
+			$payment->update_meta('_give_payment_price_id', '');
244 244
 		}
245 245
 
246 246
 		// If donation was completed, adjust stats of forms.
247
-		if ( 'publish' == $status ) {
247
+		if ('publish' == $status) {
248 248
 
249 249
 			// Decrease sale of old give form. For other payment status.
250
-			$current_form = new Give_Donate_Form( $current_form_id );
250
+			$current_form = new Give_Donate_Form($current_form_id);
251 251
 			$current_form->decrease_sales();
252
-			$current_form->decrease_earnings( $curr_total );
252
+			$current_form->decrease_earnings($curr_total);
253 253
 
254 254
 			// Increase sale of new give form.
255
-			$new_form = new Give_Donate_Form( $new_form_id );
255
+			$new_form = new Give_Donate_Form($new_form_id);
256 256
 			$new_form->increase_sales();
257
-			$new_form->increase_earnings( $new_total );
257
+			$new_form->increase_earnings($new_total);
258 258
 		}
259 259
 
260 260
 		// Re setup payment to update new meta value in object.
261
-		$payment->update_payment_setup( $payment->ID );
261
+		$payment->update_payment_setup($payment->ID);
262 262
 	}
263 263
 
264 264
 	// Update price id if current form is variable form.
265
-	if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
265
+	if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) {
266 266
 
267 267
 		// Get payment meta data.
268 268
 		$payment_meta = $payment->get_meta();
269 269
 
270 270
 		// Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
271
-		$data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
271
+		$data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : '';
272 272
 
273 273
 		// Update payment meta data.
274 274
 		$payment_meta['price_id'] = $data['give-variable-price'];
275 275
 
276 276
 		// Update payment give form meta data.
277
-		$payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
278
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
277
+		$payment->update_meta('_give_payment_price_id', $data['give-variable-price']);
278
+		$payment->update_meta('_give_payment_meta', $payment_meta);
279 279
 
280 280
 		// Re setup payment to update new meta value in object.
281
-		$payment->update_payment_setup( $payment->ID );
281
+		$payment->update_payment_setup($payment->ID);
282 282
 	}
283 283
 
284 284
 	/**
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @param int $payment_id The ID of the payment.
290 290
 	 */
291
-	do_action( 'give_updated_edited_purchase', $payment_id );
291
+	do_action('give_updated_edited_purchase', $payment_id);
292 292
 
293
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
293
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
294 294
 	exit;
295 295
 }
296 296
 
297
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
297
+add_action('give_update_payment_details', 'give_update_payment_details');
298 298
 
299 299
 /**
300 300
  * Trigger a Donation Deletion
@@ -305,48 +305,48 @@  discard block
 block discarded – undo
305 305
  *
306 306
  * @return void
307 307
  */
308
-function give_trigger_purchase_delete( $data ) {
309
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
308
+function give_trigger_purchase_delete($data) {
309
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
310 310
 
311
-		$payment_id = absint( $data['purchase_id'] );
311
+		$payment_id = absint($data['purchase_id']);
312 312
 
313
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
314
-			wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
313
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
314
+			wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
315 315
 		}
316 316
 
317
-		give_delete_purchase( $payment_id );
318
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) );
317
+		give_delete_purchase($payment_id);
318
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted'));
319 319
 		give_die();
320 320
 	}
321 321
 }
322 322
 
323
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
323
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
324 324
 
325 325
 /**
326 326
  * AJAX Store Donation Note
327 327
  */
328 328
 function give_ajax_store_payment_note() {
329 329
 
330
-	$payment_id = absint( $_POST['payment_id'] );
331
-	$note       = wp_kses( $_POST['note'], array() );
330
+	$payment_id = absint($_POST['payment_id']);
331
+	$note       = wp_kses($_POST['note'], array());
332 332
 
333
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
334
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
333
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
334
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
335 335
 	}
336 336
 
337
-	if ( empty( $payment_id ) ) {
338
-		die( '-1' );
337
+	if (empty($payment_id)) {
338
+		die('-1');
339 339
 	}
340 340
 
341
-	if ( empty( $note ) ) {
342
-		die( '-1' );
341
+	if (empty($note)) {
342
+		die('-1');
343 343
 	}
344 344
 
345
-	$note_id = give_insert_payment_note( $payment_id, $note );
346
-	die( give_get_payment_note_html( $note_id ) );
345
+	$note_id = give_insert_payment_note($payment_id, $note);
346
+	die(give_get_payment_note_html($note_id));
347 347
 }
348 348
 
349
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
349
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
350 350
 
351 351
 /**
352 352
  * Triggers a donation note deletion without ajax
@@ -357,24 +357,24 @@  discard block
 block discarded – undo
357 357
  *
358 358
  * @return void
359 359
  */
360
-function give_trigger_payment_note_deletion( $data ) {
360
+function give_trigger_payment_note_deletion($data) {
361 361
 
362
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
362
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
363 363
 		return;
364 364
 	}
365 365
 
366
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
367
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
366
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
367
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
368 368
 	}
369 369
 
370
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
370
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id='.absint($data['payment_id']));
371 371
 
372
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
372
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
373 373
 
374
-	wp_redirect( $edit_order_url );
374
+	wp_redirect($edit_order_url);
375 375
 }
376 376
 
377
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
377
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
378 378
 
379 379
 /**
380 380
  * Delete a payment note deletion with ajax
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function give_ajax_delete_payment_note() {
387 387
 
388
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
389
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
388
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
389
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
390 390
 	}
391 391
 
392
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
393
-		die( '1' );
392
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
393
+		die('1');
394 394
 	} else {
395
-		die( '-1' );
395
+		die('-1');
396 396
 	}
397 397
 
398 398
 }
399 399
 
400
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
400
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded.
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults.
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
123
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
124
-			'ajax'     => false,                              // Does this table support ajax?
125
-		) );
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
124
+			'ajax'     => false, // Does this table support ajax?
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	/**
@@ -135,29 +135,29 @@  discard block
 block discarded – undo
135 135
 	 * @return void
136 136
 	 */
137 137
 	public function advanced_filters() {
138
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
139
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
140
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
138
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
139
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
140
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
141 141
 		?>
142 142
         <div id="give-payment-filters">
143 143
 			<span id="give-payment-date-filters">
144 144
 				<label for="start-date"
145
-                       class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
145
+                       class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
146 146
 				<input type="text" id="start-date" name="start-date" class="give_datepicker"
147 147
                        value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
148
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
148
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
149 149
 				<input type="text" id="end-date" name="end-date" class="give_datepicker"
150 150
                        value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
151
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
151
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
152 152
 			</span>
153
-			<?php if ( ! empty( $status ) ) : ?>
154
-                <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
153
+			<?php if ( ! empty($status)) : ?>
154
+                <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
155 155
 			<?php endif; ?>
156
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
157
-                <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
158
-                   class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
156
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
157
+                <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
158
+                   class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
159 159
 			<?php endif; ?>
160
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
160
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
161 161
         </div>
162 162
 
163 163
 		<?php
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @return void
176 176
 	 */
177
-	public function search_box( $text, $input_id ) {
178
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
177
+	public function search_box($text, $input_id) {
178
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
179 179
 			return;
180 180
 		}
181 181
 
182
-		$input_id = $input_id . '-search-input';
182
+		$input_id = $input_id.'-search-input';
183 183
 
184
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
185
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
184
+		if ( ! empty($_REQUEST['orderby'])) {
185
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
186 186
 		}
187
-		if ( ! empty( $_REQUEST['order'] ) ) {
188
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
187
+		if ( ! empty($_REQUEST['order'])) {
188
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
189 189
 		}
190 190
 		?>
191 191
         <p class="search-box" role="search">
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 			 *
198 198
 			 * @since 1.7
199 199
 			 */
200
-			do_action( 'give_payment_history_search' );
200
+			do_action('give_payment_history_search');
201 201
 			?>
202 202
             <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
203 203
             <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
204
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
204
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
205 205
         </p>
206 206
 		<?php
207 207
 	}
@@ -215,52 +215,52 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function get_views() {
217 217
 
218
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
219
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
220
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
221
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
222
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
223
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
224
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
225
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
226
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
218
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
219
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
220
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
221
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
222
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
223
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
224
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
225
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
226
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
227 227
 
228 228
 		$views = array(
229
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
229
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
230 230
 				'status',
231 231
 				'paged',
232
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
233
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
232
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
233
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
234 234
 				'status' => 'publish',
235 235
 				'paged'  => false,
236
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
237
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
236
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
237
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
238 238
 				'status' => 'pending',
239 239
 				'paged'  => false,
240
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
241
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
240
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
241
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
242 242
 				'status' => 'refunded',
243 243
 				'paged'  => false,
244
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
245
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
244
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
245
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
246 246
 				'status' => 'revoked',
247 247
 				'paged'  => false,
248
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
249
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
248
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
249
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
250 250
 				'status' => 'failed',
251 251
 				'paged'  => false,
252
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
253
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
252
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
253
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
254 254
 				'status' => 'cancelled',
255 255
 				'paged'  => false,
256
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
257
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
256
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
257
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
258 258
 				'status' => 'abandoned',
259 259
 				'paged'  => false,
260
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ),
260
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count),
261 261
 		);
262 262
 
263
-		return apply_filters( 'give_payments_table_views', $views );
263
+		return apply_filters('give_payments_table_views', $views);
264 264
 	}
265 265
 
266 266
 	/**
@@ -273,15 +273,15 @@  discard block
 block discarded – undo
273 273
 	public function get_columns() {
274 274
 		$columns = array(
275 275
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
276
-			'donation'      => esc_html__( 'Donation', 'give' ),
277
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
278
-			'status'        => esc_html__( 'Status', 'give' ),
279
-			'date'          => esc_html__( 'Date', 'give' ),
280
-			'amount'        => esc_html__( 'Amount', 'give' ),
281
-			'details'       => esc_html__( 'Details', 'give' ),
276
+			'donation'      => esc_html__('Donation', 'give'),
277
+			'donation_form' => esc_html__('Donation Form', 'give'),
278
+			'status'        => esc_html__('Status', 'give'),
279
+			'date'          => esc_html__('Date', 'give'),
280
+			'amount'        => esc_html__('Amount', 'give'),
281
+			'details'       => esc_html__('Details', 'give'),
282 282
 		);
283 283
 
284
-		return apply_filters( 'give_payments_table_columns', $columns );
284
+		return apply_filters('give_payments_table_columns', $columns);
285 285
 	}
286 286
 
287 287
 	/**
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function get_sortable_columns() {
295 295
 		$columns = array(
296
-			'donation'      => array( 'ID', true ),
297
-			'donation_form' => array( 'donation_form', false ),
298
-			'status'        => array( 'status', false ),
299
-			'amount'        => array( 'amount', false ),
300
-			'date'          => array( 'date', false ),
296
+			'donation'      => array('ID', true),
297
+			'donation_form' => array('donation_form', false),
298
+			'status'        => array('status', false),
299
+			'amount'        => array('amount', false),
300
+			'date'          => array('date', false),
301 301
 		);
302 302
 
303
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
303
+		return apply_filters('give_payments_table_sortable_columns', $columns);
304 304
 	}
305 305
 
306 306
 	/**
@@ -326,70 +326,70 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * @return string Column Name
328 328
 	 */
329
-	public function column_default( $payment, $column_name ) {
329
+	public function column_default($payment, $column_name) {
330 330
 
331
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) );
332
-		$row_actions         = $this->get_row_actions( $payment );
331
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details')));
332
+		$row_actions         = $this->get_row_actions($payment);
333 333
 
334
-		switch ( $column_name ) {
334
+		switch ($column_name) {
335 335
 			case 'donation' :
336 336
 				$value = sprintf(
337 337
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
338 338
 					$single_donation_url,
339
-					sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ),
339
+					sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID),
340 340
 					$payment->ID,
341
-					esc_html__( 'by', 'give' ),
342
-					$this->get_donor( $payment )
341
+					esc_html__('by', 'give'),
342
+					$this->get_donor($payment)
343 343
 				);
344
-				$value .= $this->get_donor_email( $payment );
345
-				$value .= $this->row_actions( $row_actions );
344
+				$value .= $this->get_donor_email($payment);
345
+				$value .= $this->row_actions($row_actions);
346 346
 				break;
347 347
 
348 348
 			case 'amount' :
349
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
350
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
351
-				$value  .= sprintf(
349
+				$amount = ! empty($payment->total) ? $payment->total : 0;
350
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
351
+				$value .= sprintf(
352 352
 					'<br><small>%1$s %2$s</small>',
353
-					__( 'via', 'give' ),
354
-					give_get_gateway_admin_label( $payment->gateway )
353
+					__('via', 'give'),
354
+					give_get_gateway_admin_label($payment->gateway)
355 355
 				);
356 356
 				break;
357 357
 
358 358
 			case 'donation_form' :
359
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
360
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
361
-				$level      = give_get_payment_form_title( $payment->meta, true );
359
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
360
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
361
+				$level      = give_get_payment_form_title($payment->meta, true);
362 362
 
363
-				if ( ! empty( $level ) ) {
363
+				if ( ! empty($level)) {
364 364
 					$value .= $level;
365 365
 				}
366 366
 
367 367
 				break;
368 368
 
369 369
 			case 'date' :
370
-				$date  = strtotime( $payment->date );
371
-				$value = date_i18n( give_date_format(), $date );
370
+				$date  = strtotime($payment->date);
371
+				$value = date_i18n(give_date_format(), $date);
372 372
 				break;
373 373
 
374 374
 			case 'status' :
375
-				$value = $this->get_payment_status( $payment );
375
+				$value = $this->get_payment_status($payment);
376 376
 				break;
377 377
 
378 378
 			case 'details' :
379 379
 				$value = sprintf(
380 380
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
381 381
 					$single_donation_url,
382
-					sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID )
382
+					sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)
383 383
 				);
384 384
 				break;
385 385
 
386 386
 			default:
387
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
387
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
388 388
 				break;
389 389
 
390 390
 		}
391 391
 
392
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
392
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
393 393
 	}
394 394
 
395 395
 	/**
@@ -402,17 +402,17 @@  discard block
 block discarded – undo
402 402
 	 *
403 403
 	 * @return string                Data shown in the Email column
404 404
 	 */
405
-	public function get_donor_email( $payment ) {
405
+	public function get_donor_email($payment) {
406 406
 
407
-		$email = give_get_payment_user_email( $payment->ID );
407
+		$email = give_get_payment_user_email($payment->ID);
408 408
 
409
-		if ( empty( $email ) ) {
410
-			$email = esc_html__( '(unknown)', 'give' );
409
+		if (empty($email)) {
410
+			$email = esc_html__('(unknown)', 'give');
411 411
 		}
412 412
 
413
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
413
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
414 414
 
415
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
415
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
416 416
 	}
417 417
 
418 418
 	/**
@@ -424,18 +424,18 @@  discard block
 block discarded – undo
424 424
 	 *
425 425
 	 * @return array $actions
426 426
 	 */
427
-	function get_row_actions( $payment ) {
427
+	function get_row_actions($payment) {
428 428
 
429 429
 		$actions = array();
430
-		$email   = give_get_payment_user_email( $payment->ID );
430
+		$email   = give_get_payment_user_email($payment->ID);
431 431
 
432 432
 		// Add search term string back to base URL.
433
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
434
-		if ( ! empty( $search_terms ) ) {
435
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
433
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
434
+		if ( ! empty($search_terms)) {
435
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
436 436
 		}
437 437
 
438
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
438
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
439 439
 
440 440
 			$actions['email_links'] = sprintf(
441 441
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 					),
450 450
 					'give_payment_nonce'
451 451
 				),
452
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
453
-				esc_html__( 'Resend Receipt', 'give' )
452
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
453
+				esc_html__('Resend Receipt', 'give')
454 454
 			);
455 455
 
456 456
 		}
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 				),
468 468
 				'give_donation_nonce'
469 469
 			),
470
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
471
-			esc_html__( 'Delete', 'give' )
470
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
471
+			esc_html__('Delete', 'give')
472 472
 		);
473 473
 
474
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
474
+		return apply_filters('give_payment_row_actions', $actions, $payment);
475 475
 	}
476 476
 
477 477
 
@@ -485,10 +485,10 @@  discard block
 block discarded – undo
485 485
 	 *
486 486
 	 * @return string                Data shown in the Email column
487 487
 	 */
488
-	function get_payment_status( $payment ) {
489
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
490
-		if ( $payment->mode == 'test' ) {
491
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
488
+	function get_payment_status($payment) {
489
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
490
+		if ($payment->mode == 'test') {
491
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
492 492
 		}
493 493
 
494 494
 		return $value;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 *
505 505
 	 * @return string Displays a checkbox.
506 506
 	 */
507
-	public function column_cb( $payment ) {
507
+	public function column_cb($payment) {
508 508
 		return sprintf(
509 509
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
510 510
 			'payment',
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * @return string Displays a checkbox.
524 524
 	 */
525
-	public function get_payment_id( $payment ) {
526
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
525
+	public function get_payment_id($payment) {
526
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
527 527
 	}
528 528
 
529 529
 	/**
@@ -536,19 +536,19 @@  discard block
 block discarded – undo
536 536
 	 *
537 537
 	 * @return string Data shown in the User column
538 538
 	 */
539
-	public function get_donor( $payment ) {
539
+	public function get_donor($payment) {
540 540
 
541
-		$customer_id = give_get_payment_customer_id( $payment->ID );
541
+		$customer_id = give_get_payment_customer_id($payment->ID);
542 542
 
543
-		if ( ! empty( $customer_id ) ) {
544
-			$customer = new Give_Customer( $customer_id );
545
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
543
+		if ( ! empty($customer_id)) {
544
+			$customer = new Give_Customer($customer_id);
545
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
546 546
 		} else {
547
-			$email = give_get_payment_user_email( $payment->ID );
548
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
547
+			$email = give_get_payment_user_email($payment->ID);
548
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
549 549
 		}
550 550
 
551
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
551
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
552 552
 	}
553 553
 
554 554
 	/**
@@ -560,18 +560,18 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function get_bulk_actions() {
562 562
 		$actions = array(
563
-			'delete'               => esc_html__( 'Delete', 'give' ),
564
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
565
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
566
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
567
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
568
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
569
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
570
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
571
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' ),
563
+			'delete'               => esc_html__('Delete', 'give'),
564
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
565
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
566
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
567
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
568
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
569
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
570
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
571
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give'),
572 572
 		);
573 573
 
574
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
574
+		return apply_filters('give_payments_table_bulk_actions', $actions);
575 575
 	}
576 576
 
577 577
 	/**
@@ -582,59 +582,59 @@  discard block
 block discarded – undo
582 582
 	 * @return void
583 583
 	 */
584 584
 	public function process_bulk_action() {
585
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
585
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
586 586
 		$action = $this->current_action();
587 587
 
588
-		if ( ! is_array( $ids ) ) {
589
-			$ids = array( $ids );
588
+		if ( ! is_array($ids)) {
589
+			$ids = array($ids);
590 590
 		}
591 591
 
592
-		if ( empty( $action ) ) {
592
+		if (empty($action)) {
593 593
 			return;
594 594
 		}
595 595
 
596
-		foreach ( $ids as $id ) {
596
+		foreach ($ids as $id) {
597 597
 
598 598
 			// Detect when a bulk action is being triggered.
599
-			switch ( $this->current_action() ) {
599
+			switch ($this->current_action()) {
600 600
 
601 601
 				case'delete':
602
-					give_delete_purchase( $id );
602
+					give_delete_purchase($id);
603 603
 					break;
604 604
 
605 605
 				case 'set-status-publish':
606
-					give_update_payment_status( $id, 'publish' );
606
+					give_update_payment_status($id, 'publish');
607 607
 					break;
608 608
 
609 609
 				case 'set-status-pending':
610
-					give_update_payment_status( $id, 'pending' );
610
+					give_update_payment_status($id, 'pending');
611 611
 					break;
612 612
 
613 613
 				case 'set-status-refunded':
614
-					give_update_payment_status( $id, 'refunded' );
614
+					give_update_payment_status($id, 'refunded');
615 615
 					break;
616 616
 				case 'set-status-revoked':
617
-					give_update_payment_status( $id, 'revoked' );
617
+					give_update_payment_status($id, 'revoked');
618 618
 					break;
619 619
 
620 620
 				case 'set-status-failed':
621
-					give_update_payment_status( $id, 'failed' );
621
+					give_update_payment_status($id, 'failed');
622 622
 					break;
623 623
 
624 624
 				case 'set-status-cancelled':
625
-					give_update_payment_status( $id, 'cancelled' );
625
+					give_update_payment_status($id, 'cancelled');
626 626
 					break;
627 627
 
628 628
 				case 'set-status-abandoned':
629
-					give_update_payment_status( $id, 'abandoned' );
629
+					give_update_payment_status($id, 'abandoned');
630 630
 					break;
631 631
 
632 632
 				case 'set-status-preapproval':
633
-					give_update_payment_status( $id, 'preapproval' );
633
+					give_update_payment_status($id, 'preapproval');
634 634
 					break;
635 635
 
636 636
 				case 'resend-receipt':
637
-					give_email_donation_receipt( $id, false );
637
+					give_email_donation_receipt($id, false);
638 638
 					break;
639 639
 			}
640 640
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 			 * @param int    $id             The ID of the payment.
647 647
 			 * @param string $current_action The action that is being triggered.
648 648
 			 */
649
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
649
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
650 650
 		}
651 651
 
652 652
 	}
@@ -662,27 +662,27 @@  discard block
 block discarded – undo
662 662
 
663 663
 		$args = array();
664 664
 
665
-		if ( isset( $_GET['user'] ) ) {
666
-			$args['user'] = urldecode( $_GET['user'] );
667
-		} elseif ( isset( $_GET['s'] ) ) {
668
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
669
-			if ( $is_user ) {
670
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
671
-				unset( $args['s'] );
665
+		if (isset($_GET['user'])) {
666
+			$args['user'] = urldecode($_GET['user']);
667
+		} elseif (isset($_GET['s'])) {
668
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
669
+			if ($is_user) {
670
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
671
+				unset($args['s']);
672 672
 			} else {
673
-				$args['s'] = sanitize_text_field( $_GET['s'] );
673
+				$args['s'] = sanitize_text_field($_GET['s']);
674 674
 			}
675 675
 		}
676 676
 
677
-		if ( ! empty( $_GET['start-date'] ) ) {
678
-			$args['start-date'] = urldecode( $_GET['start-date'] );
677
+		if ( ! empty($_GET['start-date'])) {
678
+			$args['start-date'] = urldecode($_GET['start-date']);
679 679
 		}
680 680
 
681
-		if ( ! empty( $_GET['end-date'] ) ) {
682
-			$args['end-date'] = urldecode( $_GET['end-date'] );
681
+		if ( ! empty($_GET['end-date'])) {
682
+			$args['end-date'] = urldecode($_GET['end-date']);
683 683
 		}
684 684
 
685
-		$payment_count         = give_count_payments( $args );
685
+		$payment_count         = give_count_payments($args);
686 686
 		$this->complete_count  = $payment_count->publish;
687 687
 		$this->pending_count   = $payment_count->pending;
688 688
 		$this->refunded_count  = $payment_count->refunded;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 		$this->cancelled_count = $payment_count->cancelled;
692 692
 		$this->abandoned_count = $payment_count->abandoned;
693 693
 
694
-		foreach ( $payment_count as $count ) {
694
+		foreach ($payment_count as $count) {
695 695
 			$this->total_count += $count;
696 696
 		}
697 697
 	}
@@ -706,26 +706,26 @@  discard block
 block discarded – undo
706 706
 	public function payments_data() {
707 707
 
708 708
 		$per_page   = $this->per_page;
709
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
710
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
711
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
712
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
713
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
714
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
715
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
716
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
717
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
718
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
719
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
720
-
721
-		if ( ! empty( $search ) ) {
709
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
710
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
711
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
712
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
713
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
714
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
715
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
716
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
717
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
718
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
719
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
720
+
721
+		if ( ! empty($search)) {
722 722
 			$status = 'any'; // Force all payment statuses when searching.
723 723
 		}
724 724
 
725 725
 		$args = array(
726 726
 			'output'     => 'payments',
727 727
 			'number'     => $per_page,
728
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
728
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
729 729
 			'orderby'    => $orderby,
730 730
 			'order'      => $order,
731 731
 			'user'       => $user,
@@ -739,12 +739,12 @@  discard block
 block discarded – undo
739 739
 			'end_date'   => $end_date,
740 740
 		);
741 741
 
742
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
742
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
743 743
 			$args['search_in_notes'] = true;
744
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
744
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
745 745
 		}
746 746
 
747
-		$p_query = new Give_Payments_Query( $args );
747
+		$p_query = new Give_Payments_Query($args);
748 748
 
749 749
 		return $p_query->get_payments();
750 750
 
@@ -764,17 +764,17 @@  discard block
 block discarded – undo
764 764
 	 */
765 765
 	public function prepare_items() {
766 766
 
767
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
767
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
768 768
 
769 769
 		$columns  = $this->get_columns();
770 770
 		$hidden   = array(); // No hidden columns.
771 771
 		$sortable = $this->get_sortable_columns();
772 772
 		$data     = $this->payments_data();
773
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
773
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
774 774
 
775
-		$this->_column_headers = array( $columns, $hidden, $sortable );
775
+		$this->_column_headers = array($columns, $hidden, $sortable);
776 776
 
777
-		switch ( $status ) {
777
+		switch ($status) {
778 778
 			case 'publish':
779 779
 				$total_items = $this->complete_count;
780 780
 				break;
@@ -801,19 +801,19 @@  discard block
 block discarded – undo
801 801
 				break;
802 802
 			default:
803 803
 				// Retrieve the count of the non-default-Give status.
804
-				$count       = wp_count_posts( 'give_payment' );
805
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
804
+				$count       = wp_count_posts('give_payment');
805
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
806 806
 				break;
807 807
 		}
808 808
 
809 809
 		$this->items = $data;
810 810
 
811
-		$this->set_pagination_args( array(
811
+		$this->set_pagination_args(array(
812 812
 				'total_items' => $total_items,
813 813
 				// We have to calculate the total number of items.
814 814
 				'per_page'    => $this->per_page,
815 815
 				// We have to determine how many items to show on a page.
816
-				'total_pages' => ceil( $total_items / $this->per_page ),
816
+				'total_pages' => ceil($total_items / $this->per_page),
817 817
 				// We have to calculate the total number of pages.
818 818
 			)
819 819
 		);
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export-earnings.php 1 patch
Spacing   +28 added lines, -28 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
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		nocache_headers();
48
-		header( 'Content-Type: text/csv; charset=utf-8' );
49
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
50
-		header( "Expires: 0" );
48
+		header('Content-Type: text/csv; charset=utf-8');
49
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
50
+		header("Expires: 0");
51 51
 
52 52
 	}
53 53
 
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public function csv_cols() {
62 62
 
63 63
 		$cols = array(
64
-			'date'      => __( 'Date', 'give' ),
65
-			'donations' => __( 'Donations', 'give' ),
64
+			'date'      => __('Date', 'give'),
65
+			'donations' => __('Donations', 'give'),
66 66
 			/* translators: %s: currency */
67
-			'earnings'  => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) )
67
+			'earnings'  => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true))
68 68
 		);
69 69
 
70 70
 		return $cols;
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function get_data() {
81 81
 
82
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
83
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
84
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
85
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
82
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
83
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
84
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
85
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
86 86
 
87 87
 		$data  = array();
88 88
 		$year  = $start_year;
89 89
 		$stats = new Give_Payment_Stats;
90 90
 
91
-		while ( $year <= $end_year ) {
91
+		while ($year <= $end_year) {
92 92
 
93
-			if ( $year == $start_year && $year == $end_year ) {
93
+			if ($year == $start_year && $year == $end_year) {
94 94
 
95 95
 				$m1 = $start_month;
96 96
 				$m2 = $end_month;
97 97
 
98
-			} elseif ( $year == $start_year ) {
98
+			} elseif ($year == $start_year) {
99 99
 
100 100
 				$m1 = $start_month;
101 101
 				$m2 = 12;
102 102
 
103
-			} elseif ( $year == $end_year ) {
103
+			} elseif ($year == $end_year) {
104 104
 
105 105
 				$m1 = 1;
106 106
 				$m2 = $end_month;
@@ -112,28 +112,28 @@  discard block
 block discarded – undo
112 112
 
113 113
 			}
114 114
 
115
-			while ( $m1 <= $m2 ) {
115
+			while ($m1 <= $m2) {
116 116
 
117
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
118
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
117
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
118
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
119 119
 
120 120
 				$data[] = array(
121
-					'date'      => date_i18n( 'F Y', $date1 ),
122
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
123
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ),
121
+					'date'      => date_i18n('F Y', $date1),
122
+					'donations' => $stats->get_sales(0, $date1, $date2),
123
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2)),
124 124
 				);
125 125
 
126
-				$m1 ++;
126
+				$m1++;
127 127
 
128 128
 			}
129 129
 
130 130
 
131
-			$year ++;
131
+			$year++;
132 132
 
133 133
 		}
134 134
 
135
-		$data = apply_filters( 'give_export_get_data', $data );
136
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
135
+		$data = apply_filters('give_export_get_data', $data);
136
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
137 137
 
138 138
 		return $data;
139 139
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 		)
48 48
 	);
49 49
 
50
-    $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
51
-    $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
50
+	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
51
+	$tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
52 52
 
53 53
 	$pdf = new give_pdf();
54 54
 	$pdf->AddPage( 'L', 'A4' );
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
81 81
 	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
82 82
 
83
-    // Display Categories Heading only, if user has opted for it.
84
-    if ( $categories_enabled ) {
83
+	// Display Categories Heading only, if user has opted for it.
84
+	if ( $categories_enabled ) {
85 85
 	   $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
86
-    }
86
+	}
87 87
 
88
-    // Display Tags Heading only, if user has opted for it.
89
-    if ( $tags_enabled ) {
88
+	// Display Tags Heading only, if user has opted for it.
89
+	if ( $tags_enabled ) {
90 90
 	   $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
91
-    }
91
+	}
92 92
 
93 93
 	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
94 94
 	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 				$price = give_currency_filter( give_get_form_price( $form->ID ), '', true );
126 126
 			}
127 127
 
128
-            // Display Categories Data only, if user has opted for it.
129
-            if ( $categories_enabled ) {
130
-                $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
131
-                $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
132
-            }
128
+			// Display Categories Data only, if user has opted for it.
129
+			if ( $categories_enabled ) {
130
+				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
131
+				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
132
+			}
133 133
 
134
-            // Display Tags Data only, if user has opted for it.
135
-            if ( $tags_enabled ) {
136
-                $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
137
-                $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
138
-            }
134
+			// Display Tags Data only, if user has opted for it.
135
+			if ( $tags_enabled ) {
136
+				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
137
+				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
138
+			}
139 139
 
140 140
 			$sales    = give_get_form_sales_stats( $form->ID );
141 141
 			$link     = get_permalink( $form->ID );
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
148 148
 			}
149 149
 
150
-            // This will help filter data before appending it to PDF Receipt.
151
-            $prepare_pdf_data = array();
152
-            $prepare_pdf_data[] = $title;
153
-            $prepare_pdf_data[] = $price;
150
+			// This will help filter data before appending it to PDF Receipt.
151
+			$prepare_pdf_data = array();
152
+			$prepare_pdf_data[] = $title;
153
+			$prepare_pdf_data[] = $price;
154 154
 
155
-            // Append Categories Data only, if user has opted for it.
156
-            if ( $categories_enabled ) {
157
-                $prepare_pdf_data[] = $categories;
158
-            }
155
+			// Append Categories Data only, if user has opted for it.
156
+			if ( $categories_enabled ) {
157
+				$prepare_pdf_data[] = $categories;
158
+			}
159 159
 
160
-            // Append Tags Data only, if user has opted for it.
161
-            if ( $tags_enabled ) {
162
-                $prepare_pdf_data[] = $tags;
163
-            }
160
+			// Append Tags Data only, if user has opted for it.
161
+			if ( $tags_enabled ) {
162
+				$prepare_pdf_data[] = $tags;
163
+			}
164 164
 
165
-            $prepare_pdf_data[] = $sales;
166
-            $prepare_pdf_data[] = $earnings;
165
+			$prepare_pdf_data[] = $sales;
166
+			$prepare_pdf_data[] = $earnings;
167 167
 
168 168
 			$pdf->Row( $prepare_pdf_data );
169 169
 		endforeach;
170 170
 	} else {
171 171
 
172
-        // Fix: Minor Styling Alignment Issue for PDF
173
-        if( $categories_enabled && $tags_enabled ) {
174
-            $pdf->SetWidths( array( 280 ) );
175
-        } elseif( $categories_enabled || $tags_enabled ) {
176
-            $pdf->SetWidths( array( 235 ) );
177
-        } else {
178
-            $pdf->SetWidths( array( 190 ) );
179
-        }
172
+		// Fix: Minor Styling Alignment Issue for PDF
173
+		if( $categories_enabled && $tags_enabled ) {
174
+			$pdf->SetWidths( array( 280 ) );
175
+		} elseif( $categories_enabled || $tags_enabled ) {
176
+			$pdf->SetWidths( array( 235 ) );
177
+		} else {
178
+			$pdf->SetWidths( array( 190 ) );
179
+		}
180 180
 
181
-        $title = utf8_decode( __( 'No forms found.', 'give' ) );
181
+		$title = utf8_decode( __( 'No forms found.', 'give' ) );
182 182
 		$pdf->Row( array( $title ) );
183 183
 	}
184 184
 
Please login to merge, or discard this 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,94 +25,94 @@  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
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
39
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php';
38
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php';
39
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php';
40 40
 
41 41
 	$daterange = utf8_decode(
42 42
 		sprintf(
43 43
 		/* translators: 1: start date 2: end date */
44
-			__( '%1$s to %2$s', 'give' ),
45
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
46
-			date_i18n( give_date_format() )
44
+			__('%1$s to %2$s', 'give'),
45
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
46
+			date_i18n(give_date_format())
47 47
 		)
48 48
 	);
49 49
 
50
-    $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
51
-    $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
50
+    $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
51
+    $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled'));
52 52
 
53 53
 	$pdf = new give_pdf();
54
-	$pdf->AddPage( 'L', 'A4' );
54
+	$pdf->AddPage('L', 'A4');
55 55
 
56
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
57
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
58
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
56
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
57
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
58
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
59 59
 
60
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
60
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
61 61
 
62
-	$pdf->SetMargins( 8, 8, 8 );
63
-	$pdf->SetX( 8 );
62
+	$pdf->SetMargins(8, 8, 8);
63
+	$pdf->SetX(8);
64 64
 
65
-	$pdf->SetFont( 'Helvetica', '', 16 );
66
-	$pdf->SetTextColor( 50, 50, 50 );
67
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
65
+	$pdf->SetFont('Helvetica', '', 16);
66
+	$pdf->SetTextColor(50, 50, 50);
67
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
68 68
 
69
-	$pdf->SetFont( 'Helvetica', '', 13 );
69
+	$pdf->SetFont('Helvetica', '', 13);
70 70
 	$pdf->Ln();
71
-	$pdf->SetTextColor( 150, 150, 150 );
72
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
71
+	$pdf->SetTextColor(150, 150, 150);
72
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
73 73
 	$pdf->Ln();
74
-	$pdf->SetTextColor( 50, 50, 50 );
75
-	$pdf->SetFont( 'Helvetica', '', 14 );
76
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
77
-	$pdf->SetFont( 'Helvetica', '', 12 );
74
+	$pdf->SetTextColor(50, 50, 50);
75
+	$pdf->SetFont('Helvetica', '', 14);
76
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
77
+	$pdf->SetFont('Helvetica', '', 12);
78 78
 
79
-	$pdf->SetFillColor( 238, 238, 238 );
80
-	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
81
-	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
79
+	$pdf->SetFillColor(238, 238, 238);
80
+	$pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
81
+	$pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
82 82
 
83 83
     // Display Categories Heading only, if user has opted for it.
84
-    if ( $categories_enabled ) {
85
-	   $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
84
+    if ($categories_enabled) {
85
+	   $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
86 86
     }
87 87
 
88 88
     // Display Tags Heading only, if user has opted for it.
89
-    if ( $tags_enabled ) {
90
-	   $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
89
+    if ($tags_enabled) {
90
+	   $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
91 91
     }
92 92
 
93
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
94
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
93
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
94
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
95 95
 
96
-	$year       = date( 'Y' );
97
-	$give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) );
96
+	$year       = date('Y');
97
+	$give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
98 98
 
99
-	if ( $give_forms ) {
100
-		$pdf->SetWidths( array( 70, 30, 45, 45, 45, 45 ) );
99
+	if ($give_forms) {
100
+		$pdf->SetWidths(array(70, 30, 45, 45, 45, 45));
101 101
 
102
-		foreach ( $give_forms as $form ):
103
-			$pdf->SetFillColor( 255, 255, 255 );
102
+		foreach ($give_forms as $form):
103
+			$pdf->SetFillColor(255, 255, 255);
104 104
 
105 105
 			$title = $form->post_title;
106 106
 
107
-			if ( give_has_variable_prices( $form->ID ) ) {
107
+			if (give_has_variable_prices($form->ID)) {
108 108
 
109
-				$prices = give_get_variable_prices( $form->ID );
109
+				$prices = give_get_variable_prices($form->ID);
110 110
 
111 111
 				$first = $prices[0]['_give_amount'];
112
-				$last  = array_pop( $prices );
112
+				$last  = array_pop($prices);
113 113
 				$last  = $last['_give_amount'];
114 114
 
115
-				if ( $first < $last ) {
115
+				if ($first < $last) {
116 116
 					$min = $first;
117 117
 					$max = $last;
118 118
 				} else {
@@ -120,31 +120,31 @@  discard block
 block discarded – undo
120 120
 					$max = $first;
121 121
 				}
122 122
 
123
-				$price = give_currency_filter( give_format_amount( $min ), '', true ) . ' - ' . give_currency_filter( give_format_amount( $max ), '', true );
123
+				$price = give_currency_filter(give_format_amount($min), '', true).' - '.give_currency_filter(give_format_amount($max), '', true);
124 124
 			} else {
125
-				$price = give_currency_filter( give_get_form_price( $form->ID ), '', true );
125
+				$price = give_currency_filter(give_get_form_price($form->ID), '', true);
126 126
 			}
127 127
 
128 128
             // Display Categories Data only, if user has opted for it.
129
-            if ( $categories_enabled ) {
130
-                $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
131
-                $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
129
+            if ($categories_enabled) {
130
+                $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
131
+                $categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
132 132
             }
133 133
 
134 134
             // Display Tags Data only, if user has opted for it.
135
-            if ( $tags_enabled ) {
136
-                $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
137
-                $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
135
+            if ($tags_enabled) {
136
+                $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
137
+                $tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
138 138
             }
139 139
 
140
-			$sales    = give_get_form_sales_stats( $form->ID );
141
-			$link     = get_permalink( $form->ID );
142
-			$earnings = give_currency_filter( give_get_form_earnings_stats( $form->ID ), '', true );
140
+			$sales    = give_get_form_sales_stats($form->ID);
141
+			$link     = get_permalink($form->ID);
142
+			$earnings = give_currency_filter(give_get_form_earnings_stats($form->ID), '', true);
143 143
 
144
-			if ( function_exists( 'iconv' ) ) {
144
+			if (function_exists('iconv')) {
145 145
 				// Ensure characters like euro; are properly converted.
146
-				$price    = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) );
147
-				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
146
+				$price    = iconv('UTF-8', 'windows-1252', utf8_encode($price));
147
+				$earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
148 148
 			}
149 149
 
150 150
             // This will help filter data before appending it to PDF Receipt.
@@ -153,51 +153,51 @@  discard block
 block discarded – undo
153 153
             $prepare_pdf_data[] = $price;
154 154
 
155 155
             // Append Categories Data only, if user has opted for it.
156
-            if ( $categories_enabled ) {
156
+            if ($categories_enabled) {
157 157
                 $prepare_pdf_data[] = $categories;
158 158
             }
159 159
 
160 160
             // Append Tags Data only, if user has opted for it.
161
-            if ( $tags_enabled ) {
161
+            if ($tags_enabled) {
162 162
                 $prepare_pdf_data[] = $tags;
163 163
             }
164 164
 
165 165
             $prepare_pdf_data[] = $sales;
166 166
             $prepare_pdf_data[] = $earnings;
167 167
 
168
-			$pdf->Row( $prepare_pdf_data );
168
+			$pdf->Row($prepare_pdf_data);
169 169
 		endforeach;
170 170
 	} else {
171 171
 
172 172
         // Fix: Minor Styling Alignment Issue for PDF
173
-        if( $categories_enabled && $tags_enabled ) {
174
-            $pdf->SetWidths( array( 280 ) );
175
-        } elseif( $categories_enabled || $tags_enabled ) {
176
-            $pdf->SetWidths( array( 235 ) );
173
+        if ($categories_enabled && $tags_enabled) {
174
+            $pdf->SetWidths(array(280));
175
+        } elseif ($categories_enabled || $tags_enabled) {
176
+            $pdf->SetWidths(array(235));
177 177
         } else {
178
-            $pdf->SetWidths( array( 190 ) );
178
+            $pdf->SetWidths(array(190));
179 179
         }
180 180
 
181
-        $title = utf8_decode( __( 'No forms found.', 'give' ) );
182
-		$pdf->Row( array( $title ) );
181
+        $title = utf8_decode(__('No forms found.', 'give'));
182
+		$pdf->Row(array($title));
183 183
 	}
184 184
 
185 185
 	$pdf->Ln();
186
-	$pdf->SetTextColor( 50, 50, 50 );
187
-	$pdf->SetFont( 'Helvetica', '', 14 );
188
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
189
-	$pdf->SetFont( 'Helvetica', '', 12 );
190
-
191
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
192
-	$image = str_replace( ' ', '%20', $image );
193
-
194
-	$pdf->SetX( 25 );
195
-	$pdf->Image( $image . '&file=.png' );
196
-	$pdf->Ln( 7 );
197
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
186
+	$pdf->SetTextColor(50, 50, 50);
187
+	$pdf->SetFont('Helvetica', '', 14);
188
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
189
+	$pdf->SetFont('Helvetica', '', 12);
190
+
191
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
192
+	$image = str_replace(' ', '%20', $image);
193
+
194
+	$pdf->SetX(25);
195
+	$pdf->Image($image.'&file=.png');
196
+	$pdf->Ln(7);
197
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
198 198
 }
199 199
 
200
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
200
+add_action('give_generate_pdf', 'give_generate_pdf');
201 201
 
202 202
 /**
203 203
  * Draws Chart for PDF Report.
@@ -214,38 +214,38 @@  discard block
 block discarded – undo
214 214
  * @return string $chart->getUrl() URL for the Google Chart
215 215
  */
216 216
 function give_draw_chart_image() {
217
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
218
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
219
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
217
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
218
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
219
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
220 220
 
221
-	$chart = new GoogleChart( 'lc', 900, 330 );
221
+	$chart = new GoogleChart('lc', 900, 330);
222 222
 
223 223
 	$i        = 1;
224 224
 	$earnings = "";
225 225
 	$sales    = "";
226 226
 
227
-	while ( $i <= 12 ) :
228
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
229
-		$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
230
-		$i ++;
227
+	while ($i <= 12) :
228
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
229
+		$sales .= give_get_sales_by_date(null, $i, date('Y')).",";
230
+		$i++;
231 231
 	endwhile;
232 232
 
233
-	$earnings_array = explode( ",", $earnings );
234
-	$sales_array    = explode( ",", $sales );
233
+	$earnings_array = explode(",", $earnings);
234
+	$sales_array    = explode(",", $sales);
235 235
 
236 236
 	$i = 0;
237
-	while ( $i <= 11 ) {
238
-		if ( empty( $sales_array[ $i ] ) ) {
239
-			$sales_array[ $i ] = 0;
237
+	while ($i <= 11) {
238
+		if (empty($sales_array[$i])) {
239
+			$sales_array[$i] = 0;
240 240
 		}
241
-		$i ++;
241
+		$i++;
242 242
 	}
243 243
 
244 244
 	$min_earnings   = 0;
245
-	$max_earnings   = max( $earnings_array );
246
-	$earnings_scale = round( $max_earnings, - 1 );
245
+	$max_earnings   = max($earnings_array);
246
+	$earnings_scale = round($max_earnings, - 1);
247 247
 
248
-	$data = new GoogleChartData( array(
248
+	$data = new GoogleChartData(array(
249 249
 		$earnings_array[0],
250 250
 		$earnings_array[1],
251 251
 		$earnings_array[2],
@@ -258,25 +258,25 @@  discard block
 block discarded – undo
258 258
 		$earnings_array[9],
259 259
 		$earnings_array[10],
260 260
 		$earnings_array[11]
261
-	) );
261
+	));
262 262
 
263
-	$data->setLegend( __( 'Income', 'give' ) );
264
-	$data->setColor( '1b58a3' );
265
-	$chart->addData( $data );
263
+	$data->setLegend(__('Income', 'give'));
264
+	$data->setColor('1b58a3');
265
+	$chart->addData($data);
266 266
 
267
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
268
-	$shape_marker->setColor( '000000' );
269
-	$shape_marker->setSize( 7 );
270
-	$shape_marker->setBorder( 2 );
271
-	$shape_marker->setData( $data );
272
-	$chart->addMarker( $shape_marker );
267
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
268
+	$shape_marker->setColor('000000');
269
+	$shape_marker->setSize(7);
270
+	$shape_marker->setBorder(2);
271
+	$shape_marker->setData($data);
272
+	$chart->addMarker($shape_marker);
273 273
 
274
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
275
-	$value_marker->setColor( '000000' );
276
-	$value_marker->setData( $data );
277
-	$chart->addMarker( $value_marker );
274
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
275
+	$value_marker->setColor('000000');
276
+	$value_marker->setData($data);
277
+	$chart->addMarker($value_marker);
278 278
 
279
-	$data = new GoogleChartData( array(
279
+	$data = new GoogleChartData(array(
280 280
 		$sales_array[0],
281 281
 		$sales_array[1],
282 282
 		$sales_array[2],
@@ -289,46 +289,46 @@  discard block
 block discarded – undo
289 289
 		$sales_array[9],
290 290
 		$sales_array[10],
291 291
 		$sales_array[11]
292
-	) );
293
-	$data->setLegend( __( 'Donations', 'give' ) );
294
-	$data->setColor( 'ff6c1c' );
295
-	$chart->addData( $data );
296
-
297
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
298
-
299
-	$chart->setScale( 0, $max_earnings );
300
-
301
-	$y_axis = new GoogleChartAxis( 'y' );
302
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
303
-	$chart->addAxis( $y_axis );
304
-
305
-	$x_axis = new GoogleChartAxis( 'x' );
306
-	$x_axis->setTickMarks( 5 );
307
-	$x_axis->setLabels( array(
308
-		__( 'Jan', 'give' ),
309
-		__( 'Feb', 'give' ),
310
-		__( 'Mar', 'give' ),
311
-		__( 'Apr', 'give' ),
312
-		__( 'May', 'give' ),
313
-		__( 'June', 'give' ),
314
-		__( 'July', 'give' ),
315
-		__( 'Aug', 'give' ),
316
-		__( 'Sept', 'give' ),
317
-		__( 'Oct', 'give' ),
318
-		__( 'Nov', 'give' ),
319
-		__( 'Dec', 'give' )
320
-	) );
321
-	$chart->addAxis( $x_axis );
322
-
323
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
324
-	$shape_marker->setSize( 6 );
325
-	$shape_marker->setBorder( 2 );
326
-	$shape_marker->setData( $data );
327
-	$chart->addMarker( $shape_marker );
328
-
329
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
330
-	$value_marker->setData( $data );
331
-	$chart->addMarker( $value_marker );
292
+	));
293
+	$data->setLegend(__('Donations', 'give'));
294
+	$data->setColor('ff6c1c');
295
+	$chart->addData($data);
296
+
297
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
298
+
299
+	$chart->setScale(0, $max_earnings);
300
+
301
+	$y_axis = new GoogleChartAxis('y');
302
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
303
+	$chart->addAxis($y_axis);
304
+
305
+	$x_axis = new GoogleChartAxis('x');
306
+	$x_axis->setTickMarks(5);
307
+	$x_axis->setLabels(array(
308
+		__('Jan', 'give'),
309
+		__('Feb', 'give'),
310
+		__('Mar', 'give'),
311
+		__('Apr', 'give'),
312
+		__('May', 'give'),
313
+		__('June', 'give'),
314
+		__('July', 'give'),
315
+		__('Aug', 'give'),
316
+		__('Sept', 'give'),
317
+		__('Oct', 'give'),
318
+		__('Nov', 'give'),
319
+		__('Dec', 'give')
320
+	));
321
+	$chart->addAxis($x_axis);
322
+
323
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
324
+	$shape_marker->setSize(6);
325
+	$shape_marker->setBorder(2);
326
+	$shape_marker->setData($data);
327
+	$chart->addMarker($shape_marker);
328
+
329
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
330
+	$value_marker->setData($data);
331
+	$chart->addMarker($value_marker);
332 332
 
333 333
 	return $chart->getUrl();
334 334
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-payments.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => __( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => __( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => __( 'Email', 'give' ),
45
-			'first'     => __( 'First Name', 'give' ),
46
-			'last'      => __( 'Last Name', 'give' ),
47
-			'address1'  => __( 'Address 1', 'give' ),
48
-			'address2'  => __( 'Address 2', 'give' ),
49
-			'city'      => __( 'City', 'give' ),
50
-			'state'     => __( 'State', 'give' ),
51
-			'country'   => __( 'Country', 'give' ),
52
-			'zip'       => __( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => __( 'Form ID', 'give' ),
54
-			'form_name' => __( 'Form Name', 'give' ),
55
-			'amount'    => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')',
56
-			'gateway'   => __( 'Payment Method', 'give' ),
57
-			'trans_id'  => __( 'Transaction ID', 'give' ),
58
-			'key'       => __( 'Key', 'give' ),
59
-			'date'      => __( 'Date', 'give' ),
60
-			'user'      => __( 'User', 'give' ),
61
-			'status'    => __( 'Status', 'give' )
42
+			'id'        => __('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => __('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => __('Email', 'give'),
45
+			'first'     => __('First Name', 'give'),
46
+			'last'      => __('Last Name', 'give'),
47
+			'address1'  => __('Address 1', 'give'),
48
+			'address2'  => __('Address 2', 'give'),
49
+			'city'      => __('City', 'give'),
50
+			'state'     => __('State', 'give'),
51
+			'country'   => __('Country', 'give'),
52
+			'zip'       => __('Zip / Postal Code', 'give'),
53
+			'form_id'   => __('Form ID', 'give'),
54
+			'form_name' => __('Form Name', 'give'),
55
+			'amount'    => __('Amount', 'give').' ('.give_currency_symbol('', true).')',
56
+			'gateway'   => __('Payment Method', 'give'),
57
+			'trans_id'  => __('Transaction ID', 'give'),
58
+			'key'       => __('Key', 'give'),
59
+			'date'      => __('Date', 'give'),
60
+			'user'      => __('User', 'give'),
61
+			'status'    => __('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 			'status' => $this->status
87 87
 		);
88 88
 
89
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
89
+		if ( ! empty($this->start) || ! empty($this->end)) {
90 90
 
91 91
 			$args['date_query'] = array(
92 92
 				array(
93
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
94
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
93
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
94
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
95 95
 					'inclusive' => true
96 96
 				)
97 97
 			);
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 
101 101
 		// Add category or tag to payment query if any.
102
-		if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) {
102
+		if ( ! empty($this->categories) || ! empty($this->tags)) {
103 103
 			$form_args = array(
104 104
 				'post_type'      => 'give_forms',
105 105
 				'post_status'    => 'publish',
106
-				'posts_per_page' => - 1,
106
+				'posts_per_page' => -1,
107 107
 				'fields'         => 'ids',
108 108
 				'tax_query'      => array(
109 109
 					'relation' => 'AND',
@@ -111,72 +111,72 @@  discard block
 block discarded – undo
111 111
 			);
112 112
 
113 113
 
114
-			if ( ! empty( $this->categories ) ) {
114
+			if ( ! empty($this->categories)) {
115 115
 				$form_args['tax_query'][] = array(
116 116
 					'taxonomy' => 'give_forms_category',
117 117
 					'terms'    => $this->categories,
118 118
 				);
119 119
 			}
120 120
 
121
-			if ( ! empty( $this->tags ) ) {
121
+			if ( ! empty($this->tags)) {
122 122
 				$form_args['tax_query'][] = array(
123 123
 					'taxonomy' => 'give_forms_tag',
124 124
 					'terms'    => $this->tags,
125 125
 				);
126 126
 			}
127 127
 
128
-			$forms = new WP_Query( $form_args );
128
+			$forms = new WP_Query($form_args);
129 129
 
130
-			if ( empty( $forms->posts ) ) {
130
+			if (empty($forms->posts)) {
131 131
 				return array();
132 132
 			}
133 133
 
134 134
 			$args['give_forms'] = $forms->posts;
135 135
 		}
136 136
 
137
-		$payments = give_get_payments( $args );
137
+		$payments = give_get_payments($args);
138 138
 
139
-		if ( $payments ) {
139
+		if ($payments) {
140 140
 
141
-			foreach ( $payments as $payment ) {
142
-				$payment_meta = give_get_payment_meta( $payment->ID );
143
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
144
-				$total        = give_get_payment_amount( $payment->ID );
145
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
141
+			foreach ($payments as $payment) {
142
+				$payment_meta = give_get_payment_meta($payment->ID);
143
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
144
+				$total        = give_get_payment_amount($payment->ID);
145
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
146 146
 
147
-				if ( is_numeric( $user_id ) ) {
148
-					$user = get_userdata( $user_id );
147
+				if (is_numeric($user_id)) {
148
+					$user = get_userdata($user_id);
149 149
 				} else {
150 150
 					$user = false;
151 151
 				}
152 152
 
153 153
 				$data[] = array(
154 154
 					'id'        => $payment->ID,
155
-					'seq_id'    => give_get_payment_number( $payment->ID ),
155
+					'seq_id'    => give_get_payment_number($payment->ID),
156 156
 					'email'     => $payment_meta['email'],
157 157
 					'first'     => $user_info['first_name'],
158 158
 					'last'      => $user_info['last_name'],
159
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
160
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
161
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
162
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
163
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
164
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
165
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
166
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
167
-					'amount'    => html_entity_decode( give_format_amount( $total ) ),
168
-					'gateway'   => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ),
169
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
159
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
160
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
161
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
162
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
163
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
164
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
165
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
166
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
167
+					'amount'    => html_entity_decode(give_format_amount($total)),
168
+					'gateway'   => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)),
169
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
170 170
 					'key'       => $payment_meta['key'],
171 171
 					'date'      => $payment->post_date,
172
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
173
-					'status'    => give_get_payment_status( $payment, true )
172
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
173
+					'status'    => give_get_payment_status($payment, true)
174 174
 				);
175 175
 
176 176
 			}
177 177
 
178
-			$data = apply_filters( 'give_export_get_data', $data );
179
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
178
+			$data = apply_filters('give_export_get_data', $data);
179
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
180 180
 
181 181
 			return $data;
182 182
 
@@ -196,27 +196,27 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$status = $this->status;
198 198
 		$args   = array(
199
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
200
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
199
+			'start-date' => date('n/d/Y', strtotime($this->start)),
200
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
201 201
 		);
202 202
 
203
-		if ( 'any' == $status ) {
203
+		if ('any' == $status) {
204 204
 
205
-			$total = array_sum( (array) give_count_payments( $args ) );
205
+			$total = array_sum((array) give_count_payments($args));
206 206
 
207 207
 		} else {
208 208
 
209
-			$total = give_count_payments( $args )->$status;
209
+			$total = give_count_payments($args)->$status;
210 210
 
211 211
 		}
212 212
 
213 213
 		$percentage = 100;
214 214
 
215
-		if ( $total > 0 ) {
216
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
215
+		if ($total > 0) {
216
+			$percentage = ((30 * $this->step) / $total) * 100;
217 217
 		}
218 218
 
219
-		if ( $percentage > 100 ) {
219
+		if ($percentage > 100) {
220 220
 			$percentage = 100;
221 221
 		}
222 222
 
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @param array $request The Form Data passed into the batch processing.
232 232
 	 */
233
-	public function set_properties( $request ) {
234
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
235
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
236
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
237
-		$this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array();
238
-		$this->tags       = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array();
233
+	public function set_properties($request) {
234
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
235
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
236
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
237
+		$this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array();
238
+		$this->tags       = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array();
239 239
 	}
240 240
 }
Please login to merge, or discard this patch.