Completed
Push — master ( 5c06e9...0975de )
by Devin
13s
created
includes/admin/add-ons.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 function give_add_ons_page() {
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28
-		<h1><?php esc_html_e( 'Give Add-ons', 'give' ); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
28
+		<h1><?php esc_html_e('Give Add-ons', 'give'); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
33
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
34 34
 		<?php echo give_add_ons_get_feed(); ?>
35 35
 	</div>
36 36
 	<?php
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 function give_add_ons_get_feed() {
49 49
 
50 50
 	$addons_debug = false; //set to true to debug
51
-	$cache        = get_transient( 'give_add_ons_feed' );
51
+	$cache        = get_transient('give_add_ons_feed');
52 52
 
53
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
54
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
53
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
54
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
55 55
 
56
-		if ( ! is_wp_error( $feed ) ) {
57
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
58
-				$cache = wp_remote_retrieve_body( $feed );
59
-				set_transient( 'give_add_ons_feed', $cache, 3600 );
56
+		if ( ! is_wp_error($feed)) {
57
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
58
+				$cache = wp_remote_retrieve_body($feed);
59
+				set_transient('give_add_ons_feed', $cache, 3600);
60 60
 			}
61 61
 		} else {
62
-			$cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>';
62
+			$cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>';
63 63
 		}
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
22
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
23 23
 
24
-		parent::__construct( 'give_goal' );
24
+		parent::__construct('give_goal');
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$create_form_link = sprintf(
35 35
 			/* translators: %s: create new form URL */
36
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
37
-			admin_url( 'post-new.php?post_type=give_forms' )
36
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
37
+			admin_url('post-new.php?post_type=give_forms')
38 38
 		);
39 39
 
40 40
 		return array(
@@ -44,35 +44,35 @@  discard block
 block discarded – undo
44 44
 					'post_type' => 'give_forms',
45 45
 				),
46 46
 				'name'        => 'id',
47
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
48
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
47
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
48
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
49 49
 				'required'    => array(
50
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
51
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ),
50
+					'alert' => esc_html__('You must first select a Form!', 'give'),
51
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link),
52 52
 				),
53 53
 			),
54 54
 			array(
55 55
 				'type' => 'container',
56
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
56
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
57 57
 			),
58 58
 			array(
59 59
 				'type'    => 'listbox',
60 60
 				'name'    => 'show_text',
61
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
62
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
61
+				'label'   => esc_attr__('Show Text:', 'give'),
62
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
63 63
 				'options' => array(
64
-					'true'  => esc_html__( 'Show', 'give' ),
65
-					'false' => esc_html__( 'Hide', 'give' ),
64
+					'true'  => esc_html__('Show', 'give'),
65
+					'false' => esc_html__('Hide', 'give'),
66 66
 				),
67 67
 			),
68 68
 			array(
69 69
 				'type'    => 'listbox',
70 70
 				'name'    => 'show_bar',
71
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
72
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
71
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
72
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
73 73
 				'options' => array(
74
-					'true'  => esc_html__( 'Show', 'give' ),
75
-					'false' => esc_html__( 'Hide', 'give' ),
74
+					'true'  => esc_html__('Show', 'give'),
75
+					'false' => esc_html__('Hide', 'give'),
76 76
 				),
77 77
 			),
78 78
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 /**
15 15
  * Class Give_Shortcode_Donation_Form
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
25
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
24
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
25
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
26 26
 
27
-		parent::__construct( 'give_form' );
27
+		parent::__construct('give_form');
28 28
 	}
29 29
 
30 30
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 		$create_form_link = sprintf(
38 38
 			/* translators: %s: create new form URL */
39
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
40
-			admin_url( 'post-new.php?post_type=give_forms' )
39
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
40
+			admin_url('post-new.php?post_type=give_forms')
41 41
 		);
42 42
 
43 43
 		return array(
@@ -47,68 +47,68 @@  discard block
 block discarded – undo
47 47
 					'post_type' => 'give_forms',
48 48
 				),
49 49
 				'name'        => 'id',
50
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
51
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
50
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
51
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
52 52
 				'required'    => array(
53
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
54
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ),
53
+					'alert' => esc_html__('You must first select a Form!', 'give'),
54
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type' => 'container',
59
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional form settings', 'give' ) ),
59
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional form settings', 'give')),
60 60
 			),
