Passed
Push — master ( 337bd9...1d574c )
by Jonathan
04:01
created
object-sync-for-salesforce.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -16,75 +16,75 @@  discard block
 block discarded – undo
16 16
 class Object_Sync_Salesforce {
17 17
 
18 18
 	/**
19
-	* @var object
20
-	* Global object of `$wpdb`, the WordPress database
21
-	*/
19
+	 * @var object
20
+	 * Global object of `$wpdb`, the WordPress database
21
+	 */
22 22
 	private $wpdb;
23 23
 
24 24
 	/**
25
-	* @var array
26
-	* Login credentials for the Salesforce API; comes from wp-config or from the plugin settings
27
-	*/
25
+	 * @var array
26
+	 * Login credentials for the Salesforce API; comes from wp-config or from the plugin settings
27
+	 */
28 28
 	private $login_credentials;
29 29
 
30 30
 	/**
31
-	* @var string
32
-	* The plugin's slug so we can include it when necessary
33
-	*/
31
+	 * @var string
32
+	 * The plugin's slug so we can include it when necessary
33
+	 */
34 34
 	private $slug;
35 35
 
36 36
 	/**
37
-	* @var array
38
-	* Array of what classes in the plugin can be scheduled to occur with `wp_cron` events
39
-	*/
37
+	 * @var array
38
+	 * Array of what classes in the plugin can be scheduled to occur with `wp_cron` events
39
+	 */
40 40
 	public $schedulable_classes;
41 41
 
42 42
 	/**
43
-	* @var string
44
-	* Current version of the plugin
45
-	*/
43
+	 * @var string
44
+	 * Current version of the plugin
45
+	 */
46 46
 	private $version;
47 47
 
48 48
 	/**
49
-	* @var object
50
-	*/
49
+	 * @var object
50
+	 */
51 51
 	private $activated;
52 52
 
53 53
 	/**
54
-	* @var object
55
-	* Load and initialize the Object_Sync_Sf_Logging class
56
-	*/
54
+	 * @var object
55
+	 * Load and initialize the Object_Sync_Sf_Logging class
56
+	 */
57 57
 	private $logging;
58 58
 
59 59
 	/**
60
-	* @var object
61
-	* Load and initialize the Object_Sync_Sf_Mapping class
62
-	*/
60
+	 * @var object
61
+	 * Load and initialize the Object_Sync_Sf_Mapping class
62
+	 */
63 63
 	private $mappings;
64 64
 
65 65
 	/**
66
-	* @var object
67
-	* Load and initialize the Object_Sync_Sf_WordPress class
68
-	*/
66
+	 * @var object
67
+	 * Load and initialize the Object_Sync_Sf_WordPress class
68
+	 */
69 69
 	private $wordpress;
70 70
 
71 71
 	/**
72
-	* @var object
73
-	* Load and initialize the Object_Sync_Sf_Salesforce class.
74
-	* This contains the Salesforce API methods
75
-	*/
72
+	 * @var object
73
+	 * Load and initialize the Object_Sync_Sf_Salesforce class.
74
+	 * This contains the Salesforce API methods
75
+	 */
76 76
 	public $salesforce;
77 77
 
78 78
 	/**
79
-	* @var object
80
-	* Load and initialize the Object_Sync_Sf_Salesforce_Push class
81
-	*/
79
+	 * @var object
80
+	 * Load and initialize the Object_Sync_Sf_Salesforce_Push class
81
+	 */
82 82
 	private $push;
83 83
 
84 84
 	/**
85
-	* @var object
86
-	* Load and initialize the Object_Sync_Sf_Salesforce_Pull class
87
-	*/
85
+	 * @var object
86
+	 * Load and initialize the Object_Sync_Sf_Salesforce_Pull class
87
+	 */
88 88
 	private $pull;
89 89
 
90 90
 	/**
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	static $instance = null;
96 96
 
97 97
 	/**
98
-	* Load the static $instance property that holds the instance of the class.
99
-	* This instance makes the class reusable by other plugins
100
-	*
101
-	* @return object
102
-	*   The sfapi object if it is authenticated (empty, otherwise)
103
-	*
104
-	*/
98
+	 * Load the static $instance property that holds the instance of the class.
99
+	 * This instance makes the class reusable by other plugins
100
+	 *
101
+	 * @return object
102
+	 *   The sfapi object if it is authenticated (empty, otherwise)
103
+	 *
104
+	 */
105 105
 	static public function get_instance() {
106 106
 		if ( null === self::$instance ) {
107 107
 			self::$instance = new Object_Sync_Salesforce();
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	/**
225
-	* Private helper to load methods for manipulating core WordPress data across the plugin
226
-	*
227
-	* @param object $wpdb
228
-	* @param string $version
229
-	* @param string $slug
230
-	* @param object $mappings
231
-	* @param object $logging
232
-	*
233
-	* @return object
234
-	*   Instance of Object_Sync_Sf_WordPress
235
-	*/
225
+	 * Private helper to load methods for manipulating core WordPress data across the plugin
226
+	 *
227
+	 * @param object $wpdb
228
+	 * @param string $version
229
+	 * @param string $slug
230
+	 * @param object $mappings
231
+	 * @param object $logging
232
+	 *
233
+	 * @return object
234
+	 *   Instance of Object_Sync_Sf_WordPress
235
+	 */
236 236
 	private function wordpress( $wpdb, $version, $slug, $mappings, $logging ) {
237 237
 		require_once plugin_dir_path( __FILE__ ) . 'classes/wordpress.php';
238 238
 		$wordpress = new Object_Sync_Sf_WordPress( $wpdb, $version, $slug, $mappings, $logging );
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 
242 242
 	/**
243
-	* Public helper to load the Salesforce API and see if it is authenticated.
244
-	* This is public so other plugins can access the same SF API instance
245
-	*
246
-	* @return array
247
-	*   Whether Salesforce is authenticated (boolean)
248
-	*   The sfapi object if it is authenticated (empty, otherwise)
249
-	*/
243
+	 * Public helper to load the Salesforce API and see if it is authenticated.
244
+	 * This is public so other plugins can access the same SF API instance
245
+	 *
246
+	 * @return array
247
+	 *   Whether Salesforce is authenticated (boolean)
248
+	 *   The sfapi object if it is authenticated (empty, otherwise)
249
+	 */
250 250
 	public function salesforce_get_api() {
251 251
 		require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce.php' );
252 252
 		require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce_query.php' ); // this can be used to generate soql queries, but we don't often need it so it gets initialized whenever it's needed
@@ -352,24 +352,24 @@  discard block
 block discarded – undo
352 352
 	}
353 353
 
354 354
 	/**
355
-	* Load the admin class.
356
-	* This also creates admin menu, unless the plugin that calls this library has indicated that it has its own menu
357
-	*
358
-	* @param object $wpdb
359
-	* @param string $version
360
-	* @param array $login_credentials
361
-	* @param string $slug
362
-	* @param object $wordpress
363
-	* @param object $salesforce
364
-	* @param object $mappings
365
-	* @param object $push
366
-	* @param object $pull
367
-	* @param object $logging
368
-	* @param array $schedulable_classes
369
-	* @return object $admin
370
-	*   Instance of Object_Sync_Sf_Admin
371
-	*
372
-	*/
355
+	 * Load the admin class.
356
+	 * This also creates admin menu, unless the plugin that calls this library has indicated that it has its own menu
357
+	 *
358
+	 * @param object $wpdb
359
+	 * @param string $version
360
+	 * @param array $login_credentials
361
+	 * @param string $slug
362
+	 * @param object $wordpress
363
+	 * @param object $salesforce
364
+	 * @param object $mappings
365
+	 * @param object $push
366
+	 * @param object $pull
367
+	 * @param object $logging
368
+	 * @param array $schedulable_classes
369
+	 * @return object $admin
370
+	 *   Instance of Object_Sync_Sf_Admin
371
+	 *
372
+	 */
373 373
 	private function load_admin( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes ) {
374 374
 		require_once( plugin_dir_path( __FILE__ ) . 'classes/admin.php' );
375 375
 		$admin = new Object_Sync_Sf_Admin( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes );
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
 	}
382 382
 
383 383
 	/**
384
-	* Display a Settings link on the main Plugins page
385
-	*
386
-	* @param array $links
387
-	* @param string $file
388
-	* @return array $links
389
-	*   These are the links that go with this plugin's entry
390
-	*/
384
+	 * Display a Settings link on the main Plugins page
385
+	 *
386
+	 * @param array $links
387
+	 * @param string $file
388
+	 * @return array $links
389
+	 *   These are the links that go with this plugin's entry
390
+	 */
391 391
 	public function plugin_action_links( $links, $file ) {
392 392
 		if ( plugin_basename( __FILE__ ) === $file ) {
393 393
 			$settings = '<a href="' . get_admin_url() . 'options-general.php?page=object-sync-salesforce-admin">' . __( 'Settings', 'object-sync-for-salesforce' ) . '</a>';
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 
400 400
 
401 401
 	/**
402
-	* Admin styles. Load the CSS and JavaScript for the plugin's settings
403
-	*
404
-	* @return void
405
-	*/
402
+	 * Admin styles. Load the CSS and JavaScript for the plugin's settings
403
+	 *
404
+	 * @return void
405
+	 */
406 406
 	public function admin_scripts_and_styles() {
407 407
 		wp_enqueue_script( $this->slug . '-admin', plugins_url( 'assets/js/object-sync-for-salesforce-admin.min.js', __FILE__ ), array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'assets/js/object-sync-for-salesforce-admin.js' ), true );
408 408
 		wp_enqueue_style( $this->slug . '-admin', plugins_url( 'assets/css/object-sync-for-salesforce-admin.min.css', __FILE__ ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'assets/css/object-sync-for-salesforce-admin.css' ), 'all' );
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	}
419 419
 
420 420
 	/**
421
-	* Get the pre-login Salesforce credentials.
422
-	* These depend on the plugin's settings or constants defined in wp-config.php.
423
-	*
424
-	* @return array $login_credentials
425
-	*   Includes all settings necessary to log into the Salesforce API.
426
-	*   Replaces settings options with wp-config.php values if they exist.
427
-	*/
421
+	 * Get the pre-login Salesforce credentials.
422
+	 * These depend on the plugin's settings or constants defined in wp-config.php.
423
+	 *
424
+	 * @return array $login_credentials
425
+	 *   Includes all settings necessary to log into the Salesforce API.
426
+	 *   Replaces settings options with wp-config.php values if they exist.
427
+	 */
428 428
 	private function get_login_credentials() {
429 429
 
430 430
 		$consumer_key       = defined( 'OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY' ) ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY : get_option( 'object_sync_for_salesforce_consumer_key', '' );
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	*
104 104
 	*/
105 105
 	static public function get_instance() {
106
-		if ( null === self::$instance ) {
106
+		if (null === self::$instance) {
107 107
 			self::$instance = new Object_Sync_Salesforce();
108 108
 		}
109 109
 		return self::$instance;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		);
143 143
 
144 144
 		// users can modify the list of schedulable classes
145
-		$this->schedulable_classes = apply_filters( 'object_sync_for_salesforce_modify_schedulable_classes', $this->schedulable_classes );
145
+		$this->schedulable_classes = apply_filters('object_sync_for_salesforce_modify_schedulable_classes', $this->schedulable_classes);
146 146
 
147 147
 		/*
148 148
 		 * example to modify the array of classes by adding one and removing one
@@ -167,21 +167,21 @@  discard block
 block discarded – undo
167 167
 		 * }
168 168
 		*/
169 169
 
170
-		$this->activated = $this->activate( $this->wpdb, $this->version, $this->slug );
171
-		$this->deactivate( $this->wpdb, $this->version, $this->slug, $this->schedulable_classes );
170
+		$this->activated = $this->activate($this->wpdb, $this->version, $this->slug);
171
+		$this->deactivate($this->wpdb, $this->version, $this->slug, $this->schedulable_classes);
172 172
 
173
-		$this->logging = $this->logging( $this->wpdb, $this->version );
173
+		$this->logging = $this->logging($this->wpdb, $this->version);
174 174
 
175
-		$this->mappings = $this->mappings( $this->wpdb, $this->version, $this->slug, $this->logging );
175
+		$this->mappings = $this->mappings($this->wpdb, $this->version, $this->slug, $this->logging);
176 176
 
177
-		$this->wordpress  = $this->wordpress( $this->wpdb, $this->version, $this->slug, $this->mappings, $this->logging );
177
+		$this->wordpress  = $this->wordpress($this->wpdb, $this->version, $this->slug, $this->mappings, $this->logging);
178 178
 		$this->salesforce = $this->salesforce_get_api();
179 179
 
180
-		$this->push = $this->push( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes );
180
+		$this->push = $this->push($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes);
181 181
 
182
-		$this->pull = $this->pull( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes );
182
+		$this->pull = $this->pull($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes);
183 183
 
184
-		$this->load_admin( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $this->push, $this->pull, $this->logging, $this->schedulable_classes );
184
+		$this->load_admin($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $this->push, $this->pull, $this->logging, $this->schedulable_classes);
185 185
 
186 186
 	}
187 187
 
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 	 * @return object
196 196
 	 *   Instance of Object_Sync_Sf_Logging
197 197
 	 */
198
-	private function logging( $wpdb, $version ) {
199
-		if ( ! class_exists( 'WP_Logging' ) && file_exists( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' ) ) {
200
-			require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
201
-			require_once plugin_dir_path( __FILE__ ) . 'classes/logging.php';
198
+	private function logging($wpdb, $version) {
199
+		if ( ! class_exists('WP_Logging') && file_exists(plugin_dir_path(__FILE__) . 'vendor/autoload.php')) {
200
+			require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php';
201
+			require_once plugin_dir_path(__FILE__) . 'classes/logging.php';
202 202
 		}
203
-		$logging = new Object_Sync_Sf_Logging( $wpdb, $version );
203
+		$logging = new Object_Sync_Sf_Logging($wpdb, $version);
204 204
 		return $logging;
205 205
 	}
206 206
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 * @return object
216 216
 	 *   Instance of Object_Sync_Sf_Mapping
217 217
 	 */
218
-	private function mappings( $wpdb, $version, $slug, $logging ) {
219
-		require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce_mapping.php' );
220
-		$mappings = new Object_Sync_Sf_Mapping( $wpdb, $version, $slug, $logging );
218
+	private function mappings($wpdb, $version, $slug, $logging) {
219
+		require_once(plugin_dir_path(__FILE__) . 'classes/salesforce_mapping.php');
220
+		$mappings = new Object_Sync_Sf_Mapping($wpdb, $version, $slug, $logging);
221 221
 		return $mappings;
222 222
 	}
223 223
 
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 	* @return object
234 234
 	*   Instance of Object_Sync_Sf_WordPress
235 235
 	*/
236
-	private function wordpress( $wpdb, $version, $slug, $mappings, $logging ) {
237
-		require_once plugin_dir_path( __FILE__ ) . 'classes/wordpress.php';
238
-		$wordpress = new Object_Sync_Sf_WordPress( $wpdb, $version, $slug, $mappings, $logging );
236
+	private function wordpress($wpdb, $version, $slug, $mappings, $logging) {
237
+		require_once plugin_dir_path(__FILE__) . 'classes/wordpress.php';
238
+		$wordpress = new Object_Sync_Sf_WordPress($wpdb, $version, $slug, $mappings, $logging);
239 239
 		return $wordpress;
240 240
 	}
241 241
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	*   The sfapi object if it is authenticated (empty, otherwise)
249 249
 	*/
250 250
 	public function salesforce_get_api() {
251
-		require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce.php' );
252
-		require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce_query.php' ); // this can be used to generate soql queries, but we don't often need it so it gets initialized whenever it's needed
251
+		require_once(plugin_dir_path(__FILE__) . 'classes/salesforce.php');
252
+		require_once(plugin_dir_path(__FILE__) . 'classes/salesforce_query.php'); // this can be used to generate soql queries, but we don't often need it so it gets initialized whenever it's needed
253 253
 		$consumer_key        = $this->login_credentials['consumer_key'];
254 254
 		$consumer_secret     = $this->login_credentials['consumer_secret'];
255 255
 		$login_url           = $this->login_credentials['login_url'];
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 		$schedulable_classes = $this->schedulable_classes;
264 264
 		$is_authorized       = false;
265 265
 		$sfapi               = '';
266
-		if ( $consumer_key && $consumer_secret ) {
267
-			$sfapi = new Object_Sync_Sf_Salesforce( $consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $logging, $schedulable_classes );
268
-			if ( $sfapi->is_authorized() === true ) {
266
+		if ($consumer_key && $consumer_secret) {
267
+			$sfapi = new Object_Sync_Sf_Salesforce($consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $logging, $schedulable_classes);
268
+			if ($sfapi->is_authorized() === true) {
269 269
 				$is_authorized = true;
270 270
 			}
271 271
 		}
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 * @return object
286 286
 	 *   Instance of Object_Sync_Sf_Activate
287 287
 	 */
288
-	private function activate( $wpdb, $version, $slug ) {
289
-		require_once plugin_dir_path( __FILE__ ) . 'classes/activate.php';
290
-		$activate = new Object_Sync_Sf_Activate( $wpdb, $version, $slug );
288
+	private function activate($wpdb, $version, $slug) {
289
+		require_once plugin_dir_path(__FILE__) . 'classes/activate.php';
290
+		$activate = new Object_Sync_Sf_Activate($wpdb, $version, $slug);
291 291
 		return $activate;
292 292
 	}
293 293
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 	 * @return object
303 303
 	 *   Instance of Object_Sync_Sf_Deactivate
304 304
 	 */
305
-	private function deactivate( $wpdb, $version, $slug, $schedulable_classes ) {
306
-		require_once plugin_dir_path( __FILE__ ) . 'classes/deactivate.php';
307
-		$deactivate = new Object_Sync_Sf_Deactivate( $wpdb, $version, $slug, $schedulable_classes );
305
+	private function deactivate($wpdb, $version, $slug, $schedulable_classes) {
306
+		require_once plugin_dir_path(__FILE__) . 'classes/deactivate.php';
307
+		$deactivate = new Object_Sync_Sf_Deactivate($wpdb, $version, $slug, $schedulable_classes);
308 308
 	}
309 309
 
310 310
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 	 * @return object
325 325
 	 *   Instance of Object_Sync_Sf_Salesforce_Push
326 326
 	 */
327
-	private function push( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes ) {
328
-		require_once plugin_dir_path( __FILE__ ) . 'classes/salesforce_push.php';
329
-		$push = new Object_Sync_Sf_Salesforce_Push( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes );
327
+	private function push($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes) {
328
+		require_once plugin_dir_path(__FILE__) . 'classes/salesforce_push.php';
329
+		$push = new Object_Sync_Sf_Salesforce_Push($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes);
330 330
 		return $push;
331 331
 	}
332 332
 
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
 	 * @return object
346 346
 	 *   Instance of Object_Sync_Sf_Salesforce_Pull
347 347
 	 */
348
-	private function pull( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes ) {
349
-		require_once plugin_dir_path( __FILE__ ) . 'classes/salesforce_pull.php';
350
-		$pull = new Object_Sync_Sf_Salesforce_Pull( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes );
348
+	private function pull($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes) {
349
+		require_once plugin_dir_path(__FILE__) . 'classes/salesforce_pull.php';
350
+		$pull = new Object_Sync_Sf_Salesforce_Pull($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes);
351 351
 		return $pull;
352 352
 	}
353 353
 
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
 	*   Instance of Object_Sync_Sf_Admin
371 371
 	*
372 372
 	*/
373
-	private function load_admin( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes ) {
374
-		require_once( plugin_dir_path( __FILE__ ) . 'classes/admin.php' );
375
-		$admin = new Object_Sync_Sf_Admin( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes );
376
-		add_action( 'admin_menu', array( $admin, 'create_admin_menu' ) );
377
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts_and_styles' ) );
378
-		add_action( 'plugins_loaded', array( $this, 'textdomain' ) );
379
-		add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 5 );
373
+	private function load_admin($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes) {
374
+		require_once(plugin_dir_path(__FILE__) . 'classes/admin.php');
375
+		$admin = new Object_Sync_Sf_Admin($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes);
376
+		add_action('admin_menu', array($admin, 'create_admin_menu'));
377
+		add_action('admin_enqueue_scripts', array($this, 'admin_scripts_and_styles'));
378
+		add_action('plugins_loaded', array($this, 'textdomain'));
379
+		add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 5);
380 380
 		return $admin;
381 381
 	}
382 382
 
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 	* @return array $links
389 389
 	*   These are the links that go with this plugin's entry
390 390
 	*/
391
-	public function plugin_action_links( $links, $file ) {
392
-		if ( plugin_basename( __FILE__ ) === $file ) {
393
-			$settings = '<a href="' . get_admin_url() . 'options-general.php?page=object-sync-salesforce-admin">' . __( 'Settings', 'object-sync-for-salesforce' ) . '</a>';
391
+	public function plugin_action_links($links, $file) {
392
+		if (plugin_basename(__FILE__) === $file) {
393
+			$settings = '<a href="' . get_admin_url() . 'options-general.php?page=object-sync-salesforce-admin">' . __('Settings', 'object-sync-for-salesforce') . '</a>';
394 394
 			// make the 'Settings' link appear first
395
-			array_unshift( $links, $settings );
395
+			array_unshift($links, $settings);
396 396
 		}
397 397
 		return $links;
398 398
 	}
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	* @return void
405 405
 	*/
406 406
 	public function admin_scripts_and_styles() {
407
-		wp_enqueue_script( $this->slug . '-admin', plugins_url( 'assets/js/object-sync-for-salesforce-admin.min.js', __FILE__ ), array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'assets/js/object-sync-for-salesforce-admin.js' ), true );
408
-		wp_enqueue_style( $this->slug . '-admin', plugins_url( 'assets/css/object-sync-for-salesforce-admin.min.css', __FILE__ ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'assets/css/object-sync-for-salesforce-admin.css' ), 'all' );
407
+		wp_enqueue_script($this->slug . '-admin', plugins_url('assets/js/object-sync-for-salesforce-admin.min.js', __FILE__), array('jquery'), filemtime(plugin_dir_path(__FILE__) . 'assets/js/object-sync-for-salesforce-admin.js'), true);
408
+		wp_enqueue_style($this->slug . '-admin', plugins_url('assets/css/object-sync-for-salesforce-admin.min.css', __FILE__), array(), filemtime(plugin_dir_path(__FILE__) . 'assets/css/object-sync-for-salesforce-admin.css'), 'all');
409 409
 	}
410 410
 
411 411
 	/**
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 * @return void
415 415
 	 */
416 416
 	public function textdomain() {
417
-		load_plugin_textdomain( 'object-sync-for-salesforce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
417
+		load_plugin_textdomain('object-sync-for-salesforce', false, dirname(plugin_basename(__FILE__)) . '/languages/');
418 418
 	}
419 419
 
420 420
 	/**
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	*/
428 428
 	private function get_login_credentials() {
429 429
 
430
-		$consumer_key       = defined( 'OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY' ) ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY : get_option( 'object_sync_for_salesforce_consumer_key', '' );
431
-		$consumer_secret    = defined( 'OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET' ) ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET : get_option( 'object_sync_for_salesforce_consumer_secret', '' );
432
-		$callback_url       = defined( 'OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL' ) ? OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL : get_option( 'object_sync_for_salesforce_callback_url', '' );
433
-		$login_base_url     = defined( 'OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL' ) ? OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL : get_option( 'object_sync_for_salesforce_login_base_url', '' );
434
-		$authorize_url_path = defined( 'OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH' ) ? OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH : get_option( 'object_sync_for_salesforce_authorize_url_path', '' );
435
-		$token_url_path     = defined( 'OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH' ) ? OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH : get_option( 'object_sync_for_salesforce_token_url_path', '' );
436
-		$api_version        = defined( 'OBJECT_SYNC_SF_SALESFORCE_API_VERSION' ) ? OBJECT_SYNC_SF_SALESFORCE_API_VERSION : get_option( 'object_sync_for_salesforce_api_version', '' );
430
+		$consumer_key       = defined('OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY') ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY : get_option('object_sync_for_salesforce_consumer_key', '');
431
+		$consumer_secret    = defined('OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET') ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET : get_option('object_sync_for_salesforce_consumer_secret', '');
432
+		$callback_url       = defined('OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL') ? OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL : get_option('object_sync_for_salesforce_callback_url', '');
433
+		$login_base_url     = defined('OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL') ? OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL : get_option('object_sync_for_salesforce_login_base_url', '');
434
+		$authorize_url_path = defined('OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH') ? OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH : get_option('object_sync_for_salesforce_authorize_url_path', '');
435
+		$token_url_path     = defined('OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH') ? OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH : get_option('object_sync_for_salesforce_token_url_path', '');
436
+		$api_version        = defined('OBJECT_SYNC_SF_SALESFORCE_API_VERSION') ? OBJECT_SYNC_SF_SALESFORCE_API_VERSION : get_option('object_sync_for_salesforce_api_version', '');
437 437
 
438 438
 		$login_credentials = array(
439 439
 			'consumer_key'     => $consumer_key,
Please login to merge, or discard this patch.