Completed
Pull Request — master (#770)
by Devin
20:03
created
includes/scripts.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -241,23 +241,23 @@  discard block
 block discarded – undo
241 241
 		wp_enqueue_script( 'give-accounting' );
242 242
 	}
243 243
 
244
-    //Settings Scripts
245
-    if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
246
-        wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
247
-        wp_enqueue_script( 'give-admin-settings-scripts' );
248
-    }
244
+	//Settings Scripts
245
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
246
+		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
247
+		wp_enqueue_script( 'give-admin-settings-scripts' );
248
+	}
249 249
 
250
-    // Price Separators.
251
-    $thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
252
-    $decimal_separator  = isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.';
250
+	// Price Separators.
251
+	$thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
252
+	$decimal_separator  = isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.';
253 253
 
254
-    //Localize strings & variables for JS
254
+	//Localize strings & variables for JS
255 255
 	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
256 256
 		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
257 257
 		'give_version'            => GIVE_VERSION,
258
-        'thousands_separator'     => $thousand_separator,
259
-        'decimal_separator'       => $decimal_separator,
260
-        'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
258
+		'thousands_separator'     => $thousand_separator,
259
+		'decimal_separator'       => $decimal_separator,
260
+		'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
261 261
 		'delete_payment'          => __( 'Are you sure you wish to delete this payment?', 'give' ),
262 262
 		'delete_payment_note'     => __( 'Are you sure you wish to delete this note?', 'give' ),
263 263
 		'revoke_api_key'          => __( 'Are you sure you wish to revoke this API key?', 'give' ),
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 		'batch_export_no_class'   => __( 'You must choose a method.', 'give' ),
286 286
 		'batch_export_no_reqs'    => __( 'Required fields not completed.', 'give' ),
287 287
 		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
288
-        'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator )
289
-    ) );
288
+		'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator )
289
+	) );
290 290
 
291 291
 	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
292 292
 		//call for new media manager
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -28,94 +28,94 @@  discard block
 block discarded – undo
28 28
 
29 29
 	global $give_options;
30 30
 
31
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
32
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
33
-	$scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false;
31
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
32
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
33
+	$scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false;
34 34
 
35 35
 	// Use minified libraries if SCRIPT_DEBUG is turned off
36
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
36
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
37 37
 
38 38
 	//Localize / PHP to AJAX vars
39
-	$localize_give_checkout = apply_filters( 'give_global_script_vars', array(
39
+	$localize_give_checkout = apply_filters('give_global_script_vars', array(
40 40
 		'ajaxurl'             => give_get_ajax_url(),
41
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
42
-		'currency_sign'       => give_currency_filter( '' ),
41
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
42
+		'currency_sign'       => give_currency_filter(''),
43 43
 		'currency_pos'        => give_get_currency_position(),
44
-		'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',',
45
-		'decimal_separator'   => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.',
46
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
47
-		'bad_minimum'         => __( 'The minimum donation amount for this form is', 'give' ),
48
-		'general_loading'     => __( 'Loading...', 'give' ),
49
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
44
+		'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',',
45
+		'decimal_separator'   => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.',
46
+		'no_gateway'          => __('Please select a payment method.', 'give'),
47
+		'bad_minimum'         => __('The minimum donation amount for this form is', 'give'),
48
+		'general_loading'     => __('Loading...', 'give'),
49
+		'purchase_loading'    => __('Please Wait...', 'give'),
50 50
 		'number_decimals'  => give_get_price_decimals(),
51 51
 		'give_version'        => GIVE_VERSION
52
-	) );
53
-	$localize_give_ajax     = apply_filters( 'give_global_ajax_vars', array(
52
+	));
53
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
54 54
 		'ajaxurl'          => give_get_ajax_url(),
55
-		'loading'          => __( 'Loading', 'give' ),
55
+		'loading'          => __('Loading', 'give'),
56 56
 		// General loading message
57
-		'select_option'    => __( 'Please select an option', 'give' ),
57
+		'select_option'    => __('Please select an option', 'give'),
58 58
 		// Variable pricing error with multi-purchase option enabled
59
-		'default_gateway'  => give_get_default_gateway( null ),
60
-		'permalinks'       => get_option( 'permalink_structure' ) ? '1' : '0',
59
+		'default_gateway'  => give_get_default_gateway(null),
60
+		'permalinks'       => get_option('permalink_structure') ? '1' : '0',
61 61
 		'number_decimals'  => give_get_price_decimals()
62
-	) );
62
+	));
63 63
 
64 64
 	//DEBUG is On
65
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
65
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
66 66
 
67
-		if ( give_is_cc_verify_enabled() ) {
68
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
69
-			wp_enqueue_script( 'give-cc-validator' );
67
+		if (give_is_cc_verify_enabled()) {
68
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
69
+			wp_enqueue_script('give-cc-validator');
70 70
 		}
71 71
 
72
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
73
-		wp_enqueue_script( 'give-float-labels' );
72
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
73
+		wp_enqueue_script('give-float-labels');
74 74
 
75
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
76
-		wp_enqueue_script( 'give-blockui' );
75
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
76
+		wp_enqueue_script('give-blockui');
77 77
 
78
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
79
-		wp_enqueue_script( 'give-qtip' );
78
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
79
+		wp_enqueue_script('give-qtip');
80 80
 
81
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
82
-		wp_enqueue_script( 'give-accounting' );
81
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
82
+		wp_enqueue_script('give-accounting');
83 83
 
84
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
85
-		wp_enqueue_script( 'give-magnific' );
84
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
85
+		wp_enqueue_script('give-magnific');
86 86
 
87
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
88
-		wp_enqueue_script( 'give-checkout-global' );
87
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
88
+		wp_enqueue_script('give-checkout-global');
89 89
 
90 90
 		//General scripts
91
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
92
-		wp_enqueue_script( 'give-scripts' );
91
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
92
+		wp_enqueue_script('give-scripts');
93 93
 
94 94
 		// Load AJAX scripts, if enabled
95
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
96
-		wp_enqueue_script( 'give-ajax' );
95
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
96
+		wp_enqueue_script('give-ajax');
97 97
 
98 98
 		//Localize / Pass AJAX vars from PHP
99
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout );
100
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
99
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout);
100
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
101 101
 
102 102
 
103 103
 	} else {
104 104
 
105 105
 		//DEBUG is OFF (one JS file to rule them all!)
106
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
107
-		wp_enqueue_script( 'give' );
106
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
107
+		wp_enqueue_script('give');
108 108
 
109 109
 		//Localize / Pass AJAX vars from PHP
110
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout );
111
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
110
+		wp_localize_script('give', 'give_global_vars', $localize_give_checkout);
111
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
112 112
 
113 113
 	}
114 114
 
115 115
 
116 116
 }
117 117
 
118
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
118
+add_action('wp_enqueue_scripts', 'give_load_scripts');
119 119
 
120 120
 /**
121 121
  * Register Styles
@@ -127,47 +127,47 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_register_styles() {
129 129
 
130
-	if ( give_get_option( 'disable_css', false ) ) {
130
+	if (give_get_option('disable_css', false)) {
131 131
 		return;
132 132
 	}
133 133
 
134 134
 	// Use minified libraries if SCRIPT_DEBUG is turned off
135
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
135
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
136 136
 
137
-	$file          = 'give' . $suffix . '.css';
137
+	$file          = 'give'.$suffix.'.css';
138 138
 	$templates_dir = give_get_theme_template_dir_name();
139 139
 
140
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
141
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css';
142
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
143
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css';
144
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
140
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
141
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css';
142
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
143
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css';
144
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
145 145
 
146 146
 	// Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory
147 147
 	// Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled.
148 148
 	// This allows users to copy just give.css to their theme
149
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
150
-		if ( ! empty( $nonmin ) ) {
151
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css';
149
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
150
+		if ( ! empty($nonmin)) {
151
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css';
152 152
 		} else {
153
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
153
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
154 154
 		}
155
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
156
-		if ( ! empty( $nonmin ) ) {
157
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css';
155
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
156
+		if ( ! empty($nonmin)) {
157
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css';
158 158
 		} else {
159
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
159
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
160 160
 		}
161
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
162
-		$url = trailingslashit( give_get_templates_url() ) . $file;
161
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
162
+		$url = trailingslashit(give_get_templates_url()).$file;
163 163
 	}
164 164
 
165
-	wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' );
166
-	wp_enqueue_style( 'give-styles' );
165
+	wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all');
166
+	wp_enqueue_style('give-styles');
167 167
 
168 168
 }
169 169
 
170
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
170
+add_action('wp_enqueue_scripts', 'give_register_styles');
171 171
 
172 172
 /**
173 173
  * Load Admin Scripts
@@ -183,119 +183,119 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return void
185 185
  */