61 61
 			array(
62 62
 				'type'    => 'listbox',
63 63
 				'name'    => 'show_title',
64
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
65
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
64
+				'label'   => esc_attr__('Show Title:', 'give'),
65
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
66 66
 				'options' => array(
67
-					'true'  => esc_html__( 'Show', 'give' ),
68
-					'false' => esc_html__( 'Hide', 'give' ),
67
+					'true'  => esc_html__('Show', 'give'),
68
+					'false' => esc_html__('Hide', 'give'),
69 69
 				),
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
75
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
74
+				'label'   => esc_attr__('Show Goal:', 'give'),
75
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html__( 'Show', 'give' ),
78
-					'false' => esc_html__( 'Hide', 'give' ),
77
+					'true'  => esc_html__('Show', 'give'),
78
+					'false' => esc_html__('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_content',
84 84
 				'minWidth' => 240,
85
-				'label'   => esc_attr__( 'Display Content:', 'give' ),
86
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
85
+				'label'   => esc_attr__('Display Content:', 'give'),
86
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
87 87
 				'options' => array(
88
-					'none'  => esc_html__( 'No Content', 'give' ),
89
-					'above' => esc_html__( 'Display above the form fields', 'give' ),
90
-					'below' => esc_html__( 'Display below the form fields', 'give' ),
88
+					'none'  => esc_html__('No Content', 'give'),
89
+					'above' => esc_html__('Display above the form fields', 'give'),
90
+					'below' => esc_html__('Display below the form fields', 'give'),
91 91
 				),
92 92
 			),
93 93
 			array(
94 94
 				'type'    => 'listbox',
95 95
 				'name'    => 'display_style',
96
-				'label'   => esc_attr__( 'Payment Fields:', 'give' ),
97
-				'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ),
96
+				'label'   => esc_attr__('Payment Fields:', 'give'),
97
+				'tooltip' => esc_attr__('How would you like to display payment information?', 'give'),
98 98
 				'options' => array(
99
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
100
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
101
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
99
+					'onpage' => esc_html__('Show on Page', 'give'),
100
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
101
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'listbox',
106 106
 				'name'    => 'float_labels',
107
-				'label'   => esc_attr__( 'Floating Labels:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form?', 'give' ),
107
+				'label'   => esc_attr__('Floating Labels:', 'give'),
108
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form?', 'give'),
109 109
 				'options' => array(
110
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
111
-					'disabled' => esc_html__( 'Disabled', 'give' ),
110
+					'enabled'  => esc_html__('Enabled', 'give'),
111
+					'disabled' => esc_html__('Disabled', 'give'),
112 112
 				),
113 113
 			),
114 114
 		);
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 	/**
49 49
 	 * Main Give Class.
50 50
 	 *
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 		 * @return    Give
168 168
 		 */
169 169
 		public static function instance() {
170
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
170
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
171 171
 				self::$instance = new Give;
172 172
 				self::$instance->setup_constants();
173 173
 
174
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
174
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
175 175
 
176 176
 				self::$instance->includes();
177 177
 				self::$instance->roles           = new Give_Roles();
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		 */
204 204
 		public function __clone() {
205 205
 			// Cloning instances of the class is forbidden
206
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
206
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
207 207
 		}
208 208
 
209 209
 		/**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 */
216 216
 		public function __wakeup() {
217 217
 			// Unserializing instances of the class is forbidden.
218
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
218
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
219 219
 		}
220 220
 
221 221
 		/**
@@ -228,33 +228,33 @@  discard block
 block discarded – undo
228 228
 		private function setup_constants() {
229 229
 
230 230
 			// Plugin version
231
-			if ( ! defined( 'GIVE_VERSION' ) ) {
232
-				define( 'GIVE_VERSION', '1.6' );
231
+			if ( ! defined('GIVE_VERSION')) {
232
+				define('GIVE_VERSION', '1.6');
233 233
 			}
234 234
 
235 235
 			// Plugin Folder Path
236
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
237
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
236
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
237
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
238 238
 			}
239 239
 
240 240
 			// Plugin Folder URL
241
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
242
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
241
+			if ( ! defined('GIVE_PLUGIN_URL')) {
242
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
243 243
 			}
244 244
 
245 245
 			// Plugin Basename aka: "give/give.php"
246
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
247
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
246
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
247
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
248 248
 			}
249 249
 
250 250
 			// Plugin Root File
251
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
252
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
251
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
252
+				define('GIVE_PLUGIN_FILE', __FILE__);
253 253
 			}
254 254
 
255 255
 			// Make sure CAL_GREGORIAN is defined
256
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
257
-				define( 'CAL_GREGORIAN', 1 );
256
+			if ( ! defined('CAL_GREGORIAN')) {
257
+				define('CAL_GREGORIAN', 1);
258 258
 			}
259 259
 		}
260 260
 
@@ -268,110 +268,110 @@  discard block
 block discarded – undo
268 268
 		private function includes() {
269 269
 			global $give_options;
270 270
 
271
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
271
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
272 272
 			$give_options = give_get_settings();
273 273
 
274
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
275
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
276
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
277
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
278
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
279
-
280
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
281
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
282
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
283
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
284
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
285
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
286
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
287
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
288
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
289
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
290
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
291
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
292
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
293
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
294
-
295
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
296
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
297
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
298
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
299
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
300
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
301
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
302
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
303
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
305
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
306
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
310
-
311
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
314
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
316
-
317
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
322
-
323
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
326
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
327
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
328
-
329
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
330
-
331
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
332
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
333
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
334
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
335
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
336
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
337
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
338
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
339
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
340
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
341
-
342
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
343
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
344
-
345
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
346
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
347
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
348
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
349
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
350
-
351
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
352
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
353
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
354
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
355
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
356
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
357
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
358
-
359
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
360
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
361
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
362
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
363
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
364
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
365
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
366
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
367
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
368
-
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
274
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
275
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
276
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
277
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
278
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
279
+
280
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
281
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
282
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
283
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
284
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
285
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
286
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
287
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
288
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
289
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
290
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
291
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
292
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
293
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
294
+
295
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
296
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
297
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
298
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
299
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
300
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
301
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
302
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
305
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
310
+
311
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
314
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
316
+
317
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
322
+
323
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
326
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
327
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
328
+
329
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
330
+
331
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
332
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
333
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
334
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
335
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
336
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
337
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
338
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
339
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
340
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
341
+
342
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
343
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
344
+
345
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
346
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
347
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
348
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
349
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
350
+
351
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
352
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
353
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
354
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
355
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
356
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
357
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
358
+
359
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
360
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
361
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
362
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
363
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
364
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
365
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
366
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
367
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
368
+
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
371 371
 
372 372
 			}
373 373
 
374
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
374
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
375 375
 
376 376
 		}
377 377
 
@@ -384,26 +384,26 @@  discard block
 block discarded – undo
384 384
 		 */
385 385
 		public function load_textdomain() {
386 386
 			// Set filter for Give's languages directory
387
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
388
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
387
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
388
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
389 389
 
390 390
 			// Traditional WordPress plugin locale filter
391
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
392
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
391
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
392
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
393 393
 
394 394
 			// Setup paths to current locale file
395
-			$mofile_local  = $give_lang_dir . $mofile;
396
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
395
+			$mofile_local  = $give_lang_dir.$mofile;
396
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
397 397
 
398
-			if ( file_exists( $mofile_global ) ) {
398
+			if (file_exists($mofile_global)) {
399 399
 				// Look in global /wp-content/languages/give folder
400
-				load_textdomain( 'give', $mofile_global );
401
-			} elseif ( file_exists( $mofile_local ) ) {
400
+				load_textdomain('give', $mofile_global);
401
+			} elseif (file_exists($mofile_local)) {
402 402
 				// Look in local location from filter `give_languages_directory`
403
-				load_textdomain( 'give', $mofile_local );
403
+				load_textdomain('give', $mofile_local);
404 404
 			} else {
405 405
 				// Load the default language files packaged up w/ Give
406
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
406
+				load_plugin_textdomain('give', false, $give_lang_dir);
407 407
 			}
408 408
 		}
409 409
 	}
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param  bool  $_id   Post id. Default is false.
330 330
 	 * @param  array $_args Arguments passed.
331 331
 	 *
332
-	 * @return void
332
+	 * @return boolean
333 333
 	 */
334 334
 	public function __construct( $_id = false, $_args = array() ) {
335 335
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @param  array $data Array of attributes for a donation form.
414 414
 	 *
415
-	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
415
+	 * @return boolean       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417 417
 	public function create( $data = array() ) {
418 418
 
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
 
771 771
 	}
772 772
 
773
-    /**
774
-     * Get if form type set or not.
775
-     *
776
-     * @since  1.6
773
+	/**
774
+	 * Get if form type set or not.
775
+	 *
776
+	 * @since  1.6
777 777
 	 * @access public
778
-     *
778
+	 *
779 779
 	 * @return bool
780 780
 	 *
781 781
 	public function is_set_type_donation_form() {
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1029
-		       );
1026
+				   'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
+			   && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
+			   && ( $this->get_goal() <= $this->get_earnings()
1029
+			   );
1030 1030
 	}
1031 1031
 
1032 1032
 	/**
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 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
 
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return void
333 333
 	 */
334
-	public function __construct( $_id = false, $_args = array() ) {
334
+	public function __construct($_id = false, $_args = array()) {
335 335
 
336
-		$donation_form = WP_Post::get_instance( $_id );
336
+		$donation_form = WP_Post::get_instance($_id);
337 337
 
338
-		return $this->setup_donation_form( $donation_form );
338
+		return $this->setup_donation_form($donation_form);
339 339
 	}
340 340
 
341 341
 	/**
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return bool                   If the setup was successful or not.
350 350
 	 */
351
-	private function setup_donation_form( $donation_form ) {
351
+	private function setup_donation_form($donation_form) {
352 352
 
353
-		if ( ! is_object( $donation_form ) ) {
353
+		if ( ! is_object($donation_form)) {
354 354
 			return false;
355 355
 		}
356 356
 
357
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
357
+		if ( ! is_a($donation_form, 'WP_Post')) {
358 358
 			return false;
359 359
 		}
360 360
 
361
-		if ( 'give_forms' !== $donation_form->post_type ) {
361
+		if ('give_forms' !== $donation_form->post_type) {
362 362
 			return false;
363 363
 		}
364 364
 
365
-		foreach ( $donation_form as $key => $value ) {
365
+		foreach ($donation_form as $key => $value) {
366 366
 
367
-			switch ( $key ) {
367
+			switch ($key) {
368 368
 
369 369
 				default:
370 370
 					$this->$key = $value;
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 * @return mixed
390 390
 	 * @throws Exception
391 391
 	 */
392
-	public function __get( $key ) {
392
+	public function __get($key) {
393 393
 
394
-		if ( method_exists( $this, 'get_' . $key ) ) {
394
+		if (method_exists($this, 'get_'.$key)) {
395 395
 
396
-			return call_user_func( array( $this, 'get_' . $key ) );
396
+			return call_user_func(array($this, 'get_'.$key));
397 397
 
398 398
 		} else {
399 399
 
400 400
 			/* translators: %s: property key */
401
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
401
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
402 402
 
403 403
 		}
404 404
 
@@ -414,30 +414,30 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417
-	public function create( $data = array() ) {
417
+	public function create($data = array()) {
418 418
 
419
-		if ( $this->id != 0 ) {
419
+		if ($this->id != 0) {
420 420
 			return false;
421 421
 		}
422 422
 
423 423
 		$defaults = array(
424 424
 			'post_type'   => 'give_forms',
425 425
 			'post_status' => 'draft',
426
-			'post_title'  => esc_html__( 'New Donation Form', 'give' )
426
+			'post_title'  => esc_html__('New Donation Form', 'give')
427 427
 		);
428 428
 
429
-		$args = wp_parse_args( $data, $defaults );
429
+		$args = wp_parse_args($data, $defaults);
430 430
 
431 431
 		/**
432 432
 		 * Fired before a donation form is created
433 433
 		 *
434 434
 		 * @param array $args The post object arguments used for creation.
435 435
 		 */
436
-		do_action( 'give_form_pre_create', $args );
436
+		do_action('give_form_pre_create', $args);
437 437
 
438
-		$id = wp_insert_post( $args, true );
438
+		$id = wp_insert_post($args, true);
439 439
 
440
-		$donation_form = WP_Post::get_instance( $id );
440
+		$donation_form = WP_Post::get_instance($id);
441 441
 
442 442
 		/**
443 443
 		 * Fired after a donation form is created
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 		 * @param int   $id   The post ID of the created item.
446 446
 		 * @param array $args The post object arguments used for creation.
447 447
 		 */
448
-		do_action( 'give_form_post_create', $id, $args );
448
+		do_action('give_form_post_create', $id, $args);
449 449
 
450
-		return $this->setup_donation_form( $donation_form );
450
+		return $this->setup_donation_form($donation_form);
451 451
 
452 452
 	}
453 453
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @return string Donation form name.
473 473
 	 */
474 474
 	public function get_name() {
475
-		return get_the_title( $this->ID );
475
+		return get_the_title($this->ID);
476 476
 	}
477 477
 
478 478
 	/**
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function get_price() {
487 487
 
488
-		if ( ! isset( $this->price ) ) {
488
+		if ( ! isset($this->price)) {
489 489
 
490
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
490
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
491 491
 
492
-			if ( $this->price ) {
492
+			if ($this->price) {
493 493
 
494
-				$this->price = give_sanitize_amount( $this->price );
494
+				$this->price = give_sanitize_amount($this->price);
495 495
 
496 496
 			} else {
497 497
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		 * @param string     $price The donation form price.
510 510
 		 * @param string|int $id    The form ID.
511 511
 		 */
512
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
512
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
513 513
 	}
514 514
 
515 515
 	/**
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function get_minimum_price() {
524 524
 
525
-		if ( ! isset( $this->minimum_price ) ) {
525
+		if ( ! isset($this->minimum_price)) {
526 526
 
527
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
528
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
527
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
528
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
529 529
 
530
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
530
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
531 531
 
532
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
532
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
533 533
 
534 534
 			} else {
535 535
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 		}
541 541
 
542
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
542
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
543 543
 	}
544 544
 
545 545
 	/**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	public function get_prices() {
554 554
 
555
-		if ( ! isset( $this->prices ) ) {
555
+		if ( ! isset($this->prices)) {
556 556
 
557
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
557
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
558 558
 
559 559
 		}
560 560
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		 * @param array $prices The array of mulit-level prices.
567 567
 		 * @param int|string The ID of the form.
568 568
 		 */
569
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
569
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
570 570
 
571 571
 	}
572 572
 
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	public function get_goal() {
582 582
 
583
-		if ( ! isset( $this->goal ) ) {
583
+		if ( ! isset($this->goal)) {
584 584
 
585
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
585
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
586 586
 
587
-			if ( $this->goal ) {
587
+			if ($this->goal) {
588 588
 
589
-				$this->goal = give_sanitize_amount( $this->goal );
589
+				$this->goal = give_sanitize_amount($this->goal);
590 590
 
591 591
 			} else {
592 592
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 		}
598 598
 
599
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
599
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
600 600
 
601 601
 	}
602 602
 
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function is_single_price_mode() {
612 612
 
613
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
613
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
614 614
 		$ret    = 0;
615 615
 
616
-		if ( empty( $option ) || $option === 'set' ) {
616
+		if (empty($option) || $option === 'set') {
617 617
 			$ret = 1;
618 618
 		}
619 619
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		 * @param bool $ret Is donation form in single price mode?
626 626
 		 * @param int|string The ID of the donation form.
627 627
 		 */
628
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
628
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
629 629
 
630 630
 	}
631 631
 
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function is_custom_price_mode() {
641 641
 
642
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
642
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
643 643
 		$ret    = 0;
644 644
 
645
-		if ( $option === 'yes' ) {
645
+		if ($option === 'yes') {
646 646
 			$ret = 1;
647 647
 		}
648 648
 
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		 * @param bool $ret Is donation form in custom price mode?
655 655
 		 * @param int|string The ID of the donation form.
656 656
 		 */
657
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
657
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
658 658
 
659 659
 	}
660 660
 
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 	 */
671 671
 	public function has_variable_prices() {
672 672
 
673
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
673
+		$option = get_post_meta($this->ID, '_give_price_option', true);
674 674
 		$ret    = 0;
675 675
 
676
-		if ( $option === 'multi' ) {
676
+		if ($option === 'multi') {
677 677
 			$ret = 1;
678 678
 		}
679 679
 
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 		 * @param bool $ret Does donation form have variable prices?
684 684
 		 * @param int|string The ID of the donation form.
685 685
 		 */
686
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
686
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
687 687
 
688 688
 	}
689 689
 
@@ -697,17 +697,17 @@  discard block
 block discarded – undo
697 697
 	 */
698 698
 	public function get_type() {
699 699
 
700
-		if ( ! isset( $this->type ) ) {
700
+		if ( ! isset($this->type)) {
701 701
 
702
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
702
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
703 703
 
704
-			if ( empty( $this->type ) ) {
704
+			if (empty($this->type)) {
705 705
 				$this->type = 'set';
706 706
 			}
707 707
 
708 708
 		}
709 709
 
710
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
710
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
711 711
 
712 712
 	}
713 713
 
@@ -723,23 +723,23 @@  discard block
 block discarded – undo
723 723
 	 *
724 724
 	 * @return string
725 725
 	 */
726
-	public function get_form_classes( $args ) {
726
+	public function get_form_classes($args) {
727 727
 
728
-		$float_labels_option = give_is_float_labels_enabled( $args )
728
+		$float_labels_option = give_is_float_labels_enabled($args)
729 729
 			? 'float-labels-enabled'
730 730
 			: '';
731 731
 
732
-		$form_classes_array = apply_filters( 'give_form_classes', array(
732
+		$form_classes_array = apply_filters('give_form_classes', array(
733 733
 			'give-form',
734
-			'give-form-' . $this->ID,
735
-			'give-form-type-' . $this->get_type(),
734
+			'give-form-'.$this->ID,
735
+			'give-form-type-'.$this->get_type(),
736 736
 			$float_labels_option
737
-		), $this->ID, $args );
737
+		), $this->ID, $args);
738 738
 
739 739
 		// Remove empty class names.
740
-		$form_classes_array = array_filter( $form_classes_array );
740
+		$form_classes_array = array_filter($form_classes_array);
741 741
 
742
-		return implode( ' ', $form_classes_array );
742
+		return implode(' ', $form_classes_array);
743 743
 
744 744
 	}
745 745
 
@@ -754,19 +754,19 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return string
756 756
 	 */
757
-	public function get_form_wrap_classes( $args ) {
757
+	public function get_form_wrap_classes($args) {
758 758
 
759
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
759
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
760 760
 			? $args['display_style']
761
-			: get_post_meta( $this->ID, '_give_payment_display', true );
761
+			: get_post_meta($this->ID, '_give_payment_display', true);
762 762
 
763
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
763
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
764 764
 			'give-form-wrap',
765
-			'give-display-' . $display_option
766
-		), $this->ID, $args );
765
+			'give-display-'.$display_option
766
+		), $this->ID, $args);
767 767
 
768 768
 
769
-		return implode( ' ', $form_wrap_classes_array );
769
+		return implode(' ', $form_wrap_classes_array);
770 770
 
771 771
 	}
772 772
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	public function is_multi_type_donation_form() {
797 797
 		$form_type = $this->get_type();
798 798
 
799
-		return ( 'multi' === $form_type ? true : false );
799
+		return ('multi' === $form_type ? true : false);
800 800
 
801 801
 	}
802 802
 
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 */
811 811
 	public function get_sales() {
812 812
 
813
-		if ( ! isset( $this->sales ) ) {
813
+		if ( ! isset($this->sales)) {
814 814
 
815
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
816
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
815
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
816
+				add_post_meta($this->ID, '_give_form_sales', 0);
817 817
 			} // End if
818 818
 
819
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
819
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
820 820
 
821
-			if ( $this->sales < 0 ) {
821
+			if ($this->sales < 0) {
822 822
 				// Never let sales be less than zero
823 823
 				$this->sales = 0;
824 824
 			}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 	 *
840 840
 	 * @return int|false     New number of total sales.
841 841
 	 */
842
-	public function increase_sales( $quantity = 1 ) {
842
+	public function increase_sales($quantity = 1) {
843 843
 
844
-		$sales       = give_get_form_sales_stats( $this->ID );
845
-		$quantity    = absint( $quantity );
844
+		$sales       = give_get_form_sales_stats($this->ID);
845
+		$quantity    = absint($quantity);
846 846
 		$total_sales = $sales + $quantity;
847 847
 
848
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
848
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
849 849
 
850 850
 			$this->sales = $total_sales;
851 851
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return int|false     New number of total sales.
868 868
 	 */
869
-	public function decrease_sales( $quantity = 1 ) {
869
+	public function decrease_sales($quantity = 1) {
870 870
 
871
-		$sales = give_get_form_sales_stats( $this->ID );
871
+		$sales = give_get_form_sales_stats($this->ID);
872 872
 
873 873
 		// Only decrease if not already zero
874
-		if ( $sales > 0 ) {
874
+		if ($sales > 0) {
875 875
 
876
-			$quantity    = absint( $quantity );
876
+			$quantity    = absint($quantity);
877 877
 			$total_sales = $sales - $quantity;
878 878
 
879
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
879
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
880 880
 
881 881
 				$this->sales = $sales;
882 882
 
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	 */
901 901
 	public function get_earnings() {
902 902
 
903
-		if ( ! isset( $this->earnings ) ) {
903
+		if ( ! isset($this->earnings)) {
904 904
 
905
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
906
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
905
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
906
+				add_post_meta($this->ID, '_give_form_earnings', 0);
907 907
 			}
908 908
 
909
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
909
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
910 910
 
911
-			if ( $this->earnings < 0 ) {
911
+			if ($this->earnings < 0) {
912 912
 				// Never let earnings be less than zero
913 913
 				$this->earnings = 0;
914 914
 			}
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
 	 *
930 930
 	 * @return float|false
931 931
 	 */
932
-	public function increase_earnings( $amount = 0 ) {
932
+	public function increase_earnings($amount = 0) {
933 933
 
934
-		$earnings   = give_get_form_earnings_stats( $this->ID );
934
+		$earnings   = give_get_form_earnings_stats($this->ID);
935 935
 		$new_amount = $earnings + (float) $amount;
936 936
 
937
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
937
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
938 938
 
939 939
 			$this->earnings = $new_amount;
940 940
 
@@ -956,16 +956,16 @@  discard block
 block discarded – undo
956 956
 	 * 
957 957
 	 * @return float|false
958 958
 	 */
959
-	public function decrease_earnings( $amount ) {
959
+	public function decrease_earnings($amount) {
960 960
 
961
-		$earnings = give_get_form_earnings_stats( $this->ID );
961
+		$earnings = give_get_form_earnings_stats($this->ID);
962 962
 
963
-		if ( $earnings > 0 ) {
963
+		if ($earnings > 0) {
964 964
 			// Only decrease if greater than zero
965 965
 			$new_amount = $earnings - (float) $amount;
966 966
 
967 967
 
968
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
968
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
969 969
 
970 970
 				$this->earnings = $new_amount;
971 971
 
@@ -989,22 +989,22 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @return bool
991 991
 	 */
992
-	public function is_free( $price_id = false ) {
992
+	public function is_free($price_id = false) {
993 993
 
994 994
 		$is_free          = false;
995
-		$variable_pricing = give_has_variable_prices( $this->ID );
995
+		$variable_pricing = give_has_variable_prices($this->ID);
996 996
 
997
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
998
-			$price = give_get_price_option_amount( $this->ID, $price_id );
999
-		} elseif ( ! $variable_pricing ) {
1000
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
997
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
998
+			$price = give_get_price_option_amount($this->ID, $price_id);
999
+		} elseif ( ! $variable_pricing) {
1000
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1001 1001
 		}
1002 1002
 
1003
-		if ( isset( $price ) && (float) $price == 0 ) {
1003
+		if (isset($price) && (float) $price == 0) {
1004 1004
 			$is_free = true;
1005 1005
 		}
1006 1006
 
1007
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1007
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1008 1008
 
1009 1009
 	}
1010 1010
 
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1026
+			       'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
1027
+		       && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1028
+		       && ($this->get_goal() <= $this->get_earnings()
1029 1029
 		       );
1030 1030
 	}
1031 1031
 
@@ -1040,29 +1040,29 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool                            The result of the update query.
1042 1042
 	 */
1043
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1043
+	private function update_meta($meta_key = '', $meta_value = '') {
1044 1044
 
1045 1045
 		/* @var WPDB $wpdb */
1046 1046
 		global $wpdb;
1047 1047
 
1048
-		if ( empty( $meta_key ) ) {
1048
+		if (empty($meta_key)) {
1049 1049
 			return false;
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make sure if it needs to be serialized, we do
1053
-		$meta_value = maybe_serialize( $meta_value );
1053
+		$meta_value = maybe_serialize($meta_value);
1054 1054
 
1055
-		if ( is_numeric( $meta_value ) ) {
1056
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1055
+		if (is_numeric($meta_value)) {
1056
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1057 1057
 		} else {
1058 1058
 			$value_type = "'%s'";
1059 1059
 		}
1060 1060
 
1061
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1061
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1062 1062
 
1063
-		if ( $wpdb->query( $sql ) ) {
1063
+		if ($wpdb->query($sql)) {
1064 1064
 
1065
-			clean_post_cache( $this->ID );
1065
+			clean_post_cache($this->ID);
1066 1066
 
1067 1067
 			return true;
1068 1068
 
Please login to merge, or discard this patch.
includes/class-give-logging.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @param  array $log_data Log entry data.
224 224
 	 * @param  array $log_meta Log entry meta.
225 225
 	 *
226
-	 * @return bool            True if successful, false otherwise.
226
+	 * @return boolean|null            True if successful, false otherwise.
227 227
 	 */
228 228
 	public function update_log( $log_data = array(), $log_meta = array() ) {
229 229
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  * @param  int    $parent  Parent log. Default is 0.
407 407
  * @param  string $type    Log type. Default is null.
408 408
  *
409
- * @return mixed           ID of the new log entry.
409
+ * @return integer           ID of the new log entry.
410 410
  */
411 411
 function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
412 412
 	/* @var Give_Logging $give_logs */
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 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
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	public function __construct() {
37 37
 
38 38
 		// Create the log post type
39
-		add_action( 'init', array( $this, 'register_post_type' ), 1 );
39
+		add_action('init', array($this, 'register_post_type'), 1);
40 40
 
41 41
 		// Create types taxonomy and default types
42
-		add_action( 'init', array( $this, 'register_taxonomy' ), 1 );
42
+		add_action('init', array($this, 'register_taxonomy'), 1);
43 43
 
44 44
 	}
45 45
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	public function register_post_type() {
57 57
 		/* Logs post type */
58 58
 		$log_args = array(
59
-			'labels'              => array( 'name' => esc_html__( 'Logs', 'give' ) ),
59
+			'labels'              => array('name' => esc_html__('Logs', 'give')),
60 60
 			'public'              => false,
61 61
 			'exclude_from_search' => true,
62 62
 			'publicly_queryable'  => false,
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 			'query_var'           => false,
65 65
 			'rewrite'             => false,
66 66
 			'capability_type'     => 'post',
67
-			'supports'            => array( 'title', 'editor' ),
67
+			'supports'            => array('title', 'editor'),
68 68
 			'can_export'          => true
69 69
 		);
70 70
 
71
-		register_post_type( 'give_log', $log_args );
71
+		register_post_type('give_log', $log_args);
72 72
 	}
73 73
 
74 74
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return void
83 83
 	 */
84 84
 	public function register_taxonomy() {
85
-		register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) );
85
+		register_taxonomy('give_log_type', 'give_log', array('public' => false));
86 86
 	}
87 87
 
88 88
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'api_request'
103 103
 		);
104 104
 
105
-		return apply_filters( 'give_log_types', $terms );
105
+		return apply_filters('give_log_types', $terms);
106 106
 	}
107 107
 
108 108
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return bool         Whether log type is valid.
119 119
 	 */
120
-	public function valid_type( $type ) {
121
-		return in_array( $type, $this->log_types() );
120
+	public function valid_type($type) {
121
+		return in_array($type, $this->log_types());
122 122
 	}
123 123
 
124 124
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return int             Log ID.
139 139
 	 */
140
-	public function add( $title = '', $message = '', $parent = 0, $type = null ) {
140
+	public function add($title = '', $message = '', $parent = 0, $type = null) {
141 141
 		$log_data = array(
142 142
 			'post_title'   => $title,
143 143
 			'post_content' => $message,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'log_type'     => $type
146 146
 		);
147 147
 
148
-		return $this->insert_log( $log_data );
148
+		return $this->insert_log($log_data);
149 149
 	}
150 150
 
151 151
 	/**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return array             An array of the connected logs.
164 164
 	 */
165
-	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
166
-		return $this->get_connected_logs( array(
165
+	public function get_logs($object_id = 0, $type = null, $paged = null) {
166
+		return $this->get_connected_logs(array(
167 167
 			'post_parent' => $object_id,
168 168
 			'paged'       => $paged,
169 169
 			'log_type'    => $type
170
-		) );
170
+		));
171 171
 	}
172 172
 
173 173
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return int             The ID of the newly created log item.
183 183
 	 */
184
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
184
+	public function insert_log($log_data = array(), $log_meta = array()) {
185 185
 		$defaults = array(
186 186
 			'post_type'    => 'give_log',
187 187
 			'post_status'  => 'publish',
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 			'log_type'     => false
191 191
 		);
192 192
 
193
-		$args = wp_parse_args( $log_data, $defaults );
193
+		$args = wp_parse_args($log_data, $defaults);
194 194
 
195
-		do_action( 'give_pre_insert_log', $log_data, $log_meta );
195
+		do_action('give_pre_insert_log', $log_data, $log_meta);
196 196
 
197 197
 		// Store the log entry
198
-		$log_id = wp_insert_post( $args );
198
+		$log_id = wp_insert_post($args);
199 199
 
200 200
 		// Set the log type, if any
201
-		if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
202
-			wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false );
201
+		if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) {
202
+			wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false);
203 203
 		}
204 204
 
205 205
 		// Set log meta, if any
206
-		if ( $log_id && ! empty( $log_meta ) ) {
207
-			foreach ( (array) $log_meta as $key => $meta ) {
208
-				update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
206
+		if ($log_id && ! empty($log_meta)) {
207
+			foreach ((array) $log_meta as $key => $meta) {
208
+				update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
209 209
 			}
210 210
 		}
211 211
 
212
-		do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta );
212
+		do_action('give_post_insert_log', $log_id, $log_data, $log_meta);
213 213
 
214 214
 		return $log_id;
215 215
 	}
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return bool            True if successful, false otherwise.
227 227
 	 */
228
-	public function update_log( $log_data = array(), $log_meta = array() ) {
228
+	public function update_log($log_data = array(), $log_meta = array()) {
229 229
 
230
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
230
+		do_action('give_pre_update_log', $log_data, $log_meta);
231 231
 
232 232
 		$defaults = array(
233 233
 			'post_type'   => 'give_log',
@@ -235,20 +235,20 @@  discard block
 block discarded – undo
235 235
 			'post_parent' => 0
236 236
 		);
237 237
 
238
-		$args = wp_parse_args( $log_data, $defaults );
238
+		$args = wp_parse_args($log_data, $defaults);
239 239
 
240 240
 		// Store the log entry
241
-		$log_id = wp_update_post( $args );
241
+		$log_id = wp_update_post($args);
242 242
 
243
-		if ( $log_id && ! empty( $log_meta ) ) {
244
-			foreach ( (array) $log_meta as $key => $meta ) {
245
-				if ( ! empty( $meta ) ) {
246
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
243
+		if ($log_id && ! empty($log_meta)) {
244
+			foreach ((array) $log_meta as $key => $meta) {
245
+				if ( ! empty($meta)) {
246
+					update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
247 247
 				}
248 248
 			}
249 249
 		}
250 250
 
251
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
251
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
252 252
 	}
253 253
 
254 254
 	/**
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return array|false Array if logs were found, false otherwise.
265 265
 	 */
266
-	public function get_connected_logs( $args = array() ) {
266
+	public function get_connected_logs($args = array()) {
267 267
 
268 268
 		$defaults = array(
269 269
 			'post_type'      => 'give_log',
270 270
 			'posts_per_page' => 20,
271 271
 			'post_status'    => 'publish',
272
-			'paged'          => get_query_var( 'paged' ),
272
+			'paged'          => get_query_var('paged'),
273 273
 			'log_type'       => false
274 274
 		);
275 275
 
276
-		$query_args = wp_parse_args( $args, $defaults );
276
+		$query_args = wp_parse_args($args, $defaults);
277 277
 
278
-		if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) {
278
+		if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) {
279 279
 			$query_args['tax_query'] = array(
280 280
 				array(
281 281
 					'taxonomy' => 'give_log_type',
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			);
286 286
 		}
287 287
 		
288
-		$logs = get_posts( $query_args );
288
+		$logs = get_posts($query_args);
289 289
 	
290
-		if ( $logs ) {
290
+		if ($logs) {
291 291
 			return $logs;
292 292
 		}
293 293
 
@@ -310,17 +310,17 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @return int                Log count.
312 312
 	 */
313
-	public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) {
313
+	public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) {
314 314
 
315 315
 		$query_args = array(
316 316
 			'post_parent'    => $object_id,
317 317
 			'post_type'      => 'give_log',
318
-			'posts_per_page' => - 1,
318
+			'posts_per_page' => -1,
319 319
 			'post_status'    => 'publish',
320 320
 			'fields'         => 'ids',
321 321
 		);
322 322
 
323
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
323
+		if ( ! empty($type) && $this->valid_type($type)) {
324 324
 			$query_args['tax_query'] = array(
325 325
 				array(
326 326
 					'taxonomy' => 'give_log_type',
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 			);
331 331
 		}
332 332
 
333
-		if ( ! empty( $meta_query ) ) {
333
+		if ( ! empty($meta_query)) {
334 334
 			$query_args['meta_query'] = $meta_query;
335 335
 		}
336 336
 
337
-		if ( ! empty( $date_query ) ) {
337
+		if ( ! empty($date_query)) {
338 338
 			$query_args['date_query'] = $date_query;
339 339
 		}
340 340
 
341
-		$logs = new WP_Query( $query_args );
341
+		$logs = new WP_Query($query_args);
342 342
 
343 343
 		return (int) $logs->post_count;
344 344
 	}
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 	 *
358 358
 	 * @return void
359 359
 	 */
360
-	public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) {
360
+	public function delete_logs($object_id = 0, $type = null, $meta_query = null) {
361 361
 		$query_args = array(
362 362
 			'post_parent'    => $object_id,
363 363
 			'post_type'      => 'give_log',
364
-			'posts_per_page' => - 1,
364
+			'posts_per_page' => -1,
365 365
 			'post_status'    => 'publish',
366 366
 			'fields'         => 'ids'
367 367
 		);
368 368
 
369
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
369
+		if ( ! empty($type) && $this->valid_type($type)) {
370 370
 			$query_args['tax_query'] = array(
371 371
 				array(
372 372
 					'taxonomy' => 'give_log_type',
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 			);
377 377
 		}
378 378
 
379
-		if ( ! empty( $meta_query ) ) {
379
+		if ( ! empty($meta_query)) {
380 380
 			$query_args['meta_query'] = $meta_query;
381 381
 		}
382 382
 
383
-		$logs = get_posts( $query_args );
383
+		$logs = get_posts($query_args);
384 384
 
385
-		if ( $logs ) {
386
-			foreach ( $logs as $log ) {
387
-				wp_delete_post( $log, true );
385
+		if ($logs) {
386
+			foreach ($logs as $log) {
387
+				wp_delete_post($log, true);
388 388
 			}
389 389
 		}
390 390
 	}
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
  *
409 409
  * @return mixed           ID of the new log entry.
410 410
  */
411
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
411
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
412 412
 	/* @var Give_Logging $give_logs */
413 413
 	global $give_logs;
414
-	$log = $give_logs->add( $title, $message, $parent, $type );
414
+	$log = $give_logs->add($title, $message, $parent, $type);
415 415
 
416 416
 	return $log;
417 417
 }
Please login to merge, or discard this patch.
includes/payments/functions.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
  * @param  int $year      Year number. Default is null.
631 631
  * @param  int $hour      Hour number. Default is null.
632 632
  *
633
- * @return int $earnings  Earnings
633
+ * @return double $earnings  Earnings
634 634
  */
635 635
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
636 636
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
  *
933 933
  * @param int $payment_id Payment ID
934 934
  *
935
- * @return array $user_info User Info Meta Values
935
+ * @return string $user_info User Info Meta Values
936 936
  */
937 937
 function give_get_payment_meta_user_info( $payment_id ) {
938 938
 	$payment = new Give_Payment( $payment_id );
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
  *
949 949
  * @param int $payment_id Payment ID
950 950
  *
951
- * @return int $form_id
951
+ * @return string $form_id
952 952
  */
953 953
 function give_get_payment_form_id( $payment_id ) {
954 954
 	$payment = new Give_Payment( $payment_id );
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
  *
995 995
  * @param int $payment_id Payment ID
996 996
  *
997
- * @return string $user_id User ID
997
+ * @return integer $user_id User ID
998 998
  */
999 999
 function give_get_payment_user_id( $payment_id ) {
1000 1000
 	$payment = new Give_Payment( $payment_id );
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  *
1010 1010
  * @param int $payment_id Payment ID
1011 1011
  *
1012
- * @return string $customer_id Customer ID
1012
+ * @return integer $customer_id Customer ID
1013 1013
  */
1014 1014
 function give_get_payment_customer_id( $payment_id ) {
1015 1015
 	$payment = new Give_Payment( $payment_id );
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
  * @param array $where
1607 1607
  * @param object $wp_comment_query WordPress Comment Query Object
1608 1608
  *
1609
- * @return array $where
1609
+ * @return string $where
1610 1610
  */
1611 1611
 function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1612 1612
 	global $wpdb;
Please login to merge, or discard this patch.
Indentation   +33 added lines, -34 removed lines patch added patch discarded remove patch
@@ -228,7 +228,6 @@  discard block
 block discarded – undo
228 228
  * Deletes a Donation
229 229
  *
230 230
  * @since  1.0
231
-
232 231
  * @global $give_logs
233 232
  *
234 233
  * @param  int  $payment_id      Payment ID (default: 0)
@@ -610,7 +609,7 @@  discard block
 block discarded – undo
610 609
  * Retrieves keys for all available statuses for payments
611 610
  *
612 611
  * @since  1.0
613
-  *
612
+ *
614 613
  * @return array $payment_status All the available payment statuses.
615 614
  */
616 615
 function give_get_payment_status_keys() {
@@ -1807,13 +1806,13 @@  discard block
 block discarded – undo
1807 1806
  * @return string/void
1808 1807
  */
1809 1808
 function give_get_form_dropdown( $args = array(), $echo = false ){
1810
-    $form_dropdown_html = Give()->html->forms_dropdown( $args );
1809
+	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1811 1810
 
1812
-    if( ! $echo ) {
1813
-        return $form_dropdown_html;
1814
-    }
1811
+	if( ! $echo ) {
1812
+		return $form_dropdown_html;
1813
+	}
1815 1814
 
1816
-    echo $form_dropdown_html;
1815
+	echo $form_dropdown_html;
1817 1816
 }
1818 1817
 
1819 1818
 /**
@@ -1828,39 +1827,39 @@  discard block
 block discarded – undo
1828 1827
  */
1829 1828
 function give_get_form_variable_price_dropdown( $args = array(), $echo = false ){
1830 1829
     
1831
-    // Check for give form id.
1832
-    if( empty( $args['id'] ) ) {
1833
-        return false;
1834
-    }
1835
-
1836
-    // Check if form has variable prices or not.
1837
-    if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1838
-        return false;
1839
-    }
1830
+	// Check for give form id.
1831
+	if( empty( $args['id'] ) ) {
1832
+		return false;
1833
+	}
1834
+
1835
+	// Check if form has variable prices or not.
1836
+	if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1837
+		return false;
1838
+	}
1840 1839
     
1841
-    $variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1842
-    $variable_price_options = array();
1840
+	$variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1841
+	$variable_price_options = array();
1843 1842
 
1844
-    // Check if multi donation form support custom donation or not.
1845
-    if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1846
-        $variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1847
-    }
1843
+	// Check if multi donation form support custom donation or not.
1844
+	if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1845
+		$variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1846
+	}
1848 1847
 
1849
-    // Get variable price and ID from variable price array.
1850
-    foreach ( $variable_prices as $variable_price ) {
1851
-        $variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1852
-    }
1848
+	// Get variable price and ID from variable price array.
1849
+	foreach ( $variable_prices as $variable_price ) {
1850
+		$variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1851
+	}
1853 1852
 
1854 1853
 
1855
-    // Update options.
1856
-    $args = array_merge( $args, array( 'options' => $variable_price_options ) );
1854
+	// Update options.
1855
+	$args = array_merge( $args, array( 'options' => $variable_price_options ) );
1857 1856
 
1858
-    // Generate select html.
1859
-    $form_dropdown_html = Give()->html->select( $args );
1857
+	// Generate select html.
1858
+	$form_dropdown_html = Give()->html->select( $args );
1860 1859
 
1861
-    if( ! $echo ) {
1862
-        return $form_dropdown_html;
1863
-    }
1860
+	if( ! $echo ) {
1861
+		return $form_dropdown_html;
1862
+	}
1864 1863
 
1865
-    echo $form_dropdown_html;
1864
+	echo $form_dropdown_html;
1866 1865
 }
1867 1866
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +394 added lines, -394 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return object $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	$payment    = new Give_Payment();
142
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
143
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
144
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
145
-	$price_id   = isset( $payment_data['give_price_id'] ) ? $payment_data['give_price_id'] : give_get_price_id( $payment_data['give_form_id'], $payment_data['price'] );
146
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
142
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
143
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
144
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
145
+	$price_id   = isset($payment_data['give_price_id']) ? $payment_data['give_price_id'] : give_get_price_id($payment_data['give_form_id'], $payment_data['price']);
146
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
147 147
 
148 148
 	//Set properties
149 149
 	$payment->total          = $payment_data['price'];
150
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
151
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency();
150
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
151
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency();
152 152
 	$payment->user_info      = $payment_data['user_info'];
153 153
 	$payment->gateway        = $gateway;
154 154
 	$payment->form_title     = $form_title;
@@ -162,40 +162,40 @@  discard block
 block discarded – undo
162 162
 	$payment->ip             = give_get_ip();
163 163
 	$payment->key            = $payment_data['purchase_key'];
164 164
 	$payment->mode           = give_is_test_mode() ? 'test' : 'live';
165
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
166 166
 
167 167
 	//Add the donation
168 168
 	$args = array(
169 169
 		'price'    => $payment->total,
170 170
 		'price_id' => $payment->price_id,
171
-		'fees'     => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array()
171
+		'fees'     => isset($payment_data['fees']) ? $payment_data['fees'] : array()
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 	//Set date if present
177
-	if ( isset( $payment_data['post_date'] ) ) {
177
+	if (isset($payment_data['post_date'])) {
178 178
 		$payment->date = $payment_data['post_date'];
179 179
 	}
180 180
 
181 181
 	//Handle sequential payments
182
-	if ( give_get_option( 'enable_sequential' ) ) {
182
+	if (give_get_option('enable_sequential')) {
183 183
 		$number          = give_get_next_payment_number();
184
-		$payment->number = give_format_payment_number( $number );
185
-		update_option( 'give_last_payment_number', $number );
184
+		$payment->number = give_format_payment_number($number);
185
+		update_option('give_last_payment_number', $number);
186 186
 	}
187 187
 
188 188
 	// Clear the user's purchased cache
189
-	delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' );
189
+	delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases');
190 190
 
191 191
 	//Save payment
192 192
 	$payment->save();
193 193
 
194 194
 	//Hook it
195
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
195
+	do_action('give_insert_payment', $payment->ID, $payment_data);
196 196
 
197 197
 	//Return payment ID upon success
198
-	if ( ! empty( $payment->ID ) ) {
198
+	if ( ! empty($payment->ID)) {
199 199
 		return $payment->ID;
200 200
 	}
201 201
 
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * @return bool
216 216
  */
217
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
217
+function give_update_payment_status($payment_id, $new_status = 'publish') {
218 218
 
219
-	$payment         = new Give_Payment( $payment_id );
219
+	$payment         = new Give_Payment($payment_id);
220 220
 	$payment->status = $new_status;
221 221
 	$updated         = $payment->save();
222 222
 
@@ -236,52 +236,52 @@  discard block
 block discarded – undo
236 236
  *
237 237
  * @return void
238 238
  */
239
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
239
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
240 240
 	global $give_logs;
241 241
 
242
-	$payment     = new Give_Payment( $payment_id );
243
-	$amount      = give_get_payment_amount( $payment_id );
242
+	$payment     = new Give_Payment($payment_id);
243
+	$amount      = give_get_payment_amount($payment_id);
244 244
 	$status      = $payment->post_status;
245
-	$customer_id = give_get_payment_customer_id( $payment_id );
246
-	$customer    = new Give_Customer( $customer_id );
245
+	$customer_id = give_get_payment_customer_id($payment_id);
246
+	$customer    = new Give_Customer($customer_id);
247 247
 
248 248
 	//Only undo purchases that aren't these statuses
249
-	$dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array(
249
+	$dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array(
250 250
 		'pending',
251 251
 		'cancelled'
252
-	) );
252
+	));
253 253
 
254
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
255
-		give_undo_purchase( false, $payment_id );
254
+	if ( ! in_array($status, $dont_undo_statuses)) {
255
+		give_undo_purchase(false, $payment_id);
256 256
 	}
257 257
 
258
-	if ( $status == 'publish' ) {
258
+	if ($status == 'publish') {
259 259
 
260 260
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment)
261
-		give_decrease_total_earnings( $amount );
261
+		give_decrease_total_earnings($amount);
262 262
 		// Clear the This Month earnings (this_monththis_month is NOT a typo)
263
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
263
+		delete_transient(md5('give_earnings_this_monththis_month'));
264 264
 
265
-		if ( $customer->id && $update_customer ) {
265
+		if ($customer->id && $update_customer) {
266 266
 
267 267
 			// Decrement the stats for the customer
268 268
 			$customer->decrease_purchase_count();
269
-			$customer->decrease_value( $amount );
269
+			$customer->decrease_value($amount);
270 270
 
271 271
 		}
272 272
 	}
273 273
 
274
-	do_action( 'give_payment_delete', $payment_id );
274
+	do_action('give_payment_delete', $payment_id);
275 275
 
276
-	if ( $customer->id && $update_customer ) {
276
+	if ($customer->id && $update_customer) {
277 277
 
278 278
 		// Remove the payment ID from the customer
279
-		$customer->remove_payment( $payment_id );
279
+		$customer->remove_payment($payment_id);
280 280
 
281 281
 	}
282 282
 
283 283
 	// Remove the payment
284
-	wp_delete_post( $payment_id, true );
284
+	wp_delete_post($payment_id, true);
285 285
 
286 286
 	// Remove related sale log entries
287 287
 	$give_logs->delete_logs(
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		)
296 296
 	);
297 297
 
298
-	do_action( 'give_payment_deleted', $payment_id );
298
+	do_action('give_payment_deleted', $payment_id);
299 299
 }
300 300
 
301 301
 /**
@@ -311,25 +311,25 @@  discard block
 block discarded – undo
311 311
  *
312 312
  * @return void
313 313
  */
314
-function give_undo_purchase( $form_id = false, $payment_id ) {
314
+function give_undo_purchase($form_id = false, $payment_id) {
315 315
 
316
-	if ( ! empty( $form_id ) ) {
316
+	if ( ! empty($form_id)) {
317 317
 		$form_id = false;
318
-		_give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' );
318
+		_give_deprected_argument('form_id', 'give_undo_purchase', '1.5');
319 319
 	}
320 320
 
321
-	$payment = new Give_Payment( $payment_id );
321
+	$payment = new Give_Payment($payment_id);
322 322
 
323
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
324
-	if ( true === $maybe_decrease_earnings ) {
323
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
324
+	if (true === $maybe_decrease_earnings) {
325 325
 		// decrease earnings
326
-		give_decrease_earnings( $payment->form_id, $payment->total );
326
+		give_decrease_earnings($payment->form_id, $payment->total);
327 327
 	}
328 328
 
329
-	$maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id );
330
-	if ( true === $maybe_decrease_sales ) {
329
+	$maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id);
330
+	if (true === $maybe_decrease_sales) {
331 331
 		// decrease purchase count
332
-		give_decrease_purchase_count( $payment->form_id );
332
+		give_decrease_purchase_count($payment->form_id);
333 333
 	}
334 334
 
335 335
 }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return array $count Number of payments sorted by payment status
348 348
  */
349
-function give_count_payments( $args = array() ) {
349
+function give_count_payments($args = array()) {
350 350
 
351 351
 	global $wpdb;
352 352
 
@@ -358,18 +358,18 @@  discard block
 block discarded – undo
358 358
 		'form_id'    => null,
359 359
 	);
360 360
 
361
-	$args = wp_parse_args( $args, $defaults );
361
+	$args = wp_parse_args($args, $defaults);
362 362
 
363 363
 	$select = "SELECT p.post_status,count( * ) AS num_posts";
364 364
 	$join   = '';
365 365
 	$where  = "WHERE p.post_type = 'give_payment'";
366 366
 
367 367
 	// Count payments for a specific user
368
-	if ( ! empty( $args['user'] ) ) {
368
+	if ( ! empty($args['user'])) {
369 369
 
370
-		if ( is_email( $args['user'] ) ) {
370
+		if (is_email($args['user'])) {
371 371
 			$field = 'email';
372
-		} elseif ( is_numeric( $args['user'] ) ) {
372
+		} elseif (is_numeric($args['user'])) {
373 373
 			$field = 'id';
374 374
 		} else {
375 375
 			$field = '';
@@ -377,108 +377,108 @@  discard block
 block discarded – undo
377 377
 
378 378
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
379 379
 
380
-		if ( ! empty( $field ) ) {
380
+		if ( ! empty($field)) {
381 381
 			$where .= "
382 382
 				AND m.meta_key = '_give_payment_user_{$field}'
383 383
 				AND m.meta_value = '{$args['user']}'";
384 384
 		}
385 385
 
386 386
 		// Count payments for a search
387
-	} elseif ( ! empty( $args['s'] ) ) {
387
+	} elseif ( ! empty($args['s'])) {
388 388
 
389
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
389
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
390 390
 
391
-			if ( is_email( $args['s'] ) ) {
391
+			if (is_email($args['s'])) {
392 392
 				$field = '_give_payment_user_email';
393 393
 			} else {
394 394
 				$field = '_give_payment_purchase_key';
395 395
 			}
396 396
 
397 397
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
398
-			$where .= $wpdb->prepare( "
398
+			$where .= $wpdb->prepare("
399 399
 				AND m.meta_key = %s
400 400
 				AND m.meta_value = %s",
401 401
 				$field,
402 402
 				$args['s']
403 403
 			);
404 404
 
405
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
405
+		} elseif ('#' == substr($args['s'], 0, 1)) {
406 406
 
407
-			$search = str_replace( '#:', '', $args['s'] );
408
-			$search = str_replace( '#', '', $search );
407
+			$search = str_replace('#:', '', $args['s']);
408
+			$search = str_replace('#', '', $search);
409 409
 
410 410
 			$select = "SELECT p2.post_status,count( * ) AS num_posts ";
411 411
 			$join   = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID ";
412 412
 			$join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID ";
413 413
 			$where = "WHERE p.post_type = 'give_log' ";
414
-			$where .= $wpdb->prepare( "AND p.post_parent = %d} ", $search );
414
+			$where .= $wpdb->prepare("AND p.post_parent = %d} ", $search);
415 415
 
416
-		} elseif ( is_numeric( $args['s'] ) ) {
416
+		} elseif (is_numeric($args['s'])) {
417 417
 
418 418
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
419
-			$where .= $wpdb->prepare( "
419
+			$where .= $wpdb->prepare("
420 420
 				AND m.meta_key = '_give_payment_user_id'
421 421
 				AND m.meta_value = %d",
422 422
 				$args['s']
423 423
 			);
424 424
 
425 425
 		} else {
426
-			$search = $wpdb->esc_like( $args['s'] );
427
-			$search = '%' . $search . '%';
426
+			$search = $wpdb->esc_like($args['s']);
427
+			$search = '%'.$search.'%';
428 428
 
429
-			$where .= $wpdb->prepare( "AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search );
429
+			$where .= $wpdb->prepare("AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search);
430 430
 		}
431 431
 
432 432
 	}
433 433
 
434
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
434
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
435 435
 
436
-		$where .= $wpdb->prepare( " AND p.post_parent = %d", $args['form_id'] );
436
+		$where .= $wpdb->prepare(" AND p.post_parent = %d", $args['form_id']);
437 437
 
438 438
 	}
439 439
 	// Limit payments count by date
440
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
440
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
441 441
 
442
-		$date_parts = explode( '/', $args['start-date'] );
443
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
444
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
445
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
442
+		$date_parts = explode('/', $args['start-date']);
443
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
444
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
445
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
446 446
 
447
-		$is_date = checkdate( $month, $day, $year );
448
-		if ( false !== $is_date ) {
447
+		$is_date = checkdate($month, $day, $year);
448
+		if (false !== $is_date) {
449 449
 
450
-			$date = new DateTime( $args['start-date'] );
451
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
450
+			$date = new DateTime($args['start-date']);
451
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
452 452
 
453 453
 		}
454 454
 
455 455
 		// Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class)
456
-		if ( empty( $args['end-date'] ) ) {
456
+		if (empty($args['end-date'])) {
457 457
 			$args['end-date'] = $args['start-date'];
458 458
 		}
459 459
 
460 460
 	}
461 461
 
462
-	if ( ! empty ( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
462
+	if ( ! empty ($args['end-date']) && false !== strpos($args['end-date'], '/')) {
463 463
 
464
-		$date_parts = explode( '/', $args['end-date'] );
464
+		$date_parts = explode('/', $args['end-date']);
465 465
 
466
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
467
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
468
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
466
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
467
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
468
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
469 469
 
470
-		$is_date = checkdate( $month, $day, $year );
471
-		if ( false !== $is_date ) {
470
+		$is_date = checkdate($month, $day, $year);
471
+		if (false !== $is_date) {
472 472
 
473
-			$date = new DateTime( $args['end-date'] );
474
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
473
+			$date = new DateTime($args['end-date']);
474
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
475 475
 
476 476
 		}
477 477
 
478 478
 	}
479 479
 
480
-	$where = apply_filters( 'give_count_payments_where', $where );
481
-	$join  = apply_filters( 'give_count_payments_join', $join );
480
+	$where = apply_filters('give_count_payments_where', $where);
481
+	$join  = apply_filters('give_count_payments_join', $join);
482 482
 
483 483
 	$query = "$select
484 484
 		FROM $wpdb->posts p
@@ -487,36 +487,36 @@  discard block
 block discarded – undo
487 487
 		GROUP BY p.post_status
488 488
 	";
489 489
 
490
-	$cache_key = md5( $query );
490
+	$cache_key = md5($query);
491 491
 
492
-	$count = wp_cache_get( $cache_key, 'counts' );
493
-	if ( false !== $count ) {
492
+	$count = wp_cache_get($cache_key, 'counts');
493
+	if (false !== $count) {
494 494
 		return $count;
495 495
 	}
496 496
 
497
-	$count = $wpdb->get_results( $query, ARRAY_A );
497
+	$count = $wpdb->get_results($query, ARRAY_A);
498 498
 
499 499
 	$stats    = array();
500 500
 	$statuses = get_post_stati();
501
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
502
-		unset( $statuses['private'] );
501
+	if (isset($statuses['private']) && empty($args['s'])) {
502
+		unset($statuses['private']);
503 503
 	}
504 504
 
505
-	foreach ( $statuses as $state ) {
506
-		$stats[ $state ] = 0;
505
+	foreach ($statuses as $state) {
506
+		$stats[$state] = 0;
507 507
 	}
508 508
 
509
-	foreach ( (array) $count as $row ) {
509
+	foreach ((array) $count as $row) {
510 510
 
511
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
511
+		if ('private' == $row['post_status'] && empty($args['s'])) {
512 512
 			continue;
513 513
 		}
514 514
 
515
-		$stats[ $row['post_status'] ] = $row['num_posts'];
515
+		$stats[$row['post_status']] = $row['num_posts'];
516 516
 	}
517 517
 
518 518
 	$stats = (object) $stats;
519
-	wp_cache_set( $cache_key, $stats, 'counts' );
519
+	wp_cache_set($cache_key, $stats, 'counts');
520 520
 
521 521
 	return $stats;
522 522
 }
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
  *
532 532
  * @return bool             True if payment exists, false otherwise
533 533
  */
534
-function give_check_for_existing_payment( $payment_id ) {
534
+function give_check_for_existing_payment($payment_id) {
535 535
 	$exists  = false;
536
-	$payment = new Give_Payment( $payment_id );
536
+	$payment = new Give_Payment($payment_id);
537 537
 
538 538
 
539
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
539
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
540 540
 		$exists = true;
541 541
 	}
542 542
 
@@ -553,29 +553,29 @@  discard block
 block discarded – undo
553 553
  *
554 554
  * @return bool|mixed           True if payment status exists, false otherwise
555 555
  */
556
-function give_get_payment_status( $payment, $return_label = false ) {
556
+function give_get_payment_status($payment, $return_label = false) {
557 557
 
558
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
558
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
559 559
 		return false;
560 560
 	}
561 561
 
562 562
 	$statuses = give_get_payment_statuses();
563 563
 
564
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
564
+	if ( ! is_array($statuses) || empty($statuses)) {
565 565
 		return false;
566 566
 	}
567 567
 
568
-	$payment = new Give_Payment( $payment->ID );
568
+	$payment = new Give_Payment($payment->ID);
569 569
 
570
-	if ( array_key_exists( $payment->status, $statuses ) ) {
571
-		if ( true === $return_label ) {
572
-			return $statuses[ $payment->status ];
570
+	if (array_key_exists($payment->status, $statuses)) {
571
+		if (true === $return_label) {
572
+			return $statuses[$payment->status];
573 573
 		} else {
574 574
 			// Account that our 'publish' status is labeled 'Complete'
575 575
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
576 576
 
577 577
 			// Make sure we're matching cases, since they matter
578
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
578
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
579 579
 		}
580 580
 	}
581 581
 
@@ -591,17 +591,17 @@  discard block
 block discarded – undo
591 591
  */
592 592
 function give_get_payment_statuses() {
593 593
 	$payment_statuses = array(
594
-		'pending'     => esc_html__( 'Pending', 'give' ),
595
-		'publish'     => esc_html__( 'Complete', 'give' ),
596
-		'refunded'    => esc_html__( 'Refunded', 'give' ),
597
-		'failed'      => esc_html__( 'Failed', 'give' ),
598
-		'cancelled'   => esc_html__( 'Cancelled', 'give' ),
599
-		'abandoned'   => esc_html__( 'Abandoned', 'give' ),
600
-		'preapproval' => esc_html__( 'Pre-Approved', 'give' ),
601
-		'revoked'     => esc_html__( 'Revoked', 'give' )
594
+		'pending'     => esc_html__('Pending', 'give'),
595
+		'publish'     => esc_html__('Complete', 'give'),
596
+		'refunded'    => esc_html__('Refunded', 'give'),
597
+		'failed'      => esc_html__('Failed', 'give'),
598
+		'cancelled'   => esc_html__('Cancelled', 'give'),
599
+		'abandoned'   => esc_html__('Abandoned', 'give'),
600
+		'preapproval' => esc_html__('Pre-Approved', 'give'),
601
+		'revoked'     => esc_html__('Revoked', 'give')
602 602
 	);
603 603
 
604
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
604
+	return apply_filters('give_payment_statuses', $payment_statuses);
605 605
 }
606 606
 
607 607
 /**
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
  * @return array $payment_status All the available payment statuses.
615 615
  */
616 616
 function give_get_payment_status_keys() {
617
-	$statuses = array_keys( give_get_payment_statuses() );
618
-	asort( $statuses );
617
+	$statuses = array_keys(give_get_payment_statuses());
618
+	asort($statuses);
619 619
 
620
-	return array_values( $statuses );
620
+	return array_values($statuses);
621 621
 }
622 622
 
623 623
 /**
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
  *
633 633
  * @return int $earnings  Earnings
634 634
  */
635
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
635
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
636 636
 
637 637
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead
638 638
 
@@ -643,41 +643,41 @@  discard block
 block discarded – undo
643 643
 		'nopaging'               => true,
644 644
 		'year'                   => $year,
645 645
 		'monthnum'               => $month_num,
646
-		'post_status'            => array( 'publish' ),
646
+		'post_status'            => array('publish'),
647 647
 		'fields'                 => 'ids',
648 648
 		'update_post_term_cache' => false
649 649
 	);
650
-	if ( ! empty( $day ) ) {
650
+	if ( ! empty($day)) {
651 651
 		$args['day'] = $day;
652 652
 	}
653 653
 
654
-	if ( ! empty( $hour ) ) {
654
+	if ( ! empty($hour)) {
655 655
 		$args['hour'] = $hour;
656 656
 	}
657 657
 
658
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
659
-	$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
658
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
659
+	$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
660 660
 
661
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
661
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
662 662
 		$earnings = false;
663 663
 	} else {
664
-		$earnings = get_transient( $key );
664
+		$earnings = get_transient($key);
665 665
 	}
666 666
 
667
-	if ( false === $earnings ) {
668
-		$sales    = get_posts( $args );
667
+	if (false === $earnings) {
668
+		$sales    = get_posts($args);
669 669
 		$earnings = 0;
670
-		if ( $sales ) {
671
-			$sales = implode( ',', $sales );
670
+		if ($sales) {
671
+			$sales = implode(',', $sales);
672 672
 
673
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" );
673
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})");
674 674
 
675 675
 		}
676 676
 		// Cache the results for one hour
677
-		set_transient( $key, $earnings, HOUR_IN_SECONDS );
677
+		set_transient($key, $earnings, HOUR_IN_SECONDS);
678 678
 	}
679 679
 
680
-	return round( $earnings, 2 );
680
+	return round($earnings, 2);
681 681
 }
682 682
 
683 683
 /**
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
  *
693 693
  * @return int $count     Sales
694 694
  */
695
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
695
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
696 696
 
697 697
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead
698 698
 	$args = array(
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 		'nopaging'               => true,
701 701
 		'year'                   => $year,
702 702
 		'fields'                 => 'ids',
703
-		'post_status'            => array( 'publish' ),
703
+		'post_status'            => array('publish'),
704 704
 		'update_post_meta_cache' => false,
705 705
 		'update_post_term_cache' => false
706 706
 	);
707 707
 
708
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
708
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
709 709
 
710
-	if ( false === $show_free ) {
710
+	if (false === $show_free) {
711 711
 		$args['meta_query'] = array(
712 712
 			array(
713 713
 				'key'     => '_give_payment_total',
@@ -718,33 +718,33 @@  discard block
 block discarded – undo
718 718
 		);
719 719
 	}
720 720
 
721
-	if ( ! empty( $month_num ) ) {
721
+	if ( ! empty($month_num)) {
722 722
 		$args['monthnum'] = $month_num;
723 723
 	}
724 724
 
725
-	if ( ! empty( $day ) ) {
725
+	if ( ! empty($day)) {
726 726
 		$args['day'] = $day;
727 727
 	}
728 728
 
729
-	if ( ! empty( $hour ) ) {
729
+	if ( ! empty($hour)) {
730 730
 		$args['hour'] = $hour;
731 731
 	}
732 732
 
733
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
733
+	$args = apply_filters('give_get_sales_by_date_args', $args);
734 734
 
735
-	$key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
735
+	$key = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
736 736
 
737
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
737
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
738 738
 		$count = false;
739 739
 	} else {
740
-		$count = get_transient( $key );
740
+		$count = get_transient($key);
741 741
 	}
742 742
 
743
-	if ( false === $count ) {
744
-		$sales = new WP_Query( $args );
743
+	if (false === $count) {
744
+		$sales = new WP_Query($args);
745 745
 		$count = (int) $sales->post_count;
746 746
 		// Cache the results for one hour
747
-		set_transient( $key, $count, HOUR_IN_SECONDS );
747
+		set_transient($key, $count, HOUR_IN_SECONDS);
748 748
 	}
749 749
 
750 750
 	return $count;
@@ -759,20 +759,20 @@  discard block
 block discarded – undo
759 759
  *
760 760
  * @return bool            True if complete, false otherwise.
761 761
  */
762
-function give_is_payment_complete( $payment_id ) {
763
-	$payment = new Give_Payment( $payment_id );
762
+function give_is_payment_complete($payment_id) {
763
+	$payment = new Give_Payment($payment_id);
764 764
 
765 765
 	$ret = false;
766 766
 
767
-	if ( $payment->ID > 0 ) {
767
+	if ($payment->ID > 0) {
768 768
 
769
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
769
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
770 770
 			$ret = true;
771 771
 		}
772 772
 
773 773
 	}
774 774
 
775
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
775
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
776 776
 }
777 777
 
778 778
 /**
@@ -798,29 +798,29 @@  discard block
 block discarded – undo
798 798
  */
799 799
 function give_get_total_earnings() {
800 800
 
801
-	$total = get_option( 'give_earnings_total', false );
801
+	$total = get_option('give_earnings_total', false);
802 802
 
803 803
 	// If no total stored in DB, use old method of calculating total earnings
804
-	if ( false === $total ) {
804
+	if (false === $total) {
805 805
 
806 806
 		global $wpdb;
807 807
 
808
-		$total = get_transient( 'give_earnings_total' );
808
+		$total = get_transient('give_earnings_total');
809 809
 
810
-		if ( false === $total ) {
810
+		if (false === $total) {
811 811
 
812 812
 			$total = (float) 0;
813 813
 
814
-			$args = apply_filters( 'give_get_total_earnings_args', array(
814
+			$args = apply_filters('give_get_total_earnings_args', array(
815 815
 				'offset' => 0,
816
-				'number' => - 1,
817
-				'status' => array( 'publish' ),
816
+				'number' => -1,
817
+				'status' => array('publish'),
818 818
 				'fields' => 'ids'
819
-			) );
819
+			));
820 820
 
821 821
 
822
-			$payments = give_get_payments( $args );
823
-			if ( $payments ) {
822
+			$payments = give_get_payments($args);
823
+			if ($payments) {
824 824
 
825 825
 				/*
826 826
 				 * If performing a purchase, we need to skip the very last payment in the database, since it calls
@@ -828,30 +828,30 @@  discard block
 block discarded – undo
828 828
 				 * first purchase
829 829
 				 */
830 830
 
831
-				if ( did_action( 'give_update_payment_status' ) ) {
832
-					array_pop( $payments );
831
+				if (did_action('give_update_payment_status')) {
832
+					array_pop($payments);
833 833
 				}
834 834
 
835
-				if ( ! empty( $payments ) ) {
836
-					$payments = implode( ',', $payments );
837
-					$total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
835
+				if ( ! empty($payments)) {
836
+					$payments = implode(',', $payments);
837
+					$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
838 838
 				}
839 839
 
840 840
 			}
841 841
 
842 842
 			// Cache results for 1 day. This cache is cleared automatically when a payment is made
843
-			set_transient( 'give_earnings_total', $total, 86400 );
843
+			set_transient('give_earnings_total', $total, 86400);
844 844
 
845 845
 			// Store the total for the first time
846
-			update_option( 'give_earnings_total', $total );
846
+			update_option('give_earnings_total', $total);
847 847
 		}
848 848
 	}
849 849
 
850
-	if ( $total < 0 ) {
850
+	if ($total < 0) {
851 851
 		$total = 0; // Don't ever show negative earnings
852 852
 	}
853 853
 
854
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
854
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
855 855
 }
856 856
 
857 857
 /**
@@ -864,10 +864,10 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return float $total  Total earnings.
866 866
  */
867
-function give_increase_total_earnings( $amount = 0 ) {
867
+function give_increase_total_earnings($amount = 0) {
868 868
 	$total = give_get_total_earnings();
869 869
 	$total += $amount;
870
-	update_option( 'give_earnings_total', $total );
870
+	update_option('give_earnings_total', $total);
871 871
 
872 872
 	return $total;
873 873
 }
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @return float $total Total earnings
883 883
  */
884
-function give_decrease_total_earnings( $amount = 0 ) {
884
+function give_decrease_total_earnings($amount = 0) {
885 885
 	$total = give_get_total_earnings();
886 886
 	$total -= $amount;
887
-	if ( $total < 0 ) {
887
+	if ($total < 0) {
888 888
 		$total = 0;
889 889
 	}
890
-	update_option( 'give_earnings_total', $total );
890
+	update_option('give_earnings_total', $total);
891 891
 
892 892
 	return $total;
893 893
 }
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
  *
904 904
  * @return mixed $meta Payment Meta
905 905
  */
906
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
907
-	$payment = new Give_Payment( $payment_id );
906
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
907
+	$payment = new Give_Payment($payment_id);
908 908
 
909
-	return $payment->get_meta( $meta_key, $single );
909
+	return $payment->get_meta($meta_key, $single);
910 910
 }
911 911
 
912 912
 /**
@@ -919,10 +919,10 @@  discard block
 block discarded – undo
919 919
  *
920 920
  * @return mixed               Meta ID if successful, false if unsuccessful
921 921
  */
922
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
923
-	$payment = new Give_Payment( $payment_id );
922
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
923
+	$payment = new Give_Payment($payment_id);
924 924
 
925
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
925
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
926 926
 }
927 927
 
928 928
 /**
@@ -934,8 +934,8 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return array $user_info User Info Meta Values
936 936
  */
937
-function give_get_payment_meta_user_info( $payment_id ) {
938
-	$payment = new Give_Payment( $payment_id );
937
+function give_get_payment_meta_user_info($payment_id) {
938
+	$payment = new Give_Payment($payment_id);
939 939
 
940 940
 	return $payment->user_info;
941 941
 }
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
  *
951 951
  * @return int $form_id
952 952
  */
953
-function give_get_payment_form_id( $payment_id ) {
954
-	$payment = new Give_Payment( $payment_id );
953
+function give_get_payment_form_id($payment_id) {
954
+	$payment = new Give_Payment($payment_id);
955 955
 
956 956
 	return $payment->form_id;
957 957
 }
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
  *
966 966
  * @return string $email User Email
967 967
  */
968
-function give_get_payment_user_email( $payment_id ) {
969
-	$payment = new Give_Payment( $payment_id );
968
+function give_get_payment_user_email($payment_id) {
969
+	$payment = new Give_Payment($payment_id);
970 970
 
971 971
 	return $payment->email;
972 972
 }
@@ -980,11 +980,11 @@  discard block
 block discarded – undo
980 980
  *
981 981
  * @return bool            If the payment is associated with a user (false) or not (true)
982 982
  */
983
-function give_is_guest_payment( $payment_id ) {
984
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
985
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
983
+function give_is_guest_payment($payment_id) {
984
+	$payment_user_id  = give_get_payment_user_id($payment_id);
985
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
986 986
 
987
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
987
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
988 988
 }
989 989
 
990 990
 /**
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
  *
997 997
  * @return string $user_id User ID
998 998
  */
999
-function give_get_payment_user_id( $payment_id ) {
1000
-	$payment = new Give_Payment( $payment_id );
999
+function give_get_payment_user_id($payment_id) {
1000
+	$payment = new Give_Payment($payment_id);
1001 1001
 
1002 1002
 	return $payment->user_id;
1003 1003
 }
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
  *
1012 1012
  * @return string $customer_id Customer ID
1013 1013
  */
1014
-function give_get_payment_customer_id( $payment_id ) {
1015
-	$payment = new Give_Payment( $payment_id );
1014
+function give_get_payment_customer_id($payment_id) {
1015
+	$payment = new Give_Payment($payment_id);
1016 1016
 
1017 1017
 	return $payment->customer_id;
1018 1018
 }
@@ -1026,8 +1026,8 @@  discard block
 block discarded – undo
1026 1026
  *
1027 1027
  * @return string $ip User IP
1028 1028
  */
1029
-function give_get_payment_user_ip( $payment_id ) {
1030
-	$payment = new Give_Payment( $payment_id );
1029
+function give_get_payment_user_ip($payment_id) {
1030
+	$payment = new Give_Payment($payment_id);
1031 1031
 
1032 1032
 	return $payment->ip;
1033 1033
 }
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
  *
1042 1042
  * @return string $date The date the payment was completed
1043 1043
  */
1044
-function give_get_payment_completed_date( $payment_id = 0 ) {
1045
-	$payment = new Give_Payment( $payment_id );
1044
+function give_get_payment_completed_date($payment_id = 0) {
1045
+	$payment = new Give_Payment($payment_id);
1046 1046
 
1047 1047
 	return $payment->completed_date;
1048 1048
 }
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
  *
1057 1057
  * @return string $gateway Gateway
1058 1058
  */
1059
-function give_get_payment_gateway( $payment_id ) {
1060
-	$payment = new Give_Payment( $payment_id );
1059
+function give_get_payment_gateway($payment_id) {
1060
+	$payment = new Give_Payment($payment_id);
1061 1061
 
1062 1062
 	return $payment->gateway;
1063 1063
 }
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
  *
1072 1072
  * @return string $currency The currency code
1073 1073
  */
1074
-function give_get_payment_currency_code( $payment_id = 0 ) {
1075
-	$payment = new Give_Payment( $payment_id );
1074
+function give_get_payment_currency_code($payment_id = 0) {
1075
+	$payment = new Give_Payment($payment_id);
1076 1076
 
1077 1077
 	return $payment->currency;
1078 1078
 }
@@ -1086,10 +1086,10 @@  discard block
 block discarded – undo
1086 1086
  *
1087 1087
  * @return string $currency The currency name
1088 1088
  */
1089
-function give_get_payment_currency( $payment_id = 0 ) {
1090
-	$currency = give_get_payment_currency_code( $payment_id );
1089
+function give_get_payment_currency($payment_id = 0) {
1090
+	$currency = give_get_payment_currency_code($payment_id);
1091 1091
 
1092
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1092
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1093 1093
 }
1094 1094
 
1095 1095
 /**
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
  *
1102 1102
  * @return string $key Purchase key
1103 1103
  */
1104
-function give_get_payment_key( $payment_id = 0 ) {
1105
-	$payment = new Give_Payment( $payment_id );
1104
+function give_get_payment_key($payment_id = 0) {
1105
+	$payment = new Give_Payment($payment_id);
1106 1106
 
1107 1107
 	return $payment->key;
1108 1108
 }
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
  *
1119 1119
  * @return string $number Payment order number
1120 1120
  */
1121
-function give_get_payment_number( $payment_id = 0 ) {
1122
-	$payment = new Give_Payment( $payment_id );
1121
+function give_get_payment_number($payment_id = 0) {
1122
+	$payment = new Give_Payment($payment_id);
1123 1123
 
1124 1124
 	return $payment->number;
1125 1125
 }
@@ -1133,23 +1133,23 @@  discard block
 block discarded – undo
1133 1133
  *
1134 1134
  * @return string      The formatted payment number
1135 1135
  */
1136
-function give_format_payment_number( $number ) {
1136
+function give_format_payment_number($number) {
1137 1137
 
1138
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1138
+	if ( ! give_get_option('enable_sequential')) {
1139 1139
 		return $number;
1140 1140
 	}
1141 1141
 
1142
-	if ( ! is_numeric( $number ) ) {
1142
+	if ( ! is_numeric($number)) {
1143 1143
 		return $number;
1144 1144
 	}
1145 1145
 
1146
-	$prefix  = give_get_option( 'sequential_prefix' );
1147
-	$number  = absint( $number );
1148
-	$postfix = give_get_option( 'sequential_postfix' );
1146
+	$prefix  = give_get_option('sequential_prefix');
1147
+	$number  = absint($number);
1148
+	$postfix = give_get_option('sequential_postfix');
1149 1149
 
1150
-	$formatted_number = $prefix . $number . $postfix;
1150
+	$formatted_number = $prefix.$number.$postfix;
1151 1151
 
1152
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1152
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1153 1153
 }
1154 1154
 
1155 1155
 /**
@@ -1162,17 +1162,17 @@  discard block
 block discarded – undo
1162 1162
  */
1163 1163
 function give_get_next_payment_number() {
1164 1164
 
1165
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1165
+	if ( ! give_get_option('enable_sequential')) {
1166 1166
 		return false;
1167 1167
 	}
1168 1168
 
1169
-	$number           = get_option( 'give_last_payment_number' );
1170
-	$start            = give_get_option( 'sequential_start', 1 );
1169
+	$number           = get_option('give_last_payment_number');
1170
+	$start            = give_get_option('sequential_start', 1);
1171 1171
 	$increment_number = true;
1172 1172
 
1173
-	if ( false !== $number ) {
1173
+	if (false !== $number) {
1174 1174
 
1175
-		if ( empty( $number ) ) {
1175
+		if (empty($number)) {
1176 1176
 
1177 1177
 			$number           = $start;
1178 1178
 			$increment_number = false;
@@ -1182,24 +1182,24 @@  discard block
 block discarded – undo
1182 1182
 	} else {
1183 1183
 
1184 1184
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason
1185
-		$payments     = new Give_Payments_Query( array(
1185
+		$payments = new Give_Payments_Query(array(
1186 1186
 			'number'  => 1,
1187 1187
 			'order'   => 'DESC',
1188 1188
 			'orderby' => 'ID',
1189 1189
 			'output'  => 'posts',
1190 1190
 			'fields'  => 'ids'
1191
-		) );
1191
+		));
1192 1192
 		$last_payment = $payments->get_payments();
1193 1193
 
1194
-		if ( ! empty( $last_payment ) ) {
1194
+		if ( ! empty($last_payment)) {
1195 1195
 
1196
-			$number = give_get_payment_number( $last_payment[0] );
1196
+			$number = give_get_payment_number($last_payment[0]);
1197 1197
 
1198 1198
 		}
1199 1199
 
1200
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1200
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1201 1201
 
1202
-			$number = give_remove_payment_prefix_postfix( $number );
1202
+			$number = give_remove_payment_prefix_postfix($number);
1203 1203
 
1204 1204
 		} else {
1205 1205
 
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 	}
1211 1211
 
1212
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1212
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1213 1213
 
1214
-	if ( $increment_number ) {
1215
-		$number ++;
1214
+	if ($increment_number) {
1215
+		$number++;
1216 1216
 	}
1217 1217
 
1218
-	return apply_filters( 'give_get_next_payment_number', $number );
1218
+	return apply_filters('give_get_next_payment_number', $number);
1219 1219
 }
1220 1220
 
1221 1221
 /**
@@ -1227,25 +1227,25 @@  discard block
 block discarded – undo
1227 1227
  *
1228 1228
  * @return string          The new Payment number without prefix and postfix
1229 1229
  */
1230
-function give_remove_payment_prefix_postfix( $number ) {
1230
+function give_remove_payment_prefix_postfix($number) {
1231 1231
 
1232
-	$prefix  = give_get_option( 'sequential_prefix' );
1233
-	$postfix = give_get_option( 'sequential_postfix' );
1232
+	$prefix  = give_get_option('sequential_prefix');
1233
+	$postfix = give_get_option('sequential_postfix');
1234 1234
 
1235 1235
 	// Remove prefix
1236
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1236
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1237 1237
 
1238 1238
 	// Remove the postfix
1239
-	$length      = strlen( $number );
1240
-	$postfix_pos = strrpos( $number, $postfix );
1241
-	if ( false !== $postfix_pos ) {
1242
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1239
+	$length      = strlen($number);
1240
+	$postfix_pos = strrpos($number, $postfix);
1241
+	if (false !== $postfix_pos) {
1242
+		$number = substr_replace($number, '', $postfix_pos, $length);
1243 1243
 	}
1244 1244
 
1245 1245
 	// Ensure it's a whole number
1246
-	$number = intval( $number );
1246
+	$number = intval($number);
1247 1247
 
1248
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1248
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1249 1249
 
1250 1250
 }
1251 1251
 
@@ -1261,10 +1261,10 @@  discard block
 block discarded – undo
1261 1261
  *
1262 1262
  * @return string $amount Fully formatted payment amount
1263 1263
  */
1264
-function give_payment_amount( $payment_id = 0 ) {
1265
-	$amount = give_get_payment_amount( $payment_id );
1264
+function give_payment_amount($payment_id = 0) {
1265
+	$amount = give_get_payment_amount($payment_id);
1266 1266
 
1267
-	return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) );
1267
+	return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
1268 1268
 }
1269 1269
 
1270 1270
 /**
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
  *
1278 1278
  * @return mixed|void
1279 1279
  */
1280
-function give_get_payment_amount( $payment_id ) {
1280
+function give_get_payment_amount($payment_id) {
1281 1281
 
1282
-	$payment = new Give_Payment( $payment_id );
1282
+	$payment = new Give_Payment($payment_id);
1283 1283
 
1284
-	return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id );
1284
+	return apply_filters('give_payment_amount', floatval($payment->total), $payment_id);
1285 1285
 }
1286 1286
 
1287 1287
 /**
@@ -1297,10 +1297,10 @@  discard block
 block discarded – undo
1297 1297
  *
1298 1298
  * @return array Fully formatted payment subtotal
1299 1299
  */
1300
-function give_payment_subtotal( $payment_id = 0 ) {
1301
-	$subtotal = give_get_payment_subtotal( $payment_id );
1300
+function give_payment_subtotal($payment_id = 0) {
1301
+	$subtotal = give_get_payment_subtotal($payment_id);
1302 1302
 
1303
-	return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) );
1303
+	return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id));
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
  *
1315 1315
  * @return float $subtotal Subtotal for payment (non formatted)
1316 1316
  */
1317
-function give_get_payment_subtotal( $payment_id = 0 ) {
1318
-	$payment = new G_Payment( $payment_id );
1317
+function give_get_payment_subtotal($payment_id = 0) {
1318
+	$payment = new G_Payment($payment_id);
1319 1319
 
1320 1320
 	return $payment->subtotal;
1321 1321
 }
@@ -1330,10 +1330,10 @@  discard block
 block discarded – undo
1330 1330
  *
1331 1331
  * @return mixed array if payment fees found, false otherwise
1332 1332
  */
1333
-function give_get_payment_fees( $payment_id = 0, $type = 'all' ) {
1334
-	$payment = new Give_Payment( $payment_id );
1333
+function give_get_payment_fees($payment_id = 0, $type = 'all') {
1334
+	$payment = new Give_Payment($payment_id);
1335 1335
 
1336
-	return $payment->get_fees( $type );
1336
+	return $payment->get_fees($type);
1337 1337
 }
1338 1338
 
1339 1339
 /**
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
  *
1346 1346
  * @return string The Transaction ID
1347 1347
  */
1348
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1349
-	$payment = new Give_Payment( $payment_id );
1348
+function give_get_payment_transaction_id($payment_id = 0) {
1349
+	$payment = new Give_Payment($payment_id);
1350 1350
 
1351 1351
 	return $payment->transaction_id;
1352 1352
 }
@@ -1361,15 +1361,15 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @return bool|mixed
1363 1363
  */
1364
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1364
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1365 1365
 
1366
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1366
+	if (empty($payment_id) || empty($transaction_id)) {
1367 1367
 		return false;
1368 1368
 	}
1369 1369
 
1370
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1370
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1371 1371
 
1372
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1372
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1373 1373
 }
1374 1374
 
1375 1375
 /**
@@ -1383,12 +1383,12 @@  discard block
 block discarded – undo
1383 1383
  *
1384 1384
  * @return int $purchase Purchase ID
1385 1385
  */
1386
-function give_get_purchase_id_by_key( $key ) {
1386
+function give_get_purchase_id_by_key($key) {
1387 1387
 	global $wpdb;
1388 1388
 
1389
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) );
1389
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key));
1390 1390
 
1391
-	if ( $purchase != null ) {
1391
+	if ($purchase != null) {
1392 1392
 		return $purchase;
1393 1393
 	}
1394 1394
 
@@ -1407,12 +1407,12 @@  discard block
 block discarded – undo
1407 1407
  *
1408 1408
  * @return int $purchase Purchase ID
1409 1409
  */
1410
-function give_get_purchase_id_by_transaction_id( $key ) {
1410
+function give_get_purchase_id_by_transaction_id($key) {
1411 1411
 	global $wpdb;
1412 1412
 
1413
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1413
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1414 1414
 
1415
-	if ( $purchase != null ) {
1415
+	if ($purchase != null) {
1416 1416
 		return $purchase;
1417 1417
 	}
1418 1418
 
@@ -1429,19 +1429,19 @@  discard block
 block discarded – undo
1429 1429
  *
1430 1430
  * @return array $notes Payment Notes
1431 1431
  */
1432
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1432
+function give_get_payment_notes($payment_id = 0, $search = '') {
1433 1433
 
1434
-	if ( empty( $payment_id ) && empty( $search ) ) {
1434
+	if (empty($payment_id) && empty($search)) {
1435 1435
 		return false;
1436 1436
 	}
1437 1437
 
1438
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1439
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1438
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1439
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1440 1440
 
1441
-	$notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) );
1441
+	$notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search));
1442 1442
 
1443
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1444
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1443
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1444
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1445 1445
 
1446 1446
 	return $notes;
1447 1447
 }
@@ -1457,19 +1457,19 @@  discard block
 block discarded – undo
1457 1457
  *
1458 1458
  * @return int The new note ID
1459 1459
  */
1460
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1461
-	if ( empty( $payment_id ) ) {
1460
+function give_insert_payment_note($payment_id = 0, $note = '') {
1461
+	if (empty($payment_id)) {
1462 1462
 		return false;
1463 1463
 	}
1464 1464
 
1465
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1465
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1466 1466
 
1467
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1467
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1468 1468
 		'comment_post_ID'      => $payment_id,
1469 1469
 		'comment_content'      => $note,
1470 1470
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1471
-		'comment_date'         => current_time( 'mysql' ),
1472
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1471
+		'comment_date'         => current_time('mysql'),
1472
+		'comment_date_gmt'     => current_time('mysql', 1),
1473 1473
 		'comment_approved'     => 1,
1474 1474
 		'comment_parent'       => 0,
1475 1475
 		'comment_author'       => '',
@@ -1478,9 +1478,9 @@  discard block
 block discarded – undo
1478 1478
 		'comment_author_email' => '',
1479 1479
 		'comment_type'         => 'give_payment_note'
1480 1480
 
1481
-	) ) );
1481
+	)));
1482 1482
 
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1483
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1484
 
1485 1485
 	return $note_id;
1486 1486
 }
@@ -1495,14 +1495,14 @@  discard block
 block discarded – undo
1495 1495
  *
1496 1496
  * @return bool True on success, false otherwise
1497 1497
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1498
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1499
+	if (empty($comment_id)) {
1500 1500
 		return false;
1501 1501
 	}
1502 1502
 
1503
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1504
-	$ret = wp_delete_comment( $comment_id, true );
1505
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1503
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1504
+	$ret = wp_delete_comment($comment_id, true);
1505
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1506 1506
 
1507 1507
 	return $ret;
1508 1508
 }
@@ -1517,32 +1517,32 @@  discard block
 block discarded – undo
1517 1517
  *
1518 1518
  * @return string
1519 1519
  */
1520
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1520
+function give_get_payment_note_html($note, $payment_id = 0) {
1521 1521
 
1522
-	if ( is_numeric( $note ) ) {
1523
-		$note = get_comment( $note );
1522
+	if (is_numeric($note)) {
1523
+		$note = get_comment($note);
1524 1524
 	}
1525 1525
 
1526
-	if ( ! empty( $note->user_id ) ) {
1527
-		$user = get_userdata( $note->user_id );
1526
+	if ( ! empty($note->user_id)) {
1527
+		$user = get_userdata($note->user_id);
1528 1528
 		$user = $user->display_name;
1529 1529
 	} else {
1530
-		$user = esc_html__( 'System', 'give' );
1530
+		$user = esc_html__('System', 'give');
1531 1531
 	}
1532 1532
 
1533
-	$date_format = get_option( 'date_format' ) . ', ' . get_option( 'time_format' );
1533
+	$date_format = get_option('date_format').', '.get_option('time_format');
1534 1534
 
1535
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1535
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1536 1536
 		'give-action' => 'delete_payment_note',
1537 1537
 		'note_id'     => $note->comment_ID,
1538 1538
 		'payment_id'  => $payment_id
1539
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1539
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1540 1540
 
1541
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1541
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1542 1542
 	$note_html .= '<p>';
1543
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1543
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1544 1544
 	$note_html .= $note->comment_content;
1545
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" title="' . esc_attr__( 'Delete this payment note', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
1545
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" title="'.esc_attr__('Delete this payment note', 'give').'">'.esc_html__('Delete', 'give').'</a>';
1546 1546
 	$note_html .= '</p>';
1547 1547
 	$note_html .= '</div>';
1548 1548
 
@@ -1560,20 +1560,20 @@  discard block
 block discarded – undo
1560 1560
  *
1561 1561
  * @return void
1562 1562
  */
1563
-function give_hide_payment_notes( $query ) {
1563
+function give_hide_payment_notes($query) {
1564 1564
 	global $wp_version;
1565 1565
 
1566
-	if ( version_compare( floatval( $wp_version ), '4.1', '>=' ) ) {
1567
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1568
-		if ( ! is_array( $types ) ) {
1569
-			$types = array( $types );
1566
+	if (version_compare(floatval($wp_version), '4.1', '>=')) {
1567
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1568
+		if ( ! is_array($types)) {
1569
+			$types = array($types);
1570 1570
 		}
1571 1571
 		$types[]                           = 'give_payment_note';
1572 1572
 		$query->query_vars['type__not_in'] = $types;
1573 1573
 	}
1574 1574
 }
1575 1575
 
1576
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1576
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1577 1577
 
1578 1578
 /**
1579 1579
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1585,17 +1585,17 @@  discard block
 block discarded – undo
1585 1585
  *
1586 1586
  * @return array $clauses Updated comment clauses
1587 1587
  */
1588
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1588
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1589 1589
 	global $wpdb, $wp_version;
1590 1590
 
1591
-	if ( version_compare( floatval( $wp_version ), '4.1', '<' ) ) {
1591
+	if (version_compare(floatval($wp_version), '4.1', '<')) {
1592 1592
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1593 1593
 	}
1594 1594
 
1595 1595
 	return $clauses;
1596 1596
 }
1597 1597
 
1598
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1598
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1599 1599
 
1600 1600
 
1601 1601
 /**
@@ -1608,15 +1608,15 @@  discard block
 block discarded – undo
1608 1608
  *
1609 1609
  * @return array $where
1610 1610
  */
1611
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1611
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1612 1612
 	global $wpdb;
1613 1613
 
1614
-	$where .= $wpdb->prepare( " AND comment_type != %s", 'give_payment_note' );
1614
+	$where .= $wpdb->prepare(" AND comment_type != %s", 'give_payment_note');
1615 1615
 
1616 1616
 	return $where;
1617 1617
 }
1618 1618
 
1619
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1619
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1620 1620
 
1621 1621
 
1622 1622
 /**
@@ -1630,32 +1630,32 @@  discard block
 block discarded – undo
1630 1630
  *
1631 1631
  * @return array Array of comment counts
1632 1632
  */
1633
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1633
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1634 1634
 	global $wpdb, $pagenow;
1635 1635
 
1636
-	if ( 'index.php' != $pagenow ) {
1636
+	if ('index.php' != $pagenow) {
1637 1637
 		return $stats;
1638 1638
 	}
1639 1639
 
1640 1640
 	$post_id = (int) $post_id;
1641 1641
 
1642
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1642
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1643 1643
 		return $stats;
1644 1644
 	}
1645 1645
 
1646
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1646
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1647 1647
 
1648
-	if ( false !== $stats ) {
1648
+	if (false !== $stats) {
1649 1649
 		return $stats;
1650 1650
 	}
1651 1651
 
1652 1652
 	$where = 'WHERE comment_type != "give_payment_note"';
1653 1653
 
1654
-	if ( $post_id > 0 ) {
1655
-		$where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
1654
+	if ($post_id > 0) {
1655
+		$where .= $wpdb->prepare(" AND comment_post_ID = %d", $post_id);
1656 1656
 	}
1657 1657
 
1658
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1658
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1659 1659
 
1660 1660
 	$total    = 0;
1661 1661
 	$approved = array(
@@ -1665,30 +1665,30 @@  discard block
 block discarded – undo
1665 1665
 		'trash'        => 'trash',
1666 1666
 		'post-trashed' => 'post-trashed'
1667 1667
 	);
1668
-	foreach ( (array) $count as $row ) {
1668
+	foreach ((array) $count as $row) {
1669 1669
 		// Don't count post-trashed toward totals
1670
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1670
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1671 1671
 			$total += $row['num_comments'];
1672 1672
 		}
1673
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1674
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1673
+		if (isset($approved[$row['comment_approved']])) {
1674
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1675 1675
 		}
1676 1676
 	}
1677 1677
 
1678 1678
 	$stats['total_comments'] = $total;
1679
-	foreach ( $approved as $key ) {
1680
-		if ( empty( $stats[ $key ] ) ) {
1681
-			$stats[ $key ] = 0;
1679
+	foreach ($approved as $key) {
1680
+		if (empty($stats[$key])) {
1681
+			$stats[$key] = 0;
1682 1682
 		}
1683 1683
 	}
1684 1684
 
1685 1685
 	$stats = (object) $stats;
1686
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1686
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1687 1687
 
1688 1688
 	return $stats;
1689 1689
 }
1690 1690
 
1691
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1691
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1692 1692
 
1693 1693
 
1694 1694
 /**
@@ -1701,9 +1701,9 @@  discard block
 block discarded – undo
1701 1701
  *
1702 1702
  * @return string $where Modified where clause
1703 1703
  */
1704
-function give_filter_where_older_than_week( $where = '' ) {
1704
+function give_filter_where_older_than_week($where = '') {
1705 1705
 	// Payments older than one week
1706
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1706
+	$start = date('Y-m-d', strtotime('-7 days'));
1707 1707
 	$where .= " AND post_date <= '{$start}'";
1708 1708
 
1709 1709
 	return $where;
@@ -1722,37 +1722,37 @@  discard block
 block discarded – undo
1722 1722
  *
1723 1723
  * @return string $form_title Returns the full title if $level_title false, otherwise returns the levels title
1724 1724
  */
1725
-function give_get_payment_form_title( $payment_meta, $level_title = false, $separator = '' ) {
1725
+function give_get_payment_form_title($payment_meta, $level_title = false, $separator = '') {
1726 1726
 
1727
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1728
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1729
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1727
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1728
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1729
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1730 1730
 
1731
-	if ( $level_title == true ) {
1731
+	if ($level_title == true) {
1732 1732
 		$form_title = '';
1733 1733
 	}
1734 1734
 
1735
-	if ( give_has_variable_prices( $form_id ) ) {
1735
+	if (give_has_variable_prices($form_id)) {
1736 1736
 
1737
-		if ( ! empty( $separator ) ) {
1738
-			$form_title .= ' ' . $separator;
1737
+		if ( ! empty($separator)) {
1738
+			$form_title .= ' '.$separator;
1739 1739
 		}
1740 1740
 		$form_title .= ' <span class="donation-level-text-wrap">';
1741 1741
 
1742
-		if ( $price_id == 'custom' ) {
1742
+		if ($price_id == 'custom') {
1743 1743
 
1744
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
1745
-			$form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' );
1744
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
1745
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give');
1746 1746
 
1747 1747
 		} else {
1748
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1748
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1749 1749
 		}
1750 1750
 
1751 1751
 		$form_title .= '</span>';
1752 1752
 
1753 1753
 	}
1754 1754
 
1755
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1755
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1756 1756
 
1757 1757
 }
1758 1758
 
@@ -1766,20 +1766,20 @@  discard block
 block discarded – undo
1766 1766
  *
1767 1767
  * @return string $price_id
1768 1768
  */
1769
-function give_get_price_id( $form_id, $price ) {
1769
+function give_get_price_id($form_id, $price) {
1770 1770
 
1771 1771
 	$price_id = 0;
1772 1772
 
1773
-	if ( give_has_variable_prices( $form_id ) ) {
1773
+	if (give_has_variable_prices($form_id)) {
1774 1774
 
1775
-		$levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1775
+		$levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1776 1776
 
1777
-		foreach ( $levels as $level ) {
1777
+		foreach ($levels as $level) {
1778 1778
 
1779
-			$level_amount = (float) give_sanitize_amount( $level['_give_amount'] );
1779
+			$level_amount = (float) give_sanitize_amount($level['_give_amount']);
1780 1780
 
1781 1781
 			//check that this indeed the recurring price
1782
-			if ( $level_amount == $price ) {
1782
+			if ($level_amount == $price) {
1783 1783
 
1784 1784
 				$price_id = $level['_give_id']['level_id'];
1785 1785
 
@@ -1806,10 +1806,10 @@  discard block
 block discarded – undo
1806 1806
  * 
1807 1807
  * @return string/void
1808 1808
  */
1809
-function give_get_form_dropdown( $args = array(), $echo = false ){
1810
-    $form_dropdown_html = Give()->html->forms_dropdown( $args );
1809
+function give_get_form_dropdown($args = array(), $echo = false) {
1810
+    $form_dropdown_html = Give()->html->forms_dropdown($args);
1811 1811
 
1812
-    if( ! $echo ) {
1812
+    if ( ! $echo) {
1813 1813
         return $form_dropdown_html;
1814 1814
     }
1815 1815
 
@@ -1826,39 +1826,39 @@  discard block
 block discarded – undo
1826 1826
  *
1827 1827
  * @return string/void
1828 1828
  */
1829
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ){
1829
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1830 1830
     
1831 1831
     // Check for give form id.
1832
-    if( empty( $args['id'] ) ) {
1832
+    if (empty($args['id'])) {
1833 1833
         return false;
1834 1834
     }
1835 1835
 
1836 1836
     // Check if form has variable prices or not.
1837
-    if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1837
+    if ( ! ($variable_prices = give_has_variable_prices($args['id']))) {
1838 1838
         return false;
1839 1839
     }
1840 1840
     
1841
-    $variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1841
+    $variable_prices = give_get_variable_prices(absint($args['id']));
1842 1842
     $variable_price_options = array();
1843 1843
 
1844 1844
     // Check if multi donation form support custom donation or not.
1845
-    if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1846
-        $variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1845
+    if (give_is_custom_price_mode(absint($args['id']))) {
1846
+        $variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1847 1847
     }
1848 1848
 
1849 1849
     // Get variable price and ID from variable price array.
1850
-    foreach ( $variable_prices as $variable_price ) {
1851
-        $variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1850
+    foreach ($variable_prices as $variable_price) {
1851
+        $variable_price_options[$variable_price['_give_id']['level_id']] = $variable_price['_give_text'];
1852 1852
     }
1853 1853
 
1854 1854
 
1855 1855
     // Update options.
1856
-    $args = array_merge( $args, array( 'options' => $variable_price_options ) );
1856
+    $args = array_merge($args, array('options' => $variable_price_options));
1857 1857
 
1858 1858
     // Generate select html.
1859
-    $form_dropdown_html = Give()->html->select( $args );
1859
+    $form_dropdown_html = Give()->html->select($args);
1860 1860
 
1861
-    if( ! $echo ) {
1861
+    if ( ! $echo) {
1862 1862
         return $form_dropdown_html;
1863 1863
     }
1864 1864
 
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -64,50 +64,50 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool If the gravatar exists or not
66 66
 	 */
67
-	public function validate_gravatar( $id_or_email ) {
67
+	public function validate_gravatar($id_or_email) {
68 68
 		//id or email code borrowed from wp-includes/pluggable.php
69 69
 		$email = '';
70
-		if ( is_numeric( $id_or_email ) ) {
70
+		if (is_numeric($id_or_email)) {
71 71
 			$id   = (int) $id_or_email;
72
-			$user = get_userdata( $id );
73
-			if ( $user ) {
72
+			$user = get_userdata($id);
73
+			if ($user) {
74 74
 				$email = $user->user_email;
75 75
 			}
76
-		} elseif ( is_object( $id_or_email ) ) {
76
+		} elseif (is_object($id_or_email)) {
77 77
 			// No avatar for pingbacks or trackbacks
78
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
79
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
78
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
79
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
80 80
 				return false;
81 81
 			}
82 82
 
83
-			if ( ! empty( $id_or_email->user_id ) ) {
83
+			if ( ! empty($id_or_email->user_id)) {
84 84
 				$id   = (int) $id_or_email->user_id;
85
-				$user = get_userdata( $id );
86
-				if ( $user ) {
85
+				$user = get_userdata($id);
86
+				if ($user) {
87 87
 					$email = $user->user_email;
88 88
 				}
89
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
89
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
90 90
 				$email = $id_or_email->comment_author_email;
91 91
 			}
92 92
 		} else {
93 93
 			$email = $id_or_email;
94 94
 		}
95 95
 
96
-		$hashkey = md5( strtolower( trim( $email ) ) );
97
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
96
+		$hashkey = md5(strtolower(trim($email)));
97
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
98 98
 
99
-		$data = wp_cache_get( $hashkey );
100
-		if ( false === $data ) {
101
-			$response = wp_remote_head( $uri );
102
-			if ( is_wp_error( $response ) ) {
99
+		$data = wp_cache_get($hashkey);
100
+		if (false === $data) {
101
+			$response = wp_remote_head($uri);
102
+			if (is_wp_error($response)) {
103 103
 				$data = 'not200';
104 104
 			} else {
105 105
 				$data = $response['response']['code'];
106 106
 			}
107
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
107
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
108 108
 
109 109
 		}
110
-		if ( $data == '200' ) {
110
+		if ($data == '200') {
111 111
 			return true;
112 112
 		} else {
113 113
 			return false;
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return array        IDs if logs, false otherwise
126 126
 	 */
127
-	public function get_log_ids( $form_id = '' ) {
127
+	public function get_log_ids($form_id = '') {
128 128
 
129 129
 		// get Give_Logging class
130 130
 		global $give_logs;
131 131
 
132 132
 		// get log for this form
133
-		$logs = $give_logs->get_logs( $form_id );
133
+		$logs = $give_logs->get_logs($form_id);
134 134
 
135
-		if ( $logs ) {
135
+		if ($logs) {
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,49 +155,49 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		global $give_options;
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = get_post_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have purchased more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
178
+				$email = get_post_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			// strip duplicate emails
191
-			$unique_emails = array_unique( $unique_emails );
191
+			$unique_emails = array_unique($unique_emails);
192 192
 
193 193
 			// convert the unique IDs back into simple array
194
-			foreach ( $unique_emails as $id => $email ) {
194
+			foreach ($unique_emails as $id => $email) {
195 195
 				$unique_ids[] = $id;
196 196
 			}
197 197
 
198 198
 			// randomize the payment IDs if enabled
199
-			if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) {
200
-				shuffle( $unique_ids );
199
+			if (isset($give_options['give_donators_gravatars_random_gravatars'])) {
200
+				shuffle($unique_ids);
201 201
 			}
202 202
 
203 203
 			// return our unique IDs
@@ -218,22 +218,22 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return string
220 220
 	 */
221
-	public function gravatars( $form_id = false, $title = '' ) {
221
+	public function gravatars($form_id = false, $title = '') {
222 222
 
223 223
 		// unique $payment_ids 
224
-		$payment_ids = $this->get_payment_ids( $form_id );
224
+		$payment_ids = $this->get_payment_ids($form_id);
225 225
 
226 226
 		global $give_options;
227 227
 
228 228
 		// return if no ID
229
-		if ( ! $form_id ) {
229
+		if ( ! $form_id) {
230 230
 			return;
231 231
 		}
232 232
 
233 233
 		// minimum amount of purchases before showing gravatars
234 234
 		// if the number of items in array is not greater or equal to the number specified, then exit
235
-		if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) {
236
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) {
235
+		if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) {
236
+			if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) {
237 237
 				return;
238 238
 			}
239 239
 		}
@@ -244,51 +244,51 @@  discard block
 block discarded – undo
244 244
 		echo '<div id="give-purchase-gravatars">';
245 245
 
246 246
 
247
-		if ( isset ( $title ) ) {
247
+		if (isset ($title)) {
248 248
 
249
-			if ( $title ) {
250
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
251
-			} elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) {
252
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donators_gravatars_heading'] ) . '</h2>' );
249
+			if ($title) {
250
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
251
+			} elseif (isset($give_options['give_donators_gravatars_heading'])) {
252
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donators_gravatars_heading']).'</h2>');
253 253
 			}
254 254
 
255 255
 		}
256 256
 		echo '<ul class="give-purchase-gravatars-list">';
257 257
 		$i = 0;
258 258
 
259
-		if ( $payment_ids ) {
260
-			foreach ( $payment_ids as $id ) {
259
+		if ($payment_ids) {
260
+			foreach ($payment_ids as $id) {
261 261
 
262 262
 				// Give saves a blank option even when the control is turned off, hence the extra check
263
-				if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) {
263
+				if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) {
264 264
 					continue;
265 265
 				}
266 266
 
267 267
 				// get the payment meta
268
-				$payment_meta = get_post_meta( $id, '_give_payment_meta', true );
268
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
269 269
 
270 270
 				// unserialize the payment meta
271
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
271
+				$user_info = maybe_unserialize($payment_meta['user_info']);
272 272
 
273 273
 				// get donor's first name
274 274
 				$name = $user_info['first_name'];
275 275
 
276 276
 				// get donor's email
277
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
277
+				$email = get_post_meta($id, '_give_payment_user_email', true);
278 278
 
279 279
 				// set gravatar size and provide filter
280
-				$size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : '';
280
+				$size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : '';
281 281
 
282 282
 				// default image
283
-				$default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false );
283
+				$default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false);
284 284
 
285 285
 				// assemble output
286 286
 				$output .= '<li>';
287 287
 
288
-				$output .= get_avatar( $email, $size, $default_image, $name );
288
+				$output .= get_avatar($email, $size, $default_image, $name);
289 289
 				$output .= '</li>';
290 290
 
291
-				$i ++;
291
+				$i++;
292 292
 
293 293
 			} // end foreach
294 294
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		echo '</ul>';
298 298
 		echo '</div>';
299 299
 
300
-		return apply_filters( 'give_donators_gravatars', ob_get_clean() );
300
+		return apply_filters('give_donators_gravatars', ob_get_clean());
301 301
 	}
302 302
 
303 303
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return void
310 310
 	 */
311 311
 	public function register_widget() {
312
-		register_widget( 'Give_Donators_Gravatars_Widget' );
312
+		register_widget('Give_Donators_Gravatars_Widget');
313 313
 	}
314 314
 
315 315
 	/**
@@ -325,19 +325,19 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @todo   Set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
327 327
 	 */
328
-	public function shortcode( $atts, $content = null ) {
328
+	public function shortcode($atts, $content = null) {
329 329
 
330
-		$atts = shortcode_atts( array(
330
+		$atts = shortcode_atts(array(
331 331
 			'id'    => '',
332 332
 			'title' => ''
333
-		), $atts, 'give_donators_gravatars' );
333
+		), $atts, 'give_donators_gravatars');
334 334
 
335 335
 		// if no ID is passed on single give_forms pages, get the correct ID
336
-		if ( is_singular( 'give_forms' ) ) {
336
+		if (is_singular('give_forms')) {
337 337
 			$id = get_the_ID();
338 338
 		}
339 339
 
340
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
340
+		$content = $this->gravatars($atts['id'], $atts['title']);
341 341
 
342 342
 		return $content;
343 343
 
@@ -353,57 +353,57 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return array           Gravatar settings.
355 355
 	 */
356
-	public function settings( $settings ) {
356
+	public function settings($settings) {
357 357
 
358 358
 		$give_gravatar_settings = array(
359 359
 			array(
360
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
360
+				'name' => esc_html__('Donator Gravatars', 'give'),
361 361
 				'desc' => '<hr>',
362 362
 				'id'   => 'give_title',
363 363
 				'type' => 'give_title'
364 364
 			),
365 365
 			array(
366
-				'name' => esc_html__( 'Heading', 'give' ),
367
-				'desc' => esc_html__( 'The heading to display above the Gravatars', 'give' ),
366
+				'name' => esc_html__('Heading', 'give'),
367
+				'desc' => esc_html__('The heading to display above the Gravatars', 'give'),
368 368
 				'type' => 'text',
369 369
 				'id'   => 'give_donators_gravatars_heading'
370 370
 			),
371 371
 			array(
372
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
373
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum)', 'give' ),
372
+				'name'    => esc_html__('Gravatar Size', 'give'),
373
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum)', 'give'),
374 374
 				'type'    => 'text_small',
375 375
 				'id'      => 'give_donators_gravatars_gravatar_size',
376 376
 				'default' => '64'
377 377
 			),
378 378
 			array(
379
-				'name' => esc_html__( 'Minimum Unique Purchases Required', 'give' ),
379
+				'name' => esc_html__('Minimum Unique Purchases Required', 'give'),
380 380
 				/* translators: %s: form singular label */
381
-				'desc' => sprintf( esc_html__( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ),
381
+				'desc' => sprintf(esc_html__('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())),
382 382
 				'type' => 'text_small',
383 383
 				'id'   => 'give_donators_gravatars_min_purchases_required',
384 384
 			),
385 385
 			array(
386
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
387
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
386
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
387
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
388 388
 				'type'    => 'text',
389 389
 				'id'      => 'give_donators_gravatars_maximum_number',
390 390
 				'default' => '20',
391 391
 			),
392 392
 			array(
393
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
394
-				'desc' => esc_html__( 'Only show donators with a Gravatar account', 'give' ),
393
+				'name' => esc_html__('Gravatar Visibility', 'give'),
394
+				'desc' => esc_html__('Only show donators with a Gravatar account', 'give'),
395 395
 				'id'   => 'give_donators_gravatars_has_gravatar_account',
396 396
 				'type' => 'checkbox',
397 397
 			),
398 398
 			array(
399
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
400
-				'desc' => esc_html__( 'Randomize the Gravatars', 'give' ),
399
+				'name' => esc_html__('Randomize Gravatars', 'give'),
400
+				'desc' => esc_html__('Randomize the Gravatars', 'give'),
401 401
 				'id'   => 'give_donators_gravatars_random_gravatars',
402 402
 				'type' => 'checkbox',
403 403
 			),
404 404
 		);
405 405
 
406
-		return array_merge( $settings, $give_gravatar_settings );
406
+		return array_merge($settings, $give_gravatar_settings);
407 407
 	}
408 408
 
409 409
 }
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function __construct() {
430 430
 
431
-		$give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null;
431
+		$give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null;
432 432
 
433 433
 		// widget settings
434 434
 		$widget_ops = array(
435 435
 			'classname'   => 'give-donators-gravatars',
436 436
 			/* translators: 1: form singular label 2: form singular label */
437
-			'description' => sprintf( esc_html__( 'Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give' ), $give_label_singular, $give_label_singular )
437
+			'description' => sprintf(esc_html__('Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give'), $give_label_singular, $give_label_singular)
438 438
 		);
439 439
 
440 440
 		// widget control settings
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		// create the widget
448 448
 		parent::__construct(
449 449
 			'give_donators_gravatars_widget',
450
-			esc_html__( 'Give Donators Gravatars', 'give' ),
450
+			esc_html__('Give Donators Gravatars', 'give'),
451 451
 			$widget_ops,
452 452
 			$control_ops
453 453
 		);
@@ -467,30 +467,30 @@  discard block
 block discarded – undo
467 467
 	 *
468 468
 	 * @return void
469 469
 	 */
470
-	public function widget( $args, $instance ) {
470
+	public function widget($args, $instance) {
471 471
 		global $give_options;
472 472
 
473 473
 		//@TODO: Don't extract it!!!
474
-		extract( $args );
474
+		extract($args);
475 475
 
476
-		if ( ! is_singular( 'give_forms' ) ) {
476
+		if ( ! is_singular('give_forms')) {
477 477
 			return;
478 478
 		}
479 479
 
480 480
 		// Variables from widget settings
481
-		$title = apply_filters( 'widget_title', $instance['title'] );
481
+		$title = apply_filters('widget_title', $instance['title']);
482 482
 
483 483
 		// Used by themes. Opens the widget
484 484
 		echo $before_widget;
485 485
 
486 486
 		// Display the widget title
487
-		if ( $title ) {
488
-			echo $before_title . $title . $after_title;
487
+		if ($title) {
488
+			echo $before_title.$title.$after_title;
489 489
 		}
490 490
 
491 491
 		$gravatars = new Give_Donators_Gravatars();
492 492
 
493
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
493
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
494 494
 
495 495
 		// Used by themes. Closes the widget
496 496
 		echo $after_widget;
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 *
511 511
 	 * @return array Updated settings to save.
512 512
 	 */
513
-	public function update( $new_instance, $old_instance ) {
513
+	public function update($new_instance, $old_instance) {
514 514
 
515 515
 		$instance = $old_instance;
516 516
 
517
-		$instance['title'] = strip_tags( $new_instance['title'] );
517
+		$instance['title'] = strip_tags($new_instance['title']);
518 518
 
519 519
 		return $instance;
520 520
 
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return void
534 534
 	 */
535
-	public function form( $instance ) {
535
+	public function form($instance) {
536 536
 
537 537
 		// Set up some default widget settings.
538 538
 		$defaults = array(
539 539
 			'title' => '',
540 540
 		);
541 541
 
542
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
542
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
543 543
 
544 544
 		<!-- Title -->
545 545
 		<p>
546
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
547
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
546
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
547
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
548 548
 		</p>
549 549
 
550 550
 		<?php
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => esc_html__( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => esc_html__('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => esc_html__( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => esc_html__( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => esc_html__( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => esc_html__( 'New %1$s', 'give' ),
48
-		'all_items'          => esc_html__( 'All %2$s', 'give' ),
49
-		'view_item'          => esc_html__( 'View %1$s', 'give' ),
50
-		'search_items'       => esc_html__( 'Search %2$s', 'give' ),
51
-		'not_found'          => esc_html__( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => esc_html__( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => esc_html__('Add %1$s', 'give'),
45
+		'add_new_item'       => esc_html__('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => esc_html__('Edit Donation %1$s', 'give'),
47
+		'new_item'           => esc_html__('New %1$s', 'give'),
48
+		'all_items'          => esc_html__('All %2$s', 'give'),
49
+		'view_item'          => esc_html__('View %1$s', 'give'),
50
+		'search_items'       => esc_html__('Search %2$s', 'give'),
51
+		'not_found'          => esc_html__('No %2$s found', 'give'),
52
+		'not_found_in_trash' => esc_html__('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,42 +92,42 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 	
99 99
 	/** Payment Post Type */
100 100
 	$payment_labels = array(
101
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
102
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
103
-		'add_new'            => esc_html__( 'Add New', 'give' ),
104
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
105
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
106
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
107
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
108
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
109
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
110
-		'not_found'          => esc_html__( 'No Donations found', 'give' ),
111
-		'not_found_in_trash' => esc_html__( 'No Donations found in Trash', 'give' ),
101
+		'name'               => _x('Donations', 'post type general name', 'give'),
102
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
103
+		'add_new'            => esc_html__('Add New', 'give'),
104
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
105
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
106
+		'new_item'           => esc_html__('New Donation', 'give'),
107
+		'all_items'          => esc_html__('All Donations', 'give'),
108
+		'view_item'          => esc_html__('View Donation', 'give'),
109
+		'search_items'       => esc_html__('Search Donations', 'give'),
110
+		'not_found'          => esc_html__('No Donations found', 'give'),
111
+		'not_found_in_trash' => esc_html__('No Donations found in Trash', 'give'),
112 112
 		'parent_item_colon'  => '',
113
-		'menu_name'          => esc_html__( 'Transactions', 'give' )
113
+		'menu_name'          => esc_html__('Transactions', 'give')
114 114
 	);
115 115
 
116 116
 	$payment_args = array(
117
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
117
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
118 118
 		'public'          => false,
119 119
 		'query_var'       => false,
120 120
 		'rewrite'         => false,
121 121
 		'map_meta_cap'    => true,
122 122
 		'capability_type' => 'give_payment',
123
-		'supports'        => array( 'title' ),
123
+		'supports'        => array('title'),
124 124
 		'can_export'      => true
125 125
 	);
126
-	register_post_type( 'give_payment', $payment_args );
126
+	register_post_type('give_payment', $payment_args);
127 127
 
128 128
 }
129 129
 
130
-add_action( 'init', 'give_setup_post_types', 1 );
130
+add_action('init', 'give_setup_post_types', 1);
131 131
 
132 132
 
133 133
 /**
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_setup_taxonomies() {
142 142
 
143
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
143
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
144 144
 
145 145
 	/** Categories */
146 146
 	$category_labels = array(
147 147
 		/* translators: %s: form singular label */
148
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
149
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
150
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
151
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
152
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
153
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
154
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
155
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
148
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
149
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
150
+		'search_items'      => esc_html__('Search Categories', 'give'),
151
+		'all_items'         => esc_html__('All Categories', 'give'),
152
+		'parent_item'       => esc_html__('Parent Category', 'give'),
153
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
154
+		'edit_item'         => esc_html__('Edit Category', 'give'),
155
+		'update_item'       => esc_html__('Update Category', 'give'),
156 156
 		/* translators: %s: form singular label */
157
-		'add_new_item'      => sprintf( esc_html__( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
158
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
159
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
157
+		'add_new_item'      => sprintf(esc_html__('Add New %s Category', 'give'), give_get_forms_label_singular()),
158
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
159
+		'menu_name'         => esc_html__('Categories', 'give'),
160 160
 	);
161 161
 
162
-	$category_args = apply_filters( 'give_forms_category_args', array(
162
+	$category_args = apply_filters('give_forms_category_args', array(
163 163
 			'hierarchical' => true,
164
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
164
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
165 165
 			'show_ui'      => true,
166 166
 			'query_var'    => 'give_forms_category',
167 167
 			'rewrite'      => array(
168
-				'slug'         => $slug . '/category',
168
+				'slug'         => $slug.'/category',
169 169
 				'with_front'   => false,
170 170
 				'hierarchical' => true
171 171
 			),
@@ -179,36 +179,36 @@  discard block
 block discarded – undo
179 179
 	);
180 180
 
181 181
 	//Does the user want categories?
182
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
183
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
184
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
182
+	if (give_get_option('enable_categories') == 'on') {
183
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
184
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
185 185
 	}
186 186
 
187 187
 
188 188
 	/** Tags */
189 189
 	$tag_labels = array(
190 190
 		/* translators: %s: form singular label */
191
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
192
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
193
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
194
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
195
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
196
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
197
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
198
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
199
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
200
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
201
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
191
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
192
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
193
+		'search_items'          => esc_html__('Search Tags', 'give'),
194
+		'all_items'             => esc_html__('All Tags', 'give'),
195
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
196
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
197
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
198
+		'update_item'           => esc_html__('Update Tag', 'give'),
199
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
200
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
201
+		'menu_name'             => esc_html__('Tags', 'give'),
202 202
 		/* translators: %s: form singular label */
203
-		'choose_from_most_used' => sprintf( esc_html__( 'Choose from most used %s tags.', 'give' ), give_get_forms_label_singular() ),
203
+		'choose_from_most_used' => sprintf(esc_html__('Choose from most used %s tags.', 'give'), give_get_forms_label_singular()),
204 204
 	);
205 205
 
206
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
206
+	$tag_args = apply_filters('give_forms_tag_args', array(
207 207
 			'hierarchical' => false,
208
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
208
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
209 209
 			'show_ui'      => true,
210 210
 			'query_var'    => 'give_forms_tag',
211
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
211
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
212 212
 			'capabilities' => array(
213 213
 				'manage_terms' => 'manage_give_form_terms',
214 214
 				'edit_terms'   => 'edit_give_form_terms',
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		)
219 219
 	);
220 220
 
221
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
222
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
223
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
221
+	if (give_get_option('enable_tags') == 'on') {
222
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
223
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
224 224
 	}
225 225
 
226 226
 
227 227
 }
228 228
 
229
-add_action( 'init', 'give_setup_taxonomies', 0 );
229
+add_action('init', 'give_setup_taxonomies', 0);
230 230
 
231 231
 
232 232
 /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function give_get_default_form_labels() {
239 239
 	$defaults = array(
240
-		'singular' => esc_html__( 'Form', 'give' ),
241
-		'plural'   => esc_html__( 'Forms', 'give' )
240
+		'singular' => esc_html__('Form', 'give'),
241
+		'plural'   => esc_html__('Forms', 'give')
242 242
 	);
243 243
 
244
-	return apply_filters( 'give_default_form_name', $defaults );
244
+	return apply_filters('give_default_form_name', $defaults);
245 245
 }
246 246
 
247 247
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string $defaults['singular'] Singular label
255 255
  */
256
-function give_get_forms_label_singular( $lowercase = false ) {
256
+function give_get_forms_label_singular($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
259
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
260 260
 }
261 261
 
262 262
 /**
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
  * @since 1.0
266 266
  * @return string $defaults['plural'] Plural label
267 267
  */
268
-function give_get_forms_label_plural( $lowercase = false ) {
268
+function give_get_forms_label_plural($lowercase = false) {
269 269
 	$defaults = give_get_default_form_labels();
270 270
 
271
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
271
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
272 272
 }
273 273
 
274 274
 /**
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @return string $title New placeholder text
282 282
  */
283
-function give_change_default_title( $title ) {
283
+function give_change_default_title($title) {
284 284
 	// If a frontend plugin uses this filter (check extensions before changing this function)
285
-	if ( ! is_admin() ) {
285
+	if ( ! is_admin()) {
286 286
 		$title = sprintf(
287 287
 			/* translators: %s: form singular label */
288
-			esc_html__( 'Enter %s title here', 'give' ),
288
+			esc_html__('Enter %s title here', 'give'),
289 289
 			give_get_forms_label_singular()
290 290
 		);
291 291
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 
295 295
 	$screen = get_current_screen();
296 296
 
297
-	if ( 'give_forms' == $screen->post_type ) {
297
+	if ('give_forms' == $screen->post_type) {
298 298
 		$title = sprintf(
299 299
 			/* translators: %s: form singular label */
300
-			esc_html__( 'Enter %s title here', 'give' ),
300
+			esc_html__('Enter %s title here', 'give'),
301 301
 			give_get_forms_label_singular()
302 302
 		);
303 303
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	return $title;
306 306
 }
307 307
 
308
-add_filter( 'enter_title_here', 'give_change_default_title' );
308
+add_filter('enter_title_here', 'give_change_default_title');
309 309
 
310 310
 /**
311 311
  * Registers Custom Post Statuses which are used by the Payments
@@ -315,50 +315,50 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function give_register_post_type_statuses() {
317 317
 	// Payment Statuses
318
-	register_post_status( 'refunded', array(
319
-		'label'                     => _x( 'Refunded', 'payment status', 'give' ),
318
+	register_post_status('refunded', array(
319
+		'label'                     => _x('Refunded', 'payment status', 'give'),
320 320
 		'public'                    => true,
321 321
 		'exclude_from_search'       => false,
322 322
 		'show_in_admin_all_list'    => true,
323 323
 		'show_in_admin_status_list' => true,
324
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
325
-	) );
326
-	register_post_status( 'failed', array(
327
-		'label'                     => _x( 'Failed', 'payment status', 'give' ),
324
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
325
+	));
326
+	register_post_status('failed', array(
327
+		'label'                     => _x('Failed', 'payment status', 'give'),
328 328
 		'public'                    => true,
329 329
 		'exclude_from_search'       => false,
330 330
 		'show_in_admin_all_list'    => true,
331 331
 		'show_in_admin_status_list' => true,
332
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
333
-	) );
334
-	register_post_status( 'revoked', array(
335
-		'label'                     => _x( 'Revoked', 'payment status', 'give' ),
332
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
333
+	));
334
+	register_post_status('revoked', array(
335
+		'label'                     => _x('Revoked', 'payment status', 'give'),
336 336
 		'public'                    => true,
337 337
 		'exclude_from_search'       => false,
338 338
 		'show_in_admin_all_list'    => true,
339 339
 		'show_in_admin_status_list' => true,
340
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
341
-	) );
342
-	register_post_status( 'cancelled', array(
343
-		'label'                     => _x( 'Cancelled', 'payment status', 'give' ),
340
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
341
+	));
342
+	register_post_status('cancelled', array(
343
+		'label'                     => _x('Cancelled', 'payment status', 'give'),
344 344
 		'public'                    => true,
345 345
 		'exclude_from_search'       => false,
346 346
 		'show_in_admin_all_list'    => true,
347 347
 		'show_in_admin_status_list' => true,
348
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
349
-	) );
350
-	register_post_status( 'abandoned', array(
351
-		'label'                     => _x( 'Abandoned', 'payment status', 'give' ),
348
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
349
+	));
350
+	register_post_status('abandoned', array(
351
+		'label'                     => _x('Abandoned', 'payment status', 'give'),
352 352
 		'public'                    => true,
353 353
 		'exclude_from_search'       => false,
354 354
 		'show_in_admin_all_list'    => true,
355 355
 		'show_in_admin_status_list' => true,
356
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
357
-	) );
356
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
357
+	));
358 358
 
359 359
 }
360 360
 
361
-add_action( 'init', 'give_register_post_type_statuses' );
361
+add_action('init', 'give_register_post_type_statuses');
362 362
 
363 363
 /**
364 364
  * Updated Messages
@@ -371,43 +371,43 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @return array $messages New post updated messages
373 373
  */
374
-function give_updated_messages( $messages ) {
374
+function give_updated_messages($messages) {
375 375
 	global $post, $post_ID;
376 376
 
377
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
377
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
378 378
 	$url2 = give_get_forms_label_singular();
379 379
 	$url3 = '</a>';
380 380
 
381 381
 	$messages['give_forms'] = array(
382
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
383
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
384
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
385
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
386
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
382
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
383
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
384
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
385
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
386
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
387 387
 	);
388 388
 
389 389
 	return $messages;
390 390
 }
391 391
 
392
-add_filter( 'post_updated_messages', 'give_updated_messages' );
392
+add_filter('post_updated_messages', 'give_updated_messages');
393 393
 
394 394
 
395 395
 /**
396 396
  * Setup Post Type Images
397 397
  */
398
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
398
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
399 399
 
400 400
 /**
401 401
  * Ensure post thumbnail support is turned on
402 402
  */
403 403
 function give_add_thumbnail_support() {
404
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
404
+	if (give_get_option('disable_form_featured_img') === 'on') {
405 405
 		return;
406 406
 	}
407
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
408
-		add_theme_support( 'post-thumbnails' );
407
+	if ( ! current_theme_supports('post-thumbnails')) {
408
+		add_theme_support('post-thumbnails');
409 409
 	}
410
-	add_post_type_support( 'give_forms', 'thumbnail' );
410
+	add_post_type_support('give_forms', 'thumbnail');
411 411
 }
412 412
 
413 413
 /**
@@ -419,19 +419,19 @@  discard block
 block discarded – undo
419 419
 function give_widgets_init() {
420 420
 
421 421
 	//Single Give Forms (disabled if single turned off in settings)
422
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
422
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
423 423
 
424
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
425
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
424
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
425
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
426 426
 			'id'            => 'give-forms-sidebar',
427
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
427
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
428 428
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
429 429
 			'after_widget'  => '</div>',
430 430
 			'before_title'  => '<h3 class="widgettitle widget-title">',
431 431
 			'after_title'   => '</h3>',
432
-		) ) );
432
+		)));
433 433
 
434 434
 	}
435 435
 }
436 436
 
437
-add_action( 'widgets_init', 'give_widgets_init', 999 );
437
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.