Completed
Push — master ( 6650f3...84c2e6 )
by Devin
16:35
created
includes/install.php 1 patch
Spacing   +40 added lines, -40 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
 
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 	give_setup_post_types();
33 33
 
34 34
 	// Clear the permalinks
35
-	flush_rewrite_rules( false );
35
+	flush_rewrite_rules(false);
36 36
 
37 37
 	// Add Upgraded From Option
38
-	$current_version = get_option( 'give_version' );
39
-	if ( $current_version ) {
40
-		update_option( 'give_version_upgraded_from', $current_version );
38
+	$current_version = get_option('give_version');
39
+	if ($current_version) {
40
+		update_option('give_version_upgraded_from', $current_version);
41 41
 	}
42 42
 
43 43
 	// Setup some default options
44 44
 	$options = array();
45 45
 
46 46
 	// Checks if the Success Page option exists AND that the page exists
47
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
47
+	if ( ! get_post(give_get_option('success_page'))) {
48 48
 
49 49
 		// Purchase Confirmation (Success) Page
50 50
 		$success = wp_insert_post(
51 51
 			array(
52
-				'post_title'     => __( 'Donation Confirmation', 'give' ),
53
-				'post_content'   => __( '[give_receipt]', 'give' ),
52
+				'post_title'     => __('Donation Confirmation', 'give'),
53
+				'post_content'   => __('[give_receipt]', 'give'),
54 54
 				'post_status'    => 'publish',
55 55
 				'post_author'    => 1,
56 56
 				'post_type'      => 'page',
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	// Checks if the Failure Page option exists AND that the page exists
66
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
66
+	if ( ! get_post(give_get_option('failure_page'))) {
67 67
 
68 68
 		// Failed Purchase Page
69 69
 		$failed = wp_insert_post(
70 70
 			array(
71
-				'post_title'     => __( 'Transaction Failed', 'give' ),
72
-				'post_content'   => __( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ),
71
+				'post_title'     => __('Transaction Failed', 'give'),
72
+				'post_content'   => __('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'),
73 73
 				'post_status'    => 'publish',
74 74
 				'post_author'    => 1,
75 75
 				'post_type'      => 'page',
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	}
82 82
 
83 83
 	// Checks if the History Page option exists AND that the page exists
84
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
84
+	if ( ! get_post(give_get_option('history_page'))) {
85 85
 		// Purchase History (History) Page
86 86
 		$history = wp_insert_post(
87 87
 			array(
88
-				'post_title'     => __( 'Donation History', 'give' ),
88
+				'post_title'     => __('Donation History', 'give'),
89 89
 				'post_content'   => '[donation_history]',
90 90
 				'post_status'    => 'publish',
91 91
 				'post_author'    => 1,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency
101
-	if ( empty( $current_version ) ) {
101
+	if (empty($current_version)) {
102 102
 		$options['base_country']       = 'US';
103 103
 		$options['test_mode']          = 1;
104 104
 		$options['currency']           = 'USD';
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	}
116 116
 
117 117
 	// Populate some default values
118
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
119
-	update_option( 'give_version', GIVE_VERSION );
118
+	update_option('give_settings', array_merge($give_options, $options));
119
+	update_option('give_version', GIVE_VERSION);
120 120
 
121 121
 	//Update Version Number
122
-	if ( $current_version ) {
123
-		update_option( 'give_version_upgraded_from', $current_version );
122
+	if ($current_version) {
123
+		update_option('give_version_upgraded_from', $current_version);
124 124
 	}
125 125
 
126 126
 	// Create Give roles
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	$roles->add_caps();
130 130
 
131 131
 	$api = new Give_API();
132
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
132
+	update_option('give_default_api_version', 'v'.$api->get_version());
133 133
 
134 134
 	// Create the customers database
135 135
 	@Give()->customers->create_table();
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	Give()->session->use_php_sessions();
139 139
 
140 140
 	// Add a temporary option to note that Give pages have been created
141
-	set_transient( '_give_installed', $options, 30 );
141
+	set_transient('_give_installed', $options, 30);
142 142
 
143 143
 
144
-	if ( ! $current_version ) {
145
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
144
+	if ( ! $current_version) {
145
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
146 146
 
147 147
 		// When new upgrade routines are added, mark them as complete on fresh install
148 148
 		$upgrade_routines = array(
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 			'upgrade_give_offline_status'
151 151
 		);
152 152
 
153
-		foreach ( $upgrade_routines as $upgrade ) {
154
-			give_set_upgrade_complete( $upgrade );
153
+		foreach ($upgrade_routines as $upgrade) {
154
+			give_set_upgrade_complete($upgrade);
155 155
 		}
156 156
 	}
157 157
 	// Bail if activating from network, or bulk
158
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
158
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
159 159
 		return;
160 160
 	}
161 161
 	// Add the transient to redirect
162
-	set_transient( '_give_activation_redirect', true, 30 );
162
+	set_transient('_give_activation_redirect', true, 30);
163 163
 
164 164
 }
165 165
 
166
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
166
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
167 167
 
168 168
 /**
169 169
  * Post-installation
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function give_after_install() {
177 177
 
178
-	if ( ! is_admin() ) {
178
+	if ( ! is_admin()) {
179 179
 		return;
180 180
 	}
181 181
 
182
-	$give_options = get_transient( '_give_installed' );
182
+	$give_options = get_transient('_give_installed');
183 183
 
184 184
 	// Exit if not in admin or the transient doesn't exist
185
-	if ( false === $give_options ) {
185
+	if (false === $give_options) {
186 186
 		return;
187 187
 	}
188 188
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 	@Give()->customers->create_table();
191 191
 
192 192
 	// Delete the transient
193
-	delete_transient( '_give_installed' );
193
+	delete_transient('_give_installed');
194 194
 
195
-	do_action( 'give_after_install', $give_options );
195
+	do_action('give_after_install', $give_options);
196 196
 
197 197
 }
198 198
 
199
-add_action( 'admin_init', 'give_after_install' );
199
+add_action('admin_init', 'give_after_install');
200 200
 
201 201
 
202 202
 /**
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 
212 212
 	global $wp_roles;
213 213
 
214
-	if ( ! is_object( $wp_roles ) ) {
214
+	if ( ! is_object($wp_roles)) {
215 215
 		return;
216 216
 	}
217 217
 
218
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
218
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
219 219
 
220 220
 		// Create Give shop roles
221 221
 		$roles = new Give_Roles;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 }
228 228
 
229
-add_action( 'admin_init', 'give_install_roles_on_network' );
229
+add_action('admin_init', 'give_install_roles_on_network');
230 230
 
231 231
 /**
232 232
  * Network Activated New Site Setup
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
  * @param $site_id
243 243
  * @param $meta
244 244
  */
245
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
246
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
247
-		switch_to_blog( $blog_id );
245
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
246
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
247
+		switch_to_blog($blog_id);
248 248
 		give_install();
249 249
 		restore_current_blog();
250 250
 	}
251 251
 }
252 252
 
253
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
254 253
\ No newline at end of file
254
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
255 255
\ No newline at end of file
Please login to merge, or discard this patch.