186
-function give_load_admin_scripts( $hook ) {
186
+function give_load_admin_scripts($hook) {
187 187
 
188 188
 	global $wp_version, $post, $post_type, $give_options;
189 189
 
190 190
 	//Directories of assets
191
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
192
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
193
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
191
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
192
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
193
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
194 194
 
195 195
 	// Use minified libraries if SCRIPT_DEBUG is turned off
196
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
196
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
197 197
 
198 198
 	//Global Admin:
199
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
200
-	wp_enqueue_style( 'give-admin-bar-notification' );
199
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
200
+	wp_enqueue_style('give-admin-bar-notification');
201 201
 
202 202
 	//Give Admin Only:
203
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
203
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
204 204
 		return;
205 205
 	}
206 206
 
207 207
 	//CSS
208
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
209
-	wp_enqueue_style( 'jquery-ui-css' );
210
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION );
211
-	wp_enqueue_style( 'give-admin' );
212
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
213
-	wp_enqueue_style( 'jquery-chosen' );
214
-	wp_enqueue_style( 'thickbox' );
208
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
209
+	wp_enqueue_style('jquery-ui-css');
210
+	wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION);
211
+	wp_enqueue_style('give-admin');
212
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
213
+	wp_enqueue_style('jquery-chosen');
214
+	wp_enqueue_style('thickbox');
215 215
 
216 216
 	//JS
217
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
218
-	wp_enqueue_script( 'jquery-chosen' );
217
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
218
+	wp_enqueue_script('jquery-chosen');
219 219
 
220
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
221
-	wp_enqueue_script( 'give-admin-scripts' );
220
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
221
+	wp_enqueue_script('give-admin-scripts');
222 222
 
223
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
224
-	wp_enqueue_script( 'jquery-flot' );
223
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
224
+	wp_enqueue_script('jquery-flot');
225 225
 
226
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
227
-	wp_enqueue_script( 'give-qtip' );
226
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
227
+	wp_enqueue_script('give-qtip');
228 228
 
229
-	wp_enqueue_script( 'jquery-ui-datepicker' );
230
-	wp_enqueue_script( 'thickbox' );
229
+	wp_enqueue_script('jquery-ui-datepicker');
230
+	wp_enqueue_script('thickbox');
231 231
 
232 232
 	// Forms CPT Script.
233
-	if ( $post_type === 'give_forms' ) {
234
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
235
-		wp_enqueue_script( 'give-admin-forms-scripts' );
233
+	if ($post_type === 'give_forms') {
234
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
235
+		wp_enqueue_script('give-admin-forms-scripts');
236 236
 	}
237 237
 
238 238
 	// Report Scripts.
239
-	if ( isset($_GET['page']) && $_GET['page'] == 'give-reports'  ) {
240
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
241
-		wp_enqueue_script( 'give-accounting' );
239
+	if (isset($_GET['page']) && $_GET['page'] == 'give-reports') {
240
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
241
+		wp_enqueue_script('give-accounting');
242 242
 	}
243 243
 
244 244
     //Settings Scripts
245
-    if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
246
-        wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
247
-        wp_enqueue_script( 'give-admin-settings-scripts' );
245
+    if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
246
+        wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
247
+        wp_enqueue_script('give-admin-settings-scripts');
248 248
     }
249 249
 
250 250
     // Price Separators.
251
-    $thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
252
-    $decimal_separator  = isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.';
251
+    $thousand_separator = isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',';
252
+    $decimal_separator  = isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.';
253 253
 
254 254
     //Localize strings & variables for JS
255
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
256
-		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
255
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
256
+		'post_id'                 => isset($post->ID) ? $post->ID : null,
257 257
 		'give_version'            => GIVE_VERSION,
258 258
         'thousands_separator'     => $thousand_separator,
259 259
         'decimal_separator'       => $decimal_separator,
260
-        'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
261
-		'delete_payment'          => __( 'Are you sure you wish to delete this payment?', 'give' ),
262
-		'delete_payment_note'     => __( 'Are you sure you wish to delete this note?', 'give' ),
263
-		'revoke_api_key'          => __( 'Are you sure you wish to revoke this API key?', 'give' ),
264
-		'regenerate_api_key'      => __( 'Are you sure you wish to regenerate this API key?', 'give' ),
265
-		'resend_receipt'          => __( 'Are you sure you wish to resend the donation receipt?', 'give' ),
266
-		'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor.', 'give' ),
260
+        'quick_edit_warning'      => __('Sorry, not available for variable priced forms.', 'give'),
261
+		'delete_payment'          => __('Are you sure you wish to delete this payment?', 'give'),
262
+		'delete_payment_note'     => __('Are you sure you wish to delete this note?', 'give'),
263
+		'revoke_api_key'          => __('Are you sure you wish to revoke this API key?', 'give'),
264
+		'regenerate_api_key'      => __('Are you sure you wish to regenerate this API key?', 'give'),
265
+		'resend_receipt'          => __('Are you sure you wish to resend the donation receipt?', 'give'),
266
+		'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor.', 'give'),
267 267
 		/* translators: %s: form singular label */
268
-		'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ),
269
-		'one_price_min'           => __( 'You must have at least one price.', 'give' ),
270
-		'one_file_min'            => __( 'You must have at least one file.', 'give' ),
271
-		'one_field_min'           => __( 'You must have at least one field.', 'give' ),
268
+		'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()),
269
+		'one_price_min'           => __('You must have at least one price.', 'give'),
270
+		'one_file_min'            => __('You must have at least one file.', 'give'),
271
+		'one_field_min'           => __('You must have at least one field.', 'give'),
272 272
 		/* translators: %s: form singular label */
273
-		'one_option'              => sprintf( __( 'Choose a %s', 'give' ), give_get_forms_label_singular() ),
273
+		'one_option'              => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()),
274 274
 		/* translators: %s: form plural label */
275
-		'one_or_more_option'      => sprintf( __( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ),
276
-		'numeric_item_price'      => __( 'Item price must be numeric.', 'give' ),
277
-		'numeric_quantity'        => __( 'Quantity must be numeric.', 'give' ),
278
-		'currency_sign'           => give_currency_filter( '' ),
279
-		'currency_pos'            => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
275
+		'one_or_more_option'      => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()),
276
+		'numeric_item_price'      => __('Item price must be numeric.', 'give'),
277
+		'numeric_quantity'        => __('Quantity must be numeric.', 'give'),
278
+		'currency_sign'           => give_currency_filter(''),
279
+		'currency_pos'            => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
280 280
 		'currency_decimals'       => give_currency_decimal_filter(),
281
-		'new_media_ui'            => apply_filters( 'give_use_35_media_ui', 1 ),
282
-		'remove_text'             => __( 'Remove', 'give' ),
281
+		'new_media_ui'            => apply_filters('give_use_35_media_ui', 1),
282
+		'remove_text'             => __('Remove', 'give'),
283 283
 		/* translators: %s: form plural label */
284
-		'type_to_search'          => sprintf( __( 'Type to search %s', 'give' ), give_get_forms_label_plural() ),
285
-		'batch_export_no_class'   => __( 'You must choose a method.', 'give' ),
286
-		'batch_export_no_reqs'    => __( 'Required fields not completed.', 'give' ),
287
-		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
288
-        'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator )
289
-    ) );
290
-
291
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
284
+		'type_to_search'          => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural()),
285
+		'batch_export_no_class'   => __('You must choose a method.', 'give'),
286
+		'batch_export_no_reqs'    => __('Required fields not completed.', 'give'),
287
+		'reset_stats_warn'        => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
288
+        'price_format_guide'      => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator)
289
+    ));
290
+
291
+	if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) {
292 292
 		//call for new media manager
293 293
 		wp_enqueue_media();
294 294
 	}
