@@ -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', '' ); |
@@ -103,7 +103,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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, |
@@ -1,11 +1,11 @@ discard block |
||
1 | -<h3><?php echo esc_html__( 'Fieldmaps', 'object-sync-for-salesforce' ); ?> <a class="page-title-action" href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=add' ) ); ?>"><?php echo esc_html__( 'Add New', 'object-sync-for-salesforce' ); ?></a></h3> |
|
1 | +<h3><?php echo esc_html__('Fieldmaps', 'object-sync-for-salesforce'); ?> <a class="page-title-action" href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=add')); ?>"><?php echo esc_html__('Add New', 'object-sync-for-salesforce'); ?></a></h3> |
|
2 | 2 | <table class="widefat striped"> |
3 | 3 | <thead> |
4 | 4 | <tr> |
5 | - <th><?php echo esc_html__( 'Label', 'object-sync-for-salesforce' ); ?></th> |
|
6 | - <th><?php echo esc_html__( 'WordPress Object', 'object-sync-for-salesforce' ); ?></th> |
|
7 | - <th><?php echo esc_html__( 'Salesforce Object', 'object-sync-for-salesforce' ); ?></th> |
|
8 | - <th colspan="3"><?php echo esc_html__( 'Actions', 'object-sync-for-salesforce' ); ?></th> |
|
5 | + <th><?php echo esc_html__('Label', 'object-sync-for-salesforce'); ?></th> |
|
6 | + <th><?php echo esc_html__('WordPress Object', 'object-sync-for-salesforce'); ?></th> |
|
7 | + <th><?php echo esc_html__('Salesforce Object', 'object-sync-for-salesforce'); ?></th> |
|
8 | + <th colspan="3"><?php echo esc_html__('Actions', 'object-sync-for-salesforce'); ?></th> |
|
9 | 9 | </tr> |
10 | 10 | </thead> |
11 | 11 | <tfoot> |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | <p><small> |
15 | 15 | <?php |
16 | 16 | // translators: the placeholders refer to: 1) the cache clear link, 2) the cache clear link text |
17 | - echo sprintf( esc_html__( 'Has your WordPress or Salesforce data structure changed? ', 'object-sync-for-salesforce' ) . '<a href="%1$s" id="clear-sfwp-cache">%2$s</a>' . esc_html__( ' to make sure you can map the most recent data structures.', 'object-sync-for-salesforce' ), |
|
18 | - esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=clear_cache' ) ), |
|
19 | - esc_html__( 'Clear the plugin cache' ) |
|
17 | + echo sprintf(esc_html__('Has your WordPress or Salesforce data structure changed? ', 'object-sync-for-salesforce') . '<a href="%1$s" id="clear-sfwp-cache">%2$s</a>' . esc_html__(' to make sure you can map the most recent data structures.', 'object-sync-for-salesforce'), |
|
18 | + esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=clear_cache')), |
|
19 | + esc_html__('Clear the plugin cache') |
|
20 | 20 | ); |
21 | 21 | ?> |
22 | 22 | </small></p> |
@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | </tr> |
25 | 25 | </tfoot> |
26 | 26 | <tbody> |
27 | - <?php if ( count( $fieldmaps ) > 0 ) : ?> |
|
28 | - <?php foreach ( $fieldmaps as $record ) { ?> |
|
27 | + <?php if (count($fieldmaps) > 0) : ?> |
|
28 | + <?php foreach ($fieldmaps as $record) { ?> |
|
29 | 29 | <tr> |
30 | - <td><?php echo esc_html( $record['label'] ); ?></td> |
|
31 | - <td><?php echo esc_html( $record['wordpress_object'] ); ?></td> |
|
32 | - <td><?php echo esc_html( $record['salesforce_object'] ); ?></td> |
|
30 | + <td><?php echo esc_html($record['label']); ?></td> |
|
31 | + <td><?php echo esc_html($record['wordpress_object']); ?></td> |
|
32 | + <td><?php echo esc_html($record['salesforce_object']); ?></td> |
|
33 | 33 | <td> |
34 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=edit&id=' . $record['id'] ) ); ?>"><?php echo esc_html__( 'Edit', 'object-sync-for-salesforce' ); ?></a> |
|
34 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=edit&id=' . $record['id'])); ?>"><?php echo esc_html__('Edit', 'object-sync-for-salesforce'); ?></a> |
|
35 | 35 | </td> |
36 | 36 | <td> |
37 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=clone&id=' . $record['id'] ) ); ?>"><?php echo esc_html__( 'Clone', 'object-sync-for-salesforce' ); ?></a> |
|
37 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=clone&id=' . $record['id'])); ?>"><?php echo esc_html__('Clone', 'object-sync-for-salesforce'); ?></a> |
|
38 | 38 | </td> |
39 | 39 | <td> |
40 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=delete&id=' . $record['id'] ) ); ?>"><?php echo esc_html__( 'Delete', 'object-sync-for-salesforce' ); ?></a> |
|
40 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=delete&id=' . $record['id'])); ?>"><?php echo esc_html__('Delete', 'object-sync-for-salesforce'); ?></a> |
|
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | <?php } ?> |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | <p> |
48 | 48 | <?php |
49 | 49 | // translators: the placeholders refer to: 1) the fieldmap label, 2) the saleforce object name, and 3) the WordPress object name |
50 | - echo sprintf( esc_html__( 'No fieldmaps exist yet. You can ', 'object-sync-for-salesforce' ) . '<a href="%1$s">%2$s</a>.', |
|
51 | - esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=add' ) ), |
|
52 | - esc_html__( 'add one' ) |
|
50 | + echo sprintf(esc_html__('No fieldmaps exist yet. You can ', 'object-sync-for-salesforce') . '<a href="%1$s">%2$s</a>.', |
|
51 | + esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=add')), |
|
52 | + esc_html__('add one') |
|
53 | 53 | ); |
54 | 54 | ?> |
55 | 55 | </p> |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | <?php } ?> |
44 | - <?php else : ?> |
|
44 | + <?php else { |
|
45 | + : ?> |
|
45 | 46 | <tr> |
46 | 47 | <td colspan="4"> |
47 | 48 | <p> |
@@ -51,6 +52,7 @@ discard block |
||
51 | 52 | esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=add' ) ), |
52 | 53 | esc_html__( 'add one' ) |
53 | 54 | ); |
55 | +} |
|
54 | 56 | ?> |
55 | 57 | </p> |
56 | 58 | </td> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <form method="post" action="options.php"> |
2 | 2 | <?php |
3 | - settings_fields( $tab ) . do_settings_sections( $tab ); |
|
4 | - submit_button( esc_html__( 'Save settings', 'object-sync-for-salesforce' ) ); |
|
3 | + settings_fields($tab) . do_settings_sections($tab); |
|
4 | + submit_button(esc_html__('Save settings', 'object-sync-for-salesforce')); |
|
5 | 5 | ?> |
6 | 6 | </form> |
@@ -1,3 +1,3 @@ |
||
1 | -<div class="notice<?php echo esc_attr( $class ); ?><?php echo esc_attr( $dismissible ); ?>"> |
|
2 | - <p><?php echo esc_html( $message ); ?></p> |
|
1 | +<div class="notice<?php echo esc_attr($class); ?><?php echo esc_attr($dismissible); ?>"> |
|
2 | + <p><?php echo esc_html($message); ?></p> |
|
3 | 3 | </div> |
@@ -1,18 +1,18 @@ |
||
1 | -<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"> |
|
2 | - <input type="hidden" name="redirect_url_error" value="<?php echo esc_url( $error_url ); ?>" /> |
|
3 | - <input type="hidden" name="redirect_url_success" value="<?php echo esc_url( $success_url ); ?>" /> |
|
4 | - <input type="hidden" name="id" value="<?php echo absint( $map['id'] ); ?>" /> |
|
1 | +<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>"> |
|
2 | + <input type="hidden" name="redirect_url_error" value="<?php echo esc_url($error_url); ?>" /> |
|
3 | + <input type="hidden" name="redirect_url_success" value="<?php echo esc_url($success_url); ?>" /> |
|
4 | + <input type="hidden" name="id" value="<?php echo absint($map['id']); ?>" /> |
|
5 | 5 | <input type="hidden" name="action" value="delete_fieldmap"> |
6 | - <h2><?php echo esc_html__( 'Are you sure you want to delete this fieldmap?', 'object-sync-for-salesforce' ); ?></h2> |
|
6 | + <h2><?php echo esc_html__('Are you sure you want to delete this fieldmap?', 'object-sync-for-salesforce'); ?></h2> |
|
7 | 7 | <p> |
8 | 8 | <?php |
9 | 9 | // translators: the placeholders refer to: 1) the fieldmap label, 2) the saleforce object name, and 3) the WordPress object name |
10 | - echo sprintf( esc_html__( 'This fieldmap is called %1$s and it maps the Salesforce %2$s object to the WordPress %3$s object.', 'object-sync-for-salesforce' ), |
|
11 | - '<strong> ' . esc_html( $map['label'] ) . '</strong>', |
|
12 | - esc_html( $map['salesforce_object'] ), |
|
13 | - esc_html( $map['wordpress_object'] ) |
|
10 | + echo sprintf(esc_html__('This fieldmap is called %1$s and it maps the Salesforce %2$s object to the WordPress %3$s object.', 'object-sync-for-salesforce'), |
|
11 | + '<strong> ' . esc_html($map['label']) . '</strong>', |
|
12 | + esc_html($map['salesforce_object']), |
|
13 | + esc_html($map['wordpress_object']) |
|
14 | 14 | ); |
15 | 15 | ?> |
16 | 16 | </p> |
17 | - <?php submit_button( esc_html__( 'Confirm deletion', 'object-sync-for-salesforce' ) ); ?> |
|
17 | + <?php submit_button(esc_html__('Confirm deletion', 'object-sync-for-salesforce')); ?> |
|
18 | 18 | </form> |
@@ -1,26 +1,26 @@ |
||
1 | -<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="fieldmap"> |
|
2 | - <input type="hidden" name="redirect_url_error" value="<?php echo esc_url( $error_url ); ?>" /> |
|
3 | - <input type="hidden" name="redirect_url_success" value="<?php echo esc_url( $success_url ); ?>" /> |
|
4 | - <?php if ( isset( $transient ) ) { ?> |
|
5 | - <input type="hidden" name="transient" value="<?php echo esc_html( $transient ); ?>" /> |
|
1 | +<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="fieldmap"> |
|
2 | + <input type="hidden" name="redirect_url_error" value="<?php echo esc_url($error_url); ?>" /> |
|
3 | + <input type="hidden" name="redirect_url_success" value="<?php echo esc_url($success_url); ?>" /> |
|
4 | + <?php if (isset($transient)) { ?> |
|
5 | + <input type="hidden" name="transient" value="<?php echo esc_html($transient); ?>" /> |
|
6 | 6 | <?php } ?> |
7 | 7 | <input type="hidden" name="action" value="post_object_map" > |
8 | - <input type="hidden" name="method" value="<?php echo esc_attr( $method ); ?>" /> |
|
9 | - <?php if ( 'edit' === $method ) { ?> |
|
10 | - <input type="hidden" name="id" value="<?php echo absint( $map_row['id'] ); ?>" /> |
|
8 | + <input type="hidden" name="method" value="<?php echo esc_attr($method); ?>" /> |
|
9 | + <?php if ('edit' === $method) { ?> |
|
10 | + <input type="hidden" name="id" value="<?php echo absint($map_row['id']); ?>" /> |
|
11 | 11 | <?php } ?> |
12 | 12 | <div class="wordpress_id"> |
13 | - <label for="wordpress_id"><?php echo esc_html__( 'WordPress Id', 'object-sync-for-salesforce' ); ?>: </label> |
|
14 | - <input type="text" id="wordpress_id" name="wordpress_id" required value="<?php echo isset( $wordpress_id ) ? esc_html( $wordpress_id ) : ''; ?>" /> |
|
13 | + <label for="wordpress_id"><?php echo esc_html__('WordPress Id', 'object-sync-for-salesforce'); ?>: </label> |
|
14 | + <input type="text" id="wordpress_id" name="wordpress_id" required value="<?php echo isset($wordpress_id) ? esc_html($wordpress_id) : ''; ?>" /> |
|
15 | 15 | </div> |
16 | 16 | <div class="salesforce_id"> |
17 | - <label for="salesforce_id"><?php echo esc_html__( 'Salesforce Id', 'object-sync-for-salesforce' ); ?>: </label> |
|
18 | - <input type="text" id="salesforce_id" name="salesforce_id" required value="<?php echo isset( $salesforce_id ) ? esc_html( $salesforce_id ) : ''; ?>" /> |
|
17 | + <label for="salesforce_id"><?php echo esc_html__('Salesforce Id', 'object-sync-for-salesforce'); ?>: </label> |
|
18 | + <input type="text" id="salesforce_id" name="salesforce_id" required value="<?php echo isset($salesforce_id) ? esc_html($salesforce_id) : ''; ?>" /> |
|
19 | 19 | </div> |
20 | 20 | <?php |
21 | 21 | submit_button( |
22 | 22 | // translators: the placeholder refers to the currently selected method (edit or delete) |
23 | - sprintf( esc_html__( '%1$s object map', 'object-sync-for-salesforce' ), ucfirst( $method ) ) |
|
23 | + sprintf(esc_html__('%1$s object map', 'object-sync-for-salesforce'), ucfirst($method)) |
|
24 | 24 | ); |
25 | 25 | ?> |
26 | 26 | </form> |
@@ -1,50 +1,50 @@ |
||
1 | -<h2><?php echo esc_html__( 'Mapping Errors', 'object-sync-for-salesforce' ); ?></h2> |
|
2 | -<p><?php echo esc_html__( 'When this tab is present, it means one or more mapping errors have occurred when the plugin has tried to save a new mapping object, either based on data pulled in from Salesforce or data that was sent to Salesforce. The plugin creates a temporary flag for WordPress (if it is a pull action) or for Salesforce (if it is a push action), and if it fails the temporary flag remains.', 'object-sync-for-salesforce' ); ?></p> |
|
3 | -<p><?php echo esc_html__( 'For any mapping object error, you can edit (if, for example, you know the ID of the item that should be in place) or delete each database row, or you can try to track down what the plugin was doing based on the other data displayed here.', 'object-sync-for-salesforce' ); ?></p> |
|
4 | -<p><?php echo esc_html__( 'If you edit one of these items, and it correctly maps data between the two systems, the sync for those items will behave as normal going forward, so any edits you do after that will sync as they should.', 'object-sync-for-salesforce' ); ?></p> |
|
1 | +<h2><?php echo esc_html__('Mapping Errors', 'object-sync-for-salesforce'); ?></h2> |
|
2 | +<p><?php echo esc_html__('When this tab is present, it means one or more mapping errors have occurred when the plugin has tried to save a new mapping object, either based on data pulled in from Salesforce or data that was sent to Salesforce. The plugin creates a temporary flag for WordPress (if it is a pull action) or for Salesforce (if it is a push action), and if it fails the temporary flag remains.', 'object-sync-for-salesforce'); ?></p> |
|
3 | +<p><?php echo esc_html__('For any mapping object error, you can edit (if, for example, you know the ID of the item that should be in place) or delete each database row, or you can try to track down what the plugin was doing based on the other data displayed here.', 'object-sync-for-salesforce'); ?></p> |
|
4 | +<p><?php echo esc_html__('If you edit one of these items, and it correctly maps data between the two systems, the sync for those items will behave as normal going forward, so any edits you do after that will sync as they should.', 'object-sync-for-salesforce'); ?></p> |
|
5 | 5 | |
6 | 6 | <table class="widefat striped"> |
7 | 7 | <thead> |
8 | 8 | <tr> |
9 | - <th><?php echo esc_html__( 'Type', 'object-sync-for-salesforce' ); ?></th> |
|
10 | - <th><?php echo esc_html__( 'WordPress ID', 'object-sync-for-salesforce' ); ?></th> |
|
11 | - <th><?php echo esc_html__( 'WordPress Object Type', 'object-sync-for-salesforce' ); ?></th> |
|
12 | - <th><?php echo esc_html__( 'Salesforce ID', 'object-sync-for-salesforce' ); ?></th> |
|
13 | - <th><?php echo esc_html__( 'Created Date/Time', 'object-sync-for-salesforce' ); ?></th> |
|
14 | - <th colspan="2"><?php echo esc_html__( 'Actions', 'object-sync-for-salesforce' ); ?></th> |
|
9 | + <th><?php echo esc_html__('Type', 'object-sync-for-salesforce'); ?></th> |
|
10 | + <th><?php echo esc_html__('WordPress ID', 'object-sync-for-salesforce'); ?></th> |
|
11 | + <th><?php echo esc_html__('WordPress Object Type', 'object-sync-for-salesforce'); ?></th> |
|
12 | + <th><?php echo esc_html__('Salesforce ID', 'object-sync-for-salesforce'); ?></th> |
|
13 | + <th><?php echo esc_html__('Created Date/Time', 'object-sync-for-salesforce'); ?></th> |
|
14 | + <th colspan="2"><?php echo esc_html__('Actions', 'object-sync-for-salesforce'); ?></th> |
|
15 | 15 | </tr> |
16 | 16 | </thead> |
17 | 17 | <tbody> |
18 | - <?php if ( ! empty( $mapping_errors['pull_errors'] ) ) : ?> |
|
19 | - <?php foreach ( $mapping_errors['pull_errors'] as $error ) { ?> |
|
18 | + <?php if ( ! empty($mapping_errors['pull_errors'])) : ?> |
|
19 | + <?php foreach ($mapping_errors['pull_errors'] as $error) { ?> |
|
20 | 20 | <tr> |
21 | - <td><?php echo esc_html__( 'Pull from Salesforce', 'object-sync-for-salesforce' ); ?></td> |
|
21 | + <td><?php echo esc_html__('Pull from Salesforce', 'object-sync-for-salesforce'); ?></td> |
|
22 | 22 | <td><?php echo $error['wordpress_id']; ?></td> |
23 | 23 | <td><?php echo $error['wordpress_object']; ?></td> |
24 | 24 | <td><?php echo $error['salesforce_id']; ?></td> |
25 | - <td><?php echo date_i18n( 'Y-m-d g:i:sa', strtotime( $error['created'] ) ); ?></td> |
|
25 | + <td><?php echo date_i18n('Y-m-d g:i:sa', strtotime($error['created'])); ?></td> |
|
26 | 26 | <td> |
27 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=edit&id=' . $error['id'] ) ); ?>"><?php echo esc_html__( 'Edit', 'object-sync-for-salesforce' ); ?></a> |
|
27 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=edit&id=' . $error['id'])); ?>"><?php echo esc_html__('Edit', 'object-sync-for-salesforce'); ?></a> |
|
28 | 28 | </td> |
29 | 29 | <td> |
30 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=delete&id=' . $error['id'] ) ); ?>"><?php echo esc_html__( 'Delete', 'object-sync-for-salesforce' ); ?></a> |
|
30 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=delete&id=' . $error['id'])); ?>"><?php echo esc_html__('Delete', 'object-sync-for-salesforce'); ?></a> |
|
31 | 31 | </td> |
32 | 32 | </tr> |
33 | 33 | <?php } ?> |
34 | 34 | <?php endif; ?> |
35 | - <?php if ( ! empty( $mapping_errors['push_errors'] ) ) : ?> |
|
36 | - <?php foreach ( $mapping_errors['push_errors'] as $error ) { ?> |
|
35 | + <?php if ( ! empty($mapping_errors['push_errors'])) : ?> |
|
36 | + <?php foreach ($mapping_errors['push_errors'] as $error) { ?> |
|
37 | 37 | <tr> |
38 | - <td><?php echo esc_html__( 'Push to Salesforce', 'object-sync-for-salesforce' ); ?></td> |
|
38 | + <td><?php echo esc_html__('Push to Salesforce', 'object-sync-for-salesforce'); ?></td> |
|
39 | 39 | <td><?php echo $error['wordpress_id']; ?></td> |
40 | 40 | <td><?php echo $error['wordpress_object']; ?></td> |
41 | 41 | <td><?php echo $error['salesforce_id']; ?></td> |
42 | - <td><?php echo date_i18n( 'Y-m-d g:i:sa', strtotime( $error['created'] ) ); ?></td> |
|
42 | + <td><?php echo date_i18n('Y-m-d g:i:sa', strtotime($error['created'])); ?></td> |
|
43 | 43 | <td> |
44 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=edit&id=' . $error['id'] ) ); ?>"><?php echo esc_html__( 'Edit', 'object-sync-for-salesforce' ); ?></a> |
|
44 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=edit&id=' . $error['id'])); ?>"><?php echo esc_html__('Edit', 'object-sync-for-salesforce'); ?></a> |
|
45 | 45 | </td> |
46 | 46 | <td> |
47 | - <a href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=delete&id=' . $error['id'] ) ); ?>"><?php echo esc_html__( 'Delete', 'object-sync-for-salesforce' ); ?></a> |
|
47 | + <a href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=delete&id=' . $error['id'])); ?>"><?php echo esc_html__('Delete', 'object-sync-for-salesforce'); ?></a> |
|
48 | 48 | </td> |
49 | 49 | </tr> |
50 | 50 | <?php } ?> |
@@ -1,33 +1,33 @@ |
||
1 | -<h3><?php echo esc_html__( 'Import', 'object-sync-for-salesforce' ); ?></h3> |
|
2 | -<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" enctype="multipart/form-data" class="import"> |
|
1 | +<h3><?php echo esc_html__('Import', 'object-sync-for-salesforce'); ?></h3> |
|
2 | +<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" enctype="multipart/form-data" class="import"> |
|
3 | 3 | <input type="hidden" name="action" value="object_sync_for_salesforce_import"> |
4 | - <?php wp_nonce_field( 'object_sync_for_salesforce_nonce_import', 'object_sync_for_salesforce_nonce_import' ); ?> |
|
5 | - <p><?php _e( 'Import the plugin data from a .json file. You can use the Export options below to get this file.', 'object-sync-for-salesforce' ); ?></p> |
|
4 | + <?php wp_nonce_field('object_sync_for_salesforce_nonce_import', 'object_sync_for_salesforce_nonce_import'); ?> |
|
5 | + <p><?php _e('Import the plugin data from a .json file. You can use the Export options below to get this file.', 'object-sync-for-salesforce'); ?></p> |
|
6 | 6 | <p> |
7 | 7 | <input type="file" name="import_file" id="object-sync-for-salesforce-import" required> |
8 | 8 | </p> |
9 | 9 | <p> |
10 | 10 | <input type="checkbox" value="1" name="overwrite" id="object-sync-for-salesforce-import-overwrite"> |
11 | - <label for="object-sync-for-salesforce-import-overwrite"><?php _e( 'Overwrite existing data', 'object-sync-for-salesforce' ); ?></label> |
|
11 | + <label for="object-sync-for-salesforce-import-overwrite"><?php _e('Overwrite existing data', 'object-sync-for-salesforce'); ?></label> |
|
12 | 12 | </p> |
13 | - <input type="submit" class="button button-primary" value="<?php _e( 'Import', 'object-sync-for-salesforce' ); ?>" /> |
|
13 | + <input type="submit" class="button button-primary" value="<?php _e('Import', 'object-sync-for-salesforce'); ?>" /> |
|
14 | 14 | </form> |
15 | 15 | |
16 | -<h3><?php echo esc_html__( 'Export', 'object-sync-for-salesforce' ); ?></h3> |
|
17 | -<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="export"> |
|
16 | +<h3><?php echo esc_html__('Export', 'object-sync-for-salesforce'); ?></h3> |
|
17 | +<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="export"> |
|
18 | 18 | <input type="hidden" name="action" value="object_sync_for_salesforce_export"> |
19 | - <?php wp_nonce_field( 'object_sync_for_salesforce_nonce_export', 'object_sync_for_salesforce_nonce_export' ); ?> |
|
19 | + <?php wp_nonce_field('object_sync_for_salesforce_nonce_export', 'object_sync_for_salesforce_nonce_export'); ?> |
|
20 | 20 | <p> |
21 | 21 | <input type="checkbox" value="fieldmaps" name="export[]" id="object-sync-for-salesforce-export-fieldmaps"> |
22 | - <label for="object-sync-for-salesforce-export-fieldmaps"><?php _e( 'Include Fieldmaps', 'object-sync-for-salesforce' ); ?></label> |
|
22 | + <label for="object-sync-for-salesforce-export-fieldmaps"><?php _e('Include Fieldmaps', 'object-sync-for-salesforce'); ?></label> |
|
23 | 23 | </p> |
24 | 24 | <p> |
25 | 25 | <input type="checkbox" value="object_maps" name="export[]" id="object-sync-for-salesforce-export-object-maps" /> |
26 | - <label for="object-sync-for-salesforce-export-object-maps"><?php _e( 'Include Object Maps', 'object-sync-for-salesforce' ); ?></label> |
|
26 | + <label for="object-sync-for-salesforce-export-object-maps"><?php _e('Include Object Maps', 'object-sync-for-salesforce'); ?></label> |
|
27 | 27 | </p> |
28 | 28 | <p> |
29 | 29 | <input type="checkbox" value="plugin_settings" name="export[]" id="object-sync-for-salesforce-export-plugin-settings" /> |
30 | - <label for="object-sync-for-salesforce-export-plugin-settings"><?php _e( 'Include Plugin Settings', 'object-sync-for-salesforce' ); ?></label> |
|
30 | + <label for="object-sync-for-salesforce-export-plugin-settings"><?php _e('Include Plugin Settings', 'object-sync-for-salesforce'); ?></label> |
|
31 | 31 | </p> |
32 | - <input type="submit" class="button button-primary" value="<?php _e( 'Export', 'object-sync-for-salesforce' ); ?>" /> |
|
32 | + <input type="submit" class="button button-primary" value="<?php _e('Export', 'object-sync-for-salesforce'); ?>" /> |
|
33 | 33 | </form> |
@@ -1,41 +1,41 @@ |
||
1 | -<input type="hidden" name="mapping_id" id="mapping_id_ajax" value="<?php echo absint( $mapping['id'] ); ?>" /> |
|
2 | -<input type="hidden" name="salesforce_id" id="salesforce_id_ajax" value="<?php echo esc_attr( $mapping['salesforce_id'] ); ?>" /> |
|
3 | -<input type="hidden" name="wordpress_id" id="wordpress_id_ajax" value="<?php echo absint( $mapping['wordpress_id'] ); ?>" /> |
|
4 | -<input type="hidden" name="wordpress_object" id="wordpress_object_ajax" value="<?php echo esc_attr( $mapping['wordpress_object'] ); ?>" /> |
|
5 | -<h2><?php echo esc_html__( 'Salesforce', 'object-sync-for-salesforce' ); ?></h2> |
|
1 | +<input type="hidden" name="mapping_id" id="mapping_id_ajax" value="<?php echo absint($mapping['id']); ?>" /> |
|
2 | +<input type="hidden" name="salesforce_id" id="salesforce_id_ajax" value="<?php echo esc_attr($mapping['salesforce_id']); ?>" /> |
|
3 | +<input type="hidden" name="wordpress_id" id="wordpress_id_ajax" value="<?php echo absint($mapping['wordpress_id']); ?>" /> |
|
4 | +<input type="hidden" name="wordpress_object" id="wordpress_object_ajax" value="<?php echo esc_attr($mapping['wordpress_object']); ?>" /> |
|
5 | +<h2><?php echo esc_html__('Salesforce', 'object-sync-for-salesforce'); ?></h2> |
|
6 | 6 | <table class="wp-list-table widefat striped mapped-salesforce-user"> |
7 | - <caption><?php echo esc_html__( 'This user is mapped to a Salesforce object', 'object-sync-for-salesforce' ); ?></caption> |
|
7 | + <caption><?php echo esc_html__('This user is mapped to a Salesforce object', 'object-sync-for-salesforce'); ?></caption> |
|
8 | 8 | <tbody> |
9 | 9 | <tr> |
10 | - <th><?php echo esc_html__( 'Salesforce Id', 'object-sync-for-salesforce' ); ?></th> |
|
11 | - <td><a href="<?php echo esc_url( $this->salesforce['sfapi']->get_instance_url() . '/' . $mapping['salesforce_id'] ); ?>"><?php echo esc_attr( $mapping['salesforce_id'] ); ?></a></td> |
|
12 | - <td><a href="<?php echo esc_url( get_admin_url( null, 'user-edit.php?user_id=' . $user->ID ) . '&edit_salesforce_mapping=true' ); ?>" class="edit-salesforce-mapping"><?php echo esc_html__( 'Edit', 'object-sync-for-salesforce' ); ?></a></td> |
|
10 | + <th><?php echo esc_html__('Salesforce Id', 'object-sync-for-salesforce'); ?></th> |
|
11 | + <td><a href="<?php echo esc_url($this->salesforce['sfapi']->get_instance_url() . '/' . $mapping['salesforce_id']); ?>"><?php echo esc_attr($mapping['salesforce_id']); ?></a></td> |
|
12 | + <td><a href="<?php echo esc_url(get_admin_url(null, 'user-edit.php?user_id=' . $user->ID) . '&edit_salesforce_mapping=true'); ?>" class="edit-salesforce-mapping"><?php echo esc_html__('Edit', 'object-sync-for-salesforce'); ?></a></td> |
|
13 | 13 | </tr> |
14 | 14 | <tr> |
15 | - <th><?php echo esc_html__( 'Last Sync Message', 'object-sync-for-salesforce' ); ?></th> |
|
16 | - <td class="last_sync_message"><?php echo isset( $mapping['last_sync_message'] ) ? esc_html( $mapping['last_sync_message'] ) : ''; ?></td> |
|
15 | + <th><?php echo esc_html__('Last Sync Message', 'object-sync-for-salesforce'); ?></th> |
|
16 | + <td class="last_sync_message"><?php echo isset($mapping['last_sync_message']) ? esc_html($mapping['last_sync_message']) : ''; ?></td> |
|
17 | 17 | <td> </td> |
18 | 18 | </tr> |
19 | 19 | <tr> |
20 | - <th><?php echo esc_html__( 'Last Sync Action', 'object-sync-for-salesforce' ); ?></th> |
|
21 | - <td class="last_sync_action"><?php echo isset( $mapping['last_sync_action'] ) ? esc_html( $mapping['last_sync_action'] ) : ''; ?></td> |
|
20 | + <th><?php echo esc_html__('Last Sync Action', 'object-sync-for-salesforce'); ?></th> |
|
21 | + <td class="last_sync_action"><?php echo isset($mapping['last_sync_action']) ? esc_html($mapping['last_sync_action']) : ''; ?></td> |
|
22 | 22 | <td> </td> |
23 | 23 | </tr> |
24 | 24 | <tr> |
25 | - <th><?php echo esc_html__( 'Last Sync Status', 'object-sync-for-salesforce' ); ?></th> |
|
26 | - <td class="last_sync_status"><?php echo ( isset( $mapping['last_sync_status'] ) && '1' === $mapping['last_sync_status'] ) ? esc_html__( 'success', 'object-sync-for-salesforce' ) : esc_html__( 'error', 'object-sync-for-salesforce' ); ?></td> |
|
25 | + <th><?php echo esc_html__('Last Sync Status', 'object-sync-for-salesforce'); ?></th> |
|
26 | + <td class="last_sync_status"><?php echo (isset($mapping['last_sync_status']) && '1' === $mapping['last_sync_status']) ? esc_html__('success', 'object-sync-for-salesforce') : esc_html__('error', 'object-sync-for-salesforce'); ?></td> |
|
27 | 27 | <td> </td> |
28 | 28 | </tr> |
29 | 29 | <tr> |
30 | - <th><?php echo esc_html__( 'Last Sync', 'object-sync-for-salesforce' ); ?></th> |
|
31 | - <td class="last_sync"><?php echo isset( $mapping['last_sync'] ) ? esc_html( $mapping['last_sync'] ) : ''; ?></td> |
|
30 | + <th><?php echo esc_html__('Last Sync', 'object-sync-for-salesforce'); ?></th> |
|
31 | + <td class="last_sync"><?php echo isset($mapping['last_sync']) ? esc_html($mapping['last_sync']) : ''; ?></td> |
|
32 | 32 | <td> </td> |
33 | 33 | </tr> |
34 | 34 | <tr> |
35 | - <th><?php echo esc_html__( 'Actions', 'object-sync-for-salesforce' ); ?></th> |
|
35 | + <th><?php echo esc_html__('Actions', 'object-sync-for-salesforce'); ?></th> |
|
36 | 36 | <td> |
37 | - <a href="#" class="button button-secondary push_to_salesforce_button"><?php echo esc_html__( 'Push to Salesforce', 'object-sync-for-salesforce' ); ?></a> |
|
38 | - <a href="#" class="button button-secondary pull_from_salesforce_button"><?php echo esc_html__( 'Pull from Salesforce', 'object-sync-for-salesforce' ); ?></a> |
|
37 | + <a href="#" class="button button-secondary push_to_salesforce_button"><?php echo esc_html__('Push to Salesforce', 'object-sync-for-salesforce'); ?></a> |
|
38 | + <a href="#" class="button button-secondary pull_from_salesforce_button"><?php echo esc_html__('Pull from Salesforce', 'object-sync-for-salesforce'); ?></a> |
|
39 | 39 | </td> |
40 | 40 | </tr> |
41 | 41 | </tbody> |