Test Failed
Pull Request — master (#2814)
by Devin
05:29
created
includes/admin/emails/class-donor-register-email.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
 		 * @param string                    $email_preview_header
121 121
 		 * @param Give_Donor_Register_Email $email
122 122
 		 *
123
-		 * @return bool
123
+		 * @return string|null
124 124
 		 */
125 125
 		public function email_preview_header( $email_preview_header, $email ) {
126 126
 			// Bailout.
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if access directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_Donor_Register_Email
@@ -31,34 +31,34 @@  discard block
 block discarded – undo
31 31
 		 * @since   2.0
32 32
 		 */
33 33
 		public function init() {
34
-			$this->load( array(
34
+			$this->load(array(
35 35
 				'id'                    => 'donor-register',
36
-				'label'                 => __( 'User Registration Information', 'give' ),
37
-				'description'           => __( 'Sent to the donor when they register for an account on the site.', 'give' ),
36
+				'label'                 => __('User Registration Information', 'give'),
37
+				'description'           => __('Sent to the donor when they register for an account on the site.', 'give'),
38 38
 				'notification_status'   => 'enabled',
39 39
 				'email_tag_contex'      => 'donor',
40 40
 				'form_metabox_setting'  => false,
41
-				'recipient_group_name'  => __( 'Donor', 'give' ),
42
-				'email_tag_context'     => array( 'donor', 'general' ),
41
+				'recipient_group_name'  => __('Donor', 'give'),
42
+				'email_tag_context'     => array('donor', 'general'),
43 43
 				'default_email_subject' => sprintf(
44 44
 				/* translators: %s: site name */
45
-					esc_attr__( '[%s] Your username and password', 'give' ),
46
-					get_bloginfo( 'name' )
45
+					esc_attr__('[%s] Your username and password', 'give'),
46
+					get_bloginfo('name')
47 47
 				),
48 48
 				'default_email_message' => $this->get_default_email_message(),
49
-			) );
49
+			));
50 50
 
51 51
 			// Setup action hook.
52 52
 			add_action(
53 53
 				"give_{$this->config['id']}_email_notification",
54
-				array( $this, 'setup_email_notification' ),
54
+				array($this, 'setup_email_notification'),
55 55
 				10,
56 56
 				2
57 57
 			);
58 58
 
59 59
 			add_filter(
60 60
 				'give_email_preview_header',
61
-				array( $this, 'email_preview_header' ),
61
+				array($this, 'email_preview_header'),
62 62
 				10,
63 63
 				2
64 64
 			);
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 		 * @return string
74 74
 		 */
75 75
 		function get_default_email_message() {
76
-			$message = esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
76
+			$message = esc_attr__('Username: {username}', 'give')."\r\n\r\n";
77 77
 
78
-			$message .= __( 'To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give' ) . "\r\n";
79
-			$message .= '{reset_password_link}' . "\r\n\r\n";
78
+			$message .= __('To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give')."\r\n";
79
+			$message .= '{reset_password_link}'."\r\n\r\n";
80 80
 
81
-			$message .= __( 'After resetting password, Please login to your account with link below.', 'give' ) . "\r\n";
82
-			$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login &raquo;', 'give' ) . '</a>' . "\r\n";
81
+			$message .= __('After resetting password, Please login to your account with link below.', 'give')."\r\n";
82
+			$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login &raquo;', 'give').'</a>'."\r\n";
83 83
 
84 84
 			/**
85 85
 			 * Filter the default email message
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		 * @since 2.0
99 99
 		 */
100 100
 		public function setup_email_data() {
101
-			Give()->emails->__set( 'heading', esc_html__( 'New User Registration', 'give' ) );
101
+			Give()->emails->__set('heading', esc_html__('New User Registration', 'give'));
102 102
 		}
103 103
 
104 104
 		/**
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 		 *
113 113
 		 * @return string
114 114
 		 */
115
-		public function setup_email_notification( $user_id, $user_data ) {
115
+		public function setup_email_notification($user_id, $user_data) {
116 116
 			$this->setup_email_data();
117 117
 
118 118
 			$this->recipient_email = $user_data['user_email'];
119
-			$this->send_email_notification( array(
119
+			$this->send_email_notification(array(
120 120
 				'user_id' => $user_id,
121
-			) );
121
+			));
122 122
 		}
123 123
 
124 124
 		/**
@@ -132,42 +132,42 @@  discard block
 block discarded – undo
132 132
 		 *
133 133
 		 * @return bool
134 134
 		 */
135
-		public function email_preview_header( $email_preview_header, $email ) {
135
+		public function email_preview_header($email_preview_header, $email) {
136 136
 			// Bailout.
137
-			if ( $this->config['id'] !== $email->config['id'] ) {
137
+			if ($this->config['id'] !== $email->config['id']) {
138 138
 				return $email_preview_header;
139 139
 			}
140 140
 
141 141
 			// Payment receipt switcher
142
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
142
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
143 143
 
144 144
 			// Get payments.
145 145
 			$donors  = new Give_API();
146
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
146
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
147 147
 			$options = array();
148 148
 
149 149
 			// Default option.
150
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
150
+			$options[0] = esc_html__('No donor(s) found.', 'give');
151 151
 
152 152
 			// Provide nice human readable options.
153
-			if ( $donors ) {
154
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
155
-				foreach ( $donors as $donor ) {
153
+			if ($donors) {
154
+				$options[0] = esc_html__('- Select a donor -', 'give');
155
+				foreach ($donors as $donor) {
156 156
 					// Exclude customers for which wp user not exist.
157
-					if ( ! $donor['info']['user_id'] ) {
157
+					if ( ! $donor['info']['user_id']) {
158 158
 						continue;
159 159
 					}
160
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
160
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
161 161
 				}
162 162
 			}
163 163
 
164
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
164
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
165 165
 			$query            = $request_url_data['query'];
166 166
 
167 167
 			// Remove user id query param if set from request url.
168
-			$query = remove_query_arg( array( 'user_id' ), $query );
168
+			$query = remove_query_arg(array('user_id'), $query);
169 169
 
170
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
170
+			$request_url = home_url('/?'.str_replace('', '', $query));
171 171
 			?>
172 172
 
173 173
 			<!-- Start constructing HTML output.-->
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 				</script>
186 186
 
187 187
 				<label for="give_preview_email_user_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">
188
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
188
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
189 189
 				</label>
190 190
 
191 191
 				<?php
192 192
 				// The select field with 100 latest transactions
193
-				echo Give()->html->select( array(
193
+				echo Give()->html->select(array(
194 194
 					'name'             => 'preview_email_user_id',
195 195
 					'selected'         => $user_id,
196 196
 					'id'               => 'give_preview_email_user_id',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 					'select_atts'      => 'onchange="change_preview()"',
201 201
 					'show_option_all'  => false,
202 202
 					'show_option_none' => false,
203
-				) );
203
+				));
204 204
 				?>
205 205
 			</div>
206 206
 			<?php
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notification-util.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@
 block discarded – undo
178 178
 	 * @param Give_Email_Notification $email
179 179
 	 * @param int $form_id
180 180
 	 *
181
-	 * @return string
181
+	 * @return boolean
182 182
 	 */
183 183
 	public static function is_email_notification_active( Give_Email_Notification $email, $form_id = null ) {
184 184
 		$notification_status = $email->get_notification_status( $form_id );
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 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 access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @return static
47 47
 	 */
48 48
 	static function get_instance() {
49
-		if ( null === static::$instance ) {
49
+		if (null === static::$instance) {
50 50
 			self::$instance = new static();
51 51
 		}
52 52
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool
66 66
 	 */
67
-	public static function has_preview( Give_Email_Notification $email ) {
67
+	public static function has_preview(Give_Email_Notification $email) {
68 68
 		return $email->config['has_preview'];
69 69
 	}
70 70
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return bool
80 80
 	 */
81
-	public static function has_recipient_field( Give_Email_Notification $email ) {
81
+	public static function has_recipient_field(Give_Email_Notification $email) {
82 82
 		return $email->config['has_recipient_field'];
83 83
 	}
84 84
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return bool
94 94
 	 */
95
-	public static function is_notification_status_editable( Give_Email_Notification $email ) {
95
+	public static function is_notification_status_editable(Give_Email_Notification $email) {
96 96
 		$user_can_edit = $email->config['notification_status_editable'];
97 97
 
98 98
 		return (bool) $user_can_edit;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public static function is_content_type_editable( Give_Email_Notification $email ) {
111
+	public static function is_content_type_editable(Give_Email_Notification $email) {
112 112
 		return $email->config['content_type_editable'];
113 113
 	}
114 114
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return bool
124 124
 	 */
125
-	public static function is_email_preview_has_header( Give_Email_Notification $email ) {
125
+	public static function is_email_preview_has_header(Give_Email_Notification $email) {
126 126
 		return $email->config['has_preview_header'];
127 127
 	}
128 128
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return bool
138 138
 	 */
139
-	public static function is_email_preview( Give_Email_Notification $email ) {
139
+	public static function is_email_preview(Give_Email_Notification $email) {
140 140
 		return $email->config['has_preview'];
141 141
 	}
142 142
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return bool
152 152
 	 */
153
-	public static function is_show_on_emails_setting_page( Give_Email_Notification $email ){
153
+	public static function is_show_on_emails_setting_page(Give_Email_Notification $email) {
154 154
 		return $email->config['show_on_emails_setting_page'];
155 155
 	}
156 156
 
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return bool
167 167
 	 */
168
-	public static function can_use_form_email_options( Give_Email_Notification $email, $form_id = null ){
169
-		return give_is_setting_enabled( give_get_meta( $form_id, '_give_email_options', true ) );
168
+	public static function can_use_form_email_options(Give_Email_Notification $email, $form_id = null) {
169
+		return give_is_setting_enabled(give_get_meta($form_id, '_give_email_options', true));
170 170
 	}
171 171
 
172 172
 	/**
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string
182 182
 	 */
183
-	public static function is_email_notification_active( Give_Email_Notification $email, $form_id = null ) {
184
-		$notification_status = $email->get_notification_status( $form_id );
183
+	public static function is_email_notification_active(Give_Email_Notification $email, $form_id = null) {
184
+		$notification_status = $email->get_notification_status($form_id);
185 185
 
186 186
 
187
-		$notification_status = empty( $form_id )
188
-			? give_is_setting_enabled( $notification_status )
189
-			: give_is_setting_enabled( give_get_option( "{$email->config['id']}_notification", $email->config['notification_status'] ) ) && give_is_setting_enabled( $notification_status, array( 'enabled', 'global' ) );
187
+		$notification_status = empty($form_id)
188
+			? give_is_setting_enabled($notification_status)
189
+			: give_is_setting_enabled(give_get_option("{$email->config['id']}_notification", $email->config['notification_status'])) && give_is_setting_enabled($notification_status, array('enabled', 'global'));
190 190
 			// To check if email notification is active or not on a per-form basis, email notification must be globally active—otherwise it will be considered disabled.
191 191
 
192 192
 		return $notification_status;
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 		$is_preview = false;
204 204
 
205 205
 		if (
206
-			current_user_can( 'manage_give_settings' )
207
-			&& ! empty( $_GET['give_action'] )
206
+			current_user_can('manage_give_settings')
207
+			&& ! empty($_GET['give_action'])
208 208
 			&& 'preview_email' === $_GET['give_action']
209 209
 		) {
210 210
 			$is_preview = true;
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 		$is_preview = false;
225 225
 
226 226
 		if (
227
-			current_user_can( 'manage_give_settings' )
228
-			&& ! empty( $_GET['give_action'] )
227
+			current_user_can('manage_give_settings')
228
+			&& ! empty($_GET['give_action'])
229 229
 			&& 'send_preview_email' === $_GET['give_action']
230 230
 		) {
231 231
 			$is_preview = true;
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return string
247 247
 	 */
248
-	public static function get_formatted_email_type( $content_type ) {
248
+	public static function get_formatted_email_type($content_type) {
249 249
 		$email_contents = array(
250
-			'text/html'  => __( 'HTML', 'give' ),
251
-			'text/plain' => __( 'Plain', 'give' ),
250
+			'text/html'  => __('HTML', 'give'),
251
+			'text/plain' => __('Plain', 'give'),
252 252
 		);
253 253
 
254
-		return $email_contents[ $content_type ];
254
+		return $email_contents[$content_type];
255 255
 	}
256 256
 
257 257
 
@@ -268,40 +268,40 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return mixed
270 270
 	 */
271
-	public static function get_value( Give_Email_Notification $email, $option_name, $form_id = null, $default = false ) {
271
+	public static function get_value(Give_Email_Notification $email, $option_name, $form_id = null, $default = false) {
272 272
 		// If form id set then option name can be contain _give_ prefix which is only used for meta key,
273 273
 		// So make sure you are using correct option name.
274
-		$global_option_name = ( 0 === strpos( $option_name, '_give_' )
275
-			? str_replace( '_give_', '', $option_name )
276
-			: $option_name );
277
-		$option_value = give_get_option( $global_option_name, $default );
274
+		$global_option_name = (0 === strpos($option_name, '_give_')
275
+			? str_replace('_give_', '', $option_name)
276
+			: $option_name);
277
+		$option_value = give_get_option($global_option_name, $default);
278 278
 
279 279
 		if (
280
-			! empty( $form_id )
280
+			! empty($form_id)
281 281
 			&& give_is_setting_enabled(
282 282
 				give_get_meta(
283 283
 					$form_id,
284
-					Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'notification',
284
+					Give_Email_Setting_Field::get_prefix($email, $form_id).'notification',
285 285
 					true,
286 286
 					'global'
287 287
 				)
288 288
 			)
289 289
 		) {
290
-			$option_value = get_post_meta( $form_id, $option_name, true );
290
+			$option_value = get_post_meta($form_id, $option_name, true);
291 291
 
292 292
 			// Get only email field value from recipients setting.
293
-			if( Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'recipient' === $option_name ) {
294
-				$option_value = wp_list_pluck( $option_value, 'email' );
293
+			if (Give_Email_Setting_Field::get_prefix($email, $form_id).'recipient' === $option_name) {
294
+				$option_value = wp_list_pluck($option_value, 'email');
295 295
 			}
296 296
 		}
297 297
 
298
-		$option_value = empty( $option_value ) ? $default : $option_value;
298
+		$option_value = empty($option_value) ? $default : $option_value;
299 299
 
300 300
 		/**
301 301
 		 * Filter the setting value
302 302
 		 *
303 303
 		 * @since 2.0
304 304
 		 */
305
-		return apply_filters( 'give_email_setting_value', $option_value, $option_name, $email, $form_id, $default );
305
+		return apply_filters('give_email_setting_value', $option_value, $option_name, $email, $form_id, $default);
306 306
 	}
307 307
 }
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notifications.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 *
232 232
 	 * @since  2.0
233 233
 	 * @access public
234
-	 * @return bool|null
234
+	 * @return false|null
235 235
 	 */
236 236
 	public function preview_email() {
237 237
 		// Bailout.
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @since  2.0
371 371
 	 * @access public
372
-	 * @return bool|null
372
+	 * @return false|null
373 373
 	 */
374 374
 	public function send_preview_email() {
375 375
 		// Bailout.
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return static
53 53
 	 */
54 54
 	static function get_instance() {
55
-		if ( null === static::$instance ) {
55
+		if (null === static::$instance) {
56 56
 			self::$instance = new static();
57 57
 		}
58 58
 
@@ -66,31 +66,31 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function init() {
68 68
 		// Load files.
69
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/ajax-handler.php';
70
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-setting-field.php';
71
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/filters.php';
69
+		require_once GIVE_PLUGIN_DIR.'includes/admin/emails/ajax-handler.php';
70
+		require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-setting-field.php';
71
+		require_once GIVE_PLUGIN_DIR.'includes/admin/emails/filters.php';
72 72
 
73 73
 		// Load email notifications.
74 74
 		$this->add_emails_notifications();
75 75
 
76
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_metabox_setting_fields' ), 10, 2 );
77
-		add_action( 'init', array( $this, 'preview_email' ) );
78
-		add_action( 'init', array( $this, 'send_preview_email' ) );
79
-		add_action( 'init', array( $this, 'validate_settings' ) );
76
+		add_filter('give_metabox_form_data_settings', array($this, 'add_metabox_setting_fields'), 10, 2);
77
+		add_action('init', array($this, 'preview_email'));
78
+		add_action('init', array($this, 'send_preview_email'));
79
+		add_action('init', array($this, 'validate_settings'));
80 80
 
81 81
 		/* @var Give_Email_Notification $email */
82
-		foreach ( $this->get_email_notifications() as $email ) {
82
+		foreach ($this->get_email_notifications() as $email) {
83 83
 			// Setup email section.
84
-			if( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email ) ) {
85
-				add_filter( 'give_get_sections_emails', array( $email, 'add_section' ) );
86
-				add_filter( "give_hide_section_{$email->config['id']}_on_emails_page", array( $email, 'hide_section' ) );
84
+			if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email)) {
85
+				add_filter('give_get_sections_emails', array($email, 'add_section'));
86
+				add_filter("give_hide_section_{$email->config['id']}_on_emails_page", array($email, 'hide_section'));
87 87
 			}
88 88
 
89 89
 			// Setup email preview.
90
-			if ( Give_Email_Notification_Util::is_email_preview_has_header( $email ) ) {
91
-				add_action( "give_{$email->config['id']}_email_preview", array( $this, 'email_preview_header' ) );
92
-				add_filter( "give_{$email->config['id']}_email_preview_data", array( $this, 'email_preview_data' ) );
93
-				add_filter( "give_{$email->config['id']}_email_preview_message", array( $this, 'email_preview_message' ), 1, 2 );
90
+			if (Give_Email_Notification_Util::is_email_preview_has_header($email)) {
91
+				add_action("give_{$email->config['id']}_email_preview", array($this, 'email_preview_header'));
92
+				add_filter("give_{$email->config['id']}_email_preview_data", array($this, 'email_preview_data'));
93
+				add_filter("give_{$email->config['id']}_email_preview_message", array($this, 'email_preview_message'), 1, 2);
94 94
 			}
95 95
 		}
96 96
 	}
@@ -107,64 +107,64 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return array
109 109
 	 */
110
-	public function add_metabox_setting_fields( $settings, $post_id ) {
110
+	public function add_metabox_setting_fields($settings, $post_id) {
111 111
 		$emails = $this->get_email_notifications();
112 112
 
113 113
 		// Bailout.
114
-		if ( empty( $emails ) ) {
114
+		if (empty($emails)) {
115 115
 			return $settings;
116 116
 		}
117 117
 
118 118
 		// Email notification setting.
119 119
 		$settings['email_notification_options'] = array(
120 120
 			'id'         => 'email_notification_options',
121
-			'title'      => __( 'Email Notifications', 'give' ),
121
+			'title'      => __('Email Notifications', 'give'),
122 122
 			'icon-html' => '<span class="dashicons dashicons-email-alt"></span>',
123 123
 			'fields'     => array(
124 124
 				array(
125
-					'name'        => __( 'Email Options', 'give' ),
126
-					'description' => __( '', 'give' ),
125
+					'name'        => __('Email Options', 'give'),
126
+					'description' => __('', 'give'),
127 127
 					'id'          => '_give_email_options',
128 128
 					'type'        => 'radio_inline',
129 129
 					'default'     => 'global',
130 130
 					'options'     => array(
131
-						'global'   => __( 'Global Options' ),
132
-						'enabled'  => __( 'Customize', 'give' ),
131
+						'global'   => __('Global Options'),
132
+						'enabled'  => __('Customize', 'give'),
133 133
 					),
134 134
 				),
135 135
 				array(
136 136
 					'id'      => '_give_email_template',
137
-					'name'    => esc_html__( 'Email Template', 'give' ),
138
-					'desc'    => esc_html__( 'Choose your template from the available registered template types.', 'give' ),
137
+					'name'    => esc_html__('Email Template', 'give'),
138
+					'desc'    => esc_html__('Choose your template from the available registered template types.', 'give'),
139 139
 					'type'    => 'select',
140 140
 					'default' => 'default',
141 141
 					'options' => give_get_email_templates(),
142 142
 				),
143 143
 				array(
144 144
 					'id'   => '_give_email_logo',
145
-					'name' => esc_html__( 'Logo', 'give' ),
146
-					'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
145
+					'name' => esc_html__('Logo', 'give'),
146
+					'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
147 147
 					'type' => 'file',
148 148
 				),
149 149
 				array(
150 150
 					'id'      => '_give_from_name',
151
-					'name'    => esc_html__( 'From Name', 'give' ),
152
-					'desc'    => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ),
153
-					'default' => get_bloginfo( 'name' ),
151
+					'name'    => esc_html__('From Name', 'give'),
152
+					'desc'    => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'),
153
+					'default' => get_bloginfo('name'),
154 154
 					'type'    => 'text',
155 155
 				),
156 156
 				array(
157 157
 					'id'      => '_give_from_email',
158
-					'name'    => esc_html__( 'From Email', 'give' ),
159
-					'desc'    => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ),
160
-					'default' => get_bloginfo( 'admin_email' ),
158
+					'name'    => esc_html__('From Email', 'give'),
159
+					'desc'    => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'),
160
+					'default' => get_bloginfo('admin_email'),
161 161
 					'type'    => 'text',
162 162
 				),
163 163
 				array(
164 164
 					'name'  => 'email_notification_docs',
165 165
 					'type'  => 'docs_link',
166 166
 					'url'   => 'http://docs.givewp.com/email-notification',
167
-					'title' => __( 'Email Notification', 'give' ),
167
+					'title' => __('Email Notification', 'give'),
168 168
 				),
169 169
 			),
170 170
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			 *
174 174
 			 * @since 2.0
175 175
 			 */
176
-			'sub-fields' => apply_filters( 'give_email_notification_options_metabox_fields', array(), $post_id ),
176
+			'sub-fields' => apply_filters('give_email_notification_options_metabox_fields', array(), $post_id),
177 177
 		);
178 178
 
179 179
 		return $settings;
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	private function add_emails_notifications() {
189 189
 		$this->emails = array(
190
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donation-email.php',
191
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donation-receipt-email.php',
192
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-offline-donation-email.php',
193
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-offline-donation-instruction-email.php',
194
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donor-register-email.php',
195
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donor-register-email.php',
196
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-access-email.php',
190
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donation-email.php',
191
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donation-receipt-email.php',
192
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-offline-donation-email.php',
193
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-offline-donation-instruction-email.php',
194
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donor-register-email.php',
195
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donor-register-email.php',
196
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-access-email.php',
197 197
 		);
198 198
 
199 199
 		/**
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 		 *
202 202
 		 * @since 2.0
203 203
 		 */
204
-		$this->emails = apply_filters( 'give_email_notifications', $this->emails, $this );
204
+		$this->emails = apply_filters('give_email_notifications', $this->emails, $this);
205 205
 
206 206
 		// Bailout.
207
-		if ( empty( $this->emails ) ) {
207
+		if (empty($this->emails)) {
208 208
 			return;
209 209
 		}
210 210
 
211 211
 		// Initiate email notifications.
212
-		foreach ( $this->emails as $email ) {
212
+		foreach ($this->emails as $email) {
213 213
 			$email->init();
214 214
 		}
215 215
 	}
@@ -236,41 +236,41 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function preview_email() {
238 238
 		// Bailout.
239
-		if ( ! Give_Email_Notification_Util::can_preview_email() ) {
239
+		if ( ! Give_Email_Notification_Util::can_preview_email()) {
240 240
 			return false;
241 241
 		}
242 242
 
243 243
 		// Security check.
244
-		give_validate_nonce( $_GET['_wpnonce'], 'give-preview-email' );
244
+		give_validate_nonce($_GET['_wpnonce'], 'give-preview-email');
245 245
 
246 246
 		// Get email type.
247
-		$email_type = isset( $_GET['email_type'] ) ? esc_attr( $_GET['email_type'] ) : '';
247
+		$email_type = isset($_GET['email_type']) ? esc_attr($_GET['email_type']) : '';
248 248
 
249 249
 		/* @var Give_Email_Notification $email */
250
-		foreach ( $this->get_email_notifications() as $email ) {
251
-			if ( $email_type !== $email->config['id'] ) {
250
+		foreach ($this->get_email_notifications() as $email) {
251
+			if ($email_type !== $email->config['id']) {
252 252
 				continue;
253 253
 			}
254 254
 
255 255
 			// Set form id.
256
-			$form_id = empty( $_GET['form_id']  ) ? null : absint( $_GET['form_id'] );
256
+			$form_id = empty($_GET['form_id']) ? null : absint($_GET['form_id']);
257 257
 
258 258
 			// Call setup email data to apply filter and other thing to email.
259 259
 			$email->setup_email_data();
260 260
 
261 261
 			// Decode message.
262
-			$email_message = $email->preview_email_template_tags( $email->get_email_message( $form_id ) );
262
+			$email_message = $email->preview_email_template_tags($email->get_email_message($form_id));
263 263
 
264 264
 			// Set email template.
265
-			Give()->emails->html    = true;
266
-			Give()->emails->__set( 'template', $email->get_email_template( $form_id ) );
265
+			Give()->emails->html = true;
266
+			Give()->emails->__set('template', $email->get_email_template($form_id));
267 267
 
268
-			if ( 'text/plain' === $email->config['content_type'] ) {
268
+			if ('text/plain' === $email->config['content_type']) {
269 269
 				// Give()->emails->__set( 'html', false );
270
-				Give()->emails->__set( 'template', 'none' );
270
+				Give()->emails->__set('template', 'none');
271 271
 			}
272 272
 
273
-			if ( $email_message = Give()->emails->build_email( $email_message ) ) {
273
+			if ($email_message = Give()->emails->build_email($email_message)) {
274 274
 
275 275
 				/**
276 276
 				 * Filter the email preview data
@@ -279,14 +279,14 @@  discard block
 block discarded – undo
279 279
 				 *
280 280
 				 * @param array
281 281
 				 */
282
-				$email_preview_data = apply_filters( "give_{$email_type}_email_preview_data", array() );
282
+				$email_preview_data = apply_filters("give_{$email_type}_email_preview_data", array());
283 283
 
284 284
 				/**
285 285
 				 * Fire the give_{$email_type}_email_preview action
286 286
 				 *
287 287
 				 * @since 2.0
288 288
 				 */
289
-				do_action( "give_{$email_type}_email_preview", $email );
289
+				do_action("give_{$email_type}_email_preview", $email);
290 290
 
291 291
 				/**
292 292
 				 * Filter the email message
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 				 * @param array                   $email_preview_data
298 298
 				 * @param Give_Email_Notification $email
299 299
 				 */
300
-				echo apply_filters( "give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email );
300
+				echo apply_filters("give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email);
301 301
 
302 302
 				exit();
303 303
 			}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @param Give_Email_Notification $email
315 315
 	 */
316
-	public function email_preview_header( $email ) {
316
+	public function email_preview_header($email) {
317 317
 		/**
318 318
 		 * Filter the all email preview headers.
319 319
 		 *
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		 *
322 322
 		 * @param Give_Email_Notification $email
323 323
 		 */
324
-		$email_preview_header = apply_filters( 'give_email_preview_header', give_get_preview_email_header(), $email );
324
+		$email_preview_header = apply_filters('give_email_preview_header', give_get_preview_email_header(), $email);
325 325
 
326 326
 		echo $email_preview_header;
327 327
 	}
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @return array
338 338
 	 */
339
-	public function email_preview_data( $email_preview_data ) {
340
-		$email_preview_data['payment_id'] = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ) );
341
-		$email_preview_data['user_id']    = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ) );
339
+	public function email_preview_data($email_preview_data) {
340
+		$email_preview_data['payment_id'] = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id'));
341
+		$email_preview_data['user_id']    = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'user_id'));
342 342
 
343 343
 		return $email_preview_data;
344 344
 	}
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return string
356 356
 	 */
357
-	public function email_preview_message( $email_message, $email_preview_data ) {
357
+	public function email_preview_message($email_message, $email_preview_data) {
358 358
 		if (
359
-			! empty( $email_preview_data['payment_id'] )
360
-			|| ! empty( $email_preview_data['user_id'] )
359
+			! empty($email_preview_data['payment_id'])
360
+			|| ! empty($email_preview_data['user_id'])
361 361
 		) {
362
-			$email_message = give_do_email_tags( $email_message, $email_preview_data );
362
+			$email_message = give_do_email_tags($email_message, $email_preview_data);
363 363
 		}
364 364
 
365 365
 		return $email_message;
@@ -374,26 +374,26 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function send_preview_email() {
376 376
 		// Bailout.
377
-		if ( ! Give_Email_Notification_Util::can_send_preview_email() ) {
377
+		if ( ! Give_Email_Notification_Util::can_send_preview_email()) {
378 378
 			return false;
379 379
 		}
380 380
 
381 381
 		// Security check.
382
-		give_validate_nonce( $_GET['_wpnonce'], 'give-send-preview-email' );
382
+		give_validate_nonce($_GET['_wpnonce'], 'give-send-preview-email');
383 383
 
384 384
 		// Get email type.
385
-		$email_type = give_check_variable( give_clean( $_GET ), 'isset', '', 'email_type' );
385
+		$email_type = give_check_variable(give_clean($_GET), 'isset', '', 'email_type');
386 386
 
387 387
 		/* @var Give_Email_Notification $email */
388
-		foreach ( $this->get_email_notifications() as $email ) {
389
-			if ( $email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview( $email ) ) {
388
+		foreach ($this->get_email_notifications() as $email) {
389
+			if ($email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview($email)) {
390 390
 				$email->send_preview_email();
391 391
 				break;
392 392
 			}
393 393
 		}
394 394
 
395 395
 		// Remove the test email query arg.
396
-		wp_redirect( remove_query_arg( 'give_action' ) );
396
+		wp_redirect(remove_query_arg('give_action'));
397 397
 		exit;
398 398
 	}
399 399
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @access public
406 406
 	 */
407 407
 	public function load() {
408
-		add_action( 'init', array( $this, 'init' ), -1 );
408
+		add_action('init', array($this, 'init'), -1);
409 409
 	}
410 410
 
411 411
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 		if (
421 421
 			! Give_Admin_Settings::is_saving_settings() ||
422 422
 			'emails' !== give_get_current_setting_tab() ||
423
-			! isset( $_GET['section'] )
423
+			! isset($_GET['section'])
424 424
 		) {
425 425
 			return;
426 426
 		}
@@ -428,18 +428,18 @@  discard block
 block discarded – undo
428 428
 		// Get email type.
429 429
 		$email_type = give_get_current_setting_section();
430 430
 
431
-		if ( ! empty( $_POST["{$email_type}_recipient"] ) ) {
432
-			$_POST["{$email_type}_recipient"] = array_unique( array_filter( $_POST["{$email_type}_recipient"] ) );
431
+		if ( ! empty($_POST["{$email_type}_recipient"])) {
432
+			$_POST["{$email_type}_recipient"] = array_unique(array_filter($_POST["{$email_type}_recipient"]));
433 433
 		}
434 434
 	}
435 435
 }
436 436
 
437 437
 // Helper class.
438
-require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/abstract-email-notification.php';
439
-require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-util.php';
438
+require_once GIVE_PLUGIN_DIR.'includes/admin/emails/abstract-email-notification.php';
439
+require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-util.php';
440 440
 
441 441
 // Add backward compatibility.
442
-require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/backward-compatibility.php';
442
+require_once GIVE_PLUGIN_DIR.'includes/admin/emails/backward-compatibility.php';
443 443
 
444 444
 /**
445 445
  * Initialize functionality.
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	/**
529 529
 	 * Get donor email html.
530 530
 	 *
531
-	 * @param object $payment Contains all the data of the payment.
531
+	 * @param Give_Payment $payment Contains all the data of the payment.
532 532
 	 *
533 533
 	 * @access public
534 534
 	 * @since  1.0
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	/**
557 557
 	 * Get Row Actions
558 558
 	 *
559
-	 * @param object $payment Payment Data.
559
+	 * @param Give_Payment $payment Payment Data.
560 560
 	 *
561 561
 	 * @since 1.6
562 562
 	 *
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	/**
678 678
 	 * Get donor html.
679 679
 	 *
680
-	 * @param object $payment Contains all the data of the payment.
680
+	 * @param Give_Payment $payment Contains all the data of the payment.
681 681
 	 *
682 682
 	 * @access public
683 683
 	 * @since  1.0
Please login to merge, or discard this patch.
Spacing   +217 added lines, -218 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
 /**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 		// Set parent defaults.
137 137
 		parent::__construct(
138 138
 			array(
139
-				'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
140
-				'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
141
-				'ajax'     => false,                              // Does this table support ajax?
139
+				'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
140
+				'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
141
+				'ajax'     => false, // Does this table support ajax?
142 142
 			)
143 143
 		);
144 144
 
145 145
 		$this->process_bulk_action();
146 146
 		$this->get_payment_counts();
147
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
147
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
 	 * @return void
154 154
 	 */
155 155
 	public function advanced_filters() {
156
-		$start_date = isset( $_GET['start-date'] ) ? give_clean( $_GET['start-date'] ) : null;
157
-		$end_date   = isset( $_GET['end-date'] ) ? give_clean( $_GET['end-date'] ) : null;
158
-		$status     = isset( $_GET['status'] ) ? give_clean( $_GET['status'] ) : '';
159
-		$donor      = isset( $_GET['donor'] ) ? absint( $_GET['donor'] ) : '';
160
-		$search     = isset( $_GET['s'] ) ? give_clean( $_GET['s'] ) : '';
161
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
156
+		$start_date = isset($_GET['start-date']) ? give_clean($_GET['start-date']) : null;
157
+		$end_date   = isset($_GET['end-date']) ? give_clean($_GET['end-date']) : null;
158
+		$status     = isset($_GET['status']) ? give_clean($_GET['status']) : '';
159
+		$donor      = isset($_GET['donor']) ? absint($_GET['donor']) : '';
160
+		$search     = isset($_GET['s']) ? give_clean($_GET['s']) : '';
161
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
162 162
 		?>
163 163
 		<div id="give-payment-filters" class="give-filters">
164
-			<?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?>
164
+			<?php $this->search_box(__('Search', 'give'), 'give-payments'); ?>
165 165
 			<div id="give-payment-date-filters">
166 166
 				<div class="give-filter give-filter-half">
167 167
 					<label for="start-date"
168
-					       class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label>
168
+					       class="give-start-date-label"><?php _e('Start Date', 'give'); ?></label>
169 169
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
170 170
 					       value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
171 171
 				</div>
172 172
 				<div class="give-filter give-filter-half">
173
-					<label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label>
173
+					<label for="end-date" class="give-end-date-label"><?php _e('End Date', 'give'); ?></label>
174 174
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
175 175
 					       value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
176 176
 				</div>
177 177
 			</div>
178 178
 			<div id="give-payment-form-filter" class="give-filter">
179 179
 				<label for="give-donation-forms-filter"
180
-				       class="give-donation-forms-filter-label"><?php _e( 'Form', 'give' ); ?></label>
180
+				       class="give-donation-forms-filter-label"><?php _e('Form', 'give'); ?></label>
181 181
 				<?php
182 182
 				// Filter Donations by Donation Forms.
183 183
 				echo Give()->html->forms_dropdown(
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 						'class'    => 'give-donation-forms-filter',
188 188
 						'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
189 189
 						'chosen'   => true,
190
-						'number'   => - 1,
190
+						'number'   => -1,
191 191
 					)
192 192
 				);
193 193
 				?>
@@ -199,26 +199,26 @@  discard block
 block discarded – undo
199 199
 			 *
200 200
 			 * @since 1.8.18
201 201
 			 */
202
-			do_action( 'give_payment_table_advanced_filters' );
202
+			do_action('give_payment_table_advanced_filters');
203 203
 
204 204
 
205
-			if ( ! empty( $status ) ) {
206
-				echo sprintf( '<input type="hidden" name="status" value="%s"/>', esc_attr( $status ) );
205
+			if ( ! empty($status)) {
206
+				echo sprintf('<input type="hidden" name="status" value="%s"/>', esc_attr($status));
207 207
 			}
208 208
 
209
-			if ( ! empty( $donor ) ) {
210
-				echo sprintf( '<input type="hidden" name="donor" value="%s"/>', absint( $donor ) );
209
+			if ( ! empty($donor)) {
210
+				echo sprintf('<input type="hidden" name="donor" value="%s"/>', absint($donor));
211 211
 			}
212 212
 			?>
213 213
 
214 214
 			<div class="give-filter">
215
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
215
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
216 216
 				<?php
217 217
 				// Clear active filters button.
218
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) :
218
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) :
219 219
 					?>
220
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
221
-					   class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a>
220
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
221
+					   class="button give-clear-filters-button"><?php _e('Clear Filters', 'give'); ?></a>
222 222
 				<?php endif; ?>
223 223
 			</div>
224 224
 		</div>
@@ -237,18 +237,18 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	public function search_box( $text, $input_id ) {
241
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
240
+	public function search_box($text, $input_id) {
241
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$input_id = $input_id . '-search-input';
245
+		$input_id = $input_id.'-search-input';
246 246
 
247
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
248
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
247
+		if ( ! empty($_REQUEST['orderby'])) {
248
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
249 249
 		}
250
-		if ( ! empty( $_REQUEST['order'] ) ) {
251
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
250
+		if ( ! empty($_REQUEST['order'])) {
251
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
252 252
 		}
253 253
 		?>
254 254
 		<div class="give-filter give-filter-search" role="search">
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 			 *
261 261
 			 * @since 1.7
262 262
 			 */
263
-			do_action( 'give_payment_history_search' );
263
+			do_action('give_payment_history_search');
264 264
 			?>
265 265
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
266 266
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
267
-			<?php submit_button( $text, 'button', false, false, array(
267
+			<?php submit_button($text, 'button', false, false, array(
268 268
 				'ID' => 'search-submit',
269
-			) ); ?><br/>
269
+			)); ?><br/>
270 270
 		</div>
271 271
 		<?php
272 272
 	}
@@ -281,48 +281,48 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function get_views() {
283 283
 
284
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
284
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
285 285
 		$views   = array();
286 286
 		$tabs    = array(
287 287
 			'all'         => array(
288 288
 				'total_count',
289
-				__( 'All', 'give' ),
289
+				__('All', 'give'),
290 290
 			),
291 291
 			'publish'     => array(
292 292
 				'complete_count',
293
-				__( 'Completed', 'give' ),
293
+				__('Completed', 'give'),
294 294
 			),
295 295
 			'pending'     => array(
296 296
 				'pending_count',
297
-				__( 'Pending', 'give' ),
297
+				__('Pending', 'give'),
298 298
 			),
299 299
 			'processing'  => array(
300 300
 				'processing_count',
301
-				__( 'Processing', 'give' ),
301
+				__('Processing', 'give'),
302 302
 			),
303 303
 			'refunded'    => array(
304 304
 				'refunded_count',
305
-				__( 'Refunded', 'give' ),
305
+				__('Refunded', 'give'),
306 306
 			),
307 307
 			'revoked'     => array(
308 308
 				'revoked_count',
309
-				__( 'Revoked', 'give' ),
309
+				__('Revoked', 'give'),
310 310
 			),
311 311
 			'failed'      => array(
312 312
 				'failed_count',
313
-				__( 'Failed', 'give' ),
313
+				__('Failed', 'give'),
314 314
 			),
315 315
 			'cancelled'   => array(
316 316
 				'cancelled_count',
317
-				__( 'Cancelled', 'give' ),
317
+				__('Cancelled', 'give'),
318 318
 			),
319 319
 			'abandoned'   => array(
320 320
 				'abandoned_count',
321
-				__( 'Abandoned', 'give' ),
321
+				__('Abandoned', 'give'),
322 322
 			),
323 323
 			'preapproval' => array(
324 324
 				'preapproval_count',
325
-				__( 'Preapproval Pending', 'give' ),
325
+				__('Preapproval Pending', 'give'),
326 326
 			),
327 327
 		);
328 328
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 		 *
332 332
 		 * @since 1.8.18
333 333
 		 */
334
-		$args = (array) apply_filters( 'give_payments_table_status_remove_query_arg', array( 'paged', '_wpnonce', '_wp_http_referer' ) );
334
+		$args = (array) apply_filters('give_payments_table_status_remove_query_arg', array('paged', '_wpnonce', '_wp_http_referer'));
335 335
 
336 336
 		// Build URL.
337
-		$staus_url = remove_query_arg( $args );
337
+		$staus_url = remove_query_arg($args);
338 338
 
339
-		foreach ( $tabs as $key => $tab ) {
339
+		foreach ($tabs as $key => $tab) {
340 340
 			$count_key = $tab[0];
341 341
 			$name      = $tab[1];
342 342
 			$count     = $this->$count_key;
@@ -351,16 +351,15 @@  discard block
 block discarded – undo
351 351
 			 *
352 352
 			 * @since 1.8.12
353 353
 			 */
354
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
354
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
355 355
 
356 356
 				$staus_url = 'all' === $key ?
357
-					add_query_arg( array( 'status' => false ), $staus_url ) :
358
-					add_query_arg( array( 'status' => $key ), $staus_url );
357
+					add_query_arg(array('status' => false), $staus_url) : add_query_arg(array('status' => $key), $staus_url);
359 358
 
360
-				$views[ $key ] = sprintf(
359
+				$views[$key] = sprintf(
361 360
 					'<a href="%s"%s>%s&nbsp;<span class="count">(%s)</span></a>',
362
-					esc_url( $staus_url ),
363
-					( ( 'all' === $key && empty( $current ) ) ) ? ' class="current"' : ( $current == $key ? 'class="current"' : '' ),
361
+					esc_url($staus_url),
362
+					(('all' === $key && empty($current))) ? ' class="current"' : ($current == $key ? 'class="current"' : ''),
364 363
 					$name,
365 364
 					$count
366 365
 				);
@@ -375,7 +374,7 @@  discard block
 block discarded – undo
375 374
 		 * @param array $views
376 375
 		 * @param Give_Payment_History_Table
377 376
 		 */
378
-		return apply_filters( 'give_payments_table_views', $views, $this );
377
+		return apply_filters('give_payments_table_views', $views, $this);
379 378
 	}
380 379
 
381 380
 	/**
@@ -389,18 +388,18 @@  discard block
 block discarded – undo
389 388
 	public function get_columns() {
390 389
 		$columns = array(
391 390
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
392
-			'donation'      => __( 'Donation', 'give' ),
393
-			'donation_form' => __( 'Donation Form', 'give' ),
394
-			'status'        => __( 'Status', 'give' ),
395
-			'date'          => __( 'Date', 'give' ),
396
-			'amount'        => __( 'Amount', 'give' ),
391
+			'donation'      => __('Donation', 'give'),
392
+			'donation_form' => __('Donation Form', 'give'),
393
+			'status'        => __('Status', 'give'),
394
+			'date'          => __('Date', 'give'),
395
+			'amount'        => __('Amount', 'give'),
397 396
 		);
398 397
 
399
-		if ( current_user_can( 'view_give_payments' ) ) {
400
-			$columns['details'] = __( 'Details', 'give' );
398
+		if (current_user_can('view_give_payments')) {
399
+			$columns['details'] = __('Details', 'give');
401 400
 		}
402 401
 
403
-		return apply_filters( 'give_payments_table_columns', $columns );
402
+		return apply_filters('give_payments_table_columns', $columns);
404 403
 	}
405 404
 
406 405
 	/**
@@ -413,14 +412,14 @@  discard block
 block discarded – undo
413 412
 	 */
414 413
 	public function get_sortable_columns() {
415 414
 		$columns = array(
416
-			'donation'      => array( 'ID', true ),
417
-			'donation_form' => array( 'donation_form', false ),
418
-			'status'        => array( 'status', false ),
419
-			'amount'        => array( 'amount', false ),
420
-			'date'          => array( 'date', false ),
415
+			'donation'      => array('ID', true),
416
+			'donation_form' => array('donation_form', false),
417
+			'status'        => array('status', false),
418
+			'amount'        => array('amount', false),
419
+			'date'          => array('date', false),
421 420
 		);
422 421
 
423
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
422
+		return apply_filters('give_payments_table_sortable_columns', $columns);
424 423
 	}
425 424
 
426 425
 	/**
@@ -446,43 +445,43 @@  discard block
 block discarded – undo
446 445
 	 *
447 446
 	 * @return string Column Name
448 447
 	 */
449
-	public function column_default( $payment, $column_name ) {
448
+	public function column_default($payment, $column_name) {
450 449
 
451
-		$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-payment-details' ) ) );
452
-		$row_actions         = $this->get_row_actions( $payment );
450
+		$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-payment-details')));
451
+		$row_actions         = $this->get_row_actions($payment);
453 452
 		$value               = '';
454 453
 
455
-		switch ( $column_name ) {
454
+		switch ($column_name) {
456 455
 			case 'donation' :
457
-				if ( current_user_can( 'view_give_payments' ) ) {
458
-					$value = Give()->tooltips->render_link( array(
459
-						'label'       => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ),
456
+				if (current_user_can('view_give_payments')) {
457
+					$value = Give()->tooltips->render_link(array(
458
+						'label'       => sprintf(__('View Donation #%s', 'give'), $payment->ID),
460 459
 						'tag_content' => "#$payment->ID",
461 460
 						'link'        => $single_donation_url,
462
-					) );
461
+					));
463 462
 				} else {
464 463
 					$value = "#{$payment->ID}";
465 464
 				}
466 465
 
467 466
 				$value .= sprintf(
468 467
 					'&nbsp;%1$s&nbsp;%2$s<br>',
469
-					__( 'by', 'give' ),
470
-					$this->get_donor( $payment )
468
+					__('by', 'give'),
469
+					$this->get_donor($payment)
471 470
 				);
472 471
 
473
-				$value .= $this->get_donor_email( $payment );
474
-				$value .= $this->row_actions( $row_actions );
472
+				$value .= $this->get_donor_email($payment);
473
+				$value .= $this->row_actions($row_actions);
475 474
 				break;
476 475
 
477 476
 			case 'amount':
478
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
479
-				$value  = give_donation_amount( $payment, true );
480
-				$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
477
+				$amount = ! empty($payment->total) ? $payment->total : 0;
478
+				$value  = give_donation_amount($payment, true);
479
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
481 480
 				break;
482 481
 
483 482
 			case 'donation_form':
484
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
485
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
483
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
484
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
486 485
 				$level      = give_get_donation_form_title(
487 486
 					$payment,
488 487
 					array(
@@ -490,44 +489,44 @@  discard block
 block discarded – undo
490 489
 					)
491 490
 				);
492 491
 
493
-				if ( ! empty( $level ) ) {
492
+				if ( ! empty($level)) {
494 493
 					$value .= $level;
495 494
 				}
496 495
 
497 496
 				break;
498 497
 
499 498
 			case 'date':
500
-				$date  = strtotime( $payment->date );
501
-				$value = date_i18n( give_date_format(), $date );
499
+				$date  = strtotime($payment->date);
500
+				$value = date_i18n(give_date_format(), $date);
502 501
 				break;
503 502
 
504 503
 			case 'status':
505
-				$value = $this->get_payment_status( $payment );
504
+				$value = $this->get_payment_status($payment);
506 505
 				break;
507 506
 
508 507
 
509 508
 			case 'details' :
510
-				if ( current_user_can( 'view_give_payments' ) ) {
511
-					$value = Give()->tooltips->render_link( array(
512
-						'label'       => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ),
509
+				if (current_user_can('view_give_payments')) {
510
+					$value = Give()->tooltips->render_link(array(
511
+						'label'       => sprintf(__('View Donation #%s', 'give'), $payment->ID),
513 512
 						'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
514 513
 						'link'        => $single_donation_url,
515 514
 						'attributes'  => array(
516 515
 							'class' => 'give-payment-details-link button button-small',
517 516
 						),
518
-					) );
517
+					));
519 518
 
520 519
 					$value = "<div class=\"give-payment-details-link-wrap\">{$value}</div>";
521 520
 				}
522 521
 				break;
523 522
 
524 523
 			default:
525
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
524
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
526 525
 				break;
527 526
 
528 527
 		}// End switch().
529 528
 
530
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
529
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
531 530
 	}
532 531
 
533 532
 	/**
@@ -540,22 +539,22 @@  discard block
 block discarded – undo
540 539
 	 *
541 540
 	 * @return string Data shown in the Email column
542 541
 	 */
543
-	public function get_donor_email( $payment ) {
542
+	public function get_donor_email($payment) {
544 543
 
545
-		$email = give_get_payment_user_email( $payment->ID );
544
+		$email = give_get_payment_user_email($payment->ID);
546 545
 
547
-		if ( empty( $email ) ) {
548
-			$email = __( '(unknown)', 'give' );
546
+		if (empty($email)) {
547
+			$email = __('(unknown)', 'give');
549 548
 		}
550 549
 
551 550
 
552
-		$value = Give()->tooltips->render_link( array(
551
+		$value = Give()->tooltips->render_link(array(
553 552
 			'link'        => "mailto:{$email}",
554
-			'label'       => __( 'Email donor', 'give' ),
553
+			'label'       => __('Email donor', 'give'),
555 554
 			'tag_content' => $email,
556
-		) );
555
+		));
557 556
 
558
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
557
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
559 558
 	}
560 559
 
561 560
 	/**
@@ -567,18 +566,18 @@  discard block
 block discarded – undo
567 566
 	 *
568 567
 	 * @return array $actions
569 568
 	 */
570
-	function get_row_actions( $payment ) {
569
+	function get_row_actions($payment) {
571 570
 
572 571
 		$actions = array();
573
-		$email   = give_get_payment_user_email( $payment->ID );
572
+		$email   = give_get_payment_user_email($payment->ID);
574 573
 
575 574
 		// Add search term string back to base URL.
576
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
577
-		if ( ! empty( $search_terms ) ) {
578
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
575
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
576
+		if ( ! empty($search_terms)) {
577
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
579 578
 		}
580 579
 
581
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
580
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
582 581
 
583 582
 			$actions['email_links'] = sprintf(
584 583
 				'<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(
@@ -588,12 +587,12 @@  discard block
 block discarded – undo
588 587
 						'purchase_id' => $payment->ID,
589 588
 					), $this->base_url
590 589
 				), 'give_payment_nonce'
591
-			), sprintf( __( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), __( 'Resend Receipt', 'give' )
590
+			), sprintf(__('Resend Donation %s Receipt', 'give'), $payment->ID), __('Resend Receipt', 'give')
592 591
 			);
593 592
 
594 593
 		}
595 594
 
596
-		if ( current_user_can( 'view_give_payments' ) ) {
595
+		if (current_user_can('view_give_payments')) {
597 596
 			$actions['delete'] = sprintf(
598 597
 				'<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>',
599 598
 				wp_nonce_url(
@@ -603,11 +602,11 @@  discard block
 block discarded – undo
603 602
 							'purchase_id' => $payment->ID,
604 603
 						), $this->base_url
605 604
 					), 'give_donation_nonce'
606
-				), sprintf( __( 'Delete Donation %s', 'give' ), $payment->ID ), __( 'Delete', 'give' )
605
+				), sprintf(__('Delete Donation %s', 'give'), $payment->ID), __('Delete', 'give')
607 606
 			);
608 607
 		}
609 608
 
610
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
609
+		return apply_filters('give_payment_row_actions', $actions, $payment);
611 610
 	}
612 611
 
613 612
 
@@ -621,30 +620,30 @@  discard block
 block discarded – undo
621 620
 	 *
622 621
 	 * @return string Data shown in the Email column
623 622
 	 */
624
-	function get_payment_status( $payment ) {
623
+	function get_payment_status($payment) {
625 624
 		$value = sprintf(
626 625
 			'<div class="give-donation-status status-%1$s"><span class="give-donation-status-icon"></span>&nbsp;%2$s</div>',
627 626
 			$payment->status,
628
-			give_get_payment_status( $payment, true )
627
+			give_get_payment_status($payment, true)
629 628
 		);
630 629
 
631
-		if ( $payment->mode == 'test' ) {
632
-			$value .= Give()->tooltips->render_span( array(
633
-				'label'       => __( 'This donation was made in test mode.', 'give' ),
634
-				'tag_content' => __( 'Test', 'give' ),
630
+		if ($payment->mode == 'test') {
631
+			$value .= Give()->tooltips->render_span(array(
632
+				'label'       => __('This donation was made in test mode.', 'give'),
633
+				'tag_content' => __('Test', 'give'),
635 634
 				'attributes'  => array(
636 635
 					'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label',
637 636
 				),
638 637
 
639 638
 
640
-			) );
639
+			));
641 640
 		}
642 641
 
643
-		if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) {
642
+		if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) {
644 643
 			$value .= sprintf(
645 644
 				'&nbsp;<span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="%1$s">%2$s</span>',
646
-				__( 'This donation was imported.', 'give' ),
647
-				__( 'Import', 'give' )
645
+				__('This donation was imported.', 'give'),
646
+				__('Import', 'give')
648 647
 			);
649 648
 		}
650 649
 
@@ -661,8 +660,8 @@  discard block
 block discarded – undo
661 660
 	 *
662 661
 	 * @return string Displays a checkbox.
663 662
 	 */
664
-	public function column_cb( $payment ) {
665
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
663
+	public function column_cb($payment) {
664
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
666 665
 	}
667 666
 
668 667
 	/**
@@ -675,8 +674,8 @@  discard block
 block discarded – undo
675 674
 	 *
676 675
 	 * @return string Displays a checkbox.
677 676
 	 */
678
-	public function get_payment_id( $payment ) {
679
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
677
+	public function get_payment_id($payment) {
678
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
680 679
 	}
681 680
 
682 681
 	/**
@@ -689,32 +688,32 @@  discard block
 block discarded – undo
689 688
 	 *
690 689
 	 * @return string Data shown in the User column
691 690
 	 */
692
-	public function get_donor( $payment ) {
691
+	public function get_donor($payment) {
693 692
 
694
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
695
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
696
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
693
+		$donor_id           = give_get_payment_donor_id($payment->ID);
694
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
695
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
697 696
 
698 697
 		$value = '';
699
-		if ( ! empty( $donor_id ) ) {
698
+		if ( ! empty($donor_id)) {
700 699
 
701 700
 			// Check whether the donor name and WP_User name is same or not.
702
-			if ( sanitize_title( $donor_billing_name ) !== sanitize_title( $donor_name ) ) {
703
-				$value .= $donor_billing_name . ' (';
701
+			if (sanitize_title($donor_billing_name) !== sanitize_title($donor_name)) {
702
+				$value .= $donor_billing_name.' (';
704 703
 			}
705 704
 
706
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
705
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
707 706
 
708 707
 			// Check whether the donor name and WP_User name is same or not.
709
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
708
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
710 709
 				$value .= ')';
711 710
 			}
712 711
 		} else {
713
-			$email  = give_get_payment_user_email( $payment->ID );
714
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . __( '(donor missing)', 'give' ) . '</a>';
712
+			$email  = give_get_payment_user_email($payment->ID);
713
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.__('(donor missing)', 'give').'</a>';
715 714
 		}
716 715
 
717
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
716
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
718 717
 	}
719 718
 
720 719
 	/**
@@ -727,20 +726,20 @@  discard block
 block discarded – undo
727 726
 	 */
728 727
 	public function get_bulk_actions() {
729 728
 		$actions = array(
730
-			'delete'                 => __( 'Delete', 'give' ),
731
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
732
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
733
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
734
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
735
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
736
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
737
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
738
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
739
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
740
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
729
+			'delete'                 => __('Delete', 'give'),
730
+			'set-status-publish'     => __('Set To Completed', 'give'),
731
+			'set-status-pending'     => __('Set To Pending', 'give'),
732
+			'set-status-processing'  => __('Set To Processing', 'give'),
733
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
734
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
735
+			'set-status-failed'      => __('Set To Failed', 'give'),
736
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
737
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
738
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
739
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
741 740
 		);
742 741
 
743
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
742
+		return apply_filters('give_payments_table_bulk_actions', $actions);
744 743
 	}
745 744
 
746 745
 	/**
@@ -752,59 +751,59 @@  discard block
 block discarded – undo
752 751
 	 * @return void
753 752
 	 */
754 753
 	public function process_bulk_action() {
755
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
754
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
756 755
 		$action = $this->current_action();
757 756
 
758
-		if ( ! is_array( $ids ) ) {
759
-			$ids = array( $ids );
757
+		if ( ! is_array($ids)) {
758
+			$ids = array($ids);
760 759
 		}
761 760
 
762
-		if ( empty( $action ) ) {
761
+		if (empty($action)) {
763 762
 			return;
764 763
 		}
765 764
 
766
-		foreach ( $ids as $id ) {
765
+		foreach ($ids as $id) {
767 766
 
768 767
 			// Detect when a bulk action is being triggered.
769
-			switch ( $this->current_action() ) {
768
+			switch ($this->current_action()) {
770 769
 
771 770
 				case 'delete':
772
-					give_delete_donation( $id );
771
+					give_delete_donation($id);
773 772
 					break;
774 773
 
775 774
 				case 'set-status-publish':
776
-					give_update_payment_status( $id, 'publish' );
775
+					give_update_payment_status($id, 'publish');
777 776
 					break;
778 777
 
779 778
 				case 'set-status-pending':
780
-					give_update_payment_status( $id, 'pending' );
779
+					give_update_payment_status($id, 'pending');
781 780
 					break;
782 781
 
783 782
 				case 'set-status-processing':
784
-					give_update_payment_status( $id, 'processing' );
783
+					give_update_payment_status($id, 'processing');
785 784
 					break;
786 785
 
787 786
 				case 'set-status-refunded':
788
-					give_update_payment_status( $id, 'refunded' );
787
+					give_update_payment_status($id, 'refunded');
789 788
 					break;
790 789
 				case 'set-status-revoked':
791
-					give_update_payment_status( $id, 'revoked' );
790
+					give_update_payment_status($id, 'revoked');
792 791
 					break;
793 792
 
794 793
 				case 'set-status-failed':
795
-					give_update_payment_status( $id, 'failed' );
794
+					give_update_payment_status($id, 'failed');
796 795
 					break;
797 796
 
798 797
 				case 'set-status-cancelled':
799
-					give_update_payment_status( $id, 'cancelled' );
798
+					give_update_payment_status($id, 'cancelled');
800 799
 					break;
801 800
 
802 801
 				case 'set-status-abandoned':
803
-					give_update_payment_status( $id, 'abandoned' );
802
+					give_update_payment_status($id, 'abandoned');
804 803
 					break;
805 804
 
806 805
 				case 'set-status-preapproval':
807
-					give_update_payment_status( $id, 'preapproval' );
806
+					give_update_payment_status($id, 'preapproval');
808 807
 					break;
809 808
 
810 809
 				case 'resend-receipt':
@@ -813,7 +812,7 @@  discard block
 block discarded – undo
813 812
 					 *
814 813
 					 * @since 2.0
815 814
 					 */
816
-					do_action( 'give_donation-receipt_email_notification', $id );
815
+					do_action('give_donation-receipt_email_notification', $id);
817 816
 					break;
818 817
 			}// End switch().
819 818
 
@@ -825,7 +824,7 @@  discard block
 block discarded – undo
825 824
 			 *
826 825
 			 * @since 1.7
827 826
 			 */
828
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
827
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
829 828
 		}// End foreach().
830 829
 
831 830
 	}
@@ -842,32 +841,32 @@  discard block
 block discarded – undo
842 841
 
843 842
 		$args = array();
844 843
 
845
-		if ( isset( $_GET['user'] ) ) {
846
-			$args['user'] = urldecode( $_GET['user'] );
847
-		} elseif ( isset( $_GET['donor'] ) ) {
848
-			$args['donor'] = absint( $_GET['donor'] );
849
-		} elseif ( isset( $_GET['s'] ) ) {
850
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
851
-			if ( $is_user ) {
852
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
853
-				unset( $args['s'] );
844
+		if (isset($_GET['user'])) {
845
+			$args['user'] = urldecode($_GET['user']);
846
+		} elseif (isset($_GET['donor'])) {
847
+			$args['donor'] = absint($_GET['donor']);
848
+		} elseif (isset($_GET['s'])) {
849
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
850
+			if ($is_user) {
851
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
852
+				unset($args['s']);
854 853
 			} else {
855
-				$args['s'] = sanitize_text_field( $_GET['s'] );
854
+				$args['s'] = sanitize_text_field($_GET['s']);
856 855
 			}
857 856
 		}
858 857
 
859
-		if ( ! empty( $_GET['start-date'] ) ) {
860
-			$args['start-date'] = urldecode( $_GET['start-date'] );
858
+		if ( ! empty($_GET['start-date'])) {
859
+			$args['start-date'] = urldecode($_GET['start-date']);
861 860
 		}
862 861
 
863
-		if ( ! empty( $_GET['end-date'] ) ) {
864
-			$args['end-date'] = urldecode( $_GET['end-date'] );
862
+		if ( ! empty($_GET['end-date'])) {
863
+			$args['end-date'] = urldecode($_GET['end-date']);
865 864
 		}
866 865
 
867
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
868
-		$args['gateway'] = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null;
866
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
867
+		$args['gateway'] = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null;
869 868
 
870
-		$payment_count           = give_count_payments( $args );
869
+		$payment_count           = give_count_payments($args);
871 870
 		$this->complete_count    = $payment_count->publish;
872 871
 		$this->pending_count     = $payment_count->pending;
873 872
 		$this->processing_count  = $payment_count->processing;
@@ -878,7 +877,7 @@  discard block
 block discarded – undo
878 877
 		$this->abandoned_count   = $payment_count->abandoned;
879 878
 		$this->preapproval_count = $payment_count->preapproval;
880 879
 
881
-		foreach ( $payment_count as $count ) {
880
+		foreach ($payment_count as $count) {
882 881
 			$this->total_count += $count;
883 882
 		}
884 883
 
@@ -896,25 +895,25 @@  discard block
 block discarded – undo
896 895
 	public function payments_data() {
897 896
 
898 897
 		$per_page   = $this->per_page;
899
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
900
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
901
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
902
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
903
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
904
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
905
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
906
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
907
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
908
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
909
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
910
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
911
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
912
-		$gateway    = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null;
898
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
899
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
900
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
901
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
902
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
903
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
904
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
905
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
906
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
907
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
908
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
909
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
910
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
911
+		$gateway    = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null;
913 912
 
914 913
 		$args = array(
915 914
 			'output'     => 'payments',
916 915
 			'number'     => $per_page,
917
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
916
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
918 917
 			'orderby'    => $orderby,
919 918
 			'order'      => $order,
920 919
 			'user'       => $user,
@@ -931,9 +930,9 @@  discard block
 block discarded – undo
931 930
 			'give_forms' => $form_id,
932 931
 		);
933 932
 
934
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
933
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
935 934
 			$args['search_in_notes'] = true;
936
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
935
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
937 936
 		}
938 937
 
939 938
 		/**
@@ -941,9 +940,9 @@  discard block
 block discarded – undo
941 940
 		 *
942 941
 		 * @since 1.8.18
943 942
 		 */
944
-		$args = (array) apply_filters( 'give_payment_table_payments_query', $args );
943
+		$args = (array) apply_filters('give_payment_table_payments_query', $args);
945 944
 
946
-		$p_query = new Give_Payments_Query( $args );
945
+		$p_query = new Give_Payments_Query($args);
947 946
 
948 947
 		return $p_query->get_payments();
949 948
 
@@ -964,17 +963,17 @@  discard block
 block discarded – undo
964 963
 	 */
965 964
 	public function prepare_items() {
966 965
 
967
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
966
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
968 967
 
969 968
 		$columns  = $this->get_columns();
970 969
 		$hidden   = array(); // No hidden columns.
971 970
 		$sortable = $this->get_sortable_columns();
972 971
 		$data     = $this->payments_data();
973
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
972
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
974 973
 
975
-		$this->_column_headers = array( $columns, $hidden, $sortable );
974
+		$this->_column_headers = array($columns, $hidden, $sortable);
976 975
 
977
-		switch ( $status ) {
976
+		switch ($status) {
978 977
 			case 'publish':
979 978
 				$total_items = $this->complete_count;
980 979
 				break;
@@ -1007,8 +1006,8 @@  discard block
 block discarded – undo
1007 1006
 				break;
1008 1007
 			default:
1009 1008
 				// Retrieve the count of the non-default-Give status.
1010
-				$count       = wp_count_posts( 'give_payment' );
1011
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
1009
+				$count       = wp_count_posts('give_payment');
1010
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
1012 1011
 				break;
1013 1012
 		}
1014 1013
 
@@ -1019,7 +1018,7 @@  discard block
 block discarded – undo
1019 1018
 		 *
1020 1019
 		 * @since 1.8.19
1021 1020
 		 */
1022
-		$total_items = (int) apply_filters( 'give_payment_table_pagination_total_count', $total_items, $this );
1021
+		$total_items = (int) apply_filters('give_payment_table_pagination_total_count', $total_items, $this);
1023 1022
 
1024 1023
 		$this->set_pagination_args(
1025 1024
 			array(
@@ -1027,7 +1026,7 @@  discard block
 block discarded – undo
1027 1026
 				// We have to calculate the total number of items.
1028 1027
 				'per_page'    => $this->per_page,
1029 1028
 				// We have to determine how many items to show on a page.
1030
-				'total_pages' => ceil( $total_items / $this->per_page ),
1029
+				'total_pages' => ceil($total_items / $this->per_page),
1031 1030
 				// We have to calculate the total number of pages.
1032 1031
 			)
1033 1032
 		);
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-api-requests-logs-list-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@
 block discarded – undo
187 187
 	 * @access public
188 188
 	 * @since  1.0
189 189
 	 *
190
-	 * @return string|bool String if search is present, false otherwise
190
+	 * @return string|false String if search is present, false otherwise
191 191
 	 */
192 192
 	public function get_search() {
193 193
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
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
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
51
-			'ajax'     => false,// Does this table support ajax?
52
-		) );
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51
+			'ajax'     => false, // Does this table support ajax?
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
67
-		$input_id = $input_id . '-search-input';
66
+	public function search_box($text, $input_id) {
67
+		$input_id = $input_id.'-search-input';
68 68
 
69
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
70
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
69
+		if ( ! empty($_REQUEST['orderby'])) {
70
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
71 71
 		}
72
-		if ( ! empty( $_REQUEST['order'] ) ) {
73
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
72
+		if ( ! empty($_REQUEST['order'])) {
73
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
74 74
 		}
75 75
 		?>
76 76
 		<p class="search-box" role="search">
77 77
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
78 78
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
79
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
79
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
80 80
 		</p>
81 81
 		<?php
82 82
 	}
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_columns() {
93 93
 		$columns = array(
94
-			'ID'      => __( 'Log ID', 'give' ),
95
-			'ip'      => __( 'Request IP', 'give' ),
96
-			'date'    => __( 'Date', 'give' ),
97
-			'details' => __( 'Request Details', 'give' ),
94
+			'ID'      => __('Log ID', 'give'),
95
+			'ip'      => __('Request IP', 'give'),
96
+			'date'    => __('Date', 'give'),
97
+			'details' => __('Request Details', 'give'),
98 98
 		);
99 99
 
100 100
 		return $columns;
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return string Column Name
113 113
 	 */
114
-	public function column_default( $item, $column_name ) {
115
-		switch ( $column_name ) {
114
+	public function column_default($item, $column_name) {
115
+		switch ($column_name) {
116 116
 			default:
117
-				return esc_attr( $item[ $column_name ] );
117
+				return esc_attr($item[$column_name]);
118 118
 		}
119 119
 	}
120 120
 
@@ -128,52 +128,52 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return void
130 130
 	 */
131
-	public function column_details( $item ) {
132
-		echo Give()->tooltips->render_link( array(
133
-			'label'       => __( 'View Request', 'give' ),
131
+	public function column_details($item) {
132
+		echo Give()->tooltips->render_link(array(
133
+			'label'       => __('View Request', 'give'),
134 134
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
135 135
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-details-{$item['ID']}",
136 136
 			'attributes'  => array(
137 137
 				'class' => 'thickbox give-error-log-details-link button button-small',
138 138
 			),
139
-		) );
139
+		));
140 140
 		?>
141 141
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
142 142
 			<?php
143 143
 			// Print API Request.
144 144
 			echo sprintf(
145 145
 				'<p><strong>%1$s</strong></p><div>%2$s</div>',
146
-				__( 'API Request:', 'give' ),
147
-				Give()->logs->logmeta_db->get_meta( $item['ID'], '_give_log_api_query', true )
146
+				__('API Request:', 'give'),
147
+				Give()->logs->logmeta_db->get_meta($item['ID'], '_give_log_api_query', true)
148 148
 			);
149 149
 
150 150
 			// Print Log Content, if not empty.
151
-			if ( ! empty( $item['log_content'] ) ) {
151
+			if ( ! empty($item['log_content'])) {
152 152
 				echo sprintf(
153 153
 					'<p><strong>%1$s</strong></p><div>%2$s</div>',
154
-					__( 'Error', 'give' ),
155
-					esc_html( $item['log_content'] )
154
+					__('Error', 'give'),
155
+					esc_html($item['log_content'])
156 156
 				);
157 157
 			}
158 158
 
159 159
 			// Print User who requested data using API.
160 160
 			echo sprintf(
161 161
 				'<p><strong>%1$s</strong></p><div>%2$s</div>',
162
-				__( 'API User:', 'give' ),
163
-				Give()->logs->logmeta_db->get_meta( $item['ID'], '_give_log_user', true )
162
+				__('API User:', 'give'),
163
+				Give()->logs->logmeta_db->get_meta($item['ID'], '_give_log_user', true)
164 164
 			);
165 165
 
166 166
 			// Print the logged key used by API.
167 167
 			echo sprintf(
168 168
 				'<p><strong>%1$s</strong></p><div>%2$s</div>',
169
-				__( 'API Key:', 'give' ),
170
-				Give()->logs->logmeta_db->get_meta( $item['ID'], '_give_log_key', true )
169
+				__('API Key:', 'give'),
170
+				Give()->logs->logmeta_db->get_meta($item['ID'], '_give_log_key', true)
171 171
 			);
172 172
 
173 173
 			// Print the API Request Date.
174 174
 			echo sprintf(
175 175
 				'<p><strong>%1$s</strong></p><div>%2$s</div>',
176
-				__( 'Request Date:', 'give' ),
176
+				__('Request Date:', 'give'),
177 177
 				$item['log_date']
178 178
 			);
179 179
 			?>
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @return string|bool String if search is present, false otherwise
191 191
 	 */
192 192
 	public function get_search() {
193
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
193
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
194 194
 	}
195 195
 
196 196
 
@@ -206,19 +206,19 @@  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
 			<?php
220
-			$this->extra_tablenav( $which );
221
-			$this->pagination( $which );
220
+			$this->extra_tablenav($which);
221
+			$this->pagination($which);
222 222
 			?>
223 223
 
224 224
 			<br class="clear"/>
@@ -241,40 +241,40 @@  discard block
 block discarded – undo
241 241
 		$meta_query = array();
242 242
 		$search     = $this->get_search();
243 243
 
244
-		if ( $search ) {
245
-			if ( filter_var( $search, FILTER_VALIDATE_IP ) ) {
244
+		if ($search) {
245
+			if (filter_var($search, FILTER_VALIDATE_IP)) {
246 246
 
247 247
 				// This is an IP address search.
248 248
 				$key = '_give_log_request_ip';
249 249
 
250
-			} elseif ( is_email( $search ) ) {
250
+			} elseif (is_email($search)) {
251 251
 
252 252
 				// This is an email search.
253
-				$userdata = get_user_by( 'email', $search );
253
+				$userdata = get_user_by('email', $search);
254 254
 
255
-				if ( $userdata ) {
255
+				if ($userdata) {
256 256
 					$search = $userdata->ID;
257 257
 				}
258 258
 
259 259
 				$key = '_give_log_user';
260 260
 
261
-			} elseif ( 32 === strlen( $search ) ) {
261
+			} elseif (32 === strlen($search)) {
262 262
 
263 263
 				// Look for an API key.
264 264
 				$key = '_give_log_key';
265 265
 
266
-			} elseif ( stristr( $search, 'token:' ) ) {
266
+			} elseif (stristr($search, 'token:')) {
267 267
 
268 268
 				// Look for an API token.
269
-				$search = str_ireplace( 'token:', '', $search );
269
+				$search = str_ireplace('token:', '', $search);
270 270
 				$key    = '_give_log_token';
271 271
 
272 272
 			} else {
273 273
 
274 274
 				// This is (probably) a user ID search.
275
-				$userdata = get_userdata( $search );
275
+				$userdata = get_userdata($search);
276 276
 
277
-				if ( $userdata ) {
277
+				if ($userdata) {
278 278
 					$search = $userdata->ID;
279 279
 				}
280 280
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return int Current page number
303 303
 	 */
304 304
 	public function get_paged() {
305
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
305
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
306 306
 	}
307 307
 
308 308
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return void
317 317
 	 */
318
-	function bulk_actions( $which = '' ) {
318
+	function bulk_actions($which = '') {
319 319
 		give_log_views();
320 320
 	}
321 321
 
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
 			'posts_per_page' => $this->per_page,
338 338
 		);
339 339
 
340
-		$logs = Give()->logs->get_connected_logs( $log_query );
340
+		$logs = Give()->logs->get_connected_logs($log_query);
341 341
 
342
-		if ( $logs ) {
343
-			foreach ( $logs as $log ) {
342
+		if ($logs) {
343
+			foreach ($logs as $log) {
344 344
 
345 345
 				$logs_data[] = array(
346 346
 					'ID'          => $log->ID,
347
-					'ip'          => Give()->logs->logmeta_db->get_meta( $log->ID, '_give_log_request_ip', true ),
347
+					'ip'          => Give()->logs->logmeta_db->get_meta($log->ID, '_give_log_request_ip', true),
348 348
 					'date'        => $log->log_date,
349 349
 					'log_content' => $log->log_content,
350 350
 					'log_date'    => $log->log_date,
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 		$columns               = $this->get_columns();
373 373
 		$hidden                = array(); // No hidden columns
374 374
 		$sortable              = $this->get_sortable_columns();
375
-		$this->_column_headers = array( $columns, $hidden, $sortable );
375
+		$this->_column_headers = array($columns, $hidden, $sortable);
376 376
 		$this->items           = $this->get_logs();
377
-		$total_items           = Give()->logs->get_log_count( 0, 'api_request' );
377
+		$total_items           = Give()->logs->get_log_count(0, 'api_request');
378 378
 
379
-		$this->set_pagination_args( array(
379
+		$this->set_pagination_args(array(
380 380
 				'total_items' => $total_items,
381 381
 				'per_page'    => $this->per_page,
382
-				'total_pages' => ceil( $total_items / $this->per_page ),
382
+				'total_pages' => ceil($total_items / $this->per_page),
383 383
 			)
384 384
 		);
385 385
 	}
Please login to merge, or discard this patch.
includes/class-give-cache.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @param  string $cache_key
123 123
 	 * @param  bool   $custom_key
124
-	 * @param  mixed  $query_args
124
+	 * @param  string  $query_args
125 125
 	 *
126 126
 	 * @return mixed
127 127
 	 */
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param bool  $force If set to true then all cached values will be delete instead of only expired
239 239
 	 *
240
-	 * @return bool
240
+	 * @return false|null
241 241
 	 */
242 242
 	public static function delete_all_expired( $force = false ) {
243 243
 		global $wpdb;
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 	 * @since  2.0
670 670
 	 * @access private
671 671
 	 *
672
-	 * @param $group
672
+	 * @param string $group
673 673
 	 *
674 674
 	 * @return mixed
675 675
 	 */
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return static
54 54
 	 */
55 55
 	public static function get_instance() {
56
-		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give_Cache ) ) {
56
+		if ( ! isset(self::$instance) && ! (self::$instance instanceof Give_Cache)) {
57 57
 			self::$instance = new Give_Cache();
58 58
 		}
59 59
 
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function setup() {
70 70
 		// Currently enable cache only for backend.
71
-		self::$instance->is_cache = ( defined( 'GIVE_CACHE' ) ? GIVE_CACHE : give_is_setting_enabled( give_get_option( 'cache', 'enabled' ) ) ) && is_admin();
71
+		self::$instance->is_cache = (defined('GIVE_CACHE') ? GIVE_CACHE : give_is_setting_enabled(give_get_option('cache', 'enabled'))) && is_admin();
72 72
 
73 73
 		// weekly delete all expired cache.
74
-		Give_Cron::add_weekly_event( array( $this, 'delete_all_expired' ) );
74
+		Give_Cron::add_weekly_event(array($this, 'delete_all_expired'));
75 75
 
76
-		add_action( 'save_post_give_forms', array( $this, 'delete_form_related_cache' ) );
77
-		add_action( 'save_post_give_payment', array( $this, 'delete_payment_related_cache' ) );
78
-		add_action( 'give_deleted_give-donors_cache', array( $this, 'delete_donor_related_cache' ), 10, 3 );
79
-		add_action( 'give_deleted_give-donations_cache', array( $this, 'delete_donations_related_cache' ), 10, 3 );
76
+		add_action('save_post_give_forms', array($this, 'delete_form_related_cache'));
77
+		add_action('save_post_give_payment', array($this, 'delete_payment_related_cache'));
78
+		add_action('give_deleted_give-donors_cache', array($this, 'delete_donor_related_cache'), 10, 3);
79
+		add_action('give_deleted_give-donations_cache', array($this, 'delete_donations_related_cache'), 10, 3);
80 80
 
81
-		add_action( 'give_save_settings_give_settings', array( $this, 'flush_cache' ) );
81
+		add_action('give_save_settings_give_settings', array($this, 'flush_cache'));
82 82
 	}
83 83
 
84 84
 	/**
@@ -92,18 +92,18 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return string
94 94
 	 */
95
-	public static function get_key( $action, $query_args = null, $is_prefix = true ) {
95
+	public static function get_key($action, $query_args = null, $is_prefix = true) {
96 96
 		// Bailout.
97
-		if ( empty( $action ) ) {
98
-			return new WP_Error( 'give_invalid_cache_key_action', __( 'Do not pass empty action to generate cache key.', 'give' ) );
97
+		if (empty($action)) {
98
+			return new WP_Error('give_invalid_cache_key_action', __('Do not pass empty action to generate cache key.', 'give'));
99 99
 		}
100 100
 
101 101
 		// Set cache key.
102 102
 		$cache_key = $is_prefix ? "give_cache_{$action}" : $action;
103 103
 
104 104
 		// Bailout.
105
-		if ( ! empty( $query_args ) ) {
106
-			$cache_key = "{$cache_key}_" . substr( md5( serialize( $query_args ) ), 0, 15 );
105
+		if ( ! empty($query_args)) {
106
+			$cache_key = "{$cache_key}_".substr(md5(serialize($query_args)), 0, 15);
107 107
 		}
108 108
 
109 109
 		/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		 *
112 112
 		 * @since 2.0
113 113
 		 */
114
-		return apply_filters( 'give_get_cache_key', $cache_key, $action, $query_args );
114
+		return apply_filters('give_get_cache_key', $cache_key, $action, $query_args);
115 115
 	}
116 116
 
117 117
 	/**
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return mixed
127 127
 	 */
128
-	public static function get( $cache_key, $custom_key = false, $query_args = array() ) {
129
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
130
-			if ( ! $custom_key ) {
131
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
128
+	public static function get($cache_key, $custom_key = false, $query_args = array()) {
129
+		if ( ! self::is_valid_cache_key($cache_key)) {
130
+			if ( ! $custom_key) {
131
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
132 132
 			}
133 133
 
134
-			$cache_key = self::get_key( $cache_key, $query_args );
134
+			$cache_key = self::get_key($cache_key, $query_args);
135 135
 		}
136 136
 
137
-		$option = get_option( $cache_key );
137
+		$option = get_option($cache_key);
138 138
 
139 139
 		// Backward compatibility (<1.8.7).
140
-		if ( ! is_array( $option ) || empty( $option ) || ! array_key_exists( 'expiration', $option ) ) {
140
+		if ( ! is_array($option) || empty($option) || ! array_key_exists('expiration', $option)) {
141 141
 			return $option;
142 142
 		}
143 143
 
144 144
 		// Get current time.
145
-		$current_time = current_time( 'timestamp', 1 );
145
+		$current_time = current_time('timestamp', 1);
146 146
 
147
-		if ( empty( $option['expiration'] ) || ( $current_time < $option['expiration'] ) ) {
147
+		if (empty($option['expiration']) || ($current_time < $option['expiration'])) {
148 148
 			$option = $option['data'];
149 149
 		} else {
150 150
 			$option = false;
@@ -166,23 +166,23 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return mixed
168 168
 	 */
169
-	public static function set( $cache_key, $data, $expiration = null, $custom_key = false, $query_args = array() ) {
170
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
171
-			if ( ! $custom_key ) {
172
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
169
+	public static function set($cache_key, $data, $expiration = null, $custom_key = false, $query_args = array()) {
170
+		if ( ! self::is_valid_cache_key($cache_key)) {
171
+			if ( ! $custom_key) {
172
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
173 173
 			}
174 174
 
175
-			$cache_key = self::get_key( $cache_key, $query_args );
175
+			$cache_key = self::get_key($cache_key, $query_args);
176 176
 		}
177 177
 
178 178
 		$option_value = array(
179 179
 			'data'       => $data,
180
-			'expiration' => ! is_null( $expiration )
181
-				? ( $expiration + current_time( 'timestamp', 1 ) )
180
+			'expiration' => ! is_null($expiration)
181
+				? ($expiration + current_time('timestamp', 1))
182 182
 				: null,
183 183
 		);
184 184
 
185
-		$result = update_option( $cache_key, $option_value, 'no' );
185
+		$result = update_option($cache_key, $option_value, 'no');
186 186
 
187 187
 		return $result;
188 188
 	}
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return bool|WP_Error
200 200
 	 */
201
-	public static function delete( $cache_keys ) {
201
+	public static function delete($cache_keys) {
202 202
 		$result       = true;
203 203
 		$invalid_keys = array();
204 204
 
205
-		if ( ! empty( $cache_keys ) ) {
206
-			$cache_keys = is_array( $cache_keys ) ? $cache_keys : array( $cache_keys );
205
+		if ( ! empty($cache_keys)) {
206
+			$cache_keys = is_array($cache_keys) ? $cache_keys : array($cache_keys);
207 207
 
208
-			foreach ( $cache_keys as $cache_key ) {
209
-				if ( ! self::is_valid_cache_key( $cache_key ) ) {
208
+			foreach ($cache_keys as $cache_key) {
209
+				if ( ! self::is_valid_cache_key($cache_key)) {
210 210
 					$invalid_keys[] = $cache_key;
211 211
 					$result         = false;
212 212
 				}
213 213
 
214
-				delete_option( $cache_key );
214
+				delete_option($cache_key);
215 215
 			}
216 216
 		}
217 217
 
218
-		if ( ! $result ) {
218
+		if ( ! $result) {
219 219
 			$result = new WP_Error(
220 220
 				'give_invalid_cache_key',
221
-				__( 'Cache key format should be give_cache_*', 'give' ),
221
+				__('Cache key format should be give_cache_*', 'give'),
222 222
 				$invalid_keys
223 223
 			);
224 224
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return bool
241 241
 	 */
242
-	public static function delete_all_expired( $force = false ) {
242
+	public static function delete_all_expired($force = false) {
243 243
 		global $wpdb;
244 244
 		$options = $wpdb->get_results(
245 245
 			$wpdb->prepare(
@@ -253,30 +253,30 @@  discard block
 block discarded – undo
253 253
 		);
254 254
 
255 255
 		// Bailout.
256
-		if ( empty( $options ) ) {
256
+		if (empty($options)) {
257 257
 			return false;
258 258
 		}
259 259
 
260
-		$current_time = current_time( 'timestamp', 1 );
260
+		$current_time = current_time('timestamp', 1);
261 261
 
262 262
 		// Delete log cache.
263
-		foreach ( $options as $option ) {
264
-			$option['option_value'] = maybe_unserialize( $option['option_value'] );
263
+		foreach ($options as $option) {
264
+			$option['option_value'] = maybe_unserialize($option['option_value']);
265 265
 
266 266
 			if (
267 267
 				(
268
-					! self::is_valid_cache_key( $option['option_name'] )
269
-					|| ! is_array( $option['option_value'] ) // Backward compatibility (<1.8.7).
270
-					|| ! array_key_exists( 'expiration', $option['option_value'] ) // Backward compatibility (<1.8.7).
271
-					|| empty( $option['option_value']['expiration'] )
272
-					|| ( $current_time < $option['option_value']['expiration'] )
268
+					! self::is_valid_cache_key($option['option_name'])
269
+					|| ! is_array($option['option_value']) // Backward compatibility (<1.8.7).
270
+					|| ! array_key_exists('expiration', $option['option_value']) // Backward compatibility (<1.8.7).
271
+					|| empty($option['option_value']['expiration'])
272
+					|| ($current_time < $option['option_value']['expiration'])
273 273
 				)
274 274
 				&& ! $force
275 275
 			) {
276 276
 				continue;
277 277
 			}
278 278
 
279
-			self::delete( $option['option_name'] );
279
+			self::delete($option['option_name']);
280 280
 		}
281 281
 	}
282 282
 
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return array
296 296
 	 */
297
-	public static function get_options_like( $option_name, $fields = false ) {
297
+	public static function get_options_like($option_name, $fields = false) {
298 298
 		global $wpdb;
299 299
 
300 300
 		$field_names = $fields ? 'option_name, option_value' : 'option_name';
301 301
 
302
-		if ( $fields ) {
302
+		if ($fields) {
303 303
 			$options = $wpdb->get_results(
304 304
 				$wpdb->prepare(
305 305
 					"SELECT {$field_names }
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 			);
324 324
 		}
325 325
 
326
-		if ( ! empty( $options ) && $fields ) {
327
-			foreach ( $options as $index => $option ) {
328
-				$option['option_value'] = maybe_unserialize( $option['option_value'] );
329
-				$options[ $index ]      = $option;
326
+		if ( ! empty($options) && $fields) {
327
+			foreach ($options as $index => $option) {
328
+				$option['option_value'] = maybe_unserialize($option['option_value']);
329
+				$options[$index]      = $option;
330 330
 			}
331 331
 		}
332 332
 
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
 	 * @return bool
345 345
 	 */
346
-	public static function is_valid_cache_key( $cache_key ) {
347
-		$is_valid = ( false !== strpos( $cache_key, 'give_cache_' ) );
346
+	public static function is_valid_cache_key($cache_key) {
347
+		$is_valid = (false !== strpos($cache_key, 'give_cache_'));
348 348
 
349 349
 
350 350
 		/**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		 *
353 353
 		 * @since 2.0
354 354
 		 */
355
-		return apply_filters( 'give_is_valid_cache_key', $is_valid, $cache_key );
355
+		return apply_filters('give_is_valid_cache_key', $is_valid, $cache_key);
356 356
 	}
357 357
 
358 358
 
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @return mixed
369 369
 	 */
370
-	public static function get_group( $id, $group = '' ) {
370
+	public static function get_group($id, $group = '') {
371 371
 		$cached_data = null;
372 372
 
373 373
 		// Bailout.
374
-		if ( self::$instance->is_cache && ! empty( $id ) ) {
375
-			$group = self::$instance->filter_group_name( $group );
374
+		if (self::$instance->is_cache && ! empty($id)) {
375
+			$group = self::$instance->filter_group_name($group);
376 376
 
377
-			$cached_data = wp_cache_get( $id, $group );
377
+			$cached_data = wp_cache_get($id, $group);
378 378
 			$cached_data = false !== $cached_data ? $cached_data : null;
379 379
 		}
380 380
 
@@ -394,17 +394,17 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return bool
396 396
 	 */
397
-	public static function set_group( $id, $data, $group = '', $expire = 0 ) {
397
+	public static function set_group($id, $data, $group = '', $expire = 0) {
398 398
 		$status = false;
399 399
 
400 400
 		// Bailout.
401
-		if ( ! self::$instance->is_cache || empty( $id ) ) {
401
+		if ( ! self::$instance->is_cache || empty($id)) {
402 402
 			return $status;
403 403
 		}
404 404
 
405
-		$group = self::$instance->filter_group_name( $group );
405
+		$group = self::$instance->filter_group_name($group);
406 406
 
407
-		$status = wp_cache_set( $id, $data, $group, $expire );
407
+		$status = wp_cache_set($id, $data, $group, $expire);
408 408
 
409 409
 		return $status;
410 410
 	}
@@ -420,15 +420,15 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @return bool
422 422
 	 */
423
-	public static function set_db_query( $id, $data ) {
423
+	public static function set_db_query($id, $data) {
424 424
 		$status = false;
425 425
 
426 426
 		// Bailout.
427
-		if ( ! self::$instance->is_cache || empty( $id ) ) {
427
+		if ( ! self::$instance->is_cache || empty($id)) {
428 428
 			return $status;
429 429
 		}
430 430
 
431
-		return self::set_group( $id, $data, 'give-db-queries', 0 );
431
+		return self::set_group($id, $data, 'give-db-queries', 0);
432 432
 	}
433 433
 
434 434
 	/**
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @return mixed
443 443
 	 */
444
-	public static function get_db_query( $id ) {
445
-		return self::get_group( $id, 'give-db-queries' );
444
+	public static function get_db_query($id) {
445
+		return self::get_group($id, 'give-db-queries');
446 446
 	}
447 447
 
448 448
 	/**
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return bool
459 459
 	 */
460
-	public static function delete_group( $ids, $group = '', $expire = 0 ) {
460
+	public static function delete_group($ids, $group = '', $expire = 0) {
461 461
 		$status = false;
462 462
 
463 463
 		// Bailout.
464
-		if ( ! self::$instance->is_cache || empty( $ids ) ) {
464
+		if ( ! self::$instance->is_cache || empty($ids)) {
465 465
 			return $status;
466 466
 		}
467 467
 
468
-		$group = self::$instance->filter_group_name( $group );
468
+		$group = self::$instance->filter_group_name($group);
469 469
 
470 470
 		// Delete single or multiple cache items from cache.
471
-		if ( ! is_array( $ids ) ) {
472
-			$status = wp_cache_delete( $ids, $group, $expire );
473
-			self::$instance->get_incrementer( true );
471
+		if ( ! is_array($ids)) {
472
+			$status = wp_cache_delete($ids, $group, $expire);
473
+			self::$instance->get_incrementer(true);
474 474
 
475 475
 			/**
476 476
 			 * Fire action when cache deleted for specific id.
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 			 * @param string $group
482 482
 			 * @param int    $expire
483 483
 			 */
484
-			do_action( "give_deleted_{$group}_cache", $ids, $group, $expire, $status );
484
+			do_action("give_deleted_{$group}_cache", $ids, $group, $expire, $status);
485 485
 
486 486
 		} else {
487
-			foreach ( $ids as $id ) {
488
-				$status = wp_cache_delete( $id, $group, $expire );
489
-				self::$instance->get_incrementer( true );
487
+			foreach ($ids as $id) {
488
+				$status = wp_cache_delete($id, $group, $expire);
489
+				self::$instance->get_incrementer(true);
490 490
 
491 491
 				/**
492 492
 				 * Fire action when cache deleted for specific id .
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 				 * @param string $group
498 498
 				 * @param int    $expire
499 499
 				 */
500
-				do_action( "give_deleted_{$group}_cache", $id, $group, $expire, $status );
500
+				do_action("give_deleted_{$group}_cache", $id, $group, $expire, $status);
501 501
 			}
502 502
 		}
503 503
 
@@ -514,30 +514,30 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param int $form_id
516 516
 	 */
517
-	public function delete_form_related_cache( $form_id ) {
517
+	public function delete_form_related_cache($form_id) {
518 518
 		// If this is just a revision, don't send the email.
519
-		if ( wp_is_post_revision( $form_id ) ) {
519
+		if (wp_is_post_revision($form_id)) {
520 520
 			return;
521 521
 		}
522 522
 
523 523
 		$donation_query = new Give_Payments_Query(
524 524
 			array(
525
-				'number'     => - 1,
525
+				'number'     => -1,
526 526
 				'give_forms' => $form_id,
527 527
 			)
528 528
 		);
529 529
 
530 530
 		$donations = $donation_query->get_payments();
531 531
 
532
-		if ( ! empty( $donations ) ) {
532
+		if ( ! empty($donations)) {
533 533
 			/* @var Give_Payment $donation */
534
-			foreach ( $donations as $donation ) {
535
-				wp_cache_delete( $donation->ID, $this->filter_group_name( 'give-donations' ) );
536
-				wp_cache_delete( $donation->donor_id, $this->filter_group_name( 'give-donors' ) );
534
+			foreach ($donations as $donation) {
535
+				wp_cache_delete($donation->ID, $this->filter_group_name('give-donations'));
536
+				wp_cache_delete($donation->donor_id, $this->filter_group_name('give-donors'));
537 537
 			}
538 538
 		}
539 539
 
540
-		self::$instance->get_incrementer( true );
540
+		self::$instance->get_incrementer(true);
541 541
 	}
542 542
 
543 543
 	/**
@@ -549,22 +549,22 @@  discard block
 block discarded – undo
549 549
 	 *
550 550
 	 * @param int $donation_id
551 551
 	 */
552
-	public function delete_payment_related_cache( $donation_id ) {
552
+	public function delete_payment_related_cache($donation_id) {
553 553
 		// If this is just a revision, don't send the email.
554
-		if ( wp_is_post_revision( $donation_id ) ) {
554
+		if (wp_is_post_revision($donation_id)) {
555 555
 			return;
556 556
 		}
557 557
 
558 558
 		/* @var Give_Payment $donation */
559
-		$donation = new Give_Payment( $donation_id );
559
+		$donation = new Give_Payment($donation_id);
560 560
 
561
-		if ( $donation && $donation->donor_id ) {
562
-			wp_cache_delete( $donation->donor_id, $this->filter_group_name( 'give-donors' ) );
561
+		if ($donation && $donation->donor_id) {
562
+			wp_cache_delete($donation->donor_id, $this->filter_group_name('give-donors'));
563 563
 		}
564 564
 
565
-		wp_cache_delete( $donation->ID, $this->filter_group_name( 'give-donations' ) );
565
+		wp_cache_delete($donation->ID, $this->filter_group_name('give-donations'));
566 566
 
567
-		self::$instance->get_incrementer( true );
567
+		self::$instance->get_incrementer(true);
568 568
 	}
569 569
 
570 570
 	/**
@@ -578,17 +578,17 @@  discard block
 block discarded – undo
578 578
 	 * @param string $group
579 579
 	 * @param int    $expire
580 580
 	 */
581
-	public function delete_donor_related_cache( $id, $group, $expire ) {
582
-		$donor        = new Give_Donor( $id );
583
-		$donation_ids = array_map( 'trim', (array) explode( ',', trim( $donor->payment_ids ) ) );
581
+	public function delete_donor_related_cache($id, $group, $expire) {
582
+		$donor        = new Give_Donor($id);
583
+		$donation_ids = array_map('trim', (array) explode(',', trim($donor->payment_ids)));
584 584
 
585
-		if ( ! empty( $donation_ids ) ) {
586
-			foreach ( $donation_ids as $donation ) {
587
-				wp_cache_delete( $donation, $this->filter_group_name( 'give-donations' ) );
585
+		if ( ! empty($donation_ids)) {
586
+			foreach ($donation_ids as $donation) {
587
+				wp_cache_delete($donation, $this->filter_group_name('give-donations'));
588 588
 			}
589 589
 		}
590 590
 
591
-		self::$instance->get_incrementer( true );
591
+		self::$instance->get_incrementer(true);
592 592
 	}
593 593
 
594 594
 	/**
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 	 * @param string $group
603 603
 	 * @param int    $expire
604 604
 	 */
605
-	public function delete_donations_related_cache( $id, $group, $expire ) {
605
+	public function delete_donations_related_cache($id, $group, $expire) {
606 606
 		/* @var Give_Payment $donation */
607
-		$donation = new Give_Payment( $id );
607
+		$donation = new Give_Payment($id);
608 608
 
609
-		if ( $donation && $donation->donor_id ) {
610
-			wp_cache_delete( $donation->donor_id, $this->filter_group_name( 'give-donors' ) );
609
+		if ($donation && $donation->donor_id) {
610
+			wp_cache_delete($donation->donor_id, $this->filter_group_name('give-donors'));
611 611
 		}
612 612
 
613
-		self::$instance->get_incrementer( true );
613
+		self::$instance->get_incrementer(true);
614 614
 	}
615 615
 
616 616
 
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 	 *
629 629
 	 * @return string
630 630
 	 */
631
-	private function get_incrementer( $refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries' ) {
632
-		$incrementer_value = wp_cache_get( $incrementer_key );
631
+	private function get_incrementer($refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries') {
632
+		$incrementer_value = wp_cache_get($incrementer_key);
633 633
 
634
-		if ( false === $incrementer_value || true === $refresh ) {
635
-			$incrementer_value = microtime( true );
636
-			wp_cache_set( $incrementer_key, $incrementer_value );
634
+		if (false === $incrementer_value || true === $refresh) {
635
+			$incrementer_value = microtime(true);
636
+			wp_cache_set($incrementer_key, $incrementer_value);
637 637
 		}
638 638
 
639 639
 		return $incrementer_value;
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
 	public function flush_cache() {
651 651
 		if (
652 652
 			Give_Admin_Settings::is_saving_settings() &&
653
-			isset( $_POST['cache'] ) &&
654
-			give_is_setting_enabled( give_clean( $_POST['cache'] ) )
653
+			isset($_POST['cache']) &&
654
+			give_is_setting_enabled(give_clean($_POST['cache']))
655 655
 		) {
656
-			$this->get_incrementer( true );
657
-			$this->get_incrementer( true, 'give-cache-incrementer' );
656
+			$this->get_incrementer(true);
657
+			$this->get_incrementer(true, 'give-cache-incrementer');
658 658
 		}
659 659
 	}
660 660
 
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	 *
670 670
 	 * @return mixed
671 671
 	 */
672
-	private function filter_group_name( $group ) {
673
-		if ( ! empty( $group ) ) {
674
-			$incrementer = self::$instance->get_incrementer( false, 'give-cache-incrementer' );
672
+	private function filter_group_name($group) {
673
+		if ( ! empty($group)) {
674
+			$incrementer = self::$instance->get_incrementer(false, 'give-cache-incrementer');
675 675
 
676
-			if ( 'give-db-queries' === $group ) {
676
+			if ('give-db-queries' === $group) {
677 677
 				$incrementer = self::$instance->get_incrementer();
678 678
 			}
679 679
 
Please login to merge, or discard this patch.
includes/class-give-db-donors.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * NOTE: This should not be called directly as it does not make necessary changes to
208 208
 	 * the payment meta and logs. Use give_donor_delete() instead.
209 209
 	 *
210
-	 * @param  bool|string|int $_id_or_email ID or Email of Donor.
210
+	 * @param  integer $_id_or_email ID or Email of Donor.
211 211
 	 *
212 212
 	 * @since  1.0
213 213
 	 * @access public
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @access public
408 408
 	 *
409 409
 	 * @param  string $field ID or email. Default is 'id'.
410
-	 * @param  mixed  $value The Customer ID or email to search. Default is 0.
410
+	 * @param  integer  $value The Customer ID or email to search. Default is 0.
411 411
 	 *
412 412
 	 * @return mixed         Upon success, an object of the donor. Upon failure, NULL
413 413
 	 */
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 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
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$this->bc_200_params();
43 43
 
44 44
 		// Set hooks and register table only if instance loading first time.
45
-		if ( ! ( Give()->donors instanceof Give_DB_Donors ) ) {
45
+		if ( ! (Give()->donors instanceof Give_DB_Donors)) {
46 46
 			// Install table.
47 47
 			$this->register_table();
48 48
 		}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			'purchase_value'  => 0.00,
92 92
 			'purchase_count'  => 0,
93 93
 			'notes'           => '',
94
-			'date_created'    => date( 'Y-m-d H:i:s' ),
94
+			'date_created'    => date('Y-m-d H:i:s'),
95 95
 			'token'           => '',
96 96
 			'verify_key'      => '',
97 97
 			'verify_throttle' => '',
@@ -108,40 +108,40 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return int|bool
110 110
 	 */
111
-	public function add( $data = array() ) {
111
+	public function add($data = array()) {
112 112
 
113 113
 		$defaults = array(
114 114
 			'payment_ids' => '',
115 115
 		);
116 116
 
117
-		$args = wp_parse_args( $data, $defaults );
117
+		$args = wp_parse_args($data, $defaults);
118 118
 
119
-		if ( empty( $args['email'] ) ) {
119
+		if (empty($args['email'])) {
120 120
 			return false;
121 121
 		}
122 122
 
123
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
124
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
123
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
124
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
125 125
 		}
126 126
 
127
-		$donor = $this->get_donor_by( 'email', $args['email'] );
127
+		$donor = $this->get_donor_by('email', $args['email']);
128 128
 
129 129
 		// update an existing donor.
130
-		if ( $donor ) {
130
+		if ($donor) {
131 131
 
132 132
 			// Update the payment IDs attached to the donor
133
-			if ( ! empty( $args['payment_ids'] ) ) {
133
+			if ( ! empty($args['payment_ids'])) {
134 134
 
135
-				if ( empty( $donor->payment_ids ) ) {
135
+				if (empty($donor->payment_ids)) {
136 136
 
137 137
 					$donor->payment_ids = $args['payment_ids'];
138 138
 
139 139
 				} else {
140 140
 
141
-					$existing_ids       = array_map( 'absint', explode( ',', $donor->payment_ids ) );
142
-					$payment_ids        = array_map( 'absint', explode( ',', $args['payment_ids'] ) );
143
-					$payment_ids        = array_merge( $payment_ids, $existing_ids );
144
-					$donor->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
141
+					$existing_ids       = array_map('absint', explode(',', $donor->payment_ids));
142
+					$payment_ids        = array_map('absint', explode(',', $args['payment_ids']));
143
+					$payment_ids        = array_merge($payment_ids, $existing_ids);
144
+					$donor->payment_ids = implode(',', array_unique(array_values($payment_ids)));
145 145
 
146 146
 				}
147 147
 
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 
150 150
 			}
151 151
 
152
-			$this->update( $donor->id, $args );
152
+			$this->update($donor->id, $args);
153 153
 
154 154
 			return $donor->id;
155 155
 
156 156
 		} else {
157 157
 
158
-			return $this->insert( $args, 'donor' );
158
+			return $this->insert($args, 'donor');
159 159
 
160 160
 		}
161 161
 
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return bool
174 174
 	 */
175
-	public function update( $row_id, $data = array(), $where = '' ) {
175
+	public function update($row_id, $data = array(), $where = '') {
176 176
 
177
-		$status = parent::update( $row_id, $data, $where );
177
+		$status = parent::update($row_id, $data, $where);
178 178
 
179
-		if ( $status ) {
180
-			Give_Cache::delete_group( $row_id, 'give-donors' );
179
+		if ($status) {
180
+			Give_Cache::delete_group($row_id, 'give-donors');
181 181
 		}
182 182
 
183 183
 		return $status;
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return int
193 193
 	 */
194
-	public function insert( $data, $type = '' ) {
195
-		$donor_id = parent::insert( $data, $type );
194
+	public function insert($data, $type = '') {
195
+		$donor_id = parent::insert($data, $type);
196 196
 
197
-		if ( $donor_id ) {
198
-			Give_Cache::delete_group( $donor_id, 'give-donors' );
197
+		if ($donor_id) {
198
+			Give_Cache::delete_group($donor_id, 'give-donors');
199 199
 		}
200 200
 
201 201
 		return $donor_id;
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return bool|int
216 216
 	 */
217
-	public function delete( $_id_or_email = false ) {
217
+	public function delete($_id_or_email = false) {
218 218
 
219
-		if ( empty( $_id_or_email ) ) {
219
+		if (empty($_id_or_email)) {
220 220
 			return false;
221 221
 		}
222 222
 
223
-		$column = is_email( $_id_or_email ) ? 'email' : 'id';
224
-		$donor  = $this->get_donor_by( $column, $_id_or_email );
223
+		$column = is_email($_id_or_email) ? 'email' : 'id';
224
+		$donor  = $this->get_donor_by($column, $_id_or_email);
225 225
 
226
-		if ( $donor->id > 0 ) {
226
+		if ($donor->id > 0) {
227 227
 
228 228
 			global $wpdb;
229 229
 
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 			 *
233 233
 			 * @since 1.8.14
234 234
 			 */
235
-			Give()->donor_meta->delete_all_meta( $donor->id );
235
+			Give()->donor_meta->delete_all_meta($donor->id);
236 236
 
237 237
 			// Cache already deleted in delete_all_meta fn.
238 238
 
239
-			return $wpdb->delete( $this->table_name, array( 'id' => $donor->id ), array( '%d' ) );
239
+			return $wpdb->delete($this->table_name, array('id' => $donor->id), array('%d'));
240 240
 
241 241
 		} else {
242 242
 			return false;
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return bool|int
259 259
 	 */
260
-	public function delete_by_user_id( $user_id = false ) {
260
+	public function delete_by_user_id($user_id = false) {
261 261
 		global $wpdb;
262 262
 
263
-		if ( empty( $user_id ) ) {
263
+		if (empty($user_id)) {
264 264
 			return false;
265 265
 		}
266 266
 
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * @since 1.8.14
271 271
 		 */
272
-		$donor = new Give_Donor( $user_id, true );
273
-		if ( ! empty( $donor->id ) ) {
274
-			Give()->donor_meta->delete_all_meta( $donor->id );
272
+		$donor = new Give_Donor($user_id, true);
273
+		if ( ! empty($donor->id)) {
274
+			Give()->donor_meta->delete_all_meta($donor->id);
275 275
 		}
276 276
 
277 277
 		// Cache is already deleted in delete_all_meta fn.
278 278
 
279
-		return $wpdb->delete( $this->table_name, array( 'user_id' => $user_id ), array( '%d' ) );
279
+		return $wpdb->delete($this->table_name, array('user_id' => $user_id), array('%d'));
280 280
 	}
281 281
 
282 282
 	/**
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return bool          True is exists, false otherwise.
292 292
 	 */
293
-	public function exists( $value = '', $field = 'email' ) {
293
+	public function exists($value = '', $field = 'email') {
294 294
 
295 295
 		$columns = $this->get_columns();
296
-		if ( ! array_key_exists( $field, $columns ) ) {
296
+		if ( ! array_key_exists($field, $columns)) {
297 297
 			return false;
298 298
 		}
299 299
 
300
-		return (bool) $this->get_column_by( 'id', $field, $value );
300
+		return (bool) $this->get_column_by('id', $field, $value);
301 301
 
302 302
 	}
303 303
 
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return bool
314 314
 	 */
315
-	public function attach_payment( $donor_id = 0, $payment_id = 0 ) {
315
+	public function attach_payment($donor_id = 0, $payment_id = 0) {
316 316
 
317
-		$donor = new Give_Donor( $donor_id );
317
+		$donor = new Give_Donor($donor_id);
318 318
 
319
-		if ( empty( $donor->id ) ) {
319
+		if (empty($donor->id)) {
320 320
 			return false;
321 321
 		}
322 322
 
323 323
 		// Attach the payment, but don't increment stats, as this function previously did not
324
-		return $donor->attach_payment( $payment_id, false );
324
+		return $donor->attach_payment($payment_id, false);
325 325
 
326 326
 	}
327 327
 
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @return bool
338 338
 	 */
339
-	public function remove_payment( $donor_id = 0, $payment_id = 0 ) {
339
+	public function remove_payment($donor_id = 0, $payment_id = 0) {
340 340
 
341
-		$donor = new Give_Donor( $donor_id );
341
+		$donor = new Give_Donor($donor_id);
342 342
 
343
-		if ( ! $donor ) {
343
+		if ( ! $donor) {
344 344
 			return false;
345 345
 		}
346 346
 
347 347
 		// Remove the payment, but don't decrease stats, as this function previously did not
348
-		return $donor->remove_payment( $payment_id, false );
348
+		return $donor->remove_payment($payment_id, false);
349 349
 
350 350
 	}
351 351
 
@@ -359,18 +359,18 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @return bool
361 361
 	 */
362
-	public function increment_stats( $donor_id = 0, $amount = 0.00 ) {
362
+	public function increment_stats($donor_id = 0, $amount = 0.00) {
363 363
 
364
-		$donor = new Give_Donor( $donor_id );
364
+		$donor = new Give_Donor($donor_id);
365 365
 
366
-		if ( empty( $donor->id ) ) {
366
+		if (empty($donor->id)) {
367 367
 			return false;
368 368
 		}
369 369
 
370 370
 		$increased_count = $donor->increase_purchase_count();
371
-		$increased_value = $donor->increase_value( $amount );
371
+		$increased_value = $donor->increase_value($amount);
372 372
 
373
-		return ( $increased_count && $increased_value ) ? true : false;
373
+		return ($increased_count && $increased_value) ? true : false;
374 374
 
375 375
 	}
376 376
 
@@ -385,18 +385,18 @@  discard block
 block discarded – undo
385 385
 	 *
386 386
 	 * @return bool
387 387
 	 */
388
-	public function decrement_stats( $donor_id = 0, $amount = 0.00 ) {
388
+	public function decrement_stats($donor_id = 0, $amount = 0.00) {
389 389
 
390
-		$donor = new Give_Donor( $donor_id );
390
+		$donor = new Give_Donor($donor_id);
391 391
 
392
-		if ( ! $donor ) {
392
+		if ( ! $donor) {
393 393
 			return false;
394 394
 		}
395 395
 
396 396
 		$decreased_count = $donor->decrease_donation_count();
397
-		$decreased_value = $donor->decrease_value( $amount );
397
+		$decreased_value = $donor->decrease_value($amount);
398 398
 
399
-		return ( $decreased_count && $decreased_value ) ? true : false;
399
+		return ($decreased_count && $decreased_value) ? true : false;
400 400
 
401 401
 	}
402 402
 
@@ -411,44 +411,44 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @return mixed         Upon success, an object of the donor. Upon failure, NULL
413 413
 	 */
414
-	public function get_donor_by( $field = 'id', $value = 0 ) {
415
-		$value = sanitize_text_field( $value );
414
+	public function get_donor_by($field = 'id', $value = 0) {
415
+		$value = sanitize_text_field($value);
416 416
 
417 417
 		// Bailout.
418
-		if ( empty( $field ) || empty( $value ) ) {
418
+		if (empty($field) || empty($value)) {
419 419
 			return null;
420 420
 		}
421 421
 
422 422
 		// Verify values.
423
-		if ( 'id' === $field || 'user_id' === $field ) {
423
+		if ('id' === $field || 'user_id' === $field) {
424 424
 			// Make sure the value is numeric to avoid casting objects, for example,
425 425
 			// to int 1.
426
-			if ( ! is_numeric( $value ) ) {
426
+			if ( ! is_numeric($value)) {
427 427
 				return false;
428 428
 			}
429 429
 
430
-			$value = absint( $value );
430
+			$value = absint($value);
431 431
 
432
-			if ( $value < 1 ) {
432
+			if ($value < 1) {
433 433
 				return false;
434 434
 			}
435 435
 
436
-		} elseif ( 'email' === $field ) {
436
+		} elseif ('email' === $field) {
437 437
 
438
-			if ( ! is_email( $value ) ) {
438
+			if ( ! is_email($value)) {
439 439
 				return false;
440 440
 			}
441 441
 
442
-			$value = trim( $value );
442
+			$value = trim($value);
443 443
 		}
444 444
 
445 445
 		// Bailout
446
-		if ( ! $value ) {
446
+		if ( ! $value) {
447 447
 			return false;
448 448
 		}
449 449
 
450 450
 		// Set query params.
451
-		switch ( $field ) {
451
+		switch ($field) {
452 452
 			case 'id':
453 453
 				$args['donor'] = $value;
454 454
 				break;
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 
465 465
 		// Get donors.
466
-		$donor = new Give_Donors_Query( $args );
466
+		$donor = new Give_Donors_Query($args);
467 467
 
468
-		if ( ! $donor = $donor->get_donors() ) {
468
+		if ( ! $donor = $donor->get_donors()) {
469 469
 			// Look for donor from an additional email.
470 470
 			$args = array(
471 471
 				'meta_query' => array(
@@ -476,15 +476,15 @@  discard block
 block discarded – undo
476 476
 				),
477 477
 			);
478 478
 
479
-			$donor = new Give_Donors_Query( $args );
479
+			$donor = new Give_Donors_Query($args);
480 480
 			$donor = $donor->get_donors();
481 481
 
482
-			if ( empty( $donor ) ) {
482
+			if (empty($donor)) {
483 483
 				return false;
484 484
 			}
485 485
 		}
486 486
 
487
-		return current( $donor );
487
+		return current($donor);
488 488
 	}
489 489
 
490 490
 	/**
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 	 *
498 498
 	 * @return array|object|null Donors array or object. Null if not found.
499 499
 	 */
500
-	public function get_donors( $args = array() ) {
501
-		$this->bc_1814_params( $args );
500
+	public function get_donors($args = array()) {
501
+		$this->bc_1814_params($args);
502 502
 
503
-		$donors = new Give_Donors_Query( $args );
503
+		$donors = new Give_Donors_Query($args);
504 504
 
505 505
 		return $donors->get_donors();
506 506
 
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 	 *
518 518
 	 * @return int         Total number of donors.
519 519
 	 */
520
-	public function count( $args = array() ) {
521
-		$this->bc_1814_params( $args );
520
+	public function count($args = array()) {
521
+		$this->bc_1814_params($args);
522 522
 		$args['count'] = true;
523 523
 
524
-		$cache_key = md5( 'give_donors_count' . serialize( $args ) );
525
-		$count     = Give_Cache::get_group( $cache_key, 'donors' );
524
+		$cache_key = md5('give_donors_count'.serialize($args));
525
+		$count     = Give_Cache::get_group($cache_key, 'donors');
526 526
 
527
-		if ( is_null( $count ) ) {
528
-			$donors = new Give_Donors_Query( $args );
527
+		if (is_null($count)) {
528
+			$donors = new Give_Donors_Query($args);
529 529
 			$count  = $donors->get_donors();
530 530
 
531
-			Give_Cache::set_group( $cache_key, $count, 'donors', 3600 );
531
+			Give_Cache::set_group($cache_key, $count, 'donors', 3600);
532 532
 		}
533 533
 
534
-		return absint( $count );
534
+		return absint($count);
535 535
 
536 536
 	}
537 537
 
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
 	 */
546 546
 	public function create_table() {
547 547
 
548
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
548
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
549 549
 
550
-		$sql = "CREATE TABLE " . $this->table_name . " (
550
+		$sql = "CREATE TABLE ".$this->table_name." (
551 551
 		id bigint(20) NOT NULL AUTO_INCREMENT,
552 552
 		user_id bigint(20) NOT NULL,
553 553
 		email varchar(50) NOT NULL,
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
 		KEY user (user_id)
566 566
 		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
567 567
 
568
-		dbDelta( $sql );
568
+		dbDelta($sql);
569 569
 
570
-		update_option( $this->table_name . '_db_version', $this->version );
570
+		update_option($this->table_name.'_db_version', $this->version);
571 571
 	}
572 572
 
573 573
 	/**
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 		global $wpdb;
583 583
 
584 584
 		if (
585
-			! give_has_upgrade_completed( 'v20_rename_donor_tables' ) &&
586
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) )
585
+			! give_has_upgrade_completed('v20_rename_donor_tables') &&
586
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))
587 587
 		) {
588 588
 			$wpdb->donors = $this->table_name = "{$wpdb->prefix}give_customers";
589 589
 		}
@@ -597,41 +597,41 @@  discard block
 block discarded – undo
597 597
 	 *
598 598
 	 * @param $args
599 599
 	 */
600
-	private function bc_1814_params( &$args ) {
600
+	private function bc_1814_params(&$args) {
601 601
 		// Backward compatibility: user_id
602
-		if ( ! empty( $args['user_id'] ) ) {
602
+		if ( ! empty($args['user_id'])) {
603 603
 			$args['user'] = $args['user_id'];
604 604
 		}
605 605
 
606 606
 		// Backward compatibility: id
607
-		if ( ! empty( $args['id'] ) ) {
607
+		if ( ! empty($args['id'])) {
608 608
 			$args['donor'] = $args['id'];
609 609
 		}
610 610
 
611 611
 		// Backward compatibility: name
612
-		if ( ! empty( $args['name'] ) ) {
612
+		if ( ! empty($args['name'])) {
613 613
 			$args['s'] = "name:{$args['name']}";
614 614
 		}
615 615
 
616 616
 		// Backward compatibility: date
617 617
 		// Donors created for a specific date or in a date range.
618
-		if ( ! empty( $args['date'] ) ) {
618
+		if ( ! empty($args['date'])) {
619 619
 
620
-			if ( is_array( $args['date'] ) ) {
620
+			if (is_array($args['date'])) {
621 621
 
622
-				if ( ! empty( $args['date']['start'] ) ) {
623
-					$args['date_query']['after'] = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
622
+				if ( ! empty($args['date']['start'])) {
623
+					$args['date_query']['after'] = date('Y-m-d H:i:s', strtotime($args['date']['start']));
624 624
 				}
625 625
 
626
-				if ( ! empty( $args['date']['end'] ) ) {
627
-					$args['date_query']['before'] = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
626
+				if ( ! empty($args['date']['end'])) {
627
+					$args['date_query']['before'] = date('Y-m-d H:i:s', strtotime($args['date']['end']));
628 628
 				}
629 629
 
630 630
 			} else {
631 631
 
632
-				$args['date_query']['year']  = date( 'Y', strtotime( $args['date'] ) );
633
-				$args['date_query']['month'] = date( 'm', strtotime( $args['date'] ) );
634
-				$args['date_query']['day']   = date( 'd', strtotime( $args['date'] ) );
632
+				$args['date_query']['year']  = date('Y', strtotime($args['date']));
633
+				$args['date_query']['month'] = date('m', strtotime($args['date']));
634
+				$args['date_query']['day']   = date('d', strtotime($args['date']));
635 635
 			}
636 636
 		}
637 637
 	}
Please login to merge, or discard this patch.
includes/class-give-logging.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -512,7 +512,7 @@
 block discarded – undo
512 512
 	 * @since  1.7
513 513
 	 * @access public
514 514
 	 *
515
-	 * @return bool
515
+	 * @return false|null
516 516
 	 */
517 517
 	public function delete_cache() {
518 518
 		// Add log related keys to delete.
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		 * Setup properties
54 54
 		 */
55 55
 
56
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs.php';
57
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs-meta.php';
56
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs.php';
57
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs-meta.php';
58 58
 		$this->log_db     = new Give_DB_Logs();
59 59
 		$this->logmeta_db = new Give_DB_Log_Meta();
60 60
 
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 		 * Setup hooks.
63 63
 		 */
64 64
 
65
-		add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) );
66
-		add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) );
67
-		add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) );
68
-		add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) );
69
-		add_action( 'update_log_metadata', array( $this, 'bc_200_set_payment_as_log_parent' ), 10, 4 );
65
+		add_action('save_post_give_payment', array($this, 'background_process_delete_cache'));
66
+		add_action('save_post_give_forms', array($this, 'background_process_delete_cache'));
67
+		add_action('save_post_give_log', array($this, 'background_process_delete_cache'));
68
+		add_action('give_delete_log_cache', array($this, 'delete_cache'));
69
+		add_action('update_log_metadata', array($this, 'bc_200_set_payment_as_log_parent'), 10, 4);
70 70
 
71 71
 		// Backward compatibility.
72
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
72
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
73 73
 			// Create the log post type
74
-			add_action( 'init', array( $this, 'register_post_type' ), -2 );
74
+			add_action('init', array($this, 'register_post_type'), -2);
75 75
 		}
76 76
 
77 77
 		// Create types taxonomy and default types
78 78
 		// @todo: remove this taxonomy, some addon use this taxonomy with there custom log post type for example: recurring
79 79
 		// Do not use this taxonomy with your log type because we will remove it in future releases.
80
-		add_action( 'init', array( $this, 'register_taxonomy' ), -2 );
80
+		add_action('init', array($this, 'register_taxonomy'), -2);
81 81
 	}
82 82
 
83 83
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		/* Logs post type */
96 96
 		$log_args = array(
97 97
 			'labels'              => array(
98
-				'name' => esc_html__( 'Logs', 'give' ),
98
+				'name' => esc_html__('Logs', 'give'),
99 99
 			),
100 100
 			'public'              => false,
101 101
 			'exclude_from_search' => true,
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 			'query_var'           => false,
105 105
 			'rewrite'             => false,
106 106
 			'capability_type'     => 'post',
107
-			'supports'            => array( 'title', 'editor' ),
107
+			'supports'            => array('title', 'editor'),
108 108
 			'can_export'          => true,
109 109
 		);
110 110
 
111
-		register_post_type( 'give_log', $log_args );
111
+		register_post_type('give_log', $log_args);
112 112
 	}
113 113
 
114 114
 	/**
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @return void
123 123
 	 */
124 124
 	public function register_taxonomy() {
125
-		register_taxonomy( 'give_log_type', 'give_log', array(
125
+		register_taxonomy('give_log_type', 'give_log', array(
126 126
 			'public' => false,
127
-		) );
127
+		));
128 128
 	}
129 129
 
130 130
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'update',
146 146
 		);
147 147
 
148
-		return apply_filters( 'give_log_types', $terms );
148
+		return apply_filters('give_log_types', $terms);
149 149
 	}
150 150
 
151 151
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return bool         Whether log type is valid.
162 162
 	 */
163
-	public function valid_type( $type ) {
164
-		return in_array( $type, $this->log_types() );
163
+	public function valid_type($type) {
164
+		return in_array($type, $this->log_types());
165 165
 	}
166 166
 
167 167
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return int             Log ID.
182 182
 	 */
183
-	public function add( $title = '', $message = '', $parent = 0, $type = '' ) {
183
+	public function add($title = '', $message = '', $parent = 0, $type = '') {
184 184
 		$log_data = array(
185 185
 			'post_title'   => $title,
186 186
 			'post_content' => $message,
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			'log_type'     => $type,
189 189
 		);
190 190
 
191
-		return $this->insert_log( $log_data );
191
+		return $this->insert_log($log_data);
192 192
 	}
193 193
 
194 194
 	/**
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return array             An array of the connected logs.
207 207
 	 */
208
-	public function get_logs( $object_id = 0, $type = '', $paged = null ) {
209
-		return $this->get_connected_logs( array(
208
+	public function get_logs($object_id = 0, $type = '', $paged = null) {
209
+		return $this->get_connected_logs(array(
210 210
 			'log_parent' => $object_id,
211 211
 			'paged'      => $paged,
212 212
 			'log_type'   => $type,
213
-		) );
213
+		));
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return int             The ID of the newly created log item.
226 226
 	 */
227
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
227
+	public function insert_log($log_data = array(), $log_meta = array()) {
228 228
 		$log_id = 0;
229 229
 
230 230
 		$defaults = array(
@@ -237,28 +237,28 @@  discard block
 block discarded – undo
237 237
 			'post_status' => 'publish',
238 238
 		);
239 239
 
240
-		$args = wp_parse_args( $log_data, $defaults );
241
-		$this->bc_200_validate_params( $args, $log_meta );
240
+		$args = wp_parse_args($log_data, $defaults);
241
+		$this->bc_200_validate_params($args, $log_meta);
242 242
 
243
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
243
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
244 244
 			global $wpdb;
245 245
 
246 246
 			// Backward Compatibility.
247
-			if ( ! $wpdb->get_var( "SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1" ) ) {
248
-				$latest_log_id = $wpdb->get_var( "SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1" );
249
-				$latest_log_id = empty( $latest_log_id ) ? 1 : ++ $latest_log_id;
247
+			if ( ! $wpdb->get_var("SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1")) {
248
+				$latest_log_id = $wpdb->get_var("SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1");
249
+				$latest_log_id = empty($latest_log_id) ? 1 : ++ $latest_log_id;
250 250
 
251 251
 				$args['ID'] = $latest_log_id;
252
-				$this->log_db->insert( $args );
252
+				$this->log_db->insert($args);
253 253
 			}
254 254
 		}
255 255
 
256
-		$log_id = $this->log_db->add( $args );
256
+		$log_id = $this->log_db->add($args);
257 257
 
258 258
 		// Set log meta, if any
259
-		if ( $log_id && ! empty( $log_meta ) ) {
260
-			foreach ( (array) $log_meta as $key => $meta ) {
261
-				$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
259
+		if ($log_id && ! empty($log_meta)) {
260
+			foreach ((array) $log_meta as $key => $meta) {
261
+				$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
262 262
 			}
263 263
 		}
264 264
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return bool|null       True if successful, false otherwise.
282 282
 	 */
283
-	public function update_log( $log_data = array(), $log_meta = array() ) {
283
+	public function update_log($log_data = array(), $log_meta = array()) {
284 284
 		$log_id = 0;
285 285
 
286 286
 		/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		 * @param array $log_data Log entry data.
292 292
 		 * @param array $log_meta Log entry meta.
293 293
 		 */
294
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
294
+		do_action('give_pre_update_log', $log_data, $log_meta);
295 295
 
296 296
 		$defaults = array(
297 297
 			'log_parent'  => 0,
@@ -301,28 +301,28 @@  discard block
 block discarded – undo
301 301
 			'post_status' => 'publish',
302 302
 		);
303 303
 
304
-		$args = wp_parse_args( $log_data, $defaults );
305
-		$this->bc_200_validate_params( $args, $log_meta );
304
+		$args = wp_parse_args($log_data, $defaults);
305
+		$this->bc_200_validate_params($args, $log_meta);
306 306
 
307 307
 		// Store the log entry
308
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
308
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
309 309
 			// Backward compatibility.
310
-			$log_id = wp_update_post( $args );
310
+			$log_id = wp_update_post($args);
311 311
 
312
-			if ( $log_id && ! empty( $log_meta ) ) {
313
-				foreach ( (array) $log_meta as $key => $meta ) {
314
-					if ( ! empty( $meta ) ) {
315
-						give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
312
+			if ($log_id && ! empty($log_meta)) {
313
+				foreach ((array) $log_meta as $key => $meta) {
314
+					if ( ! empty($meta)) {
315
+						give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
316 316
 					}
317 317
 				}
318 318
 			}
319 319
 		} else {
320
-			$log_id = $this->log_db->add( $args );
320
+			$log_id = $this->log_db->add($args);
321 321
 
322
-			if ( $log_id && ! empty( $log_meta ) ) {
323
-				foreach ( (array) $log_meta as $key => $meta ) {
324
-					if ( ! empty( $meta ) ) {
325
-						$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
322
+			if ($log_id && ! empty($log_meta)) {
323
+				foreach ((array) $log_meta as $key => $meta) {
324
+					if ( ! empty($meta)) {
325
+						$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
326 326
 					}
327 327
 				}
328 328
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 * @param array $log_data Log entry data.
338 338
 		 * @param array $log_meta Log entry meta.
339 339
 		 */
340
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
340
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
341 341
 	}
342 342
 
343 343
 	/**
@@ -354,30 +354,30 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return array|false Array if logs were found, false otherwise.
356 356
 	 */
357
-	public function get_connected_logs( $args = array() ) {
357
+	public function get_connected_logs($args = array()) {
358 358
 		$logs = array();
359 359
 
360
-		$defaults   = array(
360
+		$defaults = array(
361 361
 			'number'      => 20,
362
-			'paged'       => get_query_var( 'paged' ),
362
+			'paged'       => get_query_var('paged'),
363 363
 			'log_type'    => false,
364 364
 
365 365
 			// Backward compatibility.
366 366
 			'post_type'   => 'give_log',
367 367
 			'post_status' => 'publish',
368 368
 		);
369
-		$query_args = wp_parse_args( $args, $defaults );
370
-		$this->bc_200_validate_params( $query_args );
369
+		$query_args = wp_parse_args($args, $defaults);
370
+		$this->bc_200_validate_params($query_args);
371 371
 
372
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
372
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
373 373
 			// Backward compatibility.
374
-			$logs = get_posts( $query_args );
375
-			$this->bc_200_add_new_properties( $logs );
374
+			$logs = get_posts($query_args);
375
+			$this->bc_200_add_new_properties($logs);
376 376
 		} else {
377
-			$logs = $this->log_db->get_logs( $query_args );
377
+			$logs = $this->log_db->get_logs($query_args);
378 378
 		}
379 379
 
380
-		return ( ! empty( $logs ) ? $logs : false );
380
+		return ( ! empty($logs) ? $logs : false);
381 381
 	}
382 382
 
383 383
 	/**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return int                Log count.
397 397
 	 */
398
-	public function get_log_count( $object_id = 0, $type = '', $meta_query = null, $date_query = null ) {
398
+	public function get_log_count($object_id = 0, $type = '', $meta_query = null, $date_query = null) {
399 399
 		$logs_count = 0;
400 400
 
401 401
 		$query_args = array(
402
-			'number'      => - 1,
402
+			'number'      => -1,
403 403
 
404 404
 			// Backward comatibility.
405 405
 			'post_type'   => 'give_log',
406 406
 			'post_status' => 'publish',
407 407
 		);
408 408
 
409
-		if ( $object_id ) {
409
+		if ($object_id) {
410 410
 			$query_args['log_parent'] = $object_id;
411 411
 		}
412 412
 
413
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
413
+		if ( ! empty($type) && $this->valid_type($type)) {
414 414
 			$query_args['log_type'] = $type;
415 415
 		}
416 416
 
417
-		if ( ! empty( $meta_query ) ) {
417
+		if ( ! empty($meta_query)) {
418 418
 			$query_args['meta_query'] = $meta_query;
419 419
 		}
420 420
 
421
-		if ( ! empty( $date_query ) ) {
421
+		if ( ! empty($date_query)) {
422 422
 			$query_args['date_query'] = $date_query;
423 423
 		}
424 424
 
425
-		$this->bc_200_validate_params( $query_args );
425
+		$this->bc_200_validate_params($query_args);
426 426
 
427
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
427
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
428 428
 			// Backward compatibility.
429
-			$logs       = new WP_Query( $query_args );
429
+			$logs       = new WP_Query($query_args);
430 430
 			$logs_count = (int) $logs->post_count;
431 431
 		} else {
432
-			$logs_count = $this->log_db->count( $query_args );
432
+			$logs_count = $this->log_db->count($query_args);
433 433
 		}
434 434
 
435 435
 		return $logs_count;
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 *
450 450
 	 * @return void
451 451
 	 */
452
-	public function delete_logs( $object_id = 0, $type = '', $meta_query = null ) {
452
+	public function delete_logs($object_id = 0, $type = '', $meta_query = null) {
453 453
 		$query_args = array(
454 454
 			'log_parent'  => $object_id,
455
-			'number'      => - 1,
455
+			'number'      => -1,
456 456
 			'fields'      => 'ID',
457 457
 
458 458
 			// Backward compatibility.
@@ -460,32 +460,32 @@  discard block
 block discarded – undo
460 460
 			'post_status' => 'publish',
461 461
 		);
462 462
 
463
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
463
+		if ( ! empty($type) && $this->valid_type($type)) {
464 464
 			$query_args['log_type'] = $type;
465 465
 		}
466 466
 
467
-		if ( ! empty( $meta_query ) ) {
467
+		if ( ! empty($meta_query)) {
468 468
 			$query_args['meta_query'] = $meta_query;
469 469
 		}
470 470
 
471
-		$this->bc_200_validate_params( $query_args );
471
+		$this->bc_200_validate_params($query_args);
472 472
 
473
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
473
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
474 474
 			// Backward compatibility.
475
-			$logs = get_posts( $query_args );
475
+			$logs = get_posts($query_args);
476 476
 
477
-			if ( $logs ) {
478
-				foreach ( $logs as $log ) {
479
-					wp_delete_post( $log, true );
477
+			if ($logs) {
478
+				foreach ($logs as $log) {
479
+					wp_delete_post($log, true);
480 480
 				}
481 481
 			}
482 482
 		} else {
483
-			$logs = $this->log_db->get_logs( $query_args );
483
+			$logs = $this->log_db->get_logs($query_args);
484 484
 
485
-			if ( $logs ) {
486
-				foreach ( $logs as $log ) {
487
-					if ( $this->log_db->delete( $log->ID ) ) {
488
-						$this->logmeta_db->delete_row( $log->ID );
485
+			if ($logs) {
486
+				foreach ($logs as $log) {
487
+					if ($this->log_db->delete($log->ID)) {
488
+						$this->logmeta_db->delete_row($log->ID);
489 489
 					}
490 490
 				}
491 491
 			}
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @param int $post_id
504 504
 	 */
505
-	public function background_process_delete_cache( $post_id ) {
505
+	public function background_process_delete_cache($post_id) {
506 506
 		// Delete log cache immediately
507
-		wp_schedule_single_event( time() - 5, 'give_delete_log_cache' );
507
+		wp_schedule_single_event(time() - 5, 'give_delete_log_cache');
508 508
 	}
509 509
 
510 510
 	/**
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function delete_cache() {
519 519
 		// Add log related keys to delete.
520
-		$cache_give_logs      = Give_Cache::get_options_like( 'give_logs' );
521
-		$cache_give_log_count = Give_Cache::get_options_like( 'log_count' );
520
+		$cache_give_logs      = Give_Cache::get_options_like('give_logs');
521
+		$cache_give_log_count = Give_Cache::get_options_like('log_count');
522 522
 
523
-		$cache_option_names = array_merge( $cache_give_logs, $cache_give_log_count );
523
+		$cache_option_names = array_merge($cache_give_logs, $cache_give_log_count);
524 524
 
525 525
 		// Bailout.
526
-		if ( empty( $cache_option_names ) ) {
526
+		if (empty($cache_option_names)) {
527 527
 			return false;
528 528
 		}
529 529
 
530
-		Give_Cache::delete( $cache_option_names );
530
+		Give_Cache::delete($cache_option_names);
531 531
 	}
532 532
 
533 533
 	/**
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @param array $log_query
540 540
 	 * @param array $log_meta
541 541
 	 */
542
-	private function bc_200_validate_params( &$log_query, &$log_meta = array() ) {
542
+	private function bc_200_validate_params(&$log_query, &$log_meta = array()) {
543 543
 		$query_params = array(
544 544
 			'log_title'    => 'post_title',
545 545
 			'log_parent'   => 'post_parent',
@@ -551,41 +551,41 @@  discard block
 block discarded – undo
551 551
 			'meta_query'   => 'meta_query',
552 552
 		);
553 553
 
554
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
554
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
555 555
 			// Set old params.
556
-			foreach ( $query_params as $new_query_param => $old_query_param ) {
556
+			foreach ($query_params as $new_query_param => $old_query_param) {
557 557
 
558
-				if ( isset( $log_query[ $old_query_param ] ) && empty( $log_query[ $new_query_param ] ) ) {
559
-					$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
558
+				if (isset($log_query[$old_query_param]) && empty($log_query[$new_query_param])) {
559
+					$log_query[$new_query_param] = $log_query[$old_query_param];
560 560
 					continue;
561
-				} elseif ( ! isset( $log_query[ $new_query_param ] ) ) {
561
+				} elseif ( ! isset($log_query[$new_query_param])) {
562 562
 					continue;
563
-				} elseif( empty( $log_query[ $new_query_param ] ) ) {
563
+				} elseif (empty($log_query[$new_query_param])) {
564 564
 					continue;
565 565
 				}
566 566
 
567
-				switch ( $new_query_param ) {
567
+				switch ($new_query_param) {
568 568
 					case 'log_type':
569 569
 						$log_query['tax_query'] = array(
570 570
 							array(
571 571
 								'taxonomy' => 'give_log_type',
572 572
 								'field'    => 'slug',
573
-								'terms'    => $log_query[ $new_query_param ],
573
+								'terms'    => $log_query[$new_query_param],
574 574
 							),
575 575
 						);
576 576
 						break;
577 577
 
578 578
 					case 'meta_query':
579
-						if( ! empty( $log_query['meta_query'] ) && empty( $log_query['post_parent'] ) ) {
580
-							foreach ( $log_query['meta_query'] as $index => $meta_query ){
581
-								if( ! is_array( $meta_query ) || empty( $meta_query['key'] ) ) {
579
+						if ( ! empty($log_query['meta_query']) && empty($log_query['post_parent'])) {
580
+							foreach ($log_query['meta_query'] as $index => $meta_query) {
581
+								if ( ! is_array($meta_query) || empty($meta_query['key'])) {
582 582
 									continue;
583 583
 								}
584 584
 
585
-								switch ( $meta_query['key'] ) {
585
+								switch ($meta_query['key']) {
586 586
 									case '_give_log_form_id':
587 587
 										$log_query['post_parent'] = $meta_query['value'];
588
-										unset( $log_query['meta_query'][$index] );
588
+										unset($log_query['meta_query'][$index]);
589 589
 										break;
590 590
 								}
591 591
 							}
@@ -593,40 +593,40 @@  discard block
 block discarded – undo
593 593
 						break;
594 594
 
595 595
 					default:
596
-						switch( $new_query_param ){
596
+						switch ($new_query_param) {
597 597
 							case 'log_parent':
598 598
 								$log_query['meta_query'][] = array(
599 599
 									'key' => '_give_log_payment_id',
600
-									'value' => $log_query[ $new_query_param ]
600
+									'value' => $log_query[$new_query_param]
601 601
 								);
602 602
 
603 603
 								break;
604 604
 
605 605
 							default:
606
-								$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
606
+								$log_query[$old_query_param] = $log_query[$new_query_param];
607 607
 						}
608 608
 				}
609 609
 			}
610 610
 		} else {
611 611
 			// Set only old params.
612
-			$query_params = array_flip( $query_params );
613
-			foreach ( $query_params as $old_query_param => $new_query_param ) {
614
-				if ( isset( $log_query[ $new_query_param ] ) && empty( $log_query[ $old_query_param ] ) ) {
615
-					$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
612
+			$query_params = array_flip($query_params);
613
+			foreach ($query_params as $old_query_param => $new_query_param) {
614
+				if (isset($log_query[$new_query_param]) && empty($log_query[$old_query_param])) {
615
+					$log_query[$old_query_param] = $log_query[$new_query_param];
616 616
 					continue;
617
-				} elseif ( ! isset( $log_query[ $old_query_param ] ) ) {
617
+				} elseif ( ! isset($log_query[$old_query_param])) {
618 618
 					continue;
619 619
 				}
620 620
 
621
-				switch ( $old_query_param ) {
621
+				switch ($old_query_param) {
622 622
 					case 'tax_query':
623
-						if ( isset( $log_query[ $old_query_param ][0]['terms'] ) ) {
624
-							$log_query[ $new_query_param ] = $log_query[ $old_query_param ][0]['terms'];
623
+						if (isset($log_query[$old_query_param][0]['terms'])) {
624
+							$log_query[$new_query_param] = $log_query[$old_query_param][0]['terms'];
625 625
 						}
626 626
 						break;
627 627
 
628 628
 					default:
629
-						$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
629
+						$log_query[$new_query_param] = $log_query[$old_query_param];
630 630
 				}
631 631
 			}
632 632
 		}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 *
641 641
 	 * @param  array $logs
642 642
 	 */
643
-	private function bc_200_add_new_properties( &$logs ) {
644
-		if ( empty( $logs ) ) {
643
+	private function bc_200_add_new_properties(&$logs) {
644
+		if (empty($logs)) {
645 645
 			return;
646 646
 		}
647 647
 
@@ -654,30 +654,30 @@  discard block
 block discarded – undo
654 654
 			'log_type'     => 'give_log_type',
655 655
 		);
656 656
 
657
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
658
-			foreach ( $logs as $index => $log ) {
659
-				foreach ( $query_params as $new_query_param => $old_query_param ) {
660
-					if ( ! property_exists( $log, $old_query_param ) ) {
657
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
658
+			foreach ($logs as $index => $log) {
659
+				foreach ($query_params as $new_query_param => $old_query_param) {
660
+					if ( ! property_exists($log, $old_query_param)) {
661 661
 						/**
662 662
 						 *  Set unmatched properties.
663 663
 						 */
664 664
 
665 665
 						// 1. log_type
666
-						$term = get_the_terms( $log->ID, 'give_log_type' );
667
-						$term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
666
+						$term = get_the_terms($log->ID, 'give_log_type');
667
+						$term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
668 668
 
669
-						$logs[ $index ]->{$new_query_param} = ! empty( $term ) ? $term->slug : '';
669
+						$logs[$index]->{$new_query_param} = ! empty($term) ? $term->slug : '';
670 670
 
671 671
 						continue;
672 672
 					}
673 673
 
674
-					switch ( $old_query_param ) {
674
+					switch ($old_query_param) {
675 675
 						case 'post_parent':
676
-							$logs[ $index ]->{$new_query_param} = give_get_meta( $log->ID, '_give_log_payment_id', true );
676
+							$logs[$index]->{$new_query_param} = give_get_meta($log->ID, '_give_log_payment_id', true);
677 677
 							break;
678 678
 
679 679
 						default:
680
-							$logs[ $index ]->{$new_query_param} = $log->{$old_query_param};
680
+							$logs[$index]->{$new_query_param} = $log->{$old_query_param};
681 681
 					}
682 682
 				}
683 683
 			}
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
 	 *
698 698
 	 * @return mixed
699 699
 	 */
700
-	public function bc_200_set_payment_as_log_parent( $check, $log_id, $meta_key, $meta_value ) {
700
+	public function bc_200_set_payment_as_log_parent($check, $log_id, $meta_key, $meta_value) {
701 701
 		global $wpdb;
702 702
 		$update_status = false;
703
-		$post_type     = get_post_type( $log_id );
703
+		$post_type     = get_post_type($log_id);
704 704
 
705 705
 		// Bailout.
706 706
 		if (
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
 			)
721 721
 		);
722 722
 
723
-		if ( $form_id ) {
724
-			$this->logmeta_db->delete_meta( $log_id, '_give_log_payment_id' );
725
-			$this->logmeta_db->update_meta( $log_id, '_give_log_form_id', $form_id );
723
+		if ($form_id) {
724
+			$this->logmeta_db->delete_meta($log_id, '_give_log_payment_id');
725
+			$this->logmeta_db->update_meta($log_id, '_give_log_form_id', $form_id);
726 726
 
727 727
 			$update_status = $wpdb->update(
728 728
 				$this->log_db->table_name,
Please login to merge, or discard this patch.
includes/install.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -397,7 +397,7 @@
 block discarded – undo
397 397
  *
398 398
  * @since 1.8.11
399 399
  *
400
- * @return void
400
+ * @return false|null
401 401
  */
402 402
 function give_create_pages() {
403 403
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 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
 
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
  * @global     $wpdb
29 29
  * @return void
30 30
  */
31
-function give_install( $network_wide = false ) {
31
+function give_install($network_wide = false) {
32 32
 
33 33
 	global $wpdb;
34 34
 
35
-	if ( is_multisite() && $network_wide ) {
35
+	if (is_multisite() && $network_wide) {
36 36
 
37
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
37
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
38 38
 
39
-			switch_to_blog( $blog_id );
39
+			switch_to_blog($blog_id);
40 40
 			give_run_install();
41 41
 			restore_current_blog();
42 42
 
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
 	give_setup_post_types();
64 64
 
65 65
 	// Add Upgraded From Option.
66
-	$current_version = get_option( 'give_version' );
67
-	if ( $current_version ) {
68
-		update_option( 'give_version_upgraded_from', $current_version );
66
+	$current_version = get_option('give_version');
67
+	if ($current_version) {
68
+		update_option('give_version_upgraded_from', $current_version);
69 69
 	}
70 70
 
71 71
 	// Setup some default options.
72 72
 	$options = array();
73 73
 
74 74
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
75
-	if ( empty( $current_version ) ) {
76
-		$options = array_merge( $options, give_get_default_settings() );
75
+	if (empty($current_version)) {
76
+		$options = array_merge($options, give_get_default_settings());
77 77
 	}
78 78
 
79 79
 	// Populate the default values.
80
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
80
+	update_option('give_settings', array_merge($give_options, $options));
81 81
 
82 82
 	/**
83 83
 	 * Run plugin upgrades.
84 84
 	 *
85 85
 	 * @since 1.8
86 86
 	 */
87
-	do_action( 'give_upgrades' );
87
+	do_action('give_upgrades');
88 88
 
89
-	if ( GIVE_VERSION !== get_option( 'give_version' ) ) {
90
-		update_option( 'give_version', GIVE_VERSION );
89
+	if (GIVE_VERSION !== get_option('give_version')) {
90
+		update_option('give_version', GIVE_VERSION);
91 91
 	}
92 92
 
93 93
 	// Create Give roles.
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	// Set api version, end point and refresh permalink.
99 99
 	$api = new Give_API();
100 100
 	$api->add_endpoint();
101
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
101
+	update_option('give_default_api_version', 'v'.$api->get_version());
102 102
 
103 103
 	flush_rewrite_rules();
104 104
 
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	$give_sessions->use_php_sessions();
114 114
 
115 115
 	// Add a temporary option to note that Give pages have been created.
116
-	Give_Cache::set( '_give_installed', $options, 30, true );
116
+	Give_Cache::set('_give_installed', $options, 30, true);
117 117
 
118
-	if ( ! $current_version ) {
118
+	if ( ! $current_version) {
119 119
 
120
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
120
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
121 121
 
122 122
 		// When new upgrade routines are added, mark them as complete on fresh install.
123 123
 		$upgrade_routines = array(
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 			'v201_logs_upgrades'
149 149
 		);
150 150
 
151
-		foreach ( $upgrade_routines as $upgrade ) {
152
-			give_set_upgrade_complete( $upgrade );
151
+		foreach ($upgrade_routines as $upgrade) {
152
+			give_set_upgrade_complete($upgrade);
153 153
 		}
154 154
 	}
155 155
 
156 156
 	// Bail if activating from network, or bulk.
157
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
157
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
158 158
 		return;
159 159
 	}
160 160
 
161 161
 	// Add the transient to redirect.
162
-	Give_Cache::set( '_give_activation_redirect', true, 30, true );
162
+	Give_Cache::set('_give_activation_redirect', true, 30, true);
163 163
 }
164 164
 
165 165
 /**
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
  * @param  int    $site_id The Site ID.
178 178
  * @param  array  $meta    Blog Meta.
179 179
  */
180
-function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
180
+function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
181 181
 
182
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
182
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
183 183
 
184
-		switch_to_blog( $blog_id );
184
+		switch_to_blog($blog_id);
185 185
 		give_install();
186 186
 		restore_current_blog();
187 187
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 }
191 191
 
192
-add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 );
192
+add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6);
193 193
 
194 194
 
195 195
 /**
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return array          The tables to drop.
204 204
  */
205
-function give_wpmu_drop_tables( $tables, $blog_id ) {
205
+function give_wpmu_drop_tables($tables, $blog_id) {
206 206
 
207
-	switch_to_blog( $blog_id );
207
+	switch_to_blog($blog_id);
208 208
 	$donors_db     = new Give_DB_Donors();
209 209
 	$donor_meta_db = new Give_DB_Donor_Meta();
210 210
 
211
-	if ( $donors_db->installed() ) {
211
+	if ($donors_db->installed()) {
212 212
 		$tables[] = $donors_db->table_name;
213 213
 		$tables[] = $donor_meta_db->table_name;
214 214
 	}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 }
220 220
 
221
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
221
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
222 222
 
223 223
 /**
224 224
  * Post-installation
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
  */
231 231
 function give_after_install() {
232 232
 
233
-	if ( ! is_admin() ) {
233
+	if ( ! is_admin()) {
234 234
 		return;
235 235
 	}
236 236
 
237
-	$give_options     = Give_Cache::get( '_give_installed', true );
238
-	$give_table_check = get_option( '_give_table_check', false );
237
+	$give_options     = Give_Cache::get('_give_installed', true);
238
+	$give_table_check = get_option('_give_table_check', false);
239 239
 
240
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
240
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
241 241
 
242
-		if ( ! @Give()->donor_meta->installed() ) {
242
+		if ( ! @Give()->donor_meta->installed()) {
243 243
 
244 244
 			// Create the donor meta database.
245 245
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 		}
249 249
 
250
-		if ( ! @Give()->donors->installed() ) {
250
+		if ( ! @Give()->donors->installed()) {
251 251
 			// Create the donor database.
252 252
 			// (this ensures it creates it on multisite instances where it is network activated).
253 253
 			@Give()->donors->create_table();
@@ -259,22 +259,22 @@  discard block
 block discarded – undo
259 259
 			 *
260 260
 			 * @param array $give_options Give plugin options.
261 261
 			 */
262
-			do_action( 'give_after_install', $give_options );
262
+			do_action('give_after_install', $give_options);
263 263
 		}
264 264
 
265
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
265
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
266 266
 
267 267
 	}
268 268
 
269 269
 	// Delete the transient
270
-	if ( false !== $give_options ) {
271
-		Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) );
270
+	if (false !== $give_options) {
271
+		Give_Cache::delete(Give_Cache::get_key('_give_installed'));
272 272
 	}
273 273
 
274 274
 
275 275
 }
276 276
 
277
-add_action( 'admin_init', 'give_after_install' );
277
+add_action('admin_init', 'give_after_install');
278 278
 
279 279
 
280 280
 /**
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 
290 290
 	global $wp_roles;
291 291
 
292
-	if ( ! is_object( $wp_roles ) ) {
292
+	if ( ! is_object($wp_roles)) {
293 293
 		return;
294 294
 	}
295 295
 
296
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
296
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
297 297
 
298 298
 		// Create Give plugin roles
299 299
 		$roles = new Give_Roles();
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
 }
306 306
 
307
-add_action( 'admin_init', 'give_install_roles_on_network' );
307
+add_action('admin_init', 'give_install_roles_on_network');
308 308
 
309 309
 /**
310 310
  * Default core setting values.
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
 		'uninstall_on_delete'                         => 'disabled',
344 344
 		'the_content_filter'                          => 'enabled',
345 345
 		'scripts_footer'                              => 'disabled',
346
-		'agree_to_terms_label'                        => __( 'Agree to Terms?', 'give' ),
346
+		'agree_to_terms_label'                        => __('Agree to Terms?', 'give'),
347 347
 		'agreement_text'                              => give_get_default_agreement_text(),
348 348
 
349 349
 		// Paypal IPN verification.
350 350
 		'paypal_verification'                         => 'enabled',
351 351
 
352 352
 		// Default is manual gateway.
353
-		'gateways'                                    => array( 'manual' => 1, 'offline' => 1 ),
353
+		'gateways'                                    => array('manual' => 1, 'offline' => 1),
354 354
 		'default_gateway'                             => 'manual',
355 355
 
356 356
 		// Offline gateway setup.
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
  */
379 379
 function give_get_default_agreement_text() {
380 380
 
381
-	$org_name = get_bloginfo( 'name' );
381
+	$org_name = get_bloginfo('name');
382 382
 
383 383
 	$agreement = sprintf(
384 384
 		'<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The  %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the  %1$s.</p>
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		$org_name
393 393
 	);
394 394
 
395
-	return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name );
395
+	return apply_filters('give_get_default_agreement_text', $agreement, $org_name);
396 396
 }
397 397
 
398 398
 
@@ -406,19 +406,19 @@  discard block
 block discarded – undo
406 406
 function give_create_pages() {
407 407
 
408 408
 	// Bailout if pages already created.
409
-	if ( get_option( 'give_install_pages_created' ) ) {
409
+	if (get_option('give_install_pages_created')) {
410 410
 		return false;
411 411
 	}
412 412
 
413 413
 	$options = array();
414 414
 
415 415
 	// Checks if the Success Page option exists AND that the page exists.
416
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
416
+	if ( ! get_post(give_get_option('success_page'))) {
417 417
 
418 418
 		// Donation Confirmation (Success) Page
419 419
 		$success = wp_insert_post(
420 420
 			array(
421
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
421
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
422 422
 				'post_content'   => '[give_receipt]',
423 423
 				'post_status'    => 'publish',
424 424
 				'post_author'    => 1,
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
 	}
433 433
 
434 434
 	// Checks if the Failure Page option exists AND that the page exists.
435
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
435
+	if ( ! get_post(give_get_option('failure_page'))) {
436 436
 
437 437
 		// Failed Donation Page
438 438
 		$failed = wp_insert_post(
439 439
 			array(
440
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
441
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
440
+				'post_title'     => esc_html__('Donation Failed', 'give'),
441
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
442 442
 				'post_status'    => 'publish',
443 443
 				'post_author'    => 1,
444 444
 				'post_type'      => 'page',
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 	}
451 451
 
452 452
 	// Checks if the History Page option exists AND that the page exists.
453
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
453
+	if ( ! get_post(give_get_option('history_page'))) {
454 454
 		// Donation History Page
455 455
 		$history = wp_insert_post(
456 456
 			array(
457
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
457
+				'post_title'     => esc_html__('Donation History', 'give'),
458 458
 				'post_content'   => '[donation_history]',
459 459
 				'post_status'    => 'publish',
460 460
 				'post_author'    => 1,
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 		$options['history_page'] = $history;
467 467
 	}
468 468
 
469
-	if ( ! empty( $options ) ) {
470
-		update_option( 'give_settings', array_merge( give_get_settings(), $options ) );
469
+	if ( ! empty($options)) {
470
+		update_option('give_settings', array_merge(give_get_settings(), $options));
471 471
 	}
472 472
 
473
-	add_option( 'give_install_pages_created', 1, '', 'no' );
473
+	add_option('give_install_pages_created', 1, '', 'no');
474 474
 }
475 475
 
476
-add_action( 'admin_init', 'give_create_pages', - 1 );
476
+add_action('admin_init', 'give_create_pages', - 1);
Please login to merge, or discard this patch.