295 295
 
296 296
 }
297 297
 
298
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
298
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
299 299
 
300 300
 /**
301 301
  * Admin Give Icon
@@ -312,14 +312,14 @@  discard block
 block discarded – undo
312 312
 	?>
313 313
 	<style type="text/css" media="screen">
314 314
 
315
-		<?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?>
315
+		<?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?>
316 316
 		@font-face {
317 317
 			font-family: 'give-icomoon';
318
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>');
319
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
320
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
321
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
322
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
318
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>');
319
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
320
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
321
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
322
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
323 323
 			font-weight: normal;
324 324
 			font-style: normal;
325 325
 		}
@@ -338,4 +338,4 @@  discard block
 block discarded – undo
338 338
 	<?php
339 339
 }
340 340
 
341
-add_action( 'admin_head', 'give_admin_icon' );
341
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -408,30 +408,30 @@
 block discarded – undo
408 408
 		die( '-2' );
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        echo __( 'n/a', 'give' );
413
-    } else {
414
-        // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
416
-
417
-        // Payment meta.
418
-        $payment_meta = $payment->get_meta();
419
-
420
-
421
-        // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
423
-            'id'                => $form_id,
424
-            'name'              => 'give-variable-price',
425
-            'chosen'            => true,
426
-            'show_option_all'   => '',
427
-            'selected'          => $payment_meta['price_id'],
428
-        );
429
-
430
-        // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
-    }
433
-
434
-    give_die();
411
+	if ( ! give_has_variable_prices( $form_id ) ) {
412
+		echo __( 'n/a', 'give' );
413
+	} else {
414
+		// Payment object.
415
+		$payment = new Give_Payment( $payment_id );
416
+
417
+		// Payment meta.
418
+		$payment_meta = $payment->get_meta();
419
+
420
+
421
+		// Variable price dropdown options.
422
+		$variable_price_dropdown_option =  array(
423
+			'id'                => $form_id,
424
+			'name'              => 'give-variable-price',
425
+			'chosen'            => true,
426
+			'show_option_all'   => '',
427
+			'selected'          => $payment_meta['price_id'],
428
+		);
429
+
430
+		// Render variable prices select tag html.
431
+		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
+	}
433
+
434
+	give_die();
435 435
 }
436 436
 
437 437
 add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
 function give_test_ajax_works() {
26 26
 
27 27
 	// Check if the Airplane Mode plugin is installed
28
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
28
+	if (class_exists('Airplane_Mode_Core')) {
29 29
 
30 30
 		$airplane = Airplane_Mode_Core::getInstance();
31 31
 
32
-		if ( method_exists( $airplane, 'enabled' ) ) {
32
+		if (method_exists($airplane, 'enabled')) {
33 33
 
34
-			if ( $airplane->enabled() ) {
34
+			if ($airplane->enabled()) {
35 35
 				return true;
36 36
 			}
37 37
 
38 38
 		} else {
39 39
 
40
-			if ( $airplane->check_status() == 'on' ) {
40
+			if ($airplane->check_status() == 'on') {
41 41
 				return true;
42 42
 			}
43 43
 		}
44 44
 	}
45 45
 
46
-	add_filter( 'block_local_requests', '__return_false' );
46
+	add_filter('block_local_requests', '__return_false');
47 47
 
48
-	if ( get_transient( '_give_ajax_works' ) ) {
48
+	if (get_transient('_give_ajax_works')) {
49 49
 		return true;
50 50
 	}
51 51
 
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 		)
58 58
 	);
59 59
 
60
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
60
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
61 61
 	$works = true;
62 62
 
63
-	if ( is_wp_error( $ajax ) ) {
63
+	if (is_wp_error($ajax)) {
64 64
 
65 65
 		$works = false;
66 66
 
67 67
 	} else {
68 68
 
69
-		if ( empty( $ajax['response'] ) ) {
69
+		if (empty($ajax['response'])) {
70 70
 			$works = false;
71 71
 		}
72 72
 
73
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
73
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
74 74
 			$works = false;
75 75
 		}
76 76
 
77
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
77
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
78 78
 			$works = false;
79 79
 		}
80 80
 
81
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
81
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
82 82
 			$works = false;
83 83
 		}
84 84
 
85 85
 	}
86 86
 
87
-	if ( $works ) {
88
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
87
+	if ($works) {
88
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
89 89
 	}
90 90
 
91 91
 	return $works;
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  * @return string
100 100
  */
101 101
 function give_get_ajax_url() {
102
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
102
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
103 103
 
104 104
 	$current_url = give_get_current_page_url();
105
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
105
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
106 106
 
107
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
108
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
107
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
108
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_ajax_url', $ajax_url );
111
+	return apply_filters('give_ajax_url', $ajax_url);
112 112
 }
113 113
 
114 114
 /**
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
  * @return void
119 119
  */
120 120
 function give_load_checkout_login_fields() {
121
-	do_action( 'give_purchase_form_login_fields' );
121
+	do_action('give_purchase_form_login_fields');
122 122
 	give_die();
123 123
 }
124 124
 
125
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
125
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
126 126
 
127 127
 /**
128 128
  * Load Checkout Fields
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
  * @return void
132 132
  */
133 133
 function give_load_checkout_fields() {
134
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
134
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
135 135
 
136 136
 	ob_start();
137 137
 
138
-	do_action( 'give_purchase_form_register_login_fields', $form_id );
138
+	do_action('give_purchase_form_register_login_fields', $form_id);
139 139
 
140 140
 	$fields = ob_get_clean();
141 141
 
142
-	wp_send_json( array(
143
-		'fields' => wp_json_encode( $fields ),
144
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
145
-	) );
142
+	wp_send_json(array(
143
+		'fields' => wp_json_encode($fields),
144
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
145
+	));
146 146
 }
147 147
 
148
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
149
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
148
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
149
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
150 150
 
151 151
 /**
152 152
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
  * @return void
156 156
  */
