Completed
Push — master ( 0af146...0e0d02 )
by Devin
13s
created
includes/admin/reporting/logs.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_logs_view_sales() {
26
-	include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' );
26
+	include(dirname(__FILE__).'/class-sales-logs-list-table.php');
27 27
 
28 28
 	$logs_table = new Give_Sales_Log_Table();
29 29
 	$logs_table->prepare_items();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
34
+add_action('give_logs_view_sales', 'give_logs_view_sales');
35 35
 
36 36
 
37 37
 /**
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  */
45 45
 function give_logs_view_gateway_errors() {
46
-	include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' );
46
+	include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php');
47 47
 
48 48
 	$logs_table = new Give_Gateway_Error_Log_Table();
49 49
 	$logs_table->prepare_items();
50 50
 	$logs_table->display();
51 51
 }
52 52
 
53
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
53
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
54 54
 
55 55
 /**
56 56
  * API Request Logs
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  * @return void
63 63
  */
64 64
 function give_logs_view_api_requests() {
65
-	include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' );
65
+	include(dirname(__FILE__).'/class-api-requests-logs-list-table.php');
66 66
 
67 67
 	$logs_table = new Give_API_Request_Log_Table();
68 68
 	$logs_table->prepare_items();
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		 *
76 76
 		 * @since 1.0
77 77
 		 */
78
-		do_action( 'give_logs_api_requests_top' );
78
+		do_action('give_logs_api_requests_top');
79 79
 		?>
80 80
 
81 81
 		<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>">
82 82
 			<?php
83
-			$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
83
+			$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
84 84
 			$logs_table->display();
85 85
 			?>
86 86
 			<input type="hidden" name="post_type" value="give_forms"/>
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 		 *
94 94
 		 * @since 1.0
95 95
 		 */
96
-		do_action( 'give_logs_api_requests_bottom' );
96
+		do_action('give_logs_api_requests_bottom');
97 97
 		?>
98 98
 
99 99
 	</div>
100 100
 	<?php
101 101
 }
102 102
 
103
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
103
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
104 104
 
105 105
 /**
106 106
  * Renders the Reports page views drop down
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 	$current_section = give_get_current_setting_section();
113 113
 
114 114
 	// If there are not any event attach to action then do not show form.
115
-	if ( ! has_action( 'give_log_view_actions' ) ) {
115
+	if ( ! has_action('give_log_view_actions')) {
116 116
 		return;
117 117
 	}
118 118
 	?>
119
-	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section=' . $current_section; ?>">
119
+	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section='.$current_section; ?>">
120 120
 		<?php
121 121
 		/**
122 122
 		 * Fires after displaying the reports page views drop down.
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 		 *
126 126
 		 * @since 1.0
127 127
 		 */
128
-		do_action( 'give_log_view_actions' );
128
+		do_action('give_log_view_actions');
129 129
 		?>
130 130
 
131 131
 		<input type="hidden" name="post_type" value="give_forms"/>
132 132
 		<input type="hidden" name="page" value="give-tools"/>
133 133
 		<input type="hidden" name="tab" value="logs"/>
134 134
 
135
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
135
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
136 136
 	</form>
137 137
 	<?php
138 138
 }
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Spacing   +26 added lines, -26 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
 
@@ -24,53 +24,53 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
 	// Hide subscription notices permanently.
27
-	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+	if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
 		$current_user = wp_get_current_user();
29 29
 
30 30
 		// check previously disabled notice ids.
31
-		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+		$already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
 			? $already_dismiss_notices
33 33
 			: array();
34 34
 
35 35
 		// Get notice id.
36
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-		if ( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+		if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
 			$already_dismiss_notices[] = $notice_id;
40 40
 		}
41 41
 
42 42
 		// Store subscription ids.
43
-		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+		update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
 		// Redirect user.
46
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
 		exit();
48 48
 	}
49 49
 
50 50
 	// Hide subscription notices shortly.
51
-	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+	if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
 		$current_user = wp_get_current_user();
53 53
 
54 54
 		// Get notice id.
55
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
 		// Transient key name.
58 58
 		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-		if ( get_transient( $transient_key ) ) {
60
+		if (get_transient($transient_key)) {
61 61
 			return;
62 62
 		}
63 63
 
64 64
 		// Hide notice for 24 hours.
65
-		set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
65
+		set_transient($transient_key, true, 24 * HOUR_IN_SECONDS);
66 66
 
67 67
 		// Redirect user.
68
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
68
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
69 69
 		exit();
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'admin_init', 'give_hide_subscription_notices' );
73
+add_action('admin_init', 'give_hide_subscription_notices');
74 74
 
75 75
 /**
76 76
  * Load wp editor by ajax.
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
  * @since 1.8
79 79
  */
