@@ -16,81 +16,81 @@ 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 string |
|
38 | - * The plugin's option prefix |
|
39 | - */ |
|
37 | + * @var string |
|
38 | + * The plugin's option prefix |
|
39 | + */ |
|
40 | 40 | private $option_prefix; |
41 | 41 | |
42 | 42 | /** |
43 | - * @var array |
|
44 | - * Array of what classes in the plugin can be scheduled to occur with `wp_cron` events |
|
45 | - */ |
|
43 | + * @var array |
|
44 | + * Array of what classes in the plugin can be scheduled to occur with `wp_cron` events |
|
45 | + */ |
|
46 | 46 | public $schedulable_classes; |
47 | 47 | |
48 | 48 | /** |
49 | - * @var string |
|
50 | - * Current version of the plugin |
|
51 | - */ |
|
49 | + * @var string |
|
50 | + * Current version of the plugin |
|
51 | + */ |
|
52 | 52 | private $version; |
53 | 53 | |
54 | 54 | /** |
55 | - * @var object |
|
56 | - */ |
|
55 | + * @var object |
|
56 | + */ |
|
57 | 57 | private $activated; |
58 | 58 | |
59 | 59 | /** |
60 | - * @var object |
|
61 | - * Load and initialize the Object_Sync_Sf_Logging class |
|
62 | - */ |
|
60 | + * @var object |
|
61 | + * Load and initialize the Object_Sync_Sf_Logging class |
|
62 | + */ |
|
63 | 63 | private $logging; |
64 | 64 | |
65 | 65 | /** |
66 | - * @var object |
|
67 | - * Load and initialize the Object_Sync_Sf_Mapping class |
|
68 | - */ |
|
66 | + * @var object |
|
67 | + * Load and initialize the Object_Sync_Sf_Mapping class |
|
68 | + */ |
|
69 | 69 | private $mappings; |
70 | 70 | |
71 | 71 | /** |
72 | - * @var object |
|
73 | - * Load and initialize the Object_Sync_Sf_WordPress class |
|
74 | - */ |
|
72 | + * @var object |
|
73 | + * Load and initialize the Object_Sync_Sf_WordPress class |
|
74 | + */ |
|
75 | 75 | private $wordpress; |
76 | 76 | |
77 | 77 | /** |
78 | - * @var object |
|
79 | - * Load and initialize the Object_Sync_Sf_Salesforce class. |
|
80 | - * This contains the Salesforce API methods |
|
81 | - */ |
|
78 | + * @var object |
|
79 | + * Load and initialize the Object_Sync_Sf_Salesforce class. |
|
80 | + * This contains the Salesforce API methods |
|
81 | + */ |
|
82 | 82 | public $salesforce; |
83 | 83 | |
84 | 84 | /** |
85 | - * @var object |
|
86 | - * Load and initialize the Object_Sync_Sf_Salesforce_Push class |
|
87 | - */ |
|
85 | + * @var object |
|
86 | + * Load and initialize the Object_Sync_Sf_Salesforce_Push class |
|
87 | + */ |
|
88 | 88 | private $push; |
89 | 89 | |
90 | 90 | /** |
91 | - * @var object |
|
92 | - * Load and initialize the Object_Sync_Sf_Salesforce_Pull class |
|
93 | - */ |
|
91 | + * @var object |
|
92 | + * Load and initialize the Object_Sync_Sf_Salesforce_Pull class |
|
93 | + */ |
|
94 | 94 | private $pull; |
95 | 95 | |
96 | 96 | /** |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | static $instance = null; |
102 | 102 | |
103 | 103 | /** |
104 | - * Load the static $instance property that holds the instance of the class. |
|
105 | - * This instance makes the class reusable by other plugins |
|
106 | - * |
|
107 | - * @return object |
|
108 | - * The sfapi object if it is authenticated (empty, otherwise) |
|
109 | - * |
|
110 | - */ |
|
104 | + * Load the static $instance property that holds the instance of the class. |
|
105 | + * This instance makes the class reusable by other plugins |
|
106 | + * |
|
107 | + * @return object |
|
108 | + * The sfapi object if it is authenticated (empty, otherwise) |
|
109 | + * |
|
110 | + */ |
|
111 | 111 | static public function get_instance() { |
112 | 112 | if ( null === self::$instance ) { |
113 | 113 | self::$instance = new Object_Sync_Salesforce(); |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
260 | - * Private helper to load methods for manipulating core WordPress data across the plugin |
|
261 | - * |
|
262 | - * @param object $wpdb |
|
263 | - * @param string $version |
|
264 | - * @param string $slug |
|
265 | - * @param string $option_prefix |
|
266 | - * @param object $mappings |
|
267 | - * @param object $logging |
|
268 | - * |
|
269 | - * @return object |
|
270 | - * Instance of Object_Sync_Sf_WordPress |
|
271 | - */ |
|
260 | + * Private helper to load methods for manipulating core WordPress data across the plugin |
|
261 | + * |
|
262 | + * @param object $wpdb |
|
263 | + * @param string $version |
|
264 | + * @param string $slug |
|
265 | + * @param string $option_prefix |
|
266 | + * @param object $mappings |
|
267 | + * @param object $logging |
|
268 | + * |
|
269 | + * @return object |
|
270 | + * Instance of Object_Sync_Sf_WordPress |
|
271 | + */ |
|
272 | 272 | private function wordpress( $wpdb, $version, $slug, $option_prefix, $mappings, $logging ) { |
273 | 273 | require_once plugin_dir_path( __FILE__ ) . 'classes/wordpress.php'; |
274 | 274 | $wordpress = new Object_Sync_Sf_WordPress( $wpdb, $version, $slug, $option_prefix, $mappings, $logging ); |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
279 | - * Public helper to load the Salesforce API and see if it is authenticated. |
|
280 | - * This is public so other plugins can access the same SF API instance |
|
281 | - * |
|
282 | - * @return array |
|
283 | - * Whether Salesforce is authenticated (boolean) |
|
284 | - * The sfapi object if it is authenticated (empty, otherwise) |
|
285 | - */ |
|
279 | + * Public helper to load the Salesforce API and see if it is authenticated. |
|
280 | + * This is public so other plugins can access the same SF API instance |
|
281 | + * |
|
282 | + * @return array |
|
283 | + * Whether Salesforce is authenticated (boolean) |
|
284 | + * The sfapi object if it is authenticated (empty, otherwise) |
|
285 | + */ |
|
286 | 286 | public function salesforce_get_api() { |
287 | 287 | require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce.php' ); |
288 | 288 | 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 |
@@ -391,26 +391,26 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
394 | - * Load the admin class. |
|
395 | - * This also creates admin menu, unless the plugin that calls this library has indicated that it has its own menu |
|
396 | - * |
|
397 | - * @param object $wpdb |
|
398 | - * @param string $version |
|
399 | - * @param array $login_credentials |
|
400 | - * @param string $slug |
|
401 | - * @param string $option_prefix |
|
402 | - * @param object $wordpress |
|
403 | - * @param object $salesforce |
|
404 | - * @param object $mappings |
|
405 | - * @param object $push |
|
406 | - * @param object $pull |
|
407 | - * @param object $logging |
|
408 | - * @param array $schedulable_classes |
|
409 | - * @param object $queue |
|
410 | - * @return object $admin |
|
411 | - * Instance of Object_Sync_Sf_Admin |
|
412 | - * |
|
413 | - */ |
|
394 | + * Load the admin class. |
|
395 | + * This also creates admin menu, unless the plugin that calls this library has indicated that it has its own menu |
|
396 | + * |
|
397 | + * @param object $wpdb |
|
398 | + * @param string $version |
|
399 | + * @param array $login_credentials |
|
400 | + * @param string $slug |
|
401 | + * @param string $option_prefix |
|
402 | + * @param object $wordpress |
|
403 | + * @param object $salesforce |
|
404 | + * @param object $mappings |
|
405 | + * @param object $push |
|
406 | + * @param object $pull |
|
407 | + * @param object $logging |
|
408 | + * @param array $schedulable_classes |
|
409 | + * @param object $queue |
|
410 | + * @return object $admin |
|
411 | + * Instance of Object_Sync_Sf_Admin |
|
412 | + * |
|
413 | + */ |
|
414 | 414 | private function load_admin( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ) { |
415 | 415 | require_once( plugin_dir_path( __FILE__ ) . 'classes/admin.php' ); |
416 | 416 | $admin = new Object_Sync_Sf_Admin( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ); |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
425 | - * Display a Settings link on the main Plugins page |
|
426 | - * |
|
427 | - * @param array $links |
|
428 | - * @param string $file |
|
429 | - * @return array $links |
|
430 | - * These are the links that go with this plugin's entry |
|
431 | - */ |
|
425 | + * Display a Settings link on the main Plugins page |
|
426 | + * |
|
427 | + * @param array $links |
|
428 | + * @param string $file |
|
429 | + * @return array $links |
|
430 | + * These are the links that go with this plugin's entry |
|
431 | + */ |
|
432 | 432 | public function plugin_action_links( $links, $file ) { |
433 | 433 | if ( plugin_basename( __FILE__ ) === $file ) { |
434 | 434 | $settings = '<a href="' . get_admin_url() . 'options-general.php?page=object-sync-salesforce-admin">' . __( 'Settings', 'object-sync-for-salesforce' ) . '</a>'; |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | /** |
443 | - * Admin styles. Load the CSS and JavaScript for the plugin's settings |
|
444 | - * |
|
445 | - * @return void |
|
446 | - */ |
|
443 | + * Admin styles. Load the CSS and JavaScript for the plugin's settings |
|
444 | + * |
|
445 | + * @return void |
|
446 | + */ |
|
447 | 447 | public function admin_scripts_and_styles() { |
448 | 448 | |
449 | 449 | // I think some developers might not want to bother with select2 or selectwoo, so let's allow that to be changeable |
@@ -484,13 +484,13 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
487 | - * Get the pre-login Salesforce credentials. |
|
488 | - * These depend on the plugin's settings or constants defined in wp-config.php. |
|
489 | - * |
|
490 | - * @return array $login_credentials |
|
491 | - * Includes all settings necessary to log into the Salesforce API. |
|
492 | - * Replaces settings options with wp-config.php values if they exist. |
|
493 | - */ |
|
487 | + * Get the pre-login Salesforce credentials. |
|
488 | + * These depend on the plugin's settings or constants defined in wp-config.php. |
|
489 | + * |
|
490 | + * @return array $login_credentials |
|
491 | + * Includes all settings necessary to log into the Salesforce API. |
|
492 | + * Replaces settings options with wp-config.php values if they exist. |
|
493 | + */ |
|
494 | 494 | private function get_login_credentials() { |
495 | 495 | |
496 | 496 | $consumer_key = defined( 'OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY' ) ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY : get_option( $this->option_prefix . 'consumer_key', '' ); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | */ |
111 | 111 | static public function get_instance() { |
112 | - if ( null === self::$instance ) { |
|
112 | + if (null === self::$instance) { |
|
113 | 113 | self::$instance = new Object_Sync_Salesforce(); |
114 | 114 | } |
115 | 115 | return self::$instance; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ); |
146 | 146 | |
147 | 147 | // users can modify the list of schedulable classes |
148 | - $this->schedulable_classes = apply_filters( $this->option_prefix . 'modify_schedulable_classes', $this->schedulable_classes ); |
|
148 | + $this->schedulable_classes = apply_filters($this->option_prefix . 'modify_schedulable_classes', $this->schedulable_classes); |
|
149 | 149 | |
150 | 150 | /* |
151 | 151 | * example to modify the array of classes by adding one and removing one |
@@ -170,25 +170,25 @@ discard block |
||
170 | 170 | * } |
171 | 171 | */ |
172 | 172 | |
173 | - $this->load = $this->load( $this->wpdb, $this->version, $this->slug, $this->option_prefix ); |
|
173 | + $this->load = $this->load($this->wpdb, $this->version, $this->slug, $this->option_prefix); |
|
174 | 174 | |
175 | - $this->queue = $this->queue( $this->wpdb, $this->version, $this->slug, $this->option_prefix, $this->schedulable_classes ); |
|
175 | + $this->queue = $this->queue($this->wpdb, $this->version, $this->slug, $this->option_prefix, $this->schedulable_classes); |
|
176 | 176 | |
177 | - $this->activated = $this->activate( $this->wpdb, $this->version, $this->slug ); |
|
178 | - $this->deactivate( $this->wpdb, $this->version, $this->slug, $this->schedulable_classes ); |
|
177 | + $this->activated = $this->activate($this->wpdb, $this->version, $this->slug); |
|
178 | + $this->deactivate($this->wpdb, $this->version, $this->slug, $this->schedulable_classes); |
|
179 | 179 | |
180 | - $this->logging = $this->logging( $this->wpdb, $this->version, $this->slug, $this->option_prefix ); |
|
180 | + $this->logging = $this->logging($this->wpdb, $this->version, $this->slug, $this->option_prefix); |
|
181 | 181 | |
182 | - $this->mappings = $this->mappings( $this->wpdb, $this->version, $this->slug, $this->option_prefix, $this->logging ); |
|
182 | + $this->mappings = $this->mappings($this->wpdb, $this->version, $this->slug, $this->option_prefix, $this->logging); |
|
183 | 183 | |
184 | - $this->wordpress = $this->wordpress( $this->wpdb, $this->version, $this->slug, $this->option_prefix, $this->mappings, $this->logging ); |
|
184 | + $this->wordpress = $this->wordpress($this->wpdb, $this->version, $this->slug, $this->option_prefix, $this->mappings, $this->logging); |
|
185 | 185 | $this->salesforce = $this->salesforce_get_api(); |
186 | 186 | |
187 | - $this->push = $this->push( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->option_prefix, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes, $this->queue ); |
|
187 | + $this->push = $this->push($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->option_prefix, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes, $this->queue); |
|
188 | 188 | |
189 | - $this->pull = $this->pull( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->option_prefix, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes, $this->queue ); |
|
189 | + $this->pull = $this->pull($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->option_prefix, $this->wordpress, $this->salesforce, $this->mappings, $this->logging, $this->schedulable_classes, $this->queue); |
|
190 | 190 | |
191 | - $this->load_admin( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->option_prefix, $this->wordpress, $this->salesforce, $this->mappings, $this->push, $this->pull, $this->logging, $this->schedulable_classes, $this->queue ); |
|
191 | + $this->load_admin($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->option_prefix, $this->wordpress, $this->salesforce, $this->mappings, $this->push, $this->pull, $this->logging, $this->schedulable_classes, $this->queue); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | * @param string $option_prefix |
202 | 202 | * |
203 | 203 | */ |
204 | - private function load( $wpdb, $version, $slug, $option_prefix ) { |
|
205 | - require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
204 | + private function load($wpdb, $version, $slug, $option_prefix) { |
|
205 | + require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php'; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param array $schedulable_classes |
216 | 216 | * @return Object_Sync_Sf_Queue |
217 | 217 | */ |
218 | - public function queue( $wpdb, $version, $slug, $option_prefix, $schedulable_classes ) { |
|
219 | - require_once plugin_dir_path( __FILE__ ) . 'classes/class-object-sync-sf-queue.php'; |
|
220 | - $queue = new Object_Sync_Sf_Queue( $wpdb, $version, $slug, $option_prefix, $schedulable_classes ); |
|
218 | + public function queue($wpdb, $version, $slug, $option_prefix, $schedulable_classes) { |
|
219 | + require_once plugin_dir_path(__FILE__) . 'classes/class-object-sync-sf-queue.php'; |
|
220 | + $queue = new Object_Sync_Sf_Queue($wpdb, $version, $slug, $option_prefix, $schedulable_classes); |
|
221 | 221 | return $queue; |
222 | 222 | } |
223 | 223 | |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | * @return object |
233 | 233 | * Instance of Object_Sync_Sf_Logging |
234 | 234 | */ |
235 | - private function logging( $wpdb, $version, $slug, $option_prefix ) { |
|
236 | - require_once plugin_dir_path( __FILE__ ) . 'classes/logging.php'; |
|
237 | - $logging = new Object_Sync_Sf_Logging( $wpdb, $version, $slug, $option_prefix ); |
|
235 | + private function logging($wpdb, $version, $slug, $option_prefix) { |
|
236 | + require_once plugin_dir_path(__FILE__) . 'classes/logging.php'; |
|
237 | + $logging = new Object_Sync_Sf_Logging($wpdb, $version, $slug, $option_prefix); |
|
238 | 238 | return $logging; |
239 | 239 | } |
240 | 240 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * @return object |
251 | 251 | * Instance of Object_Sync_Sf_Mapping |
252 | 252 | */ |
253 | - private function mappings( $wpdb, $version, $slug, $option_prefix, $logging ) { |
|
254 | - require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce_mapping.php' ); |
|
255 | - $mappings = new Object_Sync_Sf_Mapping( $wpdb, $version, $slug, $option_prefix, $logging ); |
|
253 | + private function mappings($wpdb, $version, $slug, $option_prefix, $logging) { |
|
254 | + require_once(plugin_dir_path(__FILE__) . 'classes/salesforce_mapping.php'); |
|
255 | + $mappings = new Object_Sync_Sf_Mapping($wpdb, $version, $slug, $option_prefix, $logging); |
|
256 | 256 | return $mappings; |
257 | 257 | } |
258 | 258 | |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | * @return object |
270 | 270 | * Instance of Object_Sync_Sf_WordPress |
271 | 271 | */ |
272 | - private function wordpress( $wpdb, $version, $slug, $option_prefix, $mappings, $logging ) { |
|
273 | - require_once plugin_dir_path( __FILE__ ) . 'classes/wordpress.php'; |
|
274 | - $wordpress = new Object_Sync_Sf_WordPress( $wpdb, $version, $slug, $option_prefix, $mappings, $logging ); |
|
272 | + private function wordpress($wpdb, $version, $slug, $option_prefix, $mappings, $logging) { |
|
273 | + require_once plugin_dir_path(__FILE__) . 'classes/wordpress.php'; |
|
274 | + $wordpress = new Object_Sync_Sf_WordPress($wpdb, $version, $slug, $option_prefix, $mappings, $logging); |
|
275 | 275 | return $wordpress; |
276 | 276 | } |
277 | 277 | |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | * The sfapi object if it is authenticated (empty, otherwise) |
285 | 285 | */ |
286 | 286 | public function salesforce_get_api() { |
287 | - require_once( plugin_dir_path( __FILE__ ) . 'classes/salesforce.php' ); |
|
288 | - 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 |
|
287 | + require_once(plugin_dir_path(__FILE__) . 'classes/salesforce.php'); |
|
288 | + 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 |
|
289 | 289 | $consumer_key = $this->login_credentials['consumer_key']; |
290 | 290 | $consumer_secret = $this->login_credentials['consumer_secret']; |
291 | 291 | $login_url = $this->login_credentials['login_url']; |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | $schedulable_classes = $this->schedulable_classes; |
301 | 301 | $is_authorized = false; |
302 | 302 | $sfapi = ''; |
303 | - if ( $consumer_key && $consumer_secret ) { |
|
304 | - $sfapi = new Object_Sync_Sf_Salesforce( $consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $option_prefix, $logging, $schedulable_classes ); |
|
305 | - if ( $sfapi->is_authorized() === true ) { |
|
303 | + if ($consumer_key && $consumer_secret) { |
|
304 | + $sfapi = new Object_Sync_Sf_Salesforce($consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $option_prefix, $logging, $schedulable_classes); |
|
305 | + if ($sfapi->is_authorized() === true) { |
|
306 | 306 | $is_authorized = true; |
307 | 307 | } |
308 | 308 | } |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * @return object |
323 | 323 | * Instance of Object_Sync_Sf_Activate |
324 | 324 | */ |
325 | - private function activate( $wpdb, $version, $slug ) { |
|
326 | - require_once plugin_dir_path( __FILE__ ) . 'classes/activate.php'; |
|
327 | - $activate = new Object_Sync_Sf_Activate( $wpdb, $version, $slug ); |
|
325 | + private function activate($wpdb, $version, $slug) { |
|
326 | + require_once plugin_dir_path(__FILE__) . 'classes/activate.php'; |
|
327 | + $activate = new Object_Sync_Sf_Activate($wpdb, $version, $slug); |
|
328 | 328 | return $activate; |
329 | 329 | } |
330 | 330 | |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | * @return object |
340 | 340 | * Instance of Object_Sync_Sf_Deactivate |
341 | 341 | */ |
342 | - private function deactivate( $wpdb, $version, $slug, $schedulable_classes ) { |
|
343 | - require_once plugin_dir_path( __FILE__ ) . 'classes/deactivate.php'; |
|
344 | - $deactivate = new Object_Sync_Sf_Deactivate( $wpdb, $version, $slug, $schedulable_classes ); |
|
342 | + private function deactivate($wpdb, $version, $slug, $schedulable_classes) { |
|
343 | + require_once plugin_dir_path(__FILE__) . 'classes/deactivate.php'; |
|
344 | + $deactivate = new Object_Sync_Sf_Deactivate($wpdb, $version, $slug, $schedulable_classes); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | * @return object |
363 | 363 | * Instance of Object_Sync_Sf_Salesforce_Push |
364 | 364 | */ |
365 | - private function push( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ) { |
|
366 | - require_once plugin_dir_path( __FILE__ ) . 'classes/salesforce_push.php'; |
|
367 | - $push = new Object_Sync_Sf_Salesforce_Push( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ); |
|
365 | + private function push($wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue) { |
|
366 | + require_once plugin_dir_path(__FILE__) . 'classes/salesforce_push.php'; |
|
367 | + $push = new Object_Sync_Sf_Salesforce_Push($wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue); |
|
368 | 368 | return $push; |
369 | 369 | } |
370 | 370 | |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | * @return object |
385 | 385 | * Instance of Object_Sync_Sf_Salesforce_Pull |
386 | 386 | */ |
387 | - private function pull( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ) { |
|
388 | - require_once plugin_dir_path( __FILE__ ) . 'classes/salesforce_pull.php'; |
|
389 | - $pull = new Object_Sync_Sf_Salesforce_Pull( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ); |
|
387 | + private function pull($wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue) { |
|
388 | + require_once plugin_dir_path(__FILE__) . 'classes/salesforce_pull.php'; |
|
389 | + $pull = new Object_Sync_Sf_Salesforce_Pull($wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue); |
|
390 | 390 | return $pull; |
391 | 391 | } |
392 | 392 | |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | * Instance of Object_Sync_Sf_Admin |
412 | 412 | * |
413 | 413 | */ |
414 | - private function load_admin( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ) { |
|
415 | - require_once( plugin_dir_path( __FILE__ ) . 'classes/admin.php' ); |
|
416 | - $admin = new Object_Sync_Sf_Admin( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ); |
|
417 | - add_action( 'admin_menu', array( $admin, 'create_admin_menu' ) ); |
|
418 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts_and_styles' ) ); |
|
419 | - add_action( 'plugins_loaded', array( $this, 'textdomain' ) ); |
|
420 | - add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 5 ); |
|
414 | + private function load_admin($wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue) { |
|
415 | + require_once(plugin_dir_path(__FILE__) . 'classes/admin.php'); |
|
416 | + $admin = new Object_Sync_Sf_Admin($wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue); |
|
417 | + add_action('admin_menu', array($admin, 'create_admin_menu')); |
|
418 | + add_action('admin_enqueue_scripts', array($this, 'admin_scripts_and_styles')); |
|
419 | + add_action('plugins_loaded', array($this, 'textdomain')); |
|
420 | + add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 5); |
|
421 | 421 | return $admin; |
422 | 422 | } |
423 | 423 | |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | * @return array $links |
430 | 430 | * These are the links that go with this plugin's entry |
431 | 431 | */ |
432 | - public function plugin_action_links( $links, $file ) { |
|
433 | - if ( plugin_basename( __FILE__ ) === $file ) { |
|
434 | - $settings = '<a href="' . get_admin_url() . 'options-general.php?page=object-sync-salesforce-admin">' . __( 'Settings', 'object-sync-for-salesforce' ) . '</a>'; |
|
432 | + public function plugin_action_links($links, $file) { |
|
433 | + if (plugin_basename(__FILE__) === $file) { |
|
434 | + $settings = '<a href="' . get_admin_url() . 'options-general.php?page=object-sync-salesforce-admin">' . __('Settings', 'object-sync-for-salesforce') . '</a>'; |
|
435 | 435 | // make the 'Settings' link appear first |
436 | - array_unshift( $links, $settings ); |
|
436 | + array_unshift($links, $settings); |
|
437 | 437 | } |
438 | 438 | return $links; |
439 | 439 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | public function admin_scripts_and_styles() { |
448 | 448 | |
449 | 449 | // I think some developers might not want to bother with select2 or selectwoo, so let's allow that to be changeable |
450 | - $select_library = apply_filters( $this->option_prefix . 'select_library', 'selectwoo' ); |
|
450 | + $select_library = apply_filters($this->option_prefix . 'select_library', 'selectwoo'); |
|
451 | 451 | |
452 | 452 | /* |
453 | 453 | * example to modify the select library |
@@ -459,19 +459,19 @@ discard block |
||
459 | 459 | * } |
460 | 460 | */ |
461 | 461 | |
462 | - $javascript_dependencies = array( 'jquery' ); |
|
462 | + $javascript_dependencies = array('jquery'); |
|
463 | 463 | $css_dependencies = array(); |
464 | - if ( '' !== $select_library ) { |
|
465 | - wp_enqueue_script( $select_library . 'js', plugins_url( 'assets/js/' . $select_library . '.min.js', __FILE__ ), array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'assets/js/' . $select_library . '.min.js' ), true ); |
|
464 | + if ('' !== $select_library) { |
|
465 | + wp_enqueue_script($select_library . 'js', plugins_url('assets/js/' . $select_library . '.min.js', __FILE__), array('jquery'), filemtime(plugin_dir_path(__FILE__) . 'assets/js/' . $select_library . '.min.js'), true); |
|
466 | 466 | $javascript_dependencies[] = $select_library . 'js'; |
467 | 467 | |
468 | - wp_enqueue_style( $select_library . 'css', plugins_url( 'assets/css/' . $select_library . '.min.css', __FILE__ ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'assets/css/' . $select_library . '.min.css' ), 'all' ); |
|
468 | + wp_enqueue_style($select_library . 'css', plugins_url('assets/css/' . $select_library . '.min.css', __FILE__), array(), filemtime(plugin_dir_path(__FILE__) . 'assets/css/' . $select_library . '.min.css'), 'all'); |
|
469 | 469 | $css_dependencies[] = $select_library . 'css'; |
470 | 470 | } |
471 | 471 | |
472 | - wp_enqueue_script( $this->slug . '-admin', plugins_url( 'assets/js/object-sync-for-salesforce-admin.min.js', __FILE__ ), $javascript_dependencies, filemtime( plugin_dir_path( __FILE__ ) . 'assets/js/object-sync-for-salesforce-admin.min.js' ), true ); |
|
472 | + wp_enqueue_script($this->slug . '-admin', plugins_url('assets/js/object-sync-for-salesforce-admin.min.js', __FILE__), $javascript_dependencies, filemtime(plugin_dir_path(__FILE__) . 'assets/js/object-sync-for-salesforce-admin.min.js'), true); |
|
473 | 473 | |
474 | - wp_enqueue_style( $this->slug . '-admin', plugins_url( 'assets/css/object-sync-for-salesforce-admin.min.css', __FILE__ ), $css_dependencies, filemtime( plugin_dir_path( __FILE__ ) . 'assets/css/object-sync-for-salesforce-admin.min.css' ), 'all' ); |
|
474 | + wp_enqueue_style($this->slug . '-admin', plugins_url('assets/css/object-sync-for-salesforce-admin.min.css', __FILE__), $css_dependencies, filemtime(plugin_dir_path(__FILE__) . 'assets/css/object-sync-for-salesforce-admin.min.css'), 'all'); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @return void |
481 | 481 | */ |
482 | 482 | public function textdomain() { |
483 | - load_plugin_textdomain( 'object-sync-for-salesforce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
483 | + load_plugin_textdomain('object-sync-for-salesforce', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -493,13 +493,13 @@ discard block |
||
493 | 493 | */ |
494 | 494 | private function get_login_credentials() { |
495 | 495 | |
496 | - $consumer_key = defined( 'OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY' ) ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY : get_option( $this->option_prefix . 'consumer_key', '' ); |
|
497 | - $consumer_secret = defined( 'OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET' ) ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET : get_option( $this->option_prefix . 'consumer_secret', '' ); |
|
498 | - $callback_url = defined( 'OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL' ) ? OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL : get_option( $this->option_prefix . 'callback_url', '' ); |
|
499 | - $login_base_url = defined( 'OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL' ) ? OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL : get_option( $this->option_prefix . 'login_base_url', '' ); |
|
500 | - $authorize_url_path = defined( 'OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH' ) ? OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH : get_option( $this->option_prefix . 'authorize_url_path', '' ); |
|
501 | - $token_url_path = defined( 'OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH' ) ? OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH : get_option( $this->option_prefix . 'token_url_path', '' ); |
|
502 | - $api_version = defined( 'OBJECT_SYNC_SF_SALESFORCE_API_VERSION' ) ? OBJECT_SYNC_SF_SALESFORCE_API_VERSION : get_option( $this->option_prefix . 'api_version', '' ); |
|
496 | + $consumer_key = defined('OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY') ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_KEY : get_option($this->option_prefix . 'consumer_key', ''); |
|
497 | + $consumer_secret = defined('OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET') ? OBJECT_SYNC_SF_SALESFORCE_CONSUMER_SECRET : get_option($this->option_prefix . 'consumer_secret', ''); |
|
498 | + $callback_url = defined('OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL') ? OBJECT_SYNC_SF_SALESFORCE_CALLBACK_URL : get_option($this->option_prefix . 'callback_url', ''); |
|
499 | + $login_base_url = defined('OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL') ? OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL : get_option($this->option_prefix . 'login_base_url', ''); |
|
500 | + $authorize_url_path = defined('OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH') ? OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH : get_option($this->option_prefix . 'authorize_url_path', ''); |
|
501 | + $token_url_path = defined('OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH') ? OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH : get_option($this->option_prefix . 'token_url_path', ''); |
|
502 | + $api_version = defined('OBJECT_SYNC_SF_SALESFORCE_API_VERSION') ? OBJECT_SYNC_SF_SALESFORCE_API_VERSION : get_option($this->option_prefix . 'api_version', ''); |
|
503 | 503 | |
504 | 504 | $login_credentials = array( |
505 | 505 | 'consumer_key' => $consumer_key, |