157 157
 function give_ajax_get_form_title() {
158
-	if ( isset( $_POST['form_id'] ) ) {
159
-		$title = get_the_title( $_POST['form_id'] );
160
-		if ( $title ) {
158
+	if (isset($_POST['form_id'])) {
159
+		$title = get_the_title($_POST['form_id']);
160
+		if ($title) {
161 161
 			echo $title;
162 162
 		} else {
163 163
 			echo 'fail';
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	give_die();
167 167
 }
168 168
 
169
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
170
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
169
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
170
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
171 171
 
172 172
 /**
173 173
  * Retrieve a states drop down
@@ -177,23 +177,23 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function give_ajax_get_states_field() {
179 179
 
180
-	if ( empty( $_POST['country'] ) ) {
180
+	if (empty($_POST['country'])) {
181 181
 		$_POST['country'] = give_get_country();
182 182
 	}
183
-	$states = give_get_states( $_POST['country'] );
183
+	$states = give_get_states($_POST['country']);
184 184
 
185
-	if ( ! empty( $states ) ) {
185
+	if ( ! empty($states)) {
186 186
 
187 187
 		$args = array(
188 188
 			'name'             => $_POST['field_name'],
189 189
 			'id'               => $_POST['field_name'],
190
-			'class'            => $_POST['field_name'] . '  give-select',
191
-			'options'          => give_get_states( $_POST['country'] ),
190
+			'class'            => $_POST['field_name'].'  give-select',
191
+			'options'          => give_get_states($_POST['country']),
192 192
 			'show_option_all'  => false,
193 193
 			'show_option_none' => false
194 194
 		);
195 195
 
196
-		$response = Give()->html->select( $args );
196
+		$response = Give()->html->select($args);
197 197
 
198 198
 	} else {
199 199
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	give_die();
206 206
 }
207 207
 
208
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
209
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
208
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
209
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
210 210
 
211 211
 /**
212 212
  * Retrieve a states drop down
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
 function give_ajax_form_search() {
218 218
 	global $wpdb;
219 219
 
220
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
220
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
221 221
 	$results = array();
222
-	if ( current_user_can( 'edit_give_forms' ) ) {
223
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
222
+	if (current_user_can('edit_give_forms')) {
223
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
224 224
 	} else {
225
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
225
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
226 226
 	}
227 227
 
228
-	if ( $items ) {
228
+	if ($items) {
229 229
 
230
-		foreach ( $items as $item ) {
230
+		foreach ($items as $item) {
231 231
 
232 232
 			$results[] = array(
233 233
 				'id'   => $item->ID,
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$items[] = array(
241 241
 			'id'   => 0,
242
-			'name' => __( 'No results found', 'give' )
242
+			'name' => __('No results found', 'give')
243 243
 		);
244 244
 
245 245
 	}
246 246
 
247
-	echo json_encode( $results );
247
+	echo json_encode($results);
248 248
 
249 249
 	give_die();
250 250
 }
251 251
 
252
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
253
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
252
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
253
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
254 254
 
255 255
 /**
256 256
  * Search the donors database via Ajax
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 function give_ajax_donor_search() {
262 262
 	global $wpdb;
263 263
 
264
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
264
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
265 265
 	$results = array();
266
-	if ( ! current_user_can( 'view_give_reports' ) ) {
266
+	if ( ! current_user_can('view_give_reports')) {
267 267
 		$donors = array();
268 268
 	} else {
269
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
269
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
270 270
 	}
271 271
 
272
-	if ( $donors ) {
272
+	if ($donors) {
273 273
 
274
-		foreach ( $donors as $donor ) {
274
+		foreach ($donors as $donor) {
275 275
 
276 276
 			$results[] = array(
277 277
 				'id'   => $donor->id,
278
-				'name' => $donor->name . '(' . $donor->email . ')'
278
+				'name' => $donor->name.'('.$donor->email.')'
279 279
 			);
280 280
 		}
281 281
 
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
 
284 284
 		$donors[] = array(
285 285
 			'id'   => 0,
286
-			'name' => __( 'No results found', 'give' )
286
+			'name' => __('No results found', 'give')
287 287
 		);
288 288
 
289 289
 	}
290 290
 
291
-	echo json_encode( $results );
291
+	echo json_encode($results);
292 292
 
293 293
 	give_die();
294 294
 }
295 295
 
296
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
296
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
297 297
 
298 298
 
299 299
 /**
@@ -304,42 +304,42 @@  discard block
 block discarded – undo
304 304
  */
305 305
 function give_ajax_search_users() {
306 306
 
307
-	if ( current_user_can( 'manage_give_settings' ) ) {
307
+	if (current_user_can('manage_give_settings')) {
308 308
 
309
-		$search_query = trim( $_POST['user_name'] );
310
-		$exclude      = trim( $_POST['exclude'] );
309
+		$search_query = trim($_POST['user_name']);
310
+		$exclude      = trim($_POST['exclude']);
311 311
 
312 312
 		$get_users_args = array(
313 313
 			'number' => 9999,
314
-			'search' => $search_query . '*'
314
+			'search' => $search_query.'*'
315 315
 		);
316 316
 
317
-		if ( ! empty( $exclude ) ) {
318
-			$exclude_array             = explode( ',', $exclude );
317
+		if ( ! empty($exclude)) {
318
+			$exclude_array             = explode(',', $exclude);
319 319
 			$get_users_args['exclude'] = $exclude_array;
320 320
 		}
321 321
 
322
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
322
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
323 323
 
324
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
324
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
325 325
 
326 326
 		$user_list = '<ul>';
327
-		if ( $found_users ) {
328
-			foreach ( $found_users as $user ) {
329
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
327
+		if ($found_users) {
328
+			foreach ($found_users as $user) {
329
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
330 330
 			}
331 331
 		} else {
332
-			$user_list .= '<li>' . __( 'No users found', 'give' ) . '</li>';
332
+			$user_list .= '<li>'.__('No users found', 'give').'</li>';
333 333
 		}
334 334
 		$user_list .= '</ul>';
335 335
 
336
-		echo json_encode( array( 'results' => $user_list ) );
336
+		echo json_encode(array('results' => $user_list));
337 337
 
338 338
 	}
339 339
 	die();
340 340
 }
341 341
 
342
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
342
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
343 343
 
344 344
 
345 345
 /**
@@ -350,32 +350,32 @@  discard block
 block discarded – undo
350 350
  */
351 351
 function give_check_for_form_price_variations() {
352 352
 
353
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
354
-		die( '-1' );
353
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
354
+		die('-1');
355 355
 	}
356 356
 
357
-	$form_id = intval( $_POST['form_id'] );
358
-	$form    = get_post( $form_id );
357
+	$form_id = intval($_POST['form_id']);
358
+	$form    = get_post($form_id);
359 359
 
360
-	if ( 'give_forms' != $form->post_type ) {
361
-		die( '-2' );
360
+	if ('give_forms' != $form->post_type) {
361
+		die('-2');
362 362
 	}
363 363
 
364
-	if ( give_has_variable_prices( $form_id ) ) {
365
-		$variable_prices = give_get_variable_prices( $form_id );
364
+	if (give_has_variable_prices($form_id)) {
365
+		$variable_prices = give_get_variable_prices($form_id);
366 366
 
367
-		if ( $variable_prices ) {
367
+		if ($variable_prices) {
368 368
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
369 369
 
370
-			if ( isset( $_POST['all_prices'] ) ) {
371
-				$ajax_response .= '<option value="">' . __( 'All Levels', 'give' ) . '</option>';
370
+			if (isset($_POST['all_prices'])) {
371
+				$ajax_response .= '<option value="">'.__('All Levels', 'give').'</option>';
372 372
 			}
373 373
 
374
-			foreach ( $variable_prices as $key => $price ) {
374
+			foreach ($variable_prices as $key => $price) {
375 375
 
376
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
376
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
377 377
 				
378
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
378
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
379 379
 			}
380 380
 			$ajax_response .= '</select>';
381 381
 			echo $ajax_response;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	give_die();
387 387
 }
388 388
 
389
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
389
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
390 390
 
391 391
 
392 392
 /**
@@ -396,30 +396,30 @@  discard block
 block discarded – undo
396 396
  * @return void
397 397
  */
398 398
 function give_check_for_form_price_variations_html() {
399
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
400
-		die( '-1' );
399
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
400
+		die('-1');
401 401
 	}
402 402
 
403
-	$form_id = intval( $_POST['form_id'] );
404
-	$payment_id = intval( $_POST['payment_id'] );
405
-	$form    = get_post( $form_id );
403
+	$form_id = intval($_POST['form_id']);
404
+	$payment_id = intval($_POST['payment_id']);
405
+	$form    = get_post($form_id);
406 406
 
407
-	if ( 'give_forms' != $form->post_type ) {
408
-		die( '-2' );
407
+	if ('give_forms' != $form->post_type) {
408
+		die('-2');
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        echo __( 'n/a', 'give' );
411
+    if ( ! give_has_variable_prices($form_id)) {
412
+        echo __('n/a', 'give');
413 413
     } else {
414 414
         // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
415
+        $payment = new Give_Payment($payment_id);
416 416
 
417 417
         // Payment meta.
418 418
         $payment_meta = $payment->get_meta();
419 419
 
420 420
 
421 421
         // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
422
+        $variable_price_dropdown_option = array(
423 423
             'id'                => $form_id,
424 424
             'name'              => 'give-variable-price',
425 425
             'chosen'            => true,
@@ -428,10 +428,10 @@  discard block
 block discarded – undo
428 428
         );
429 429
 
430 430
         // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
431
+        give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
432 432
     }
433 433
 
434 434
     give_die();
435 435
 }
436 436
 
437
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
437
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/class-give-customer.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -514,12 +514,12 @@  discard block
 block discarded – undo
514 514
 
515 515
 	/**
516 516
 	 * Decrease/Increase a customer's lifetime value
517
-     *
518
-     * This function will update donation stat on basis of current amount and new amount donation difference.
519
-     * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
520
-     *
521
-     *
522
-     * @access public
517
+	 *
518
+	 * This function will update donation stat on basis of current amount and new amount donation difference.
519
+	 * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
520
+	 *
521
+	 *
522
+	 * @access public
523 523
 	 * @since  1.0
524 524
 	 *
525 525
 	 * @param  float $curr_amount Current Donation amount
@@ -528,28 +528,28 @@  discard block
 block discarded – undo
528 528
 	 * @return mixed              If successful, the new donation stat value, otherwise false
529 529
 	 */
530 530
 	public function update_donation_value( $curr_amount, $new_amount ) {
531
-        /**
532
-         * Payment total difference value can be:
533
-         *  zero   (in case amount not change)
534
-         *  or -ve (in case amount decrease)
535
-         *  or +ve (in case amount increase)
536
-         */
537
-        $payment_total_diff = $new_amount - $curr_amount;
538
-
539
-        // We do not need to update donation stat if donation did not change.
540
-        if( ! $payment_total_diff ) {
541
-            return false;
542
-        }
543
-
544
-
545
-        if( $payment_total_diff > 0 ) {
546
-            $this->increase_value( $payment_total_diff );
547
-        }else{
548
-            // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549
-            $this->decrease_value( -$payment_total_diff );
550
-        }
551
-
552
-        return $this->purchase_value;
531
+		/**
532
+		 * Payment total difference value can be:
533
+		 *  zero   (in case amount not change)
534
+		 *  or -ve (in case amount decrease)
535
+		 *  or +ve (in case amount increase)
536
+		 */
537
+		$payment_total_diff = $new_amount - $curr_amount;
538
+
539
+		// We do not need to update donation stat if donation did not change.
540
+		if( ! $payment_total_diff ) {
541
+			return false;
542
+		}
543
+
544
+
545
+		if( $payment_total_diff > 0 ) {
546
+			$this->increase_value( $payment_total_diff );
547
+		}else{
548
+			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549
+			$this->decrease_value( -$payment_total_diff );
550
+		}
551
+
552
+		return $this->purchase_value;
553 553
 	}
554 554
 
555 555
 	/**
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 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
 
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 	 * @param bool $_id_or_email
98 98
 	 * @param bool $by_user_id
99 99
 	 */
100
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
100
+	public function __construct($_id_or_email = false, $by_user_id = false) {
101 101
 
102 102
 		$this->db = new Give_DB_Customers;
103 103
 
104
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
104
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
105 105
 			return false;
106 106
 		}
107 107
 
108
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
108
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
109 109
 
110
-		if ( is_numeric( $_id_or_email ) ) {
110
+		if (is_numeric($_id_or_email)) {
111 111
 			$field = $by_user_id ? 'user_id' : 'id';
112 112
 		} else {
113 113
 			$field = 'email';
114 114
 		}
115 115
 
116
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
116
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
117 117
 
118
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
118
+		if (empty($customer) || ! is_object($customer)) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		$this->setup_customer( $customer );
122
+		$this->setup_customer($customer);
123 123
 
124 124
 	}
125 125
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return bool             If the setup was successful or not
134 134
 	 */
135
-	private function setup_customer( $customer ) {
135
+	private function setup_customer($customer) {
136 136
 
137
-		if ( ! is_object( $customer ) ) {
137
+		if ( ! is_object($customer)) {
138 138
 			return false;
139 139
 		}
140 140
 
141
-		foreach ( $customer as $key => $value ) {
141
+		foreach ($customer as $key => $value) {
142 142
 
143
-			switch ( $key ) {
143
+			switch ($key) {
144 144
 
145 145
 				case 'notes':
146 146
 					$this->$key = $this->get_notes();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 		// Customer ID and email are the only things that are necessary, make sure they exist
158
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
158
+		if ( ! empty($this->id) && ! empty($this->email)) {
159 159
 			return true;
160 160
 		}
161 161
 
@@ -168,16 +168,16 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @since 1.0
170 170
 	 */
171
-	public function __get( $key ) {
171
+	public function __get($key) {
172 172
 
173
-		if ( method_exists( $this, 'get_' . $key ) ) {
173
+		if (method_exists($this, 'get_'.$key)) {
174 174
 
175
-			return call_user_func( array( $this, 'get_' . $key ) );
175
+			return call_user_func(array($this, 'get_'.$key));
176 176
 
177 177
 		} else {
178 178
 
179 179
 			/* translators: %s: property key */
180
-			return new WP_Error( 'give-customer-invalid-property', sprintf( __( 'Can\'t get property %s.', 'give' ), $key ) );
180
+			return new WP_Error('give-customer-invalid-property', sprintf(__('Can\'t get property %s.', 'give'), $key));
181 181
 
182 182
 		}
183 183
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return mixed        False if not a valid creation, Customer ID if user is found or valid creation
194 194
 	 */
195
-	public function create( $data = array() ) {
195
+	public function create($data = array()) {
196 196
 
197
-		if ( $this->id != 0 || empty( $data ) ) {
197
+		if ($this->id != 0 || empty($data)) {
198 198
 			return false;
199 199
 		}
200 200
 
@@ -202,34 +202,34 @@  discard block
 block discarded – undo
202 202
 			'payment_ids' => ''
203 203
 		);
204 204
 
205
-		$args = wp_parse_args( $data, $defaults );
206
-		$args = $this->sanitize_columns( $args );
205
+		$args = wp_parse_args($data, $defaults);
206
+		$args = $this->sanitize_columns($args);
207 207
 
208
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
208
+		if (empty($args['email']) || ! is_email($args['email'])) {
209 209
 			return false;
210 210
 		}
211 211
 
212
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
213
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
212
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
213
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
214 214
 		}
215 215
 
216
-		do_action( 'give_customer_pre_create', $args );
216
+		do_action('give_customer_pre_create', $args);
217 217
 
218 218
 		$created = false;
219 219
 
220 220
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
221
-		if ( $this->db->add( $data ) ) {
221
+		if ($this->db->add($data)) {
222 222
 
223 223
 			// We've successfully added/updated the customer, reset the class vars with the new data
224
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
224
+			$customer = $this->db->get_customer_by('email', $args['email']);
225 225
 
226 226
 			// Setup the customer data with the values from DB
227
-			$this->setup_customer( $customer );
227
+			$this->setup_customer($customer);
228 228
 
229 229
 			$created = $this->id;
230 230
 		}
231 231
 
232
-		do_action( 'give_customer_post_create', $created, $args );
232
+		do_action('give_customer_post_create', $created, $args);
233 233
 
234 234
 		return $created;
235 235
 
@@ -244,27 +244,27 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return bool         If the update was successful or not
246 246
 	 */
247
-	public function update( $data = array() ) {
247
+	public function update($data = array()) {
248 248
 
249
-		if ( empty( $data ) ) {
249
+		if (empty($data)) {
250 250
 			return false;
251 251
 		}
252 252
 
253
-		$data = $this->sanitize_columns( $data );
253
+		$data = $this->sanitize_columns($data);
254 254
 
255
-		do_action( 'give_customer_pre_update', $this->id, $data );
255
+		do_action('give_customer_pre_update', $this->id, $data);
256 256
 
257 257
 		$updated = false;
258 258
 
259
-		if ( $this->db->update( $this->id, $data ) ) {
259
+		if ($this->db->update($this->id, $data)) {
260 260
 
261
-			$customer = $this->db->get_customer_by( 'id', $this->id );
262
-			$this->setup_customer( $customer );
261
+			$customer = $this->db->get_customer_by('id', $this->id);
262
+			$this->setup_customer($customer);
263 263
 
264 264
 			$updated = true;
265 265
 		}
266 266
 
267
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
267
+		do_action('give_customer_post_update', $updated, $this->id, $data);
268 268
 
269 269
 		return $updated;
270 270
 	}
@@ -280,44 +280,44 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return bool            If the attachment was successfuly
282 282
 	 */
283
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
283
+	public function attach_payment($payment_id = 0, $update_stats = true) {
284 284
 
285
-		if ( empty( $payment_id ) ) {
285
+		if (empty($payment_id)) {
286 286
 			return false;
287 287
 		}
288 288
 
289
-		if ( empty( $this->payment_ids ) ) {
289
+		if (empty($this->payment_ids)) {
290 290
 
291 291
 			$new_payment_ids = $payment_id;
292 292
 
293 293
 		} else {
294 294
 
295
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
295
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
296 296
 
297
-			if ( in_array( $payment_id, $payment_ids ) ) {
297
+			if (in_array($payment_id, $payment_ids)) {
298 298
 				$update_stats = false;
299 299
 			}
300 300
 
301 301
 			$payment_ids[] = $payment_id;
302 302
 
303
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
303
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
304 304
 
305 305
 		}
306 306
 
307
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
307
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
308 308
 
309
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
309
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
310 310
 
311
-		if ( $payment_added ) {
311
+		if ($payment_added) {
312 312
 
313 313
 			$this->payment_ids = $new_payment_ids;
314 314
 
315 315
 			// We added this payment successfully, increment the stats
316
-			if ( $update_stats ) {
317
-				$payment_amount = give_get_payment_amount( $payment_id );
316
+			if ($update_stats) {
317
+				$payment_amount = give_get_payment_amount($payment_id);
318 318
 
319
-				if ( ! empty( $payment_amount ) ) {
320
-					$this->increase_value( $payment_amount );
319
+				if ( ! empty($payment_amount)) {
320
+					$this->increase_value($payment_amount);
321 321
 				}
322 322
 
323 323
 				$this->increase_purchase_count();
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 		}
327 327
 
328
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
328
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
329 329
 
330 330
 		return $payment_added;
331 331
 	}
@@ -341,50 +341,50 @@  discard block
 block discarded – undo
341 341
 	 *
342 342
 	 * @return boolean             If the removal was successful
343 343
 	 */
344
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
344
+	public function remove_payment($payment_id = 0, $update_stats = true) {
345 345
 
346
-		if ( empty( $payment_id ) ) {
346
+		if (empty($payment_id)) {
347 347
 			return false;
348 348
 		}
349 349
 
350
-		$payment = new Give_Payment( $payment_id );
350
+		$payment = new Give_Payment($payment_id);
351 351
 
352
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
352
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
353 353
 			$update_stats = false;
354 354
 		}
355 355
 
356 356
 		$new_payment_ids = '';
357 357
 
358
-		if ( ! empty( $this->payment_ids ) ) {
358
+		if ( ! empty($this->payment_ids)) {
359 359
 
360
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
360
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
361 361
 
362
-			$pos = array_search( $payment_id, $payment_ids );
363
-			if ( false === $pos ) {
362
+			$pos = array_search($payment_id, $payment_ids);
363
+			if (false === $pos) {
364 364
 				return false;
365 365
 			}
366 366
 
367
-			unset( $payment_ids[ $pos ] );
368
-			$payment_ids = array_filter( $payment_ids );
367
+			unset($payment_ids[$pos]);
368
+			$payment_ids = array_filter($payment_ids);
369 369
 
370
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
370
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
371 371
 
372 372
 		}
373 373
 
374
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
374
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
375 375
 
376
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
376
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
377 377
 
378
-		if ( $payment_removed ) {
378
+		if ($payment_removed) {
379 379
 
380 380
 			$this->payment_ids = $new_payment_ids;
381 381
 
382
-			if ( $update_stats ) {
382
+			if ($update_stats) {
383 383
 				// We removed this payment successfully, decrement the stats
384
-				$payment_amount = give_get_payment_amount( $payment_id );
384
+				$payment_amount = give_get_payment_amount($payment_id);
385 385
 
386
-				if ( ! empty( $payment_amount ) ) {
387
-					$this->decrease_value( $payment_amount );
386
+				if ( ! empty($payment_amount)) {
387
+					$this->decrease_value($payment_amount);
388 388
 				}
389 389
 
390 390
 				$this->decrease_purchase_count();
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 		}
394 394
 
395
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
395
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
396 396
 
397 397
 		return $payment_removed;
398 398
 
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 	 *
408 408
 	 * @return int            The purchase count
409 409
 	 */
410
-	public function increase_purchase_count( $count = 1 ) {
410
+	public function increase_purchase_count($count = 1) {
411 411
 
412 412
 		// Make sure it's numeric and not negative
413
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
413
+		if ( ! is_numeric($count) || $count != absint($count)) {
414 414
 			return false;
415 415
 		}
416 416
 
417 417
 		$new_total = (int) $this->purchase_count + (int) $count;
418 418
 
419
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
419
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
420 420
 
421
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
421
+		if ($this->update(array('purchase_count' => $new_total))) {
422 422
 			$this->purchase_count = $new_total;
423 423
 		}
424 424
 
425
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
425
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
426 426
 
427 427
 		return $this->purchase_count;
428 428
 	}
@@ -436,26 +436,26 @@  discard block
 block discarded – undo
436 436
 	 *
437 437
 	 * @return mixed          If successful, the new count, otherwise false
438 438
 	 */
439
-	public function decrease_purchase_count( $count = 1 ) {
439
+	public function decrease_purchase_count($count = 1) {
440 440
 
441 441
 		// Make sure it's numeric and not negative
442
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
442
+		if ( ! is_numeric($count) || $count != absint($count)) {
443 443
 			return false;
444 444
 		}
445 445
 
446 446
 		$new_total = (int) $this->purchase_count - (int) $count;
447 447
 
448
-		if ( $new_total < 0 ) {
448
+		if ($new_total < 0) {
449 449
 			$new_total = 0;
450 450
 		}
451 451
 
452
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
452
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
453 453
 
454
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
454
+		if ($this->update(array('purchase_count' => $new_total))) {
455 455
 			$this->purchase_count = $new_total;
456 456
 		}
457 457
 
458
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
458
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
459 459
 
460 460
 		return $this->purchase_count;
461 461
 	}
@@ -469,17 +469,17 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return mixed         If successful, the new value, otherwise false
471 471
 	 */
472
-	public function increase_value( $value = 0.00 ) {
472
+	public function increase_value($value = 0.00) {
473 473
 
474
-		$new_value = floatval( $this->purchase_value ) + $value;
474
+		$new_value = floatval($this->purchase_value) + $value;
475 475
 
476
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
476
+		do_action('give_customer_pre_increase_value', $value, $this->id);
477 477
 
478
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
478
+		if ($this->update(array('purchase_value' => $new_value))) {
479 479
 			$this->purchase_value = $new_value;
480 480
 		}
481 481
 
482
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
482
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
483 483
 
484 484
 		return $this->purchase_value;
485 485
 	}
@@ -493,21 +493,21 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @return mixed         If successful, the new value, otherwise false
495 495
 	 */
496
-	public function decrease_value( $value = 0.00 ) {
496
+	public function decrease_value($value = 0.00) {
497 497
 
498
-		$new_value = floatval( $this->purchase_value ) - $value;
498
+		$new_value = floatval($this->purchase_value) - $value;
499 499
 
500
-		if ( $new_value < 0 ) {
500
+		if ($new_value < 0) {
501 501
 			$new_value = 0.00;
502 502
 		}
503 503
 
504
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
504
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
505 505
 
506
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
506
+		if ($this->update(array('purchase_value' => $new_value))) {
507 507
 			$this->purchase_value = $new_value;
508 508
 		}
509 509
 
510
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
510
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
511 511
 
512 512
 		return $this->purchase_value;
513 513
 	}
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return mixed              If successful, the new donation stat value, otherwise false
529 529
 	 */
530
-	public function update_donation_value( $curr_amount, $new_amount ) {
530
+	public function update_donation_value($curr_amount, $new_amount) {
531 531
         /**
532 532
          * Payment total difference value can be:
533 533
          *  zero   (in case amount not change)
@@ -537,14 +537,14 @@  discard block
 block discarded – undo
537 537
         $payment_total_diff = $new_amount - $curr_amount;
538 538
 
539 539
         // We do not need to update donation stat if donation did not change.
540
-        if( ! $payment_total_diff ) {
540
+        if ( ! $payment_total_diff) {
541 541
             return false;
542 542
         }
543 543
 
544 544
 
545
-        if( $payment_total_diff > 0 ) {
546
-            $this->increase_value( $payment_total_diff );
547
-        }else{
545
+        if ($payment_total_diff > 0) {
546
+            $this->increase_value($payment_total_diff);
547
+        } else {
548 548
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549 549
             $this->decrease_value( -$payment_total_diff );
550 550
         }
@@ -562,15 +562,15 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return array           The notes requsted
564 564
 	 */
565
-	public function get_notes( $length = 20, $paged = 1 ) {
565
+	public function get_notes($length = 20, $paged = 1) {
566 566
 
567
-		$length = is_numeric( $length ) ? $length : 20;
568
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
567
+		$length = is_numeric($length) ? $length : 20;
568
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
569 569
 
570 570
 		$all_notes   = $this->get_raw_notes();
571
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
571
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
572 572
 
573
-		$desired_notes = array_slice( $notes_array, $offset, $length );
573
+		$desired_notes = array_slice($notes_array, $offset, $length);
574 574
 
575 575
 		return $desired_notes;
576 576
 
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 	public function get_notes_count() {
586 586
 
587 587
 		$all_notes   = $this->get_raw_notes();
588
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
588
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
589 589
 
590
-		return count( $notes_array );
590
+		return count($notes_array);
591 591
 
592 592
 	}
593 593
 
@@ -600,32 +600,32 @@  discard block
 block discarded – undo
600 600
 	 *
601 601
 	 * @return string|boolean The new note if added succesfully, false otherwise
602 602
 	 */
603
-	public function add_note( $note = '' ) {
603
+	public function add_note($note = '') {
604 604
 
605
-		$note = trim( $note );
606
-		if ( empty( $note ) ) {
605
+		$note = trim($note);
606
+		if (empty($note)) {
607 607
 			return false;
608 608
 		}
609 609
 
610 610
 		$notes = $this->get_raw_notes();
611 611
 
612
-		if ( empty( $notes ) ) {
612
+		if (empty($notes)) {
613 613
 			$notes = '';
614 614
 		}
615 615
 
616
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
617
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
618
-		$notes .= "\n\n" . $new_note;
616
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
617
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
618
+		$notes .= "\n\n".$new_note;
619 619
 
620
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
620
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
621 621
 
622
-		$updated = $this->update( array( 'notes' => $notes ) );
622
+		$updated = $this->update(array('notes' => $notes));
623 623
 
624
-		if ( $updated ) {
624
+		if ($updated) {
625 625
 			$this->notes = $this->get_notes();
626 626
 		}
627 627
 
628
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
628
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
629 629
 
630 630
 		// Return the formatted note, so we can test, as well as update any displays
631 631
 		return $new_note;
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 */
641 641
 	private function get_raw_notes() {
642 642
 
643
-		$all_notes = $this->db->get_column( 'notes', $this->id );
643
+		$all_notes = $this->db->get_column('notes', $this->id);
644 644
 
645 645
 		return $all_notes;
646 646
 
@@ -655,51 +655,51 @@  discard block
 block discarded – undo
655 655
 	 *
656 656
 	 * @return array       The sanitized data, based off column defaults
657 657
 	 */
658
-	private function sanitize_columns( $data ) {
658
+	private function sanitize_columns($data) {
659 659
 
660 660
 		$columns        = $this->db->get_columns();
661 661
 		$default_values = $this->db->get_column_defaults();
662 662
 
663
-		foreach ( $columns as $key => $type ) {
663
+		foreach ($columns as $key => $type) {
664 664
 
665 665
 			// Only sanitize data that we were provided
666
-			if ( ! array_key_exists( $key, $data ) ) {
666
+			if ( ! array_key_exists($key, $data)) {
667 667
 				continue;
668 668
 			}
669 669
 
670
-			switch ( $type ) {
670
+			switch ($type) {
671 671
 
672 672
 				case '%s':
673
-					if ( 'email' == $key ) {
674
-						$data[ $key ] = sanitize_email( $data[ $key ] );
675
-					} elseif ( 'notes' == $key ) {
676
-						$data[ $key ] = strip_tags( $data[ $key ] );
673
+					if ('email' == $key) {
674
+						$data[$key] = sanitize_email($data[$key]);
675
+					} elseif ('notes' == $key) {
676
+						$data[$key] = strip_tags($data[$key]);
677 677
 					} else {
678
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
678
+						$data[$key] = sanitize_text_field($data[$key]);
679 679
 					}
680 680
 					break;
681 681
 
682 682
 				case '%d':
683
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
684
-						$data[ $key ] = $default_values[ $key ];
683
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
684
+						$data[$key] = $default_values[$key];
685 685
 					} else {
686
-						$data[ $key ] = absint( $data[ $key ] );
686
+						$data[$key] = absint($data[$key]);
687 687
 					}
688 688
 					break;
689 689
 
690 690
 				case '%f':
691 691
 					// Convert what was given to a float
692
-					$value = floatval( $data[ $key ] );
692
+					$value = floatval($data[$key]);
693 693
 
694
-					if ( ! is_float( $value ) ) {
695
-						$data[ $key ] = $default_values[ $key ];
694
+					if ( ! is_float($value)) {
695
+						$data[$key] = $default_values[$key];
696 696
 					} else {
697
-						$data[ $key ] = $value;
697
+						$data[$key] = $value;
698 698
 					}
699 699
 					break;
700 700
 
701 701
 				default:
702
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
702
+					$data[$key] = sanitize_text_field($data[$key]);
703 703
 					break;
704 704
 
705 705
 			}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -544,7 +544,7 @@
 block discarded – undo
544 544
 
545 545
         if( $payment_total_diff > 0 ) {
546 546
             $this->increase_value( $payment_total_diff );
547
-        }else{
547
+        } else{
548 548
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549 549
             $this->decrease_value( -$payment_total_diff );
550 550
         }
Please login to merge, or discard this patch.
includes/template-functions.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
  * @uses  load_template()
52 52
  * @uses  get_template_part()
53 53
  */
54
-function give_get_template_part( $slug, $name = null, $load = true ) {
54
+function give_get_template_part($slug, $name = null, $load = true) {
55 55
 
56 56
 	// Execute code for this part
57
-	do_action( 'get_template_part_' . $slug, $slug, $name );
57
+	do_action('get_template_part_'.$slug, $slug, $name);
58 58
 
59 59
 	// Setup possible parts
60 60
 	$templates = array();
61
-	if ( isset( $name ) ) {
62
-		$templates[] = $slug . '-' . $name . '.php';
61
+	if (isset($name)) {
62
+		$templates[] = $slug.'-'.$name.'.php';
63 63
 	}
64
-	$templates[] = $slug . '.php';
64
+	$templates[] = $slug.'.php';
65 65
 
66 66
 	// Allow template parts to be filtered
67
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
67
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
68 68
 
69 69
 	// Return the part that is found
70
-	return give_locate_template( $templates, $load, false );
70
+	return give_locate_template($templates, $load, false);
71 71
 }
72 72
 
73 73
 /**
@@ -88,37 +88,37 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return string The template filename if one is located.
90 90
  */
91
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
91
+function give_locate_template($template_names, $load = false, $require_once = true) {
92 92
 	// No file found yet
93 93
 	$located = false;
94 94
 
95 95
 	// Try to find a template file
96
-	foreach ( (array) $template_names as $template_name ) {
96
+	foreach ((array) $template_names as $template_name) {
97 97
 
98 98
 		// Continue if template is empty
99
-		if ( empty( $template_name ) ) {
99
+		if (empty($template_name)) {
100 100
 			continue;
101 101
 		}
102 102
 
103 103
 		// Trim off any slashes from the template name
104
-		$template_name = ltrim( $template_name, '/' );
104
+		$template_name = ltrim($template_name, '/');
105 105
 
106 106
 		// try locating this template file by looping through the template paths
107
-		foreach ( give_get_theme_template_paths() as $template_path ) {
107
+		foreach (give_get_theme_template_paths() as $template_path) {
108 108
 
109
-			if ( file_exists( $template_path . $template_name ) ) {
110
-				$located = $template_path . $template_name;
109
+			if (file_exists($template_path.$template_name)) {
110
+				$located = $template_path.$template_name;
111 111
 				break;
112 112
 			}
113 113
 		}
114 114
 
115
-		if ( $located ) {
115
+		if ($located) {
116 116
 			break;
117 117
 		}
118 118
 	}
119 119
 
120
-	if ( ( true == $load ) && ! empty( $located ) ) {
121
-		load_template( $located, $require_once );
120
+	if ((true == $load) && ! empty($located)) {
121
+		load_template($located, $require_once);
122 122
 	}
123 123
 
124 124
 	return $located;
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	$template_dir = give_get_theme_template_dir_name();
136 136
 
137 137
 	$file_paths = array(
138
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
139
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
138
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
139
+		10  => trailingslashit(get_template_directory()).$template_dir,
140 140
 		100 => give_get_templates_dir()
141 141
 	);
142 142
 
143
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
143
+	$file_paths = apply_filters('give_template_paths', $file_paths);
144 144
 
145 145
 	// sort the file paths based on priority
146
-	ksort( $file_paths, SORT_NUMERIC );
146
+	ksort($file_paths, SORT_NUMERIC);
147 147
 
148
-	return array_map( 'trailingslashit', $file_paths );
148
+	return array_map('trailingslashit', $file_paths);
149 149
 }
150 150
 
151 151
 /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  * @return string
158 158
  */
159 159
 function give_get_theme_template_dir_name() {
160
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
160
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
161 161
 }
162 162
 
163 163
 /**
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
  * @return void
168 168
  */
169 169
 function give_version_in_header() {
170
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
170
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
171 171
 }
172 172
 
173
-add_action( 'wp_head', 'give_version_in_header' );
173
+add_action('wp_head', 'give_version_in_header');
174 174
 
175 175
 /**
176 176
  * Determines if we're currently on the Donations History page.
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
  */
181 181
 function give_is_donation_history_page() {
182 182
 
183
-	$ret = is_page( give_get_option( 'history_page' ) );
183
+	$ret = is_page(give_get_option('history_page'));
184 184
 
185
-	return apply_filters( 'give_is_donation_history_page', $ret );
185
+	return apply_filters('give_is_donation_history_page', $ret);
186 186
 }
187 187
 
188 188
 /**
@@ -194,25 +194,25 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return array Modified array of classes
196 196
  */
197
-function give_add_body_classes( $class ) {
197
+function give_add_body_classes($class) {
198 198
 	$classes = (array) $class;
199 199
 
200
-	if ( give_is_success_page() ) {
200
+	if (give_is_success_page()) {
201 201
 		$classes[] = 'give-success';
202 202
 		$classes[] = 'give-page';
203 203
 	}
204 204
 
205
-	if ( give_is_failed_transaction_page() ) {
205
+	if (give_is_failed_transaction_page()) {
206 206
 		$classes[] = 'give-failed-transaction';
207 207
 		$classes[] = 'give-page';
208 208
 	}
209 209
 
210
-	if ( give_is_donation_history_page() ) {
210
+	if (give_is_donation_history_page()) {
211 211
 		$classes[] = 'give-donation-history';
212 212
 		$classes[] = 'give-page';
213 213
 	}
214 214
 
215
-	if ( give_is_test_mode() ) {
215
+	if (give_is_test_mode()) {
216 216
 		$classes[] = 'give-test-mode';
217 217
 		$classes[] = 'give-page';
218 218
 	}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	//Theme-specific Classes used to prevent conflicts via CSS
221 221
 	$current_theme = wp_get_theme();
222 222
 
223
-	switch ( $current_theme->template ) {
223
+	switch ($current_theme->template) {
224 224
 
225 225
 		case 'Divi':
226 226
 			$classes[] = 'give-divi';
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 
235 235
 	}
236 236
 
237
-	return array_unique( $classes );
237
+	return array_unique($classes);
238 238
 }
239 239
 
240
-add_filter( 'body_class', 'give_add_body_classes' );
240
+add_filter('body_class', 'give_add_body_classes');
241 241
 
242 242
 
243 243
 /**
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return array
255 255
  */
256
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
257
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
256
+function give_add_post_class($classes, $class = '', $post_id = '') {
257
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
258 258
 		return $classes;
259 259
 	}
260 260
 
261 261
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
262 262
 
263
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
264
-		unset( $classes[ $key ] );
263
+	if (false !== ($key = array_search('hentry', $classes))) {
264
+		unset($classes[$key]);
265 265
 	}
266 266
 
267 267
 	return $classes;
268 268
 }
269 269
 
270 270
 
271
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
271
+add_filter('post_class', 'give_add_post_class', 20, 3);
272 272
 
273 273
 /**
274 274
  * Get the placeholder image URL for forms etc
@@ -278,84 +278,84 @@  discard block
 block discarded – undo
278 278
  */
279 279
 function give_get_placeholder_img_src() {
280 280
 
281
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
281
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
282 282
 
283
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
283
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
284 284
 }
285 285
 
286 286
 
287 287
 /**
288 288
  * Global
289 289
  */
290
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
290
+if ( ! function_exists('give_output_content_wrapper')) {
291 291
 
292 292
 	/**
293 293
 	 * Output the start of the page wrapper.
294 294
 	 */
295 295
 	function give_output_content_wrapper() {
296
-		give_get_template_part( 'global/wrapper-start' );
296
+		give_get_template_part('global/wrapper-start');
297 297
 	}
298 298
 }
299
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
299
+if ( ! function_exists('give_output_content_wrapper_end')) {
300 300
 
301 301
 	/**
302 302
 	 * Output the end of the page wrapper.
303 303
 	 */
304 304
 	function give_output_content_wrapper_end() {
305
-		give_get_template_part( 'global/wrapper-end' );
305
+		give_get_template_part('global/wrapper-end');
306 306
 	}
307 307
 }
308 308
 
309 309
 /**
310 310
  * Single Give Form
311 311
  */
312
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
312
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
313 313
 	function give_left_sidebar_pre_wrap() {
314
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
314
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
315 315
 	}
316 316
 }
317 317
 
318
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
318
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
319 319
 	function give_left_sidebar_post_wrap() {
320
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
320
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
321 321
 	}
322 322
 }
323 323
 
324
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
324
+if ( ! function_exists('give_get_forms_sidebar')) {
325 325
 	function give_get_forms_sidebar() {
326
-		give_get_template_part( 'single-give-form/sidebar' );
326
+		give_get_template_part('single-give-form/sidebar');
327 327
 	}
328 328
 }
329 329
 
330
-if ( ! function_exists( 'give_show_form_images' ) ) {
330
+if ( ! function_exists('give_show_form_images')) {
331 331
 
332 332
 	/**
333 333
 	 * Output the product image before the single product summary.
334 334
 	 */
335 335
 	function give_show_form_images() {
336
-		$featured_image_option = give_get_option( 'disable_form_featured_img' );
337
-		if ( $featured_image_option !== 'on' ) {
338
-			give_get_template_part( 'single-give-form/featured-image' );
336
+		$featured_image_option = give_get_option('disable_form_featured_img');
337
+		if ($featured_image_option !== 'on') {
338
+			give_get_template_part('single-give-form/featured-image');
339 339
 		}
340 340
 	}
341 341
 }
342 342
 
343
-if ( ! function_exists( 'give_template_single_title' ) ) {
343
+if ( ! function_exists('give_template_single_title')) {
344 344
 
345 345
 	/**
346 346
 	 * Output the product title.
347 347
 	 */
348 348
 	function give_template_single_title() {
349
-		give_get_template_part( 'single-give-form/title' );
349
+		give_get_template_part('single-give-form/title');
350 350
 	}
351 351
 }
352 352
 
353
-if ( ! function_exists( 'give_show_avatars' ) ) {
353
+if ( ! function_exists('give_show_avatars')) {
354 354
 
355 355
 	/**
356 356
 	 * Output the product title.
357 357
 	 */
358 358
 	function give_show_avatars() {
359
-		echo do_shortcode( '[give_donators_gravatars]' );
359
+		echo do_shortcode('[give_donators_gravatars]');
360 360
 	}
361 361
 }
362 362
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @see   Give_Cron::weekly_events()
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
33
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
32
+		add_filter('cron_schedules', array($this, 'add_schedules'));
33
+		add_action('wp', array($this, 'schedule_Events'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array
44 44
 	 */
45
-	public function add_schedules( $schedules = array() ) {
45
+	public function add_schedules($schedules = array()) {
46 46
 		// Adds once weekly to the existing schedules.
47 47
 		$schedules['weekly'] = array(
48 48
 			'interval' => 604800,
49
-			'display'  => __( 'Once Weekly', 'give' )
49
+			'display'  => __('Once Weekly', 'give')
50 50
 		);
51 51
 
52 52
 		return $schedules;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	private function weekly_events() {
75
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
76
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
75
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
76
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
77 77
 		}
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return void
86 86
 	 */
87 87
 	private function daily_events() {
88
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
89
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
88
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
89
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.