80 80
 function give_load_wp_editor() {
81
-	if ( ! isset( $_POST['wp_editor'] ) ) {
81
+	if ( ! isset($_POST['wp_editor'])) {
82 82
 		die();
83 83
 	}
84 84
 
85
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
85
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
86 86
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
87 87
 
88
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
88
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
89 89
 
90 90
 	die();
91 91
 }
92 92
 
93
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
93
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
94 94
 
95 95
 
96 96
 /**
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 	);
110 110
 
111 111
 	// Get current page.
112
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
112
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
113 113
 
114 114
 	// Bailout.
115 115
 	if (
116
-		empty( $current_page )
117
-		|| empty( $_GET['_wp_http_referer'] )
118
-		|| ! in_array( $current_page, $give_pages )
116
+		empty($current_page)
117
+		|| empty($_GET['_wp_http_referer'])
118
+		|| ! in_array($current_page, $give_pages)
119 119
 	) {
120 120
 		return false;
121 121
 	}
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @since 1.8
127 127
 	 */
128
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
128
+	$redirect = apply_filters("give_validate_{$current_page}", true);
129 129
 
130
-	if ( $redirect ) {
130
+	if ($redirect) {
131 131
 		// Redirect.
132 132
 		wp_redirect(
133 133
 			remove_query_arg(
134
-				array( '_wp_http_referer', '_wpnonce' ),
135
-				wp_unslash( $_SERVER['REQUEST_URI'] )
134
+				array('_wp_http_referer', '_wpnonce'),
135
+				wp_unslash($_SERVER['REQUEST_URI'])
136 136
 			)
137 137
 		);
138 138
 		exit;
139 139
 	}
140 140
 }
141 141
 
142
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
142
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
  *
99 99
  * @since 1.8
100 100
  *
101
- * @return bool
101
+ * @return false|null
102 102
  */
103 103
 function give_redirect_to_clean_url_admin_pages() {
104 104
 	// Give admin pages.
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 // uncomment this line for testing
4 4
 // set_site_transient( 'update_plugins', null );
5 5
 // Exit if accessed directly.
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	 * @param string $_plugin_file Path to the plugin file.
27 27
 	 * @param array  $_api_data    Optional data to send with API calls.
28 28
 	 */
29
-	function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
30
-		$this->api_url  = trailingslashit( $_api_url );
29
+	function __construct($_api_url, $_plugin_file, $_api_data = null) {
30
+		$this->api_url  = trailingslashit($_api_url);
31 31
 		$this->api_data = $_api_data;
32
-		$this->name     = plugin_basename( $_plugin_file );
33
-		$this->slug     = basename( $_plugin_file, '.php' );
32
+		$this->name     = plugin_basename($_plugin_file);
33
+		$this->slug     = basename($_plugin_file, '.php');
34 34
 		$this->version  = $_api_data['version'];
35 35
 
36 36
 		// Set up hooks.
37 37
 		$this->init();
38
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
38
+		add_action('admin_init', array($this, 'show_changelog'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function init() {
47 47
 
48
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
49
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
48
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
49
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
50 50
 
51
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
51
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
52 52
 	}
53 53
 
54 54
 	/**
@@ -65,34 +65,34 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return stdClass Modified update array with custom plugin data
67 67
 	 */
68
-	function check_update( $_transient_data ) {
68
+	function check_update($_transient_data) {
69 69
 
70 70
 		$screen = get_current_screen();
71 71
 
72
-		if ( ! is_object( $_transient_data ) ) {
72
+		if ( ! is_object($_transient_data)) {
73 73
 			$_transient_data = new stdClass;
74 74
 		}
75 75
 
76
-		if ( is_object( $screen ) && 'plugins.php' == $screen->parent_file && is_multisite() ) {
76
+		if (is_object($screen) && 'plugins.php' == $screen->parent_file && is_multisite()) {
77 77
 			return $_transient_data;
78 78
 		}
79 79
 
80
-		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
80
+		if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
81 81
 
82
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
82
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
83 83
 
84
-			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
84
+			if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
85 85
 
86 86
 				$this->did_check = true;
87 87
 
88
-				if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
88
+				if (version_compare($this->version, $version_info->new_version, '<')) {
89 89
 
90
-					$_transient_data->response[ $this->name ] = $version_info;
90
+					$_transient_data->response[$this->name] = $version_info;
91 91
 
92 92
 				}
93 93
 
94 94
 				$_transient_data->last_checked           = time();
95
-				$_transient_data->checked[ $this->name ] = $this->version;
95
+				$_transient_data->checked[$this->name] = $this->version;
96 96
 
97 97
 			}
98 98
 		}
@@ -106,85 +106,85 @@  discard block
 block discarded – undo
106 106
 	 * @param string $file
107 107
 	 * @param array  $plugin
108 108
 	 */
109
-	public function show_update_notification( $file, $plugin ) {
109
+	public function show_update_notification($file, $plugin) {
110 110
 
111
-		if ( ! current_user_can( 'update_plugins' ) ) {
111
+		if ( ! current_user_can('update_plugins')) {
112 112
 			return;
113 113
 		}
114 114
 
115
-		if ( ! is_multisite() ) {
115
+		if ( ! is_multisite()) {
116 116
 			return;
117 117
 		}
118 118
 
119
-		if ( $this->name != $file ) {
119
+		if ($this->name != $file) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		// Remove our filter on the site transient
124
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
124
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
125 125
 
126
-		$update_cache = get_site_transient( 'update_plugins' );
126
+		$update_cache = get_site_transient('update_plugins');
127 127
 
128
-		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
128
+		if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
129 129
 
130
-			$cache_key    = md5( 'edd_plugin_' . sanitize_key( $this->name ) . '_version_info' );
131
-			$version_info = get_transient( $cache_key );
130
+			$cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
131
+			$version_info = get_transient($cache_key);
132 132
 
133
-			if ( false === $version_info ) {
133
+			if (false === $version_info) {
134 134
 
135
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
135
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
136 136
 
137
-				set_transient( $cache_key, $version_info, 3600 );
137
+				set_transient($cache_key, $version_info, 3600);
138 138
 			}
139 139
 
140
-			if ( ! is_object( $version_info ) ) {
140
+			if ( ! is_object($version_info)) {
141 141
 				return;
142 142
 			}
143 143
 
144
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
144
+			if (version_compare($this->version, $version_info->new_version, '<')) {
145 145
 
146
-				$update_cache->response[ $this->name ] = $version_info;
146
+				$update_cache->response[$this->name] = $version_info;
147 147
 
148 148
 			}
149 149
 
150 150
 			$update_cache->last_checked           = time();
151
-			$update_cache->checked[ $this->name ] = $this->version;
151
+			$update_cache->checked[$this->name] = $this->version;
152 152
 
153
-			set_site_transient( 'update_plugins', $update_cache );
153
+			set_site_transient('update_plugins', $update_cache);
154 154
 
155 155
 		} else {
156 156
 
157
-			$version_info = $update_cache->response[ $this->name ];
157
+			$version_info = $update_cache->response[$this->name];
158 158
 
159 159
 		}
160 160
 
161 161
 		// Restore our filter
162
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
162
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
163 163
 
164
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
164
+		if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
165 165
 
166 166
 			// build a plugin list row, with update notification
167
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
168
-			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
167
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
168
+			echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
169 169
 
170
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
170
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
171 171
 
172
-			if ( empty( $version_info->download_link ) ) {
172
+			if (empty($version_info->download_link)) {
173 173
 				printf(
174 174
 				/* translators: 1: name 2: changelog URL 3: version */
175
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give' ),
176
-					esc_html( $version_info->name ),
177
-					esc_url( $changelog_link ),
178
-					esc_html( $version_info->new_version )
175
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give'),
176
+					esc_html($version_info->name),
177
+					esc_url($changelog_link),
178
+					esc_html($version_info->new_version)
179 179
 				);
180 180
 			} else {
181 181
 				printf(
182 182
 				/* translators: 1: name 2: changelog URL 3: version 4: update URL */
183
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give' ),
184
-					esc_html( $version_info->name ),
185
-					esc_url( $changelog_link ),
186
-					esc_html( $version_info->new_version ),
187
-					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
183
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give'),
184
+					esc_html($version_info->name),
185
+					esc_url($changelog_link),
186
+					esc_html($version_info->new_version),
187
+					esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
188 188
 				);
189 189
 			}
190 190
 
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return object $_data
206 206
 	 */
207
-	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
207
+	function plugins_api_filter($_data, $_action = '', $_args = null) {
208 208
 
209
-		if ( $_action != 'plugin_information' ) {
209
+		if ($_action != 'plugin_information') {
210 210
 
211 211
 			return $_data;
212 212
 
213 213
 		}
214 214
 
215
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
215
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
216 216
 
217 217
 			return $_data;
218 218
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 			),
228 228
 		);
229 229
 
230
-		$api_response = $this->api_request( 'plugin_information', $to_send );
230
+		$api_response = $this->api_request('plugin_information', $to_send);
231 231
 
232
-		if ( false !== $api_response ) {
232
+		if (false !== $api_response) {
233 233
 			$_data = $api_response;
234 234
 		}
235 235
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return object $array
247 247
 	 */
248
-	function http_request_args( $args, $url ) {
248
+	function http_request_args($args, $url) {
249 249
 		// If it is an https request and we are performing a package download, disable ssl verification
250
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
250
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
251 251
 			$args['sslverify'] = false;
252 252
 		}
253 253
 
@@ -266,43 +266,43 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @return false||object
268 268
 	 */
269
-	private function api_request( $_action, $_data ) {
269
+	private function api_request($_action, $_data) {
270 270
 
271
-		$data = array_merge( $this->api_data, $_data );
271
+		$data = array_merge($this->api_data, $_data);
272 272
 
273
-		if ( $data['slug'] != $this->slug ) {
273
+		if ($data['slug'] != $this->slug) {
274 274
 			return;
275 275
 		}
276 276
 
277
-		if ( empty( $data['license'] ) ) {
277
+		if (empty($data['license'])) {
278 278
 			return;
279 279
 		}
280 280
 
281
-		if ( $this->api_url == home_url() ) {
281
+		if ($this->api_url == home_url()) {
282 282
 			return false; // Don't allow a plugin to ping itself
283 283
 		}
284 284
 
285 285
 		$api_params = array(
286 286
 			'edd_action' => 'get_version',
287 287
 			'license'    => $data['license'],
288
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
289
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
288
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
289
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
290 290
 			'slug'       => $data['slug'],
291 291
 			'author'     => $data['author'],
292 292
 			'url'        => home_url(),
293 293
 		);
294 294
 
295
-		$request = wp_remote_post( $this->api_url, array( 'timeout'   => 15,
295
+		$request = wp_remote_post($this->api_url, array('timeout'   => 15,
296 296
 														  'sslverify' => false,
297 297
 														  'body'      => $api_params,
298
-		) );
298
+		));
299 299
 
300
-		if ( ! is_wp_error( $request ) ) {
301
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
300
+		if ( ! is_wp_error($request)) {
301
+			$request = json_decode(wp_remote_retrieve_body($request));
302 302
 		}
303 303
 
304
-		if ( $request && isset( $request->sections ) ) {
305
-			$request->sections = maybe_unserialize( $request->sections );
304
+		if ($request && isset($request->sections)) {
305
+			$request->sections = maybe_unserialize($request->sections);
306 306
 		} else {
307 307
 			$request = false;
308 308
 		}
@@ -312,26 +312,26 @@  discard block
 block discarded – undo
312 312
 
313 313
 	public function show_changelog() {
314 314
 
315
-		if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
315
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
316 316
 			return;
317 317
 		}
318 318
 
319
-		if ( empty( $_REQUEST['plugin'] ) ) {
319
+		if (empty($_REQUEST['plugin'])) {
320 320
 			return;
321 321
 		}
322 322
 
323
-		if ( empty( $_REQUEST['slug'] ) ) {
323
+		if (empty($_REQUEST['slug'])) {
324 324
 			return;
325 325
 		}
326 326
 
327
-		if ( ! current_user_can( 'update_plugins' ) ) {
328
-			wp_die( esc_html__( 'You do not have permission to install plugin updates.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
327
+		if ( ! current_user_can('update_plugins')) {
328
+			wp_die(esc_html__('You do not have permission to install plugin updates.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
329 329
 		}
330 330
 
331
-		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
331
+		$response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
332 332
 
333
-		if ( $response && isset( $response->sections['changelog'] ) ) {
334
-			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
333
+		if ($response && isset($response->sections['changelog'])) {
334
+			echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
335 335
 		}
336 336
 
337 337
 		exit;
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 			/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 			/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 			/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 		// Badge for welcome page
109
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
109
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
110 110
 
111 111
 		?>
112 112
 		<style type="text/css" media="screen">
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 	 * @return void
187 187
 	 */
188 188
 	public function tabs() {
189
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
189
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
190 190
 		?>
191 191
 		<h2 class="nav-tab-wrapper">
192
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
193
-				<?php esc_html_e( 'About Give', 'give' ); ?>
192
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
193
+				<?php esc_html_e('About Give', 'give'); ?>
194 194
 			</a>
195
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
196
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
195
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
196
+				<?php esc_html_e('Getting Started', 'give'); ?>
197 197
 			</a>
198
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
199
-				<?php esc_html_e( 'Credits', 'give' ); ?>
198
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
199
+				<?php esc_html_e('Credits', 'give'); ?>
200 200
 			</a>
201
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
202
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
201
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
202
+				<?php esc_html_e('Add-ons', 'give'); ?>
203 203
 			</a>
204 204
 		</h2>
205 205
 	<?php
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return void
214 214
 	 */
215 215
 	public function about_screen() {
216
-		list( $display_version ) = explode( '-', GIVE_VERSION );
216
+		list($display_version) = explode('-', GIVE_VERSION);
217 217
 		?>
218 218
 		<div class="wrap about-wrap">
219 219
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 			<p class="about-text"><?php
224 224
 				printf(
225 225
 					/* translators: %s: https://givewp.com/documenation/ */
226
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
227
-					esc_url( 'https://givewp.com/documenation/' )
226
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
227
+					esc_url('https://givewp.com/documenation/')
228 228
 				);
229 229
 			?></p>
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			<div class="give-badge"><?php
234 234
 				printf(
235 235
 					/* translators: %s: Give version */
236
-					esc_html__( 'Version %s', 'give' ),
236
+					esc_html__('Version %s', 'give'),
237 237
 					$display_version
238 238
 				);
239 239
 			?></div>
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
 			<div class="feature-section clearfix introduction">
244 244
 
245 245
 				<div class="video feature-section-item">
246
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
246
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
247 247
 				</div>
248 248
 
249 249
 				<div class="content feature-section-item last-feature">
250 250
 
251
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
251
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
252 252
 
253
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
253
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
254 254
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
255
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
255
+						<?php esc_html_e('Learn More', 'give'); ?>
256 256
 						<span class="dashicons dashicons-external"></span>
257 257
 					</a>
258 258
 
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
 				<div class="content feature-section-item">
267 267
 
268
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
268
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
269 269
 
270
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
270
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
271 271
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary">
272
-						<?php esc_html_e( 'View Documentation', 'give' ); ?>
272
+						<?php esc_html_e('View Documentation', 'give'); ?>
273 273
 						<span class="dashicons dashicons-external"></span>
274 274
 					</a>
275 275
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 				<div class="content  feature-section-item last-feature">
279 279
 
280
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
280
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>">
281 281
 
282 282
 				</div>
283 283
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return void
298 298
 	 */
299 299
 	public function changelog_screen() {
300
-		list( $display_version ) = explode( '-', GIVE_VERSION );
300
+		list($display_version) = explode('-', GIVE_VERSION);
301 301
 		?>
302 302
 		<div class="wrap about-wrap">
303 303
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
 			<p class="about-text"><?php
306 306
 				printf(
307 307
 					/* translators: %s: Give version */
308
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
308
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
309 309
 					$display_version
310 310
 				);
311 311
 			?></p>
312 312
 			<div class="give-badge"><?php
313 313
 				printf(
314 314
 					/* translators: %s: Give version */
315
-					esc_html__( 'Version %s', 'give' ),
315
+					esc_html__('Version %s', 'give'),
316 316
 					$display_version
317 317
 				);
318 318
 			?></div>
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			<?php $this->tabs(); ?>
321 321
 
322 322
 			<div class="changelog">
323
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
323
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
324 324
 
325 325
 				<div class="feature-section">
326 326
 					<?php echo $this->parse_readme(); ?>
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			</div>
329 329
 
330 330
 			<div class="return-to-dashboard">
331
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
331
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
332 332
 					'post_type' => 'give_forms',
333 333
 					'page'      => 'give-settings'
334
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
334
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
335 335
 			</div>
336 336
 		</div>
337 337
 	<?php
@@ -345,37 +345,37 @@  discard block
 block discarded – undo
345 345
 	 * @return void
346 346
 	 */
347 347
 	public function getting_started_screen() {
348
-		list( $display_version ) = explode( '-', GIVE_VERSION );
348
+		list($display_version) = explode('-', GIVE_VERSION);
349 349
 		?>
350 350
 		<div class="wrap about-wrap get-started">
351 351
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
352 352
 
353 353
 			<?php give_social_media_elements() ?>
354 354
 
355
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
355
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
356 356
 
357 357
 			<?php give_get_newsletter(); ?>
358 358
 
359 359
 			<div class="give-badge"><?php
360 360
 				printf(
361 361
 					/* translators: %s: Give version */
362
-					esc_html__( 'Version %s', 'give' ),
362
+					esc_html__('Version %s', 'give'),
363 363
 					$display_version
364 364
 				);
365 365
 			?></div>
366 366
 
367 367
 			<?php $this->tabs(); ?>
368 368
 
369
-			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
369
+			<p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
370 370
 
371 371
 			<div class="feature-section clearfix">
372 372
 
373 373
 				<div class="content feature-section-item">
374
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
374
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
375 375
 
376
-					<p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
376
+					<p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
377 377
 
378
-					<p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
378
+					<p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
379 379
 				</div>
380 380
 
381 381
 				<div class="content feature-section-item last-feature">
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 				</div>
393 393
 
394 394
 				<div class="content feature-section-item last-feature">
395
-					<h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
395
+					<h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
396 396
 
397
-					<p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
397
+					<p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
398 398
 				</div>
399 399
 
400 400
 			</div>
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 			<div class="feature-section clearfix">
404 404
 
405 405
 				<div class="content feature-section-item add-content">
406
-					<h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
406
+					<h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
407 407
 
408
-					<p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
408
+					<p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
409 409
 
410
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
410
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
411 411
 				</div>
412 412
 
413 413
 				<div class="content feature-section-item last-feature">
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 				</div>
425 425
 
426 426
 				<div class="content feature-section-item last-feature">
427
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
427
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
428 428
 
429
-					<p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
429
+					<p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
430 430
 				</div>
431 431
 
432 432
 
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 	 * @return void
447 447
 	 */
448 448
 	public function credits_screen() {
449
-		list( $display_version ) = explode( '-', GIVE_VERSION );
449
+		list($display_version) = explode('-', GIVE_VERSION);
450 450
 		?>
451 451
 		<div class="wrap about-wrap">
452 452
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
453 453
 
454 454
 			<?php give_social_media_elements() ?>
455 455
 
456
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
456
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
457 457
 
458
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
458
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
459 459
 
460 460
 			<?php give_get_newsletter(); ?>
461 461
 
462 462
 			<div class="give-badge"><?php
463 463
 				printf(
464 464
 					/* translators: %s: Give version */
465
-					esc_html__( 'Version %s', 'give' ),
465
+					esc_html__('Version %s', 'give'),
466 466
 					$display_version
467 467
 				);
468 468
 			?></div>
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 			<p class="about-description"><?php
473 473
 				printf(
474 474
 					/* translators: %s: https://github.com/WordImpress/give */
475
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
476
-					esc_url( 'https://github.com/WordImpress/give' )
475
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
476
+					esc_url('https://github.com/WordImpress/give')
477 477
 				);
478 478
 			?></p>
479 479
 
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
 	 * @return string $readme HTML formatted readme file
491 491
 	 */
492 492
 	public function parse_readme() {
493
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
493
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
494 494
 
495
-		if ( ! $file ) {
496
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
495
+		if ( ! $file) {
496
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
497 497
 		} else {
498
-			$readme = file_get_contents( $file );
499
-			$readme = nl2br( esc_html( $readme ) );
500
-			$readme = explode( '== Changelog ==', $readme );
501
-			$readme = end( $readme );
502
-
503
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
504
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
505
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
506
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
507
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
498
+			$readme = file_get_contents($file);
499
+			$readme = nl2br(esc_html($readme));
500
+			$readme = explode('== Changelog ==', $readme);
501
+			$readme = end($readme);
502
+
503
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
504
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
505
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
506
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
507
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
508 508
 		}
509 509
 
510 510
 		return $readme;
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 	public function contributors() {
522 522
 		$contributors = $this->get_contributors();
523 523
 
524
-		if ( empty( $contributors ) ) {
524
+		if (empty($contributors)) {
525 525
 			return '';
526 526
 		}
527 527
 
528 528
 		$contributor_list = '<ul class="wp-people-group">';
529 529
 
530
-		foreach ( $contributors as $contributor ) {
530
+		foreach ($contributors as $contributor) {
531 531
 			$contributor_list .= '<li class="wp-person">';
532 532
 			$contributor_list .= sprintf(
533 533
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
534
-				esc_url( 'https://github.com/' . $contributor->login ),
535
-				esc_url( $contributor->avatar_url ),
536
-				esc_attr( $contributor->login )
534
+				esc_url('https://github.com/'.$contributor->login),
535
+				esc_url($contributor->avatar_url),
536
+				esc_attr($contributor->login)
537 537
 			);
538 538
 			$contributor_list .= sprintf(
539 539
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
540
-				esc_url( 'https://github.com/' . $contributor->login ),
541
-				esc_html( $contributor->login )
540
+				esc_url('https://github.com/'.$contributor->login),
541
+				esc_html($contributor->login)
542 542
 			);
543 543
 			$contributor_list .= '</li>';
544 544
 		}
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 	 * @return array $contributors List of contributors
557 557
 	 */
558 558
 	public function get_contributors() {
559
-		$contributors = get_transient( 'give_contributors' );
559
+		$contributors = get_transient('give_contributors');
560 560
 
561
-		if ( false !== $contributors ) {
561
+		if (false !== $contributors) {
562 562
 			return $contributors;
563 563
 		}
564 564
 
565
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
565
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
566 566
 
567
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
567
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
568 568
 			return array();
569 569
 		}
570 570
 
571
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
571
+		$contributors = json_decode(wp_remote_retrieve_body($response));
572 572
 
573
-		if ( ! is_array( $contributors ) ) {
573
+		if ( ! is_array($contributors)) {
574 574
 			return array();
575 575
 		}
576 576
 
577
-		set_transient( 'give_contributors', $contributors, 3600 );
577
+		set_transient('give_contributors', $contributors, 3600);
578 578
 
579 579
 		return $contributors;
580 580
 	}
@@ -592,24 +592,24 @@  discard block
 block discarded – undo
592 592
 		$give_options = give_get_settings();
593 593
 
594 594
 		// Bail if no activation redirect
595
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
595
+		if ( ! get_transient('_give_activation_redirect')) {
596 596
 			return;
597 597
 		}
598 598
 
599 599
 		// Delete the redirect transient
600
-		delete_transient( '_give_activation_redirect' );
600
+		delete_transient('_give_activation_redirect');
601 601
 
602 602
 		// Bail if activating from network, or bulk
603
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
603
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
604 604
 			return;
605 605
 		}
606 606
 
607
-		$upgrade = get_option( 'give_version_upgraded_from' );
607
+		$upgrade = get_option('give_version_upgraded_from');
608 608
 
609
-		if ( ! $upgrade ) { // First time install
610
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
609
+		if ( ! $upgrade) { // First time install
610
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
611 611
 			exit;
612
-		} elseif( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
612
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
613 613
 
614 614
 		} else { // Welcome is NOT disabled in settings
615 615
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/formatting.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-	return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
26
+	return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0));
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-	return give_get_option( 'thousands_separator', ',' );
37
+	return give_get_option('thousands_separator', ',');
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-	return give_get_option( 'decimal_separator', '.' );
48
+	return give_get_option('decimal_separator', '.');
49 49
 }
50 50
 
51 51
 /**
@@ -61,67 +61,67 @@  discard block
 block discarded – undo
61 61
  *
62 62
  * @return string $amount Newly sanitized amount
63 63
  */
64
-function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
64
+function give_sanitize_amount($number, $dp = false, $trim_zeros = false) {
65 65
 
66 66
 	// Bailout.
67
-	if ( empty( $number ) ) {
67
+	if (empty($number)) {
68 68
 		return $number;
69 69
 	}
70 70
 
71 71
 	// Remove slash from amount.
72 72
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
73 73
 	// To prevent notices and warning remove slash from amount/number.
74
-	$number = wp_unslash( $number );
74
+	$number = wp_unslash($number);
75 75
 
76 76
 	$thousand_separator = give_get_price_thousand_separator();
77 77
 
78 78
 	$locale   = localeconv();
79
-	$decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
79
+	$decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']);
80 80
 
81 81
 	// Remove locale from string
82
-	if ( ! is_float( $number ) ) {
83
-		$number = str_replace( $decimals, '.', $number );
82
+	if ( ! is_float($number)) {
83
+		$number = str_replace($decimals, '.', $number);
84 84
 	}
85 85
 
86 86
 	// Remove thousand amount formatting if amount has.
87 87
 	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
88 88
 	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
89
-	if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
90
-		$number = str_replace( $thousand_separator, '', $number );
91
-	} elseif ( in_array( $thousand_separator, $decimals ) ) {
92
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
89
+	if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
90
+		$number = str_replace($thousand_separator, '', $number);
91
+	} elseif (in_array($thousand_separator, $decimals)) {
92
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
93 93
 	}
94 94
 
95 95
 	// Remove non numeric entity before decimal separator.
96
-	$number     = preg_replace( '/[^0-9\.]/', '', $number );
96
+	$number     = preg_replace('/[^0-9\.]/', '', $number);
97 97
 	$default_dp = give_get_price_decimals();
98 98
 
99 99
 	// Reset negative amount to zero.
100
-	if ( 0 > $number ) {
101
-		$number = number_format( 0, $default_dp, '.' );
100
+	if (0 > $number) {
101
+		$number = number_format(0, $default_dp, '.');
102 102
 	}
103 103
 
104 104
 	// If number does not have decimal then add number of decimals to it.
105 105
 	if (
106
-		false === strpos( $number, '.' )
107
-		|| ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) )
106
+		false === strpos($number, '.')
107
+		|| ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
108 108
 	) {
109
-		$number = number_format( $number, $default_dp, '.', '' );
109
+		$number = number_format($number, $default_dp, '.', '');
110 110
 	}
111 111
 
112 112
 	// Format number by custom number of decimals.
113
-	if ( false !== $dp ) {
114
-		$dp     = intval( empty( $dp ) ? $default_dp : $dp );
115
-		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
116
-		$number = number_format( floatval( $number ), $dp, '.', '' );
113
+	if (false !== $dp) {
114
+		$dp     = intval(empty($dp) ? $default_dp : $dp);
115
+		$dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
116
+		$number = number_format(floatval($number), $dp, '.', '');
117 117
 	}
118 118
 
119 119
 	// Trim zeros.
120
-	if ( $trim_zeros && strstr( $number, '.' ) ) {
121
-		$number = rtrim( rtrim( $number, '0' ), '.' );
120
+	if ($trim_zeros && strstr($number, '.')) {
121
+		$number = rtrim(rtrim($number, '0'), '.');
122 122
 	}
123 123
 
124
-	return apply_filters( 'give_sanitize_amount', $number );
124
+	return apply_filters('give_sanitize_amount', $number);
125 125
 }
126 126
 
127 127
 /**
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return string $amount   Newly formatted amount or Price Not Available
136 136
  */
137
-function give_format_amount( $amount, $decimals = true ) {
138
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
139
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
137
+function give_format_amount($amount, $decimals = true) {
138
+	$thousands_sep = give_get_option('thousands_separator', ',');
139
+	$decimal_sep   = give_get_option('decimal_separator', '.');
140 140
 
141
-	if ( empty( $amount ) ) {
141
+	if (empty($amount)) {
142 142
 		$amount = 0;
143 143
 	} else {
144 144
 		// Sanitize amount before formatting.
145
-		$amount = give_sanitize_amount( $amount );
145
+		$amount = give_sanitize_amount($amount);
146 146
 	}
147 147
 
148 148
 	$decimals = $decimals ? give_get_price_decimals() : 0;
149 149
 
150
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
150
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
151 151
 
152
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
152
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
153 153
 }
154 154
 
155 155
 
@@ -166,33 +166,33 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @return float|string  formatted amount number with large number names.
168 168
  */
169
-function give_human_format_large_amount( $amount ) {
169
+function give_human_format_large_amount($amount) {
170 170
 
171 171
 	// Get thousand separator.
172 172
 	$thousands_sep = give_get_price_thousand_separator();
173 173
 
174 174
 	// Sanitize amount.
175
-	$sanitize_amount = give_sanitize_amount( $amount );
175
+	$sanitize_amount = give_sanitize_amount($amount);
176 176
 
177 177
 	// Explode amount to calculate name of large numbers.
178
-	$amount_array = explode( $thousands_sep, $amount );
178
+	$amount_array = explode($thousands_sep, $amount);
179 179
 
180 180
 	// Calculate amount parts count.
181
-	$amount_count_parts = count( $amount_array );
181
+	$amount_count_parts = count($amount_array);
182 182
 
183 183
 	// Human format amount (default).
184 184
 	$human_format_amount = $amount;
185 185
 
186 186
 	// Calculate large number formatted amount.
187
-	if ( 4 < $amount_count_parts ) {
188
-		$human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
189
-	} elseif ( 3 < $amount_count_parts ) {
190
-		$human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
191
-	} elseif ( 2 < $amount_count_parts ) {
192
-		$human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) );
187
+	if (4 < $amount_count_parts) {
188
+		$human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
189
+	} elseif (3 < $amount_count_parts) {
190
+		$human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
191
+	} elseif (2 < $amount_count_parts) {
192
+		$human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
193 193
 	}
194 194
 
195
-	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
195
+	return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
196 196
 }
197 197
 
198 198
 /**
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @return string $amount Newly formatted amount or Price Not Available
207 207
  */
208
-function give_format_decimal( $amount, $dp = false ) {
208
+function give_format_decimal($amount, $dp = false) {
209 209
 	$decimal_separator = give_get_price_decimal_separator();
210
-	$formatted_amount  = give_sanitize_amount( $amount, $dp );
210
+	$formatted_amount  = give_sanitize_amount($amount, $dp);
211 211
 
212
-	if ( false !== strpos( $formatted_amount, '.' ) ) {
213
-		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
212
+	if (false !== strpos($formatted_amount, '.')) {
213
+		$formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
214 214
 	}
215 215
 
216
-	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
216
+	return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
217 217
 }
218 218
 
219 219
 /**
@@ -226,24 +226,24 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return mixed|string
228 228
  */
229
-function give_currency_filter( $price = '', $currency = '' ) {
229
+function give_currency_filter($price = '', $currency = '') {
230 230
 
231
-	if ( empty( $currency ) ) {
231
+	if (empty($currency)) {
232 232
 		$currency = give_get_currency();
233 233
 	}
234 234
 
235
-	$position = give_get_option( 'currency_position', 'before' );
235
+	$position = give_get_option('currency_position', 'before');
236 236
 
237 237
 	$negative = $price < 0;
238 238
 
239
-	if ( $negative ) {
239
+	if ($negative) {
240 240
 		// Remove proceeding "-".
241
-		$price = substr( $price, 1 );
241
+		$price = substr($price, 1);
242 242
 	}
243 243
 
244
-	$symbol = give_currency_symbol( $currency );
244
+	$symbol = give_currency_symbol($currency);
245 245
 
246
-	switch ( $currency ) :
246
+	switch ($currency) :
247 247
 		case 'GBP' :
248 248
 		case 'BRL' :
249 249
 		case 'EUR' :
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
 		case 'MAD' :
273 273
 		case 'KRW' :
274 274
 		case 'ZAR' :
275
-			$formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
275
+			$formatted = ('before' === $position ? $symbol.$price : $price.$symbol);
276 276
 			break;
277 277
 		case 'NOK' :
278
-			$formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
278
+			$formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol);
279 279
 			break;
280 280
 		default :
281
-			$formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
281
+			$formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency);
282 282
 			break;
283 283
 	endswitch;
284 284
 
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	 *           and if currency is USD and currency position is after then
294 294
 	 *           filter name will be give_usd_currency_filter_after
295 295
 	 */
296
-	$formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
296
+	$formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price);
297 297
 
298
-	if ( $negative ) {
298
+	if ($negative) {
299 299
 		// Prepend the minus sign before the currency sign.
300
-		$formatted = '-' . $formatted;
300
+		$formatted = '-'.$formatted;
301 301
 	}
302 302
 
303 303
 	return $formatted;
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function give_currency_decimal_filter() {
315 315
 
316
-	remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
316
+	remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
317 317
 
318 318
 	// Set default number of decimals.
319 319
 	$decimals = give_get_price_decimals();
320 320
 
321
-	add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
321
+	add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
322 322
 
323 323
 	// Get number of decimals with backward compatibility ( version < 1.6 )
324
-	if ( 1 <= func_num_args() ) {
325
-		$decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
324
+	if (1 <= func_num_args()) {
325
+		$decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0)));
326 326
 	}
327 327
 
328 328
 	$currency = give_get_currency();
329 329
 
330
-	switch ( $currency ) {
330
+	switch ($currency) {
331 331
 		case 'RIAL' :
332 332
 		case 'JPY' :
333 333
 		case 'TWD' :
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 			break;
338 338
 	}
339 339
 
340
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
340
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
341 341
 }
342 342
 
343
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
344
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
343
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
344
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
345 345
 
346 346
 
347 347
 /**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
  *
354 354
  * @return string                  Date format string
355 355
  */
356
-function give_date_format( $date_context = '' ) {
356
+function give_date_format($date_context = '') {
357 357
 	/**
358 358
 	 * Filter the date context
359 359
 	 *
@@ -374,19 +374,19 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 *    }
376 376
 	 */
377
-	$date_format_contexts = apply_filters( 'give_date_format_contexts', array() );
377
+	$date_format_contexts = apply_filters('give_date_format_contexts', array());
378 378
 
379 379
 	// Set date format to default date format.
380
-	$date_format = get_option( 'date_format' );
380
+	$date_format = get_option('date_format');
381 381
 
382 382
 	// Update date format if we have non empty date format context array and non empty date format string for that context.
383
-	if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) {
384
-		$date_format = ! empty( $date_format_contexts[ $date_context ] )
385
-			? $date_format_contexts[ $date_context ]
383
+	if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) {
384
+		$date_format = ! empty($date_format_contexts[$date_context])
385
+			? $date_format_contexts[$date_context]
386 386
 			: $date_format;
387 387
 	}
388 388
 
389
-	return apply_filters( 'give_date_format', $date_format );
389
+	return apply_filters('give_date_format', $date_format);
390 390
 }
391 391
 
392 392
 /**
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
  *
400 400
  * @return string
401 401
  */
402
-function give_get_cache_key( $action, $query_args ) {
402
+function give_get_cache_key($action, $query_args) {
403 403
 	// Bailout.
404
-	if ( ! is_array( $query_args ) || empty( $query_args ) ) {
404
+	if ( ! is_array($query_args) || empty($query_args)) {
405 405
 		return '';
406 406
 	}
407 407
 
408
-	return "give_cache_{$action}_" . substr( md5( serialize( $query_args ) ), 0, 15 );
408
+	return "give_cache_{$action}_".substr(md5(serialize($query_args)), 0, 15);
409 409
 }
410 410
 
411 411
 /**
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
  *
419 419
  * @return string|array
420 420
  */
421
-function give_clean( $var ) {
422
-	if ( is_array( $var ) ) {
423
-		return array_map( 'give_clean', $var );
421
+function give_clean($var) {
422
+	if (is_array($var)) {
423
+		return array_map('give_clean', $var);
424 424
 	} else {
425
-		return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
425
+		return is_scalar($var) ? sanitize_text_field($var) : $var;
426 426
 	}
427 427
 }
428 428
 
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
  *
436 436
  * @return int
437 437
  */
438
-function give_let_to_num( $size ) {
439
-	$l   = substr( $size, - 1 );
440
-	$ret = substr( $size, 0, - 1 );
441
-	switch ( strtoupper( $l ) ) {
438
+function give_let_to_num($size) {
439
+	$l   = substr($size, - 1);
440
+	$ret = substr($size, 0, - 1);
441
+	switch (strtoupper($l)) {
442 442
 		case 'P':
443 443
 			$ret *= 1024;
444 444
 		case 'T':
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
  * @param int   $action
464 464
  * @param array $wp_die_args
465 465
  */
466
-function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) {
466
+function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) {
467 467
 
468 468
 	$default_wp_die_args = array(
469
-		'message' => esc_html__( 'Nonce verification has failed.', 'give' ),
470
-		'title'   => esc_html__( 'Error', 'give' ),
471
-		'args'    => array( 'response' => 403 ),
469
+		'message' => esc_html__('Nonce verification has failed.', 'give'),
470
+		'title'   => esc_html__('Error', 'give'),
471
+		'args'    => array('response' => 403),
472 472
 	);
473 473
 
474
-	$wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args );
474
+	$wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args);
475 475
 
476
-	if ( ! wp_verify_nonce( $nonce, $action ) ) {
476
+	if ( ! wp_verify_nonce($nonce, $action)) {
477 477
 		wp_die(
478 478
 			$wp_die_args['message'],
479 479
 			$wp_die_args['title'],
@@ -495,23 +495,23 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return mixed
497 497
  */
498
-function give_check_variable( $variable, $conditional = '', $default = false ) {
498
+function give_check_variable($variable, $conditional = '', $default = false) {
499 499
 
500
-	switch ( $conditional ) {
500
+	switch ($conditional) {
501 501
 		case 'isset_empty':
502
-			$variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default;
502
+			$variable = (isset($variable) && ! empty($variable)) ? $variable : $default;
503 503
 			break;
504 504
 
505 505
 		case 'empty':
506
-			$variable = ! empty( $variable ) ? $variable : $default;
506
+			$variable = ! empty($variable) ? $variable : $default;
507 507
 			break;
508 508
 
509 509
 		case 'null':
510
-			$variable = ! is_null( $variable ) ? $variable : $default;
510
+			$variable = ! is_null($variable) ? $variable : $default;
511 511
 			break;
512 512
 
513 513
 		default:
514
-			$variable = isset( $variable ) ? $variable : $default;
514
+			$variable = isset($variable) ? $variable : $default;
515 515
 
516 516
 	}
517 517
 
Please login to merge, or discard this patch.
includes/deprecated/deprecated-functions.php 1 patch
Spacing   +10 added lines, -10 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
 
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return bool $ret True if guest checkout is enabled, false otherwise
29 29
  */
30
-function give_no_guest_checkout( $form_id ) {
30
+function give_no_guest_checkout($form_id) {
31 31
 
32 32
 	$backtrace = debug_backtrace();
33 33
 
34
-	_give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace );
34
+	_give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace);
35 35
 
36
-	$ret = get_post_meta( $form_id, '_give_logged_in_only', true );
36
+	$ret = get_post_meta($form_id, '_give_logged_in_only', true);
37 37
 
38
-	return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) );
38
+	return (bool) apply_filters('give_no_guest_checkout', give_is_setting_enabled($ret));
39 39
 }
40 40
 
41 41
 
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 
51 51
 	$backtrace = debug_backtrace();
52 52
 
53
-	_give_deprecated_function( __FUNCTION__, '1.8', null, $backtrace );
53
+	_give_deprecated_function(__FUNCTION__, '1.8', null, $backtrace);
54 54
 
55 55
 	$views = array(
56
-		'sales'          => esc_html__( 'Donations', 'give' ),
57
-		'gateway_errors' => esc_html__( 'Payment Errors', 'give' ),
58
-		'api_requests'   => esc_html__( 'API Requests', 'give' ),
56
+		'sales'          => esc_html__('Donations', 'give'),
57
+		'gateway_errors' => esc_html__('Payment Errors', 'give'),
58
+		'api_requests'   => esc_html__('API Requests', 'give'),
59 59
 	);
60 60
 
61
-	$views = apply_filters( 'give_log_views', $views );
61
+	$views = apply_filters('give_log_views', $views);
62 62
 
63 63
 	return $views;
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
includes/deprecated/deprecated-filters.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
  */
5 5
 $give_map_deprecated_filters = give_deprecated_filters();
6 6
 
7
-foreach ( $give_map_deprecated_filters as $new => $old ) {
8
-	add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 );
7
+foreach ($give_map_deprecated_filters as $new => $old) {
8
+	add_filter($new, 'give_deprecated_filter_mapping', 10, 4);
9 9
 }
10 10
 
11 11
 /**
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return mixed
43 43
  */
44
-function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) {
44
+function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') {
45 45
 	$give_map_deprecated_filters = give_deprecated_filters();
46 46
 	$filter                      = current_filter();
47 47
 
48
-	if ( isset( $give_map_deprecated_filters[ $filter ] ) ) {
49
-		if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) {
50
-			$data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 );
48
+	if (isset($give_map_deprecated_filters[$filter])) {
49
+		if (has_filter($give_map_deprecated_filters[$filter])) {
50
+			$data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3);
51 51
 
52
-			if ( ! defined( 'DOING_AJAX' ) ) {
52
+			if ( ! defined('DOING_AJAX')) {
53 53
 				_give_deprecated_function(
54 54
 					sprintf(
55 55
 					/* translators: %s: filter name */
56
-						__( 'The %s filter' ),
57
-						$give_map_deprecated_filters[ $filter ]
56
+						__('The %s filter'),
57
+						$give_map_deprecated_filters[$filter]
58 58
 					),
59 59
 					'1.7',
60 60
 					$filter
Please login to merge, or discard this patch.
includes/gateways/functions.php 1 patch
Spacing   +66 added lines, -66 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
 
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29 29
 		),
30 30
 		'manual' => array(
31
-			'admin_label'    => __( 'Test Donation', 'give' ),
32
-			'checkout_label' => __( 'Test Donation', 'give' )
31
+			'admin_label'    => __('Test Donation', 'give'),
32
+			'checkout_label' => __('Test Donation', 'give')
33 33
 		),
34 34
 	);
35 35
 
36
-	return apply_filters( 'give_payment_gateways', $gateways );
36
+	return apply_filters('give_payment_gateways', $gateways);
37 37
 
38 38
 }
39 39
 
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array $gateway_list All the available gateways
48 48
  */
49
-function give_get_enabled_payment_gateways( $form_id = 0 ) {
49
+function give_get_enabled_payment_gateways($form_id = 0) {
50 50
 
51 51
 	$gateways = give_get_payment_gateways();
52 52
 
53
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
53
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
54 54
 
55 55
 	$gateway_list = array();
56 56
 
57
-	foreach ( $gateways as $key => $gateway ) {
58
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
59
-			$gateway_list[ $key ] = $gateway;
57
+	foreach ($gateways as $key => $gateway) {
58
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
59
+			$gateway_list[$key] = $gateway;
60 60
 		}
61 61
 	}
62 62
 
63 63
 	// Set order of payment gateway in list.
64
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
64
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
65 65
 
66
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id );
66
+	return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id);
67 67
 }
68 68
 
69 69
 /**
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
  *
76 76
  * @return boolean true if enabled, false otherwise
77 77
  */
78
-function give_is_gateway_active( $gateway ) {
78
+function give_is_gateway_active($gateway) {
79 79
 	$gateways = give_get_enabled_payment_gateways();
80 80
 
81
-	$ret = array_key_exists( $gateway, $gateways );
81
+	$ret = array_key_exists($gateway, $gateways);
82 82
 
83
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
83
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
84 84
 }
85 85
 
86 86
 /**
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return string Gateway ID
94 94
  */
95
-function give_get_default_gateway( $form_id ) {
95
+function give_get_default_gateway($form_id) {
96 96
 
97 97
 	$give_options = give_get_settings();
98
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
99
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
98
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
99
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
100 100
 
101 101
 	// Single Form settings varies compared to the Global default settings.
102
-	if ( ! empty( $form_default ) &&
102
+	if ( ! empty($form_default) &&
103 103
 		 $form_id !== null &&
104 104
 		 $default !== $form_default &&
105 105
 		 $form_default !== 'global' &&
106
-		 give_is_gateway_active( $form_default )
106
+		 give_is_gateway_active($form_default)
107 107
 	) {
108 108
 		$default = $form_default;
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_default_gateway', $default );
111
+	return apply_filters('give_default_gateway', $default);
112 112
 }
113 113
 
114 114
 /**
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string Gateway admin label
122 122
  */
123
-function give_get_gateway_admin_label( $gateway ) {
123
+function give_get_gateway_admin_label($gateway) {
124 124
 	$gateways = give_get_payment_gateways();
125
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
126
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
125
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
126
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
127 127
 
128
-	if ( $gateway == 'manual' && $payment ) {
129
-		if ( give_get_payment_amount( $payment ) == 0 ) {
130
-			$label = __( 'Test Donation', 'give' );
128
+	if ($gateway == 'manual' && $payment) {
129
+		if (give_get_payment_amount($payment) == 0) {
130
+			$label = __('Test Donation', 'give');
131 131
 		}
132 132
 	}
133 133
 
134
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
134
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
135 135
 }
136 136
 
137 137
 /**
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
  *
144 144
  * @return string Checkout label for the gateway
145 145
  */
146
-function give_get_gateway_checkout_label( $gateway ) {
146
+function give_get_gateway_checkout_label($gateway) {
147 147
 	$gateways = give_get_payment_gateways();
148
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
148
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
149 149
 
150
-	if ( $gateway == 'manual' ) {
151
-		$label = __( 'Test Donation', 'give' );
150
+	if ($gateway == 'manual') {
151
+		$label = __('Test Donation', 'give');
152 152
 	}
153 153
 
154
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
154
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
155 155
 }
156 156
 
157 157
 /**
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return array Options the gateway supports
165 165
  */
166
-function give_get_gateway_supports( $gateway ) {
166
+function give_get_gateway_supports($gateway) {
167 167
 	$gateways = give_get_enabled_payment_gateways();
168
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
168
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
169 169
 
170
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
170
+	return apply_filters('give_gateway_supports', $supports, $gateway);
171 171
 }
172 172
 
173 173
 /**
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function give_send_to_gateway( $gateway, $payment_data ) {
183
+function give_send_to_gateway($gateway, $payment_data) {
184 184
 
185
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
185
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
186 186
 
187 187
 	/**
188 188
 	 * Fires while loading payment gateway via AJAX.
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param array $payment_data All the payment data to be sent to the gateway.
195 195
 	 */
196
-	do_action( "give_gateway_{$gateway}", $payment_data );
196
+	do_action("give_gateway_{$gateway}", $payment_data);
197 197
 }
198 198
 
199 199
 
@@ -207,34 +207,34 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return string $enabled_gateway The slug of the gateway
209 209
  */
210
-function give_get_chosen_gateway( $form_id ) {
210
+function give_get_chosen_gateway($form_id) {
211 211
 
212
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
212
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
213 213
 
214 214
 	// Back to check if 'form-id' is present.
215
-	if ( empty( $request_form_id ) ) {
216
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
215
+	if (empty($request_form_id)) {
216
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
217 217
 	}
218 218
 
219
-	$request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : '';
219
+	$request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : '';
220 220
 	$chosen               = false;
221 221
 
222 222
 	// If both 'payment-mode' and 'form-id' then set for only this form.
223
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
223
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
224 224
 		$chosen = $request_payment_mode;
225
-	} elseif ( empty( $request_form_id ) && $request_payment_mode ) {
225
+	} elseif (empty($request_form_id) && $request_payment_mode) {
226 226
 		// If no 'form-id' but there is 'payment-mode'.
227 227
 		$chosen = $request_payment_mode;
228 228
 	}
229 229
 
230 230
 	// Get the enable gateway based of chosen var.
231
-	if ( $chosen && give_is_gateway_active( $chosen ) ) {
232
-		$enabled_gateway = urldecode( $chosen );
231
+	if ($chosen && give_is_gateway_active($chosen)) {
232
+		$enabled_gateway = urldecode($chosen);
233 233
 	} else {
234
-		$enabled_gateway = give_get_default_gateway( $form_id );
234
+		$enabled_gateway = give_get_default_gateway($form_id);
235 235
 	}
236 236
 
237
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
237
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
238 238
 
239 239
 }
240 240
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return int ID of the new log entry
254 254
  */
255
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
256
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
255
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
256
+	return give_record_log($title, $message, $parent, 'gateway_error');
257 257
 }
258 258
 
259 259
 /**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
  *
267 267
  * @return int
268 268
  */
269
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
269
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
270 270
 
271 271
 	$ret  = 0;
272 272
 	$args = array(
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 		'fields'      => 'ids',
279 279
 	);
280 280
 
281
-	$payments = new WP_Query( $args );
281
+	$payments = new WP_Query($args);
282 282
 
283
-	if ( $payments ) {
283
+	if ($payments) {
284 284
 		$ret = $payments->post_count;
285 285
 	}
286 286
 
@@ -297,27 +297,27 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return array $gateways All the available gateways
299 299
  */
300
-function give_get_ordered_payment_gateways( $gateways ) {
300
+function give_get_ordered_payment_gateways($gateways) {
301 301
 
302 302
 	// Get gateways setting.
303
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
303
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
304 304
 
305 305
 	// Return from here if we do not have gateways setting.
306
-	if ( empty( $gateways_setting ) ) {
306
+	if (empty($gateways_setting)) {
307 307
 		return $gateways;
308 308
 	}
309 309
 
310 310
 	// Reverse array to order payment gateways.
311
-	$gateways_setting = array_reverse( $gateways_setting );
311
+	$gateways_setting = array_reverse($gateways_setting);
312 312
 
313 313
 	// Reorder gateways array
314
-	foreach ( $gateways_setting as $gateway_key => $value ) {
314
+	foreach ($gateways_setting as $gateway_key => $value) {
315 315
 
316
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
317
-		unset( $gateways[ $gateway_key ] );
316
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
317
+		unset($gateways[$gateway_key]);
318 318
 
319
-		if ( ! empty( $new_gateway_value ) ) {
320
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
319
+		if ( ! empty($new_gateway_value)) {
320
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
321 321
 		}
322 322
 	}
323 323
 
@@ -328,5 +328,5 @@  discard block
 block discarded – undo
328 328
 	 *
329 329
 	 * @param array $gateways All the available gateways
330 330
 	 */
331
-	return apply_filters( 'give_payment_gateways_order', $gateways );
331
+	return apply_filters('give_payment_gateways_order', $gateways);
332 332
 }
333 333
\ No newline at end of file
Please login to merge, or discard this patch.
includes/ajax-functions.php 1 patch
Spacing   +105 added lines, -105 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
 
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
 function give_test_ajax_works() {
27 27
 
28 28
 	// Check if the Airplane Mode plugin is installed
29
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31 31
 		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-		if ( method_exists( $airplane, 'enabled' ) ) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-			if ( $airplane->enabled() ) {
35
+			if ($airplane->enabled()) {
36 36
 				return true;
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
 
62 62
 	$works = true;
63 63
 
64
-	if ( is_wp_error( $ajax ) ) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66 66
 		$works = false;
67 67
 
68 68
 	} else {
69 69
 
70
-		if ( empty( $ajax['response'] ) ) {
70
+		if (empty($ajax['response'])) {
71 71
 			$works = false;
72 72
 		}
73 73
 
74
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
74
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
 			$works = false;
76 76
 		}
77 77
 
78
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79 79
 			$works = false;
80 80
 		}
81 81
 
82
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
82
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
 			$works = false;
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;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
  * @return string
101 101
  */
102 102
 function give_get_ajax_url() {
103
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
103
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
104 104
 
105 105
 	$current_url = give_get_current_page_url();
106
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
106
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
107 107
 
108
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
109
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
108
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
109
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
110 110
 	}
111 111
 
112
-	return apply_filters( 'give_ajax_url', $ajax_url );
112
+	return apply_filters('give_ajax_url', $ajax_url);
113 113
 }
114 114
 
115 115
 /**
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @since 1.7
127 127
 	 */
128
-	do_action( 'give_donation_form_login_fields' );
128
+	do_action('give_donation_form_login_fields');
129 129
 
130 130
 	give_die();
131 131
 }
132 132
 
133
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
133
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
134 134
 
135 135
 /**
136 136
  * Load Checkout Fields
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * @return void
141 141
  */
142 142
 function give_load_checkout_fields() {
143
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
143
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
144 144
 
145 145
 	ob_start();
146 146
 
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @since 1.7
151 151
 	 */
152
-	do_action( 'give_donation_form_register_login_fields', $form_id );
152
+	do_action('give_donation_form_register_login_fields', $form_id);
153 153
 
154 154
 	$fields = ob_get_clean();
155 155
 
156
-	wp_send_json( array(
157
-		'fields' => wp_json_encode( $fields ),
158
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
159
-	) );
156
+	wp_send_json(array(
157
+		'fields' => wp_json_encode($fields),
158
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
159
+	));
160 160
 }
161 161
 
162
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
163
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
162
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
163
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
164 164
 
165 165
 /**
166 166
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
  * @return void
171 171
  */
172 172
 function give_ajax_get_form_title() {
173
-	if ( isset( $_POST['form_id'] ) ) {
174
-		$title = get_the_title( $_POST['form_id'] );
175
-		if ( $title ) {
173
+	if (isset($_POST['form_id'])) {
174
+		$title = get_the_title($_POST['form_id']);
175
+		if ($title) {
176 176
 			echo $title;
177 177
 		} else {
178 178
 			echo 'fail';
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	give_die();
182 182
 }
183 183
 
184
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
185
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
184
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
185
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
186 186
 
187 187
 /**
188 188
  * Retrieve a states drop down
@@ -193,23 +193,23 @@  discard block
 block discarded – undo
193 193
  */
194 194
 function give_ajax_get_states_field() {
195 195
 
196
-	if ( empty( $_POST['country'] ) ) {
196
+	if (empty($_POST['country'])) {
197 197
 		$_POST['country'] = give_get_country();
198 198
 	}
199
-	$states = give_get_states( $_POST['country'] );
199
+	$states = give_get_states($_POST['country']);
200 200
 
201
-	if ( ! empty( $states ) ) {
201
+	if ( ! empty($states)) {
202 202
 
203 203
 		$args = array(
204 204
 			'name'             => $_POST['field_name'],
205 205
 			'id'               => $_POST['field_name'],
206
-			'class'            => $_POST['field_name'] . '  give-select',
207
-			'options'          => give_get_states( $_POST['country'] ),
206
+			'class'            => $_POST['field_name'].'  give-select',
207
+			'options'          => give_get_states($_POST['country']),
208 208
 			'show_option_all'  => false,
209 209
 			'show_option_none' => false,
210 210
 		);
211 211
 
212
-		$response = Give()->html->select( $args );
212
+		$response = Give()->html->select($args);
213 213
 
214 214
 	} else {
215 215
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	give_die();
222 222
 }
223 223
 
224
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
225
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
224
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
225
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
226 226
 
227 227
 /**
228 228
  * Retrieve a states drop down
@@ -234,17 +234,17 @@  discard block
 block discarded – undo
234 234
 function give_ajax_form_search() {
235 235
 	global $wpdb;
236 236
 
237
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
237
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
238 238
 	$results = array();
239
-	if ( current_user_can( 'edit_give_forms' ) ) {
240
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
239
+	if (current_user_can('edit_give_forms')) {
240
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
241 241
 	} else {
242
-		$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" );
242
+		$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");
243 243
 	}
244 244
 
245
-	if ( $items ) {
245
+	if ($items) {
246 246
 
247
-		foreach ( $items as $item ) {
247
+		foreach ($items as $item) {
248 248
 
249 249
 			$results[] = array(
250 250
 				'id'   => $item->ID,
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$items[] = array(
257 257
 			'id'   => 0,
258
-			'name' => esc_html__( 'No forms found.', 'give' ),
258
+			'name' => esc_html__('No forms found.', 'give'),
259 259
 		);
260 260
 
261 261
 	}
262 262
 
263
-	echo json_encode( $results );
263
+	echo json_encode($results);
264 264
 
265 265
 	give_die();
266 266
 }
267 267
 
268
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
269
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
268
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
269
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
270 270
 
271 271
 /**
272 272
  * Search the donors database via Ajax
@@ -278,38 +278,38 @@  discard block
 block discarded – undo
278 278
 function give_ajax_donor_search() {
279 279
 	global $wpdb;
280 280
 
281
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
281
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
282 282
 	$results = array();
283
-	if ( ! current_user_can( 'view_give_reports' ) ) {
283
+	if ( ! current_user_can('view_give_reports')) {
284 284
 		$donors = array();
285 285
 	} else {
286
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
286
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
287 287
 	}
288 288
 
289
-	if ( $donors ) {
289
+	if ($donors) {
290 290
 
291
-		foreach ( $donors as $donor ) {
291
+		foreach ($donors as $donor) {
292 292
 
293 293
 			$results[] = array(
294 294
 				'id'   => $donor->id,
295
-				'name' => $donor->name . '(' . $donor->email . ')',
295
+				'name' => $donor->name.'('.$donor->email.')',
296 296
 			);
297 297
 		}
298 298
 	} else {
299 299
 
300 300
 		$donors[] = array(
301 301
 			'id'   => 0,
302
-			'name' => esc_html__( 'No donors found.', 'give' ),
302
+			'name' => esc_html__('No donors found.', 'give'),
303 303
 		);
304 304
 
305 305
 	}
306 306
 
307
-	echo json_encode( $results );
307
+	echo json_encode($results);
308 308
 
309 309
 	give_die();
310 310
 }
311 311
 
312
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
312
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
313 313
 
314 314
 
315 315
 /**
@@ -321,42 +321,42 @@  discard block
 block discarded – undo
321 321
  */
322 322
 function give_ajax_search_users() {
323 323
 
324
-	if ( current_user_can( 'manage_give_settings' ) ) {
324
+	if (current_user_can('manage_give_settings')) {
325 325
 
326
-		$search_query = trim( $_POST['user_name'] );
327
-		$exclude      = trim( $_POST['exclude'] );
326
+		$search_query = trim($_POST['user_name']);
327
+		$exclude      = trim($_POST['exclude']);
328 328
 
329 329
 		$get_users_args = array(
330 330
 			'number' => 9999,
331
-			'search' => $search_query . '*',
331
+			'search' => $search_query.'*',
332 332
 		);
333 333
 
334
-		if ( ! empty( $exclude ) ) {
335
-			$exclude_array             = explode( ',', $exclude );
334
+		if ( ! empty($exclude)) {
335
+			$exclude_array             = explode(',', $exclude);
336 336
 			$get_users_args['exclude'] = $exclude_array;
337 337
 		}
338 338
 
339
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
339
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
340 340
 
341
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
341
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
342 342
 
343 343
 		$user_list = '<ul>';
344
-		if ( $found_users ) {
345
-			foreach ( $found_users as $user ) {
346
-				$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>';
344
+		if ($found_users) {
345
+			foreach ($found_users as $user) {
346
+				$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>';
347 347
 			}
348 348
 		} else {
349
-			$user_list .= '<li>' . esc_html__( 'No users found.', 'give' ) . '</li>';
349
+			$user_list .= '<li>'.esc_html__('No users found.', 'give').'</li>';
350 350
 		}
351 351
 		$user_list .= '</ul>';
352 352
 
353
-		echo json_encode( array( 'results' => $user_list ) );
353
+		echo json_encode(array('results' => $user_list));
354 354
 
355 355
 	}
356 356
 	die();
357 357
 }
358 358
 
359
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
359
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
360 360
 
361 361
 
362 362
 /**
@@ -368,32 +368,32 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function give_check_for_form_price_variations() {
370 370
 
371
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
372
-		die( '-1' );
371
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
372
+		die('-1');
373 373
 	}
374 374
 
375
-	$form_id = intval( $_POST['form_id'] );
376
-	$form    = get_post( $form_id );
375
+	$form_id = intval($_POST['form_id']);
376
+	$form    = get_post($form_id);
377 377
 
378
-	if ( 'give_forms' != $form->post_type ) {
379
-		die( '-2' );
378
+	if ('give_forms' != $form->post_type) {
379
+		die('-2');
380 380
 	}
381 381
 
382
-	if ( give_has_variable_prices( $form_id ) ) {
383
-		$variable_prices = give_get_variable_prices( $form_id );
382
+	if (give_has_variable_prices($form_id)) {
383
+		$variable_prices = give_get_variable_prices($form_id);
384 384
 
385
-		if ( $variable_prices ) {
385
+		if ($variable_prices) {
386 386
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
387 387
 
388
-			if ( isset( $_POST['all_prices'] ) ) {
389
-				$ajax_response .= '<option value="">' . esc_html__( 'All Levels', 'give' ) . '</option>';
388
+			if (isset($_POST['all_prices'])) {
389
+				$ajax_response .= '<option value="">'.esc_html__('All Levels', 'give').'</option>';
390 390
 			}
391 391
 
392
-			foreach ( $variable_prices as $key => $price ) {
392
+			foreach ($variable_prices as $key => $price) {
393 393
 
394
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
394
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
395 395
 
396
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
396
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
397 397
 			}
398 398
 			$ajax_response .= '</select>';
399 399
 			echo $ajax_response;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	give_die();
404 404
 }
405 405
 
406
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
406
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
407 407
 
408 408
 
409 409
 /**
@@ -414,29 +414,29 @@  discard block
 block discarded – undo
414 414
  * @return void
415 415
  */
416 416
 function give_check_for_form_price_variations_html() {
417
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
417
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
418 418
 		wp_die();
419 419
 	}
420 420
 
421
-	$form_id    = intval( $_POST['form_id'] );
422
-	$payment_id = intval( $_POST['payment_id'] );
423
-	$form       = get_post( $form_id );
421
+	$form_id    = intval($_POST['form_id']);
422
+	$payment_id = intval($_POST['payment_id']);
423
+	$form       = get_post($form_id);
424 424
 
425
-	if ( 'give_forms' != $form->post_type ) {
425
+	if ('give_forms' != $form->post_type) {
426 426
 		wp_die();
427 427
 	}
428 428
 
429
-	if ( ! give_has_variable_prices( $form_id ) ) {
430
-		esc_html_e( 'n/a', 'give' );
429
+	if ( ! give_has_variable_prices($form_id)) {
430
+		esc_html_e('n/a', 'give');
431 431
 	} else {
432 432
 		// Payment object.
433
-		$payment = new Give_Payment( $payment_id );
433
+		$payment = new Give_Payment($payment_id);
434 434
 
435 435
 
436 436
 		$prices_atts = '';
437
-		if( $variable_prices = give_get_variable_prices( $form_id ) ) {
438
-			foreach ( $variable_prices as $variable_price ) {
439
-				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] );
437
+		if ($variable_prices = give_get_variable_prices($form_id)) {
438
+			foreach ($variable_prices as $variable_price) {
439
+				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']);
440 440
 			}
441 441
 		}
442 442
 
@@ -451,15 +451,15 @@  discard block
 block discarded – undo
451 451
 			'chosen'           => true,
452 452
 			'show_option_all'  => '',
453 453
 			'show_option_none' => '',
454
-			'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
454
+			'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
455 455
 			'selected'         => $payment_meta['price_id'],
456 456
 		);
457 457
 
458 458
 		// Render variable prices select tag html.
459
-		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
459
+		give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
460 460
 	}
461 461
 
462 462
 	give_die();
463 463
 }
464 464
 
465
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
465
+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.