Completed
Push — master ( 174751...a17e4c )
by Devin
22:30 queued 02:40
created
includes/admin/tools/class-settings-logs.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Logs' ) ) :
16
+if ( ! class_exists('Give_Settings_Logs')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Logs.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'logs';
46
-			$this->label = esc_html__( 'Logs', 'give' );
46
+			$this->label = esc_html__('Logs', 'give');
47 47
 
48 48
 			$this->default_tab = 'sales';
49 49
 
50 50
 			parent::__construct();
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if ( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-tools_open_form', '__return_empty_string' );
55
-				add_action( 'give-tools_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-tools_open_form', '__return_empty_string');
55
+				add_action('give-tools_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 		 *
66 66
 		 * @return array
67 67
 		 */
68
-		public function add_settings_page( $pages ) {
69
-			$pages[ $this->id ] = $this->label;
68
+		public function add_settings_page($pages) {
69
+			$pages[$this->id] = $this->label;
70 70
 
71 71
 			return $pages;
72 72
 		}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			$GLOBALS['give_hide_save_button'] = true;
83 83
 
84 84
 			// Get settings.
85
-			$settings = apply_filters( 'give_settings_logs', array(
85
+			$settings = apply_filters('give_settings_logs', array(
86 86
 				array(
87 87
 					'id'         => 'give_tools_logs',
88 88
 					'type'       => 'title',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 				),
91 91
 				array(
92 92
 					'id'   => 'api',
93
-					'name' => esc_html__( 'Log', 'give' ),
93
+					'name' => esc_html__('Log', 'give'),
94 94
 					'type' => 'logs',
95 95
 
96 96
 				),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 					'type'       => 'sectionend',
100 100
 					'table_html' => false,
101 101
 				),
102
-			) );
102
+			));
103 103
 
104 104
 			/**
105 105
 			 * Filter the settings.
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			 *
109 109
 			 * @param  array $settings
110 110
 			 */
111
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
111
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
112 112
 
113 113
 			// Output.
114 114
 			return $settings;
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 		 */
123 123
 		public function get_sections() {
124 124
 			$sections = array(
125
-				'sales'          => esc_html__( 'Donations', 'give' ),
126
-				'gateway_errors' => esc_html__( 'Payment Errors', 'give' ),
127
-				'api_requests'   => esc_html__( 'API Requests', 'give' ),
125
+				'sales'          => esc_html__('Donations', 'give'),
126
+				'gateway_errors' => esc_html__('Payment Errors', 'give'),
127
+				'api_requests'   => esc_html__('API Requests', 'give'),
128 128
 			);
129 129
 
130
-			$sections = apply_filters( 'give_log_views', $sections );
130
+			$sections = apply_filters('give_log_views', $sections);
131 131
 
132
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
132
+			return apply_filters('give_get_sections_'.$this->id, $sections);
133 133
 		}
134 134
 
135 135
 		/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		public function output() {
142 142
 			$settings = $this->get_settings();
143 143
 
144
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
144
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
145 145
 		}
146 146
 	}
147 147
 
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-api.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_API' ) ) :
16
+if ( ! class_exists('Give_Settings_API')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_API.
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'api';
46
-			$this->label = esc_html__( 'API', 'give' );
46
+			$this->label = esc_html__('API', 'give');
47 47
 
48
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
50 50
 		}
51 51
 
52 52
 		/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 		 * @param  array $pages Lst of pages.
57 57
 		 * @return array
58 58
 		 */
59
-		public function add_settings_page( $pages ) {
60
-			$pages[ $this->id ] = $this->label;
59
+		public function add_settings_page($pages) {
60
+			$pages[$this->id] = $this->label;
61 61
 
62 62
 			return $pages;
63 63
 		}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			$GLOBALS['give_hide_save_button'] = true;
74 74
 
75 75
 			// Get settings.
76
-			$settings = apply_filters( 'give_settings_api', array(
76
+			$settings = apply_filters('give_settings_api', array(
77 77
 				array(
78 78
 					'id'   => 'give_tools_api',
79 79
 					'type' => 'title',
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				),
82 82
 				array(
83 83
 					'id'   => 'api',
84
-					'name' => esc_html__( 'API', 'give' ),
84
+					'name' => esc_html__('API', 'give'),
85 85
 					'type' => 'api',
86 86
 				),
87 87
 				array(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			 * @since  1.8
98 98
 			 * @param  array $settings
99 99
 			 */
100
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
100
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
101 101
 
102 102
 			// Output.
103 103
 			return $settings;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		public function output() {
113 113
 			$settings = $this->get_settings();
114 114
 
115
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
115
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
116 116
 		}
117 117
 	}
118 118
 
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-data.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Data' ) ) :
16
+if ( ! class_exists('Give_Settings_Data')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Data.
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'data';
46
-			$this->label = esc_html__( 'Data', 'give' );
46
+			$this->label = esc_html__('Data', 'give');
47 47
 
48
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
50 50
 
51 51
 			// Do not use main form for this tab.
52
-			if( give_get_current_setting_tab() === $this->id ) {
53
-				add_action( "give-tools_open_form", '__return_empty_string' );
54
-				add_action( "give-tools_close_form", '__return_empty_string' );
52
+			if (give_get_current_setting_tab() === $this->id) {
53
+				add_action("give-tools_open_form", '__return_empty_string');
54
+				add_action("give-tools_close_form", '__return_empty_string');
55 55
 			}
56 56
 		}
57 57
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 		 * @param  array $pages Lst of pages.
63 63
 		 * @return array
64 64
 		 */
65
-		public function add_settings_page( $pages ) {
66
-			$pages[ $this->id ] = $this->label;
65
+		public function add_settings_page($pages) {
66
+			$pages[$this->id] = $this->label;
67 67
 
68 68
 			return $pages;
69 69
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			$GLOBALS['give_hide_save_button'] = true;
80 80
 
81 81
 			// Get settings.
82
-			$settings = apply_filters( 'give_settings_data', array(
82
+			$settings = apply_filters('give_settings_data', array(
83 83
 				array(
84 84
 					'id'   => 'give_tools_tools',
85 85
 					'type' => 'title',
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				),
88 88
 				array(
89 89
 					'id'   => 'api',
90
-					'name' => esc_html__( 'Tools', 'give' ),
90
+					'name' => esc_html__('Tools', 'give'),
91 91
 					'type' => 'data',
92 92
 				),
93 93
 				array(
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			 * @since  1.8
104 104
 			 * @param  array $settings
105 105
 			 */
106
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
106
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
107 107
 
108 108
 			// Output.
109 109
 			return $settings;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		public function output() {
119 119
 			$settings = $this->get_settings();
120 120
 
121
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
121
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
122 122
 		}
123 123
 	}
124 124
 
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Spacing   +102 added lines, -102 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
 
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 function give_donation_history() {
27 27
 
28 28
 	// If payment_key query arg exists, return receipt instead of donation history.
29
-	if ( isset( $_GET['payment_key'] ) ) {
29
+	if (isset($_GET['payment_key'])) {
30 30
 		ob_start();
31
-		echo give_receipt_shortcode( array() );
32
-		echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">&laquo; ' . esc_html__( 'Return to All Donations', 'give' ) . '</a>';
31
+		echo give_receipt_shortcode(array());
32
+		echo '<a href="'.esc_url(give_get_history_page_uri()).'">&laquo; '.esc_html__('Return to All Donations', 'give').'</a>';
33 33
 
34 34
 		return ob_get_clean();
35 35
 	}
36 36
 
37
-	$email_access = give_get_option( 'email_access' );
37
+	$email_access = give_get_option('email_access');
38 38
 
39 39
 	/**
40 40
 	 * Determine access
@@ -44,28 +44,28 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	if (
46 46
 		is_user_logged_in() || false !== Give()->session->get_session_expiration()
47
-		|| ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists )
47
+		|| (give_is_setting_enabled($email_access) && Give()->email_access->token_exists)
48 48
 	) {
49 49
 		ob_start();
50
-		give_get_template_part( 'history', 'donations' );
50
+		give_get_template_part('history', 'donations');
51 51
 
52 52
 		return ob_get_clean();
53 53
 
54
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
54
+	} elseif (give_is_setting_enabled($email_access)) {
55 55
 		//Is Email-based access enabled?
56 56
 		ob_start();
57
-		give_get_template_part( 'email', 'login-form' );
57
+		give_get_template_part('email', 'login-form');
58 58
 
59 59
 		return ob_get_clean();
60 60
 	} else {
61 61
 
62
-		echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
63
-		echo do_shortcode( '[give_login]' );
62
+		echo apply_filters('give_donation_history_nonuser_message', give_output_error(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
63
+		echo do_shortcode('[give_login]');
64 64
 		
65 65
 	}
66 66
 }
67 67
 
68
-add_shortcode( 'donation_history', 'give_donation_history' );
68
+add_shortcode('donation_history', 'give_donation_history');
69 69
 
70 70
 /**
71 71
  * Donation Form Shortcode
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
  *
79 79
  * @return string
80 80
  */
81
-function give_form_shortcode( $atts ) {
82
-	$atts = shortcode_atts( array(
81
+function give_form_shortcode($atts) {
82
+	$atts = shortcode_atts(array(
83 83
 		'id'                    => '',
84 84
 		'show_title'            => true,
85 85
 		'show_goal'             => true,
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
 		'float_labels'          => '',
88 88
 		'display_style'         => '',
89 89
 		'continue_button_title' => '',
90
-	), $atts, 'give_form' );
90
+	), $atts, 'give_form');
91 91
 
92 92
 	// Convert string to bool.
93
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
94
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
93
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
94
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
95 95
 
96 96
 	//get the Give Form
97 97
 	ob_start();
98
-	give_get_donation_form( $atts );
98
+	give_get_donation_form($atts);
99 99
 	$final_output = ob_get_clean();
100 100
 
101
-	return apply_filters( 'give_donate_form', $final_output, $atts );
101
+	return apply_filters('give_donate_form', $final_output, $atts);
102 102
 }
103 103
 
104
-add_shortcode( 'give_form', 'give_form_shortcode' );
104
+add_shortcode('give_form', 'give_form_shortcode');
105 105
 
106 106
 /**
107 107
  * Donation Form Goal Shortcode.
@@ -114,37 +114,37 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return string
116 116
  */
117
-function give_goal_shortcode( $atts ) {
118
-	$atts = shortcode_atts( array(
117
+function give_goal_shortcode($atts) {
118
+	$atts = shortcode_atts(array(
119 119
 		'id'        => '',
120 120
 		'show_text' => true,
121 121
 		'show_bar'  => true,
122
-	), $atts, 'give_goal' );
122
+	), $atts, 'give_goal');
123 123
 
124 124
 
125 125
 	//get the Give Form.
126 126
 	ob_start();
127 127
 
128 128
 	//Sanity check 1: ensure there is an ID Provided.
129
-	if ( empty( $atts['id'] ) ) {
130
-		give_output_error( esc_html__( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
129
+	if (empty($atts['id'])) {
130
+		give_output_error(esc_html__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
131 131
 	}
132 132
 
133 133
 	//Sanity check 2: Check the form even has Goals enabled.
134
-	if ( ! give_is_setting_enabled( get_post_meta( $atts['id'], '_give_goal_option', true ) ) ) {
134
+	if ( ! give_is_setting_enabled(get_post_meta($atts['id'], '_give_goal_option', true))) {
135 135
 
136
-		give_output_error( esc_html__( 'The form does not have Goals enabled.', 'give' ), true );
136
+		give_output_error(esc_html__('The form does not have Goals enabled.', 'give'), true);
137 137
 	} else {
138 138
 		//Passed all sanity checks: output Goal.
139
-		give_show_goal_progress( $atts['id'], $atts );
139
+		give_show_goal_progress($atts['id'], $atts);
140 140
 	}
141 141
 
142 142
 	$final_output = ob_get_clean();
143 143
 
144
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
144
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
145 145
 }
146 146
 
147
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
147
+add_shortcode('give_goal', 'give_goal_shortcode');
148 148
 
149 149
 
150 150
 /**
@@ -161,22 +161,22 @@  discard block
 block discarded – undo
161 161
  *
162 162
  * @return string
163 163
  */
164
-function give_login_form_shortcode( $atts ) {
165
-	$atts = shortcode_atts( array(
164
+function give_login_form_shortcode($atts) {
165
+	$atts = shortcode_atts(array(
166 166
 		// Add backward compatibility for redirect attribute.
167 167
 		'redirect' => '',
168 168
 
169 169
 		'login-redirect'  => '',
170 170
 		'logout-redirect' => '',
171
-	), $atts, 'give_login' );
171
+	), $atts, 'give_login');
172 172
 
173 173
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
174
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
174
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
175 175
 
176
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
176
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
177 177
 }
178 178
 
179
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
179
+add_shortcode('give_login', 'give_login_form_shortcode');
180 180
 
181 181
 /**
182 182
  * Register Shortcode.
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
  *
192 192
  * @return string
193 193
  */
194
-function give_register_form_shortcode( $atts ) {
195
-	$atts = shortcode_atts( array(
194
+function give_register_form_shortcode($atts) {
195
+	$atts = shortcode_atts(array(
196 196
 		'redirect' => '',
197
-	), $atts, 'give_register' );
197
+	), $atts, 'give_register');
198 198
 
199
-	return give_register_form( $atts['redirect'] );
199
+	return give_register_form($atts['redirect']);
200 200
 }
201 201
 
202
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
202
+add_shortcode('give_register', 'give_register_form_shortcode');
203 203
 
204 204
 /**
205 205
  * Receipt Shortcode.
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
  *
213 213
  * @return string
214 214
  */
215
-function give_receipt_shortcode( $atts ) {
215
+function give_receipt_shortcode($atts) {
216 216
 
217 217
 	global $give_receipt_args, $payment;
218 218
 
219
-	$give_receipt_args = shortcode_atts( array(
220
-		'error'          => esc_html__( 'You are missing the payment key to view this donation receipt.', 'give' ),
219
+	$give_receipt_args = shortcode_atts(array(
220
+		'error'          => esc_html__('You are missing the payment key to view this donation receipt.', 'give'),
221 221
 		'price'          => true,
222 222
 		'donor'          => true,
223 223
 		'date'           => true,
@@ -226,50 +226,50 @@  discard block
 block discarded – undo
226 226
 		'payment_id'     => true,
227 227
 		'payment_status' => false,
228 228
 		'status_notice'  => true,
229
-	), $atts, 'give_receipt' );
229
+	), $atts, 'give_receipt');
230 230
 
231 231
 	//set $session var
232 232
 	$session = give_get_purchase_session();
233 233
 
234 234
 	//set payment key var
235
-	if ( isset( $_GET['payment_key'] ) ) {
236
-		$payment_key = urldecode( $_GET['payment_key'] );
237
-	} elseif ( $session ) {
235
+	if (isset($_GET['payment_key'])) {
236
+		$payment_key = urldecode($_GET['payment_key']);
237
+	} elseif ($session) {
238 238
 		$payment_key = $session['purchase_key'];
239
-	} elseif ( $give_receipt_args['payment_key'] ) {
239
+	} elseif ($give_receipt_args['payment_key']) {
240 240
 		$payment_key = $give_receipt_args['payment_key'];
241 241
 	}
242 242
 
243
-	$email_access = give_get_option( 'email_access' );
243
+	$email_access = give_get_option('email_access');
244 244
 
245 245
 	// No payment_key found & Email Access is Turned on:
246
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
246
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
247 247
 
248 248
 		ob_start();
249 249
 
250
-		give_get_template_part( 'email-login-form' );
250
+		give_get_template_part('email-login-form');
251 251
 
252 252
 		return ob_get_clean();
253 253
 
254
-	} elseif ( ! isset( $payment_key ) ) {
254
+	} elseif ( ! isset($payment_key)) {
255 255
 
256
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
256
+		return give_output_error($give_receipt_args['error'], false, 'error');
257 257
 
258 258
 	}
259 259
 
260
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
261
-	$user_can_view = give_can_view_receipt( $payment_key );
260
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
261
+	$user_can_view = give_can_view_receipt($payment_key);
262 262
 
263 263
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
264
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
264
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
265 265
 
266 266
 		ob_start();
267 267
 
268
-		give_get_template_part( 'email-login-form' );
268
+		give_get_template_part('email-login-form');
269 269
 
270 270
 		return ob_get_clean();
271 271
 
272
-	} elseif ( ! $user_can_view ) {
272
+	} elseif ( ! $user_can_view) {
273 273
 
274 274
 		global $give_login_redirect;
275 275
 
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 
278 278
 		ob_start();
279 279
 
280
-		give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation receipt.', 'give' ) ) );
280
+		give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation receipt.', 'give')));
281 281
 
282
-		give_get_template_part( 'shortcode', 'login' );
282
+		give_get_template_part('shortcode', 'login');
283 283
 
284 284
 		$login_form = ob_get_clean();
285 285
 
@@ -294,20 +294,20 @@  discard block
 block discarded – undo
294 294
 	 * or if user is logged in and the user can view sensitive shop data.
295 295
 	 *
296 296
 	 */
297
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
298
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
297
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
298
+		return give_output_error($give_receipt_args['error'], false, 'error');
299 299
 	}
300 300
 
301 301
 	ob_start();
302 302
 
303
-	give_get_template_part( 'shortcode', 'receipt' );
303
+	give_get_template_part('shortcode', 'receipt');
304 304
 
305 305
 	$display = ob_get_clean();
306 306
 
307 307
 	return $display;
308 308
 }
309 309
 
310
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
310
+add_shortcode('give_receipt', 'give_receipt_shortcode');
311 311
 
312 312
 /**
313 313
  * Profile Editor Shortcode.
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @return string Output generated from the profile editor
328 328
  */
329
-function give_profile_editor_shortcode( $atts ) {
329
+function give_profile_editor_shortcode($atts) {
330 330
 
331 331
 	ob_start();
332 332
 
333
-	give_get_template_part( 'shortcode', 'profile-editor' );
333
+	give_get_template_part('shortcode', 'profile-editor');
334 334
 
335 335
 	$display = ob_get_clean();
336 336
 
337 337
 	return $display;
338 338
 }
339 339
 
340
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
340
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
341 341
 
342 342
 /**
343 343
  * Process Profile Updater Form.
@@ -350,30 +350,30 @@  discard block
 block discarded – undo
350 350
  *
351 351
  * @return bool
352 352
  */
353
-function give_process_profile_editor_updates( $data ) {
353
+function give_process_profile_editor_updates($data) {
354 354
 	// Profile field change request
355
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
355
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
356 356
 		return false;
357 357
 	}
358 358
 
359 359
 	// Nonce security
360
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
360
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
361 361
 		return false;
362 362
 	}
363 363
 
364 364
 	$user_id       = get_current_user_id();
365
-	$old_user_data = get_userdata( $user_id );
366
-
367
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
368
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
369
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
370
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
371
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
372
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
373
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
374
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
375
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
376
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
365
+	$old_user_data = get_userdata($user_id);
366
+
367
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
368
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
369
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
370
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
371
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
372
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
373
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
374
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
375
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
376
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
377 377
 
378 378
 	$userdata = array(
379 379
 		'ID'           => $user_id,
@@ -401,46 +401,46 @@  discard block
 block discarded – undo
401 401
 	 * @param int   $user_id  The ID of the user.
402 402
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
403 403
 	 */
404
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
404
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
405 405
 
406 406
 	// New password
407
-	if ( ! empty( $data['give_new_user_pass1'] ) ) {
408
-		if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) {
409
-			give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) );
407
+	if ( ! empty($data['give_new_user_pass1'])) {
408
+		if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) {
409
+			give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give'));
410 410
 		} else {
411 411
 			$userdata['user_pass'] = $data['give_new_user_pass1'];
412 412
 		}
413 413
 	}
414 414
 
415
-	if ( empty( $email ) ) {
415
+	if (empty($email)) {
416 416
 		// Make sure email should not be empty.
417
-		give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) );
417
+		give_set_error('email_empty', esc_html__('The email you entered is empty.', 'give'));
418 418
 
419
-	} else if ( ! is_email( $email ) ) {
419
+	} else if ( ! is_email($email)) {
420 420
 		// Make sure email should be valid.
421
-		give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) );
421
+		give_set_error('email_not_valid', esc_html__('The email you entered is not valid. Please use another', 'give'));
422 422
 
423
-	} else if ( $email != $old_user_data->user_email ) {
423
+	} else if ($email != $old_user_data->user_email) {
424 424
 		// Make sure the new email doesn't belong to another user
425
-		if ( email_exists( $email ) ) {
426
-			give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) );
425
+		if (email_exists($email)) {
426
+			give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give'));
427 427
 		}
428 428
 	}
429 429
 
430 430
 	// Check for errors
431 431
 	$errors = give_get_errors();
432 432
 
433
-	if ( $errors ) {
433
+	if ($errors) {
434 434
 		// Send back to the profile editor if there are errors
435
-		wp_redirect( $data['give_redirect'] );
435
+		wp_redirect($data['give_redirect']);
436 436
 		give_die();
437 437
 	}
438 438
 
439 439
 	// Update the user
440
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
441
-	$updated = wp_update_user( $userdata );
440
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
441
+	$updated = wp_update_user($userdata);
442 442
 
443
-	if ( $updated ) {
443
+	if ($updated) {
444 444
 
445 445
 		/**
446 446
 		 * Fires after updating user profile.
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $user_id  The ID of the user.
451 451
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
452 452
 		 */
453
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
454
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
453
+		do_action('give_user_profile_updated', $user_id, $userdata);
454
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
455 455
 		give_die();
456 456
 	}
457 457
 
458 458
 	return false;
459 459
 }
460 460
 
461
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
461
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
Please login to merge, or discard this patch.
includes/scripts.php 1 patch
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_load_scripts() {
27 27
 
28
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
29
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
30
-	$scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false;
28
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
29
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
30
+	$scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false;
31 31
 
32 32
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
33
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
33
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
34 34
 
35 35
 	// Localize / PHP to AJAX vars.
36
-	$localize_give_vars = apply_filters( 'give_global_script_vars', array(
36
+	$localize_give_vars = apply_filters('give_global_script_vars', array(
37 37
 		'ajaxurl'             => give_get_ajax_url(),
38
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
39
-		'currency_sign'       => give_currency_filter( '' ),
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
39
+		'currency_sign'       => give_currency_filter(''),
40 40
 		'currency_pos'        => give_get_currency_position(),
41 41
 		'thousands_separator' => give_get_price_thousand_separator(),
42 42
 		'decimal_separator'   => give_get_price_decimal_separator(),
43
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
44
-		'bad_minimum'         => __( 'The minimum donation amount for this form is', 'give' ),
45
-		'general_loading'     => __( 'Loading...', 'give' ),
46
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
43
+		'no_gateway'          => __('Please select a payment method.', 'give'),
44
+		'bad_minimum'         => __('The minimum donation amount for this form is', 'give'),
45
+		'general_loading'     => __('Loading...', 'give'),
46
+		'purchase_loading'    => __('Please Wait...', 'give'),
47 47
 		'number_decimals'     => give_get_price_decimals(),
48 48
 		'give_version'        => GIVE_VERSION,
49 49
 		'magnific_options'    => apply_filters(
@@ -57,81 +57,81 @@  discard block
 block discarded – undo
57 57
 			'give_form_translation_js',
58 58
 			array(
59 59
 				// Field name               Validation message.
60
-				'payment-mode'           => __( 'Please select payment mode.', 'give' ),
61
-				'give_first'             => __( 'Please enter your first name.', 'give' ),
62
-				'give_email'             => __( 'Please enter a valid email address.', 'give' ),
63
-				'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
64
-				'give_user_pass'         => __( 'Enter a password.', 'give' ),
65
-				'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
66
-				'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
60
+				'payment-mode'           => __('Please select payment mode.', 'give'),
61
+				'give_first'             => __('Please enter your first name.', 'give'),
62
+				'give_email'             => __('Please enter a valid email address.', 'give'),
63
+				'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
64
+				'give_user_pass'         => __('Enter a password.', 'give'),
65
+				'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
66
+				'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
67 67
 			)
68 68
 		),
69
-	) );
69
+	));
70 70
 
71
-	$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array(
71
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
72 72
 		'ajaxurl'         => give_get_ajax_url(),
73
-		'loading'         => __( 'Loading', 'give' ),
73
+		'loading'         => __('Loading', 'give'),
74 74
 		// General loading message.
75
-		'select_option'   => __( 'Please select an option', 'give' ),
75
+		'select_option'   => __('Please select an option', 'give'),
76 76
 		// Variable pricing error with multi-donation option enabled.
77
-		'default_gateway' => give_get_default_gateway( null ),
78
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
77
+		'default_gateway' => give_get_default_gateway(null),
78
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
79 79
 		'number_decimals' => give_get_price_decimals(),
80
-	) );
80
+	));
81 81
 
82 82
 	// DEBUG is On.
83
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
83
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
84 84
 
85
-		if ( give_is_cc_verify_enabled() ) {
86
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
87
-			wp_enqueue_script( 'give-cc-validator' );
85
+		if (give_is_cc_verify_enabled()) {
86
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
87
+			wp_enqueue_script('give-cc-validator');
88 88
 		}
89 89
 
90
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
91
-		wp_enqueue_script( 'give-float-labels' );
90
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
91
+		wp_enqueue_script('give-float-labels');
92 92
 
93
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
94
-		wp_enqueue_script( 'give-blockui' );
93
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
94
+		wp_enqueue_script('give-blockui');
95 95
 
96
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
97
-		wp_enqueue_script( 'give-qtip' );
96
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
97
+		wp_enqueue_script('give-qtip');
98 98
 
99
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
100
-		wp_enqueue_script( 'give-accounting' );
99
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
100
+		wp_enqueue_script('give-accounting');
101 101
 
102
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
103
-		wp_enqueue_script( 'give-magnific' );
102
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
103
+		wp_enqueue_script('give-magnific');
104 104
 
105
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
106
-		wp_enqueue_script( 'give-checkout-global' );
105
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give-checkout-global');
107 107
 
108 108
 		// General scripts.
109
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
110
-		wp_enqueue_script( 'give-scripts' );
109
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
110
+		wp_enqueue_script('give-scripts');
111 111
 
112 112
 		// Load AJAX scripts, if enabled.
113
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
114
-		wp_enqueue_script( 'give-ajax' );
113
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
114
+		wp_enqueue_script('give-ajax');
115 115
 
116 116
 		// Localize / Pass AJAX vars from PHP,
117
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars );
118
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
117
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars);
118
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
119 119
 
120 120
 	} else {
121 121
 
122 122
 		// DEBUG is OFF (one JS file to rule them all!).
123
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
124
-		wp_enqueue_script( 'give' );
123
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
124
+		wp_enqueue_script('give');
125 125
 
126 126
 		// Localize / Pass AJAX vars from PHP.
127
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
128
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
127
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
128
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
129 129
 
130 130
 	}
131 131
 
132 132
 }
133 133
 
134
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
134
+add_action('wp_enqueue_scripts', 'give_load_scripts');
135 135
 
136 136
 /**
137 137
  * Register styles.
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function give_register_styles() {
146 146
 
147
-	if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) {
147
+	if ( ! give_is_setting_enabled(give_get_option('css'))) {
148 148
 		return;
149 149
 	}
150 150
 
151
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
152
-	wp_enqueue_style( 'give-styles' );
151
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
152
+	wp_enqueue_style('give-styles');
153 153
 
154 154
 }
155 155
 
156
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
156
+add_action('wp_enqueue_scripts', 'give_register_styles');
157 157
 
158 158
 
159 159
 /**
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 function give_get_stylesheet_uri() {
167 167
 
168 168
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
169
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
169
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
170 170
 
171 171
 	// LTR or RTL files.
172
-	$direction = ( is_rtl() ) ? '-rtl' : '';
172
+	$direction = (is_rtl()) ? '-rtl' : '';
173 173
 
174
-	$file          = 'give' . $direction . $suffix . '.css';
174
+	$file          = 'give'.$direction.$suffix.'.css';
175 175
 	$templates_dir = give_get_theme_template_dir_name();
176 176
 
177
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
178
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
179
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
180
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
181
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
177
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
178
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
179
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
180
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
181
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
182 182
 
183 183
 	$uri = false;
184 184
 
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	 * followed by non minified version, even if SCRIPT_DEBUG is not enabled.
189 189
 	 * This allows users to copy just give.css to their theme.
190 190
 	 */
191
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
192
-		if ( ! empty( $nonmin ) ) {
193
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
191
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
192
+		if ( ! empty($nonmin)) {
193
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
194 194
 		} else {
195
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
195
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
196 196
 		}
197
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
198
-		if ( ! empty( $nonmin ) ) {
199
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
197
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
198
+		if ( ! empty($nonmin)) {
199
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
200 200
 		} else {
201
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
201
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
202 202
 		}
203
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
204
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
203
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
204
+		$uri = trailingslashit(give_get_templates_url()).$file;
205 205
 	}
206 206
 
207
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
207
+	return apply_filters('give_get_stylesheet_uri', $uri);
208 208
 
209 209
 }
210 210
 
@@ -221,76 +221,76 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return void
223 223
  */
224
-function give_load_admin_scripts( $hook ) {
224
+function give_load_admin_scripts($hook) {
225 225
 
226 226
 	global $post, $post_type;
227 227
 
228 228
 	$give_options = give_get_settings();
229 229
 
230 230
 	// Directories of assets.
231
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
232
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
233
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
231
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
232
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
233
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
234 234
 
235 235
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
236
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
236
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
237 237
 
238 238
 	// LTR or RTL files.
239
-	$direction = ( is_rtl() ) ? '-rtl' : '';
239
+	$direction = (is_rtl()) ? '-rtl' : '';
240 240
 
241 241
 	// Global Admin.
242
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
243
-	wp_enqueue_style( 'give-admin-bar-notification' );
242
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
243
+	wp_enqueue_style('give-admin-bar-notification');
244 244
 
245 245
 	// Give Admin Only.
246
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
246
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
247 247
 		return;
248 248
 	}
249 249
 
250 250
 	// CSS.
251
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
252
-	wp_enqueue_style( 'jquery-ui-css' );
253
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION );
254
-	wp_enqueue_style( 'give-admin' );
255
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
256
-	wp_enqueue_style( 'jquery-chosen' );
257
-	wp_enqueue_style( 'thickbox' );
258
-	wp_enqueue_style( 'wp-color-picker' );
251
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
252
+	wp_enqueue_style('jquery-ui-css');
253
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION);
254
+	wp_enqueue_style('give-admin');
255
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
256
+	wp_enqueue_style('jquery-chosen');
257
+	wp_enqueue_style('thickbox');
258
+	wp_enqueue_style('wp-color-picker');
259 259
 
260 260
 
261 261
 	// JS.
262
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
263
-	wp_enqueue_script( 'jquery-chosen' );
262
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
263
+	wp_enqueue_script('jquery-chosen');
264 264
 
265
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
266
-	wp_enqueue_script( 'give-accounting' );
265
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
266
+	wp_enqueue_script('give-accounting');
267 267
 
268
-	wp_enqueue_script( 'wp-color-picker' );
269
-	wp_enqueue_script( 'jquery-ui-datepicker' );
270
-	wp_enqueue_script( 'thickbox' );
268
+	wp_enqueue_script('wp-color-picker');
269
+	wp_enqueue_script('jquery-ui-datepicker');
270
+	wp_enqueue_script('thickbox');
271 271
 
272
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker' ), GIVE_VERSION, false );
273
-	wp_enqueue_script( 'give-admin-scripts' );
272
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker'), GIVE_VERSION, false);
273
+	wp_enqueue_script('give-admin-scripts');
274 274
 
275
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
276
-	wp_enqueue_script( 'jquery-flot' );
275
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
276
+	wp_enqueue_script('jquery-flot');
277 277
 
278
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
279
-	wp_enqueue_script( 'give-qtip' );
278
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
279
+	wp_enqueue_script('give-qtip');
280 280
 
281
-	wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
282
-	wp_enqueue_script( 'give-repeatable-fields' );
281
+	wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
282
+	wp_enqueue_script('give-repeatable-fields');
283 283
 
284 284
 	// Forms CPT Script.
285
-	if ( $post_type === 'give_forms' ) {
286
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
287
-		wp_enqueue_script( 'give-admin-forms-scripts' );
285
+	if ($post_type === 'give_forms') {
286
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
287
+		wp_enqueue_script('give-admin-forms-scripts');
288 288
 	}
289 289
 
290 290
 	// Settings Scripts.
291
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
292
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
293
-		wp_enqueue_script( 'give-admin-settings-scripts' );
291
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
292
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
293
+		wp_enqueue_script('give-admin-settings-scripts');
294 294
 	}
295 295
 
296 296
 	// Price Separators.
@@ -298,59 +298,59 @@  discard block
 block discarded – undo
298 298
 	$decimal_separator  = give_get_price_decimal_separator();
299 299
 
300 300
 	// Localize strings & variables for JS.
301
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
302
-		'post_id'                        => isset( $post->ID ) ? $post->ID : null,
301
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
302
+		'post_id'                        => isset($post->ID) ? $post->ID : null,
303 303
 		'give_version'                   => GIVE_VERSION,
304 304
 		'thousands_separator'            => $thousand_separator,
305 305
 		'decimal_separator'              => $decimal_separator,
306
-		'quick_edit_warning'             => __( 'Not available for variable priced forms.', 'give' ),
307
-		'delete_payment'                 => __( 'Are you sure you wish to delete this payment?', 'give' ),
308
-		'delete_payment_note'            => __( 'Are you sure you wish to delete this note?', 'give' ),
309
-		'revoke_api_key'                 => __( 'Are you sure you wish to revoke this API key?', 'give' ),
310
-		'regenerate_api_key'             => __( 'Are you sure you wish to regenerate this API key?', 'give' ),
311
-		'resend_receipt'                 => __( 'Are you sure you wish to resend the donation receipt?', 'give' ),
312
-		'logo'                           => __( 'Logo', 'give' ),
313
-		'use_this_image'                 => __( 'Use this image', 'give' ),
314
-		'one_option'                     => __( 'Choose a form', 'give' ),
315
-		'one_or_more_option'             => __( 'Choose one or more forms', 'give' ),
316
-		'currency_sign'                  => give_currency_filter( '' ),
317
-		'currency_pos'                   => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
318
-		'currency_decimals'              => give_currency_decimal_filter( give_get_price_decimals() ),
319
-		'batch_export_no_class'          => __( 'You must choose a method.', 'give' ),
320
-		'batch_export_no_reqs'           => __( 'Required fields not completed.', 'give' ),
321
-		'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' ),
322
-		'price_format_guide'             => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
306
+		'quick_edit_warning'             => __('Not available for variable priced forms.', 'give'),
307
+		'delete_payment'                 => __('Are you sure you wish to delete this payment?', 'give'),
308
+		'delete_payment_note'            => __('Are you sure you wish to delete this note?', 'give'),
309
+		'revoke_api_key'                 => __('Are you sure you wish to revoke this API key?', 'give'),
310
+		'regenerate_api_key'             => __('Are you sure you wish to regenerate this API key?', 'give'),
311
+		'resend_receipt'                 => __('Are you sure you wish to resend the donation receipt?', 'give'),
312
+		'logo'                           => __('Logo', 'give'),
313
+		'use_this_image'                 => __('Use this image', 'give'),
314
+		'one_option'                     => __('Choose a form', 'give'),
315
+		'one_or_more_option'             => __('Choose one or more forms', 'give'),
316
+		'currency_sign'                  => give_currency_filter(''),
317
+		'currency_pos'                   => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
318
+		'currency_decimals'              => give_currency_decimal_filter(give_get_price_decimals()),
319
+		'batch_export_no_class'          => __('You must choose a method.', 'give'),
320
+		'batch_export_no_reqs'           => __('Required fields not completed.', 'give'),
321
+		'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'),
322
+		'price_format_guide'             => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
323 323
 		/* translators : %s: Donation form options metabox */
324
-		'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ),
325
-		'matched_success_failure_page'   => __( 'You cannot set the success and failed pages to the same page', 'give' ),
326
-		'dismiss_notice_text'            => __( 'Dismiss this notice.', 'give' ),
324
+		'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'),
325
+		'matched_success_failure_page'   => __('You cannot set the success and failed pages to the same page', 'give'),
326
+		'dismiss_notice_text'            => __('Dismiss this notice.', 'give'),
327 327
 		'bulk_action' => array(
328 328
 			'delete'         => array(
329
-				'zero_payment_selected' => __( 'You must choose at least one or more payments to delete.', 'give' ),
330
-				'delete_payment'        => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
331
-				'delete_payments'       => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
329
+				'zero_payment_selected' => __('You must choose at least one or more payments to delete.', 'give'),
330
+				'delete_payment'        => __('Are you sure you want to permanently delete this donation?', 'give'),
331
+				'delete_payments'       => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
332 332
 			),
333 333
 			'resend_receipt' => array(
334
-				'zero_recipient_selected' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
335
-				'resend_receipt'          => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
336
-				'resend_receipts'         => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
334
+				'zero_recipient_selected' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
335
+				'resend_receipt'          => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
336
+				'resend_receipts'         => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
337 337
 			),
338 338
 		),
339 339
 		'metabox_fields' => array(
340 340
 			'media' => array(
341
-				'button_title' => esc_html__( 'Choose Attachment', 'give' ),
341
+				'button_title' => esc_html__('Choose Attachment', 'give'),
342 342
 			)
343 343
 		)
344
-	) );
344
+	));
345 345
 
346
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
346
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
347 347
 		// call for new media manager.
348 348
 		wp_enqueue_media();
349 349
 	}
350 350
 
351 351
 }
352 352
 
353
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
353
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
354 354
 
355 355
 /**
356 356
  * Admin Give Icon
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 	?>
366 366
     <style type="text/css" media="screen">
367 367
 
368
-        <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
368
+        <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
369 369
         @font-face {
370 370
             font-family: 'give-icomoon';
371
-            src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>');
372
-            src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
373
-            url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
374
-            url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
371
+            src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>');
372
+            src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
373
+            url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
374
+            url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
375 375
             font-weight: normal;
376 376
             font-style: normal;
377 377
         }
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	<?php
391 391
 }
392 392
 
393
-add_action( 'admin_head', 'give_admin_icon' );
393
+add_action('admin_head', 'give_admin_icon');
394 394
 
395 395
 /**
396 396
  * Admin js code
@@ -420,4 +420,4 @@  discard block
 block discarded – undo
420 420
 	<?php
421 421
 }
422 422
 
423
-add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' );
423
+add_action('admin_head', 'give_admin_hide_notice_shortly_js');
Please login to merge, or discard this patch.