Passed
Push — master ( 337bd9...1d574c )
by Jonathan
04:01
created
object-sync-for-salesforce.php 1 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.