@@ -16,75 +16,75 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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', '' ); |