@@ -22,27 +22,27 @@ discard block |
||
22 | 22 | public $conditions = array(); |
23 | 23 | |
24 | 24 | /** |
25 | - * Constructor which sets the query object type. |
|
26 | - * |
|
27 | - * @param string $object_type |
|
28 | - * Salesforce object type to query. |
|
29 | - */ |
|
25 | + * Constructor which sets the query object type. |
|
26 | + * |
|
27 | + * @param string $object_type |
|
28 | + * Salesforce object type to query. |
|
29 | + */ |
|
30 | 30 | public function __construct( $object_type = '' ) { |
31 | 31 | $this->object_type = $object_type; |
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * Add a condition to the query. |
|
36 | - * |
|
37 | - * @param string $field |
|
38 | - * Field name. |
|
39 | - * @param mixed $value |
|
40 | - * Condition value. If an array, it will be split into quote enclosed |
|
41 | - * strings separated by commas inside of parenthesis. Note that the caller |
|
42 | - * must enclose the value in quotes as needed by the SF API. |
|
43 | - * @param string $operator |
|
44 | - * Conditional operator. One of '=', '!=', '<', '>', 'LIKE, 'IN', 'NOT IN'. |
|
45 | - */ |
|
35 | + * Add a condition to the query. |
|
36 | + * |
|
37 | + * @param string $field |
|
38 | + * Field name. |
|
39 | + * @param mixed $value |
|
40 | + * Condition value. If an array, it will be split into quote enclosed |
|
41 | + * strings separated by commas inside of parenthesis. Note that the caller |
|
42 | + * must enclose the value in quotes as needed by the SF API. |
|
43 | + * @param string $operator |
|
44 | + * Conditional operator. One of '=', '!=', '<', '>', 'LIKE, 'IN', 'NOT IN'. |
|
45 | + */ |
|
46 | 46 | public function add_condition( $field, $value, $operator = '=' ) { |
47 | 47 | if ( is_array( $value ) ) { |
48 | 48 | $value = "('" . implode( "','", $value ) . "')"; |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * Implements PHP's magic __toString(). |
|
64 | - * |
|
65 | - * Function to convert the query to a string to pass to the SF API. |
|
66 | - * |
|
67 | - * @return string |
|
68 | - * SOQL query ready to be executed the SF API. |
|
69 | - */ |
|
63 | + * Implements PHP's magic __toString(). |
|
64 | + * |
|
65 | + * Function to convert the query to a string to pass to the SF API. |
|
66 | + * |
|
67 | + * @return string |
|
68 | + * SOQL query ready to be executed the SF API. |
|
69 | + */ |
|
70 | 70 | public function __toString() { |
71 | 71 | |
72 | 72 | $query = 'SELECT '; |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | protected $template; |
22 | 22 | |
23 | 23 | /** |
24 | - * Constructor which sets up the admin_notices hook for rendering |
|
25 | - * |
|
26 | - * @param mixed $condition |
|
27 | - * @param string $message |
|
28 | - * @param bool $dismissible |
|
29 | - * @param string $type |
|
30 | - * @param string $template |
|
31 | - * |
|
32 | - */ |
|
24 | + * Constructor which sets up the admin_notices hook for rendering |
|
25 | + * |
|
26 | + * @param mixed $condition |
|
27 | + * @param string $message |
|
28 | + * @param bool $dismissible |
|
29 | + * @param string $type |
|
30 | + * @param string $template |
|
31 | + * |
|
32 | + */ |
|
33 | 33 | public function __construct( $condition, $message, $dismissible = false, $type = '', $template = '' ) { |
34 | 34 | $this->condition = $condition; |
35 | 35 | $this->message = $message; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * Render an admin notice |
|
46 | - * |
|
47 | - */ |
|
45 | + * Render an admin notice |
|
46 | + * |
|
47 | + */ |
|
48 | 48 | public function render() { |
49 | 49 | |
50 | 50 | // class for the notice to use |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | protected $installed_version; |
20 | 20 | |
21 | 21 | /** |
22 | - * Constructor which sets up activate hooks |
|
23 | - * |
|
24 | - * @param object $wpdb |
|
25 | - * @param string $version |
|
26 | - * @param string $slug |
|
27 | - * |
|
28 | - */ |
|
22 | + * Constructor which sets up activate hooks |
|
23 | + * |
|
24 | + * @param object $wpdb |
|
25 | + * @param string $version |
|
26 | + * @param string $slug |
|
27 | + * |
|
28 | + */ |
|
29 | 29 | public function __construct( $wpdb, $version, $slug ) { |
30 | 30 | $this->wpdb = $wpdb; |
31 | 31 | $this->version = $version; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | - * Check for the minimum required version of php |
|
41 | - */ |
|
40 | + * Check for the minimum required version of php |
|
41 | + */ |
|
42 | 42 | public function php_requirements() { |
43 | 43 | if ( version_compare( PHP_VERSION, '5.5', '<' ) ) { |
44 | 44 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * Create database tables for Salesforce |
|
51 | - * This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects) |
|
52 | - * |
|
53 | - */ |
|
50 | + * Create database tables for Salesforce |
|
51 | + * This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects) |
|
52 | + * |
|
53 | + */ |
|
54 | 54 | public function wordpress_salesforce_tables() { |
55 | 55 | |
56 | 56 | $charset_collate = $this->wpdb->get_charset_collate(); |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * Check for database version on plugin upgrade |
|
115 | - * When the plugin is upgraded, if the database version does not match the current version, perform these methods |
|
116 | - * |
|
117 | - */ |
|
114 | + * Check for database version on plugin upgrade |
|
115 | + * When the plugin is upgraded, if the database version does not match the current version, perform these methods |
|
116 | + * |
|
117 | + */ |
|
118 | 118 | public function wordpress_salesforce_update_db_check() { |
119 | 119 | if ( get_site_option( 'object_sync_for_salesforce_db_version' ) !== $this->version ) { |
120 | 120 | $this->wordpress_salesforce_tables(); |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * Add roles and capabilities |
|
126 | - * This adds the configure_salesforce capability to the admin role |
|
127 | - * |
|
128 | - * It also allows other plugins to add the capability to other roles |
|
129 | - * |
|
130 | - */ |
|
125 | + * Add roles and capabilities |
|
126 | + * This adds the configure_salesforce capability to the admin role |
|
127 | + * |
|
128 | + * It also allows other plugins to add the capability to other roles |
|
129 | + * |
|
130 | + */ |
|
131 | 131 | public function add_roles_capabilities() { |
132 | 132 | |
133 | 133 | // by default, only administrators can configure the plugin |
@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | protected $schedulable_classes; |
25 | 25 | |
26 | 26 | /** |
27 | - * @var string |
|
28 | - */ |
|
27 | + * @var string |
|
28 | + */ |
|
29 | 29 | public $schedule_name; // allow for naming the queue in case there are multiple queues |
30 | 30 | |
31 | 31 | /** |
32 | - * Constructor which sets up pull schedule |
|
33 | - * |
|
34 | - * @param object $wpdb |
|
35 | - * @param string $version |
|
36 | - * @param array $login_credentials |
|
37 | - * @param string $slug |
|
38 | - * @param object $wordpress |
|
39 | - * @param object $salesforce |
|
40 | - * @param object $mappings |
|
41 | - * @param object $logging |
|
42 | - * @param array $schedulable_classes |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
32 | + * Constructor which sets up pull schedule |
|
33 | + * |
|
34 | + * @param object $wpdb |
|
35 | + * @param string $version |
|
36 | + * @param array $login_credentials |
|
37 | + * @param string $slug |
|
38 | + * @param object $wordpress |
|
39 | + * @param object $salesforce |
|
40 | + * @param object $mappings |
|
41 | + * @param object $logging |
|
42 | + * @param array $schedulable_classes |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | 45 | public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes ) { |
46 | 46 | $this->wpdb = $wpdb; |
47 | 47 | $this->version = $version; |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * Create the action hooks based on what object maps exist from the admin settings |
|
74 | - * |
|
75 | - */ |
|
73 | + * Create the action hooks based on what object maps exist from the admin settings |
|
74 | + * |
|
75 | + */ |
|
76 | 76 | private function add_actions() { |
77 | 77 | add_action( 'wp_ajax_salesforce_pull_webhook', array( $this, 'salesforce_pull_webhook' ) ); |
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * Ajax callback for salesforce pull. Returns status of 200 for successful |
|
82 | - * attempt or 403 for a failed pull attempt (SF not authorized, threshhold |
|
83 | - * reached, etc. |
|
84 | - * this is the ajax callback; not a cron run |
|
85 | - */ |
|
81 | + * Ajax callback for salesforce pull. Returns status of 200 for successful |
|
82 | + * attempt or 403 for a failed pull attempt (SF not authorized, threshhold |
|
83 | + * reached, etc. |
|
84 | + * this is the ajax callback; not a cron run |
|
85 | + */ |
|
86 | 86 | public function salesforce_pull_webhook() { |
87 | 87 | |
88 | 88 | if ( true === $this->salesforce_pull() ) { |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | - * Callback for the standard pull process used by webhooks and cron. |
|
106 | - */ |
|
105 | + * Callback for the standard pull process used by webhooks and cron. |
|
106 | + */ |
|
107 | 107 | public function salesforce_pull() { |
108 | 108 | $sfapi = $this->salesforce['sfapi']; |
109 | 109 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | - * Load schedule |
|
127 | - * This loads the schedule class |
|
128 | - */ |
|
126 | + * Load schedule |
|
127 | + * This loads the schedule class |
|
128 | + */ |
|
129 | 129 | private function schedule() { |
130 | 130 | if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) { |
131 | 131 | require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php'; |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | - * Determines if the Salesforce pull should be allowed, or throttled. |
|
141 | - * |
|
142 | - * Prevents too many pull processes from running at once. |
|
143 | - * |
|
144 | - * @return bool |
|
145 | - * Returns false if the time elapsed between recent pulls is too short. |
|
146 | - */ |
|
140 | + * Determines if the Salesforce pull should be allowed, or throttled. |
|
141 | + * |
|
142 | + * Prevents too many pull processes from running at once. |
|
143 | + * |
|
144 | + * @return bool |
|
145 | + * Returns false if the time elapsed between recent pulls is too short. |
|
146 | + */ |
|
147 | 147 | private function check_throttle() { |
148 | 148 | $pull_throttle = get_option( 'object_sync_for_salesforce_pull_throttle', 5 ); |
149 | 149 | $last_sync = get_option( 'object_sync_for_salesforce_pull_last_sync', 0 ); |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | - * Pull updated records from Salesforce and place them in the queue. |
|
160 | - * |
|
161 | - * Executes a SOQL query based on defined mappings, loops through the results, |
|
162 | - * and places each updated SF object into the queue for later processing. |
|
163 | - * |
|
164 | - * We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF |
|
165 | - * |
|
166 | - */ |
|
159 | + * Pull updated records from Salesforce and place them in the queue. |
|
160 | + * |
|
161 | + * Executes a SOQL query based on defined mappings, loops through the results, |
|
162 | + * and places each updated SF object into the queue for later processing. |
|
163 | + * |
|
164 | + * We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF |
|
165 | + * |
|
166 | + */ |
|
167 | 167 | private function get_updated_records() { |
168 | 168 | $sfapi = $this->salesforce['sfapi']; |
169 | 169 | foreach ( $this->mappings->get_fieldmaps() as $salesforce_mapping ) { |
@@ -329,18 +329,18 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * Given a SObject type name, build an SOQL query to include all fields for all |
|
333 | - * SalesforceMappings mapped to that SObject. |
|
334 | - * |
|
335 | - * @param string $type |
|
336 | - * e.g. "Contact", "Account", etc. |
|
337 | - * |
|
338 | - * @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields |
|
339 | - * were found. |
|
340 | - * |
|
341 | - * @see Object_Sync_Sf_Mapping::get_mapped_fields |
|
342 | - * @see Object_Sync_Sf_Mapping::get_mapped_record_types |
|
343 | - */ |
|
332 | + * Given a SObject type name, build an SOQL query to include all fields for all |
|
333 | + * SalesforceMappings mapped to that SObject. |
|
334 | + * |
|
335 | + * @param string $type |
|
336 | + * e.g. "Contact", "Account", etc. |
|
337 | + * |
|
338 | + * @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields |
|
339 | + * were found. |
|
340 | + * |
|
341 | + * @see Object_Sync_Sf_Mapping::get_mapped_fields |
|
342 | + * @see Object_Sync_Sf_Mapping::get_mapped_record_types |
|
343 | + */ |
|
344 | 344 | private function get_pull_query( $type, $salesforce_mapping = array() ) { |
345 | 345 | $mapped_fields = array(); |
346 | 346 | $mapped_record_types = array(); |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
425 | - * Get deleted records from salesforce. |
|
426 | - * Note that deletions can only be queried via REST with an API version >= 29.0. |
|
427 | - * |
|
428 | - */ |
|
425 | + * Get deleted records from salesforce. |
|
426 | + * Note that deletions can only be queried via REST with an API version >= 29.0. |
|
427 | + * |
|
428 | + */ |
|
429 | 429 | private function get_deleted_records() { |
430 | 430 | |
431 | 431 | $sfapi = $this->salesforce['sfapi']; |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
520 | - * Method for ajax hooks to call for pulling manually |
|
521 | - * |
|
522 | - * @param string $object_type |
|
523 | - * @param string $salesforce_id |
|
524 | - * @param string $wordpress_object |
|
525 | - * |
|
526 | - */ |
|
520 | + * Method for ajax hooks to call for pulling manually |
|
521 | + * |
|
522 | + * @param string $object_type |
|
523 | + * @param string $salesforce_id |
|
524 | + * @param string $wordpress_object |
|
525 | + * |
|
526 | + */ |
|
527 | 527 | public function manual_pull( $object_type, $salesforce_id, $wordpress_object ) { |
528 | 528 | $sfapi = $this->salesforce['sfapi']; |
529 | 529 | $object = $sfapi->api_call( 'sobjects/' . $object_type . '/' . $salesforce_id ); |
@@ -538,20 +538,20 @@ discard block |
||
538 | 538 | } |
539 | 539 | |
540 | 540 | /** |
541 | - * Sync WordPress objects and Salesforce objects from the queue using the REST API. |
|
542 | - * |
|
543 | - * @param string $object_type |
|
544 | - * Type of Salesforce object. |
|
545 | - * @param object $object |
|
546 | - * The Salesforce object. |
|
547 | - * @param object $mapping |
|
548 | - * Salesforce/WP mapping object. |
|
549 | - * @param int $sf_sync_trigger |
|
550 | - * Trigger for this sync. |
|
551 | - * |
|
552 | - * @return true or exit the method |
|
553 | - * |
|
554 | - */ |
|
541 | + * Sync WordPress objects and Salesforce objects from the queue using the REST API. |
|
542 | + * |
|
543 | + * @param string $object_type |
|
544 | + * Type of Salesforce object. |
|
545 | + * @param object $object |
|
546 | + * The Salesforce object. |
|
547 | + * @param object $mapping |
|
548 | + * Salesforce/WP mapping object. |
|
549 | + * @param int $sf_sync_trigger |
|
550 | + * Trigger for this sync. |
|
551 | + * |
|
552 | + * @return true or exit the method |
|
553 | + * |
|
554 | + */ |
|
555 | 555 | public function salesforce_pull_process_records( $object_type, $object, $mapping, $sf_sync_trigger ) { |
556 | 556 | $mapping_conditions = array( |
557 | 557 | 'salesforce_object' => $object_type, |
@@ -1282,19 +1282,19 @@ discard block |
||
1282 | 1282 | } |
1283 | 1283 | |
1284 | 1284 | /** |
1285 | - * Create an object map between a Salesforce object and a WordPress object |
|
1286 | - * |
|
1287 | - * @param array $salesforce_object |
|
1288 | - * Array of the salesforce object's data |
|
1289 | - * @param string $wordpress_id |
|
1290 | - * Unique identifier for the WordPress object |
|
1291 | - * @param array $field_mapping |
|
1292 | - * The row that maps the object types together, including which fields match which other fields |
|
1293 | - * |
|
1294 | - * @return int $wpdb->insert_id |
|
1295 | - * This is the database row for the map object |
|
1296 | - * |
|
1297 | - */ |
|
1285 | + * Create an object map between a Salesforce object and a WordPress object |
|
1286 | + * |
|
1287 | + * @param array $salesforce_object |
|
1288 | + * Array of the salesforce object's data |
|
1289 | + * @param string $wordpress_id |
|
1290 | + * Unique identifier for the WordPress object |
|
1291 | + * @param array $field_mapping |
|
1292 | + * The row that maps the object types together, including which fields match which other fields |
|
1293 | + * |
|
1294 | + * @return int $wpdb->insert_id |
|
1295 | + * This is the database row for the map object |
|
1296 | + * |
|
1297 | + */ |
|
1298 | 1298 | private function create_object_map( $salesforce_object, $wordpress_id, $field_mapping ) { |
1299 | 1299 | // Create object map and save it |
1300 | 1300 | $mapping_object = $this->mappings->create_object_map( |
@@ -26,62 +26,62 @@ discard block |
||
26 | 26 | protected $schedulable_classes; |
27 | 27 | |
28 | 28 | /** |
29 | - * @var string |
|
30 | - * Default path for the Salesforce authorize URL |
|
31 | - */ |
|
29 | + * @var string |
|
30 | + * Default path for the Salesforce authorize URL |
|
31 | + */ |
|
32 | 32 | public $default_authorize_url_path; |
33 | 33 | |
34 | 34 | /** |
35 | - * @var string |
|
36 | - * Default path for the Salesforce token URL |
|
37 | - */ |
|
35 | + * @var string |
|
36 | + * Default path for the Salesforce token URL |
|
37 | + */ |
|
38 | 38 | public $default_token_url_path; |
39 | 39 | |
40 | 40 | /** |
41 | - * @var string |
|
42 | - * What version of the Salesforce API should be the default on the settings screen. |
|
43 | - * Users can edit this, but they won't see a correct list of all their available versions until WordPress has |
|
44 | - * been authenticated with Salesforce. |
|
45 | - */ |
|
41 | + * @var string |
|
42 | + * What version of the Salesforce API should be the default on the settings screen. |
|
43 | + * Users can edit this, but they won't see a correct list of all their available versions until WordPress has |
|
44 | + * been authenticated with Salesforce. |
|
45 | + */ |
|
46 | 46 | public $default_api_version; |
47 | 47 | |
48 | 48 | /** |
49 | - * @var bool |
|
50 | - * Default for whether to limit to triggerable items |
|
51 | - * Users can edit this |
|
52 | - */ |
|
49 | + * @var bool |
|
50 | + * Default for whether to limit to triggerable items |
|
51 | + * Users can edit this |
|
52 | + */ |
|
53 | 53 | public $default_triggerable; |
54 | 54 | |
55 | 55 | /** |
56 | - * @var bool |
|
57 | - * Default for whether to limit to updateable items |
|
58 | - * Users can edit this |
|
59 | - */ |
|
56 | + * @var bool |
|
57 | + * Default for whether to limit to updateable items |
|
58 | + * Users can edit this |
|
59 | + */ |
|
60 | 60 | public $default_updateable; |
61 | 61 | |
62 | 62 | /** |
63 | - * @var int |
|
64 | - * Default pull throttle for how often Salesforce can pull |
|
65 | - * Users can edit this |
|
66 | - */ |
|
63 | + * @var int |
|
64 | + * Default pull throttle for how often Salesforce can pull |
|
65 | + * Users can edit this |
|
66 | + */ |
|
67 | 67 | public $default_pull_throttle; |
68 | 68 | |
69 | 69 | /** |
70 | - * Constructor which sets up admin pages |
|
71 | - * |
|
72 | - * @param object $wpdb |
|
73 | - * @param string $version |
|
74 | - * @param array $login_credentials |
|
75 | - * @param string $slug |
|
76 | - * @param object $wordpress |
|
77 | - * @param object $salesforce |
|
78 | - * @param object $mappings |
|
79 | - * @param object $push |
|
80 | - * @param object $pull |
|
81 | - * @param object $logging |
|
82 | - * @param array $schedulable_classes |
|
83 | - * @throws \Exception |
|
84 | - */ |
|
70 | + * Constructor which sets up admin pages |
|
71 | + * |
|
72 | + * @param object $wpdb |
|
73 | + * @param string $version |
|
74 | + * @param array $login_credentials |
|
75 | + * @param string $slug |
|
76 | + * @param object $wordpress |
|
77 | + * @param object $salesforce |
|
78 | + * @param object $mappings |
|
79 | + * @param object $push |
|
80 | + * @param object $pull |
|
81 | + * @param object $logging |
|
82 | + * @param array $schedulable_classes |
|
83 | + * @throws \Exception |
|
84 | + */ |
|
85 | 85 | public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes ) { |
86 | 86 | $this->wpdb = $wpdb; |
87 | 87 | $this->version = $version; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | - * Create the action hooks to create the admin page(s) |
|
121 | - * |
|
122 | - */ |
|
120 | + * Create the action hooks to create the admin page(s) |
|
121 | + * |
|
122 | + */ |
|
123 | 123 | public function add_actions() { |
124 | 124 | add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) ); |
125 | 125 | add_action( 'admin_init', array( $this, 'notices' ) ); |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * Create WordPress admin options page |
|
152 | - * |
|
153 | - */ |
|
151 | + * Create WordPress admin options page |
|
152 | + * |
|
153 | + */ |
|
154 | 154 | public function create_admin_menu() { |
155 | 155 | $title = __( 'Salesforce', 'object-sync-for-salesforce' ); |
156 | 156 | add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) ); |
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | - * Render full admin pages in WordPress |
|
161 | - * This allows other plugins to add tabs to the Salesforce settings screen |
|
162 | - * |
|
163 | - * todo: better front end: html, organization of html into templates, css, js |
|
164 | - * |
|
165 | - */ |
|
160 | + * Render full admin pages in WordPress |
|
161 | + * This allows other plugins to add tabs to the Salesforce settings screen |
|
162 | + * |
|
163 | + * todo: better front end: html, organization of html into templates, css, js |
|
164 | + * |
|
165 | + */ |
|
166 | 166 | public function show_admin_page() { |
167 | 167 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
168 | 168 | echo '<div class="wrap">'; |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
375 | - * Create default WordPress admin settings form for salesforce |
|
376 | - * This is for the Settings page/tab |
|
377 | - * |
|
378 | - */ |
|
375 | + * Create default WordPress admin settings form for salesforce |
|
376 | + * This is for the Settings page/tab |
|
377 | + * |
|
378 | + */ |
|
379 | 379 | public function salesforce_settings_forms() { |
380 | 380 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
381 | 381 | $page = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings'; |
@@ -400,13 +400,13 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | - * Fields for the Settings tab |
|
404 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
405 | - * |
|
406 | - * @param string $page |
|
407 | - * @param string $section |
|
408 | - * @param string $input_callback |
|
409 | - */ |
|
403 | + * Fields for the Settings tab |
|
404 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
405 | + * |
|
406 | + * @param string $page |
|
407 | + * @param string $section |
|
408 | + * @param string $input_callback |
|
409 | + */ |
|
410 | 410 | private function fields_settings( $page, $section, $callbacks ) { |
411 | 411 | add_settings_section( $page, ucwords( $page ), null, $page ); |
412 | 412 | $salesforce_settings = array( |
@@ -611,25 +611,25 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
614 | - * Fields for the Fieldmaps tab |
|
615 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
616 | - * |
|
617 | - * @param string $page |
|
618 | - * @param string $section |
|
619 | - * @param string $input_callback |
|
620 | - */ |
|
614 | + * Fields for the Fieldmaps tab |
|
615 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
616 | + * |
|
617 | + * @param string $page |
|
618 | + * @param string $section |
|
619 | + * @param string $input_callback |
|
620 | + */ |
|
621 | 621 | private function fields_fieldmaps( $page, $section, $input_callback = '' ) { |
622 | 622 | add_settings_section( $page, ucwords( $page ), null, $page ); |
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
626 | - * Fields for the Scheduling tab |
|
627 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
628 | - * |
|
629 | - * @param string $page |
|
630 | - * @param string $section |
|
631 | - * @param string $input_callback |
|
632 | - */ |
|
626 | + * Fields for the Scheduling tab |
|
627 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
628 | + * |
|
629 | + * @param string $page |
|
630 | + * @param string $section |
|
631 | + * @param string $input_callback |
|
632 | + */ |
|
633 | 633 | private function fields_scheduling( $page, $section, $callbacks ) { |
634 | 634 | foreach ( $this->schedulable_classes as $key => $value ) { |
635 | 635 | add_settings_section( $key, $value['label'], null, $page ); |
@@ -708,13 +708,13 @@ discard block |
||
708 | 708 | } |
709 | 709 | |
710 | 710 | /** |
711 | - * Fields for the Log Settings tab |
|
712 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
713 | - * |
|
714 | - * @param string $page |
|
715 | - * @param string $section |
|
716 | - * @param array $callbacks |
|
717 | - */ |
|
711 | + * Fields for the Log Settings tab |
|
712 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
713 | + * |
|
714 | + * @param string $page |
|
715 | + * @param string $section |
|
716 | + * @param array $callbacks |
|
717 | + */ |
|
718 | 718 | private function fields_log_settings( $page, $section, $callbacks ) { |
719 | 719 | add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page ); |
720 | 720 | $log_settings = array( |
@@ -892,9 +892,9 @@ discard block |
||
892 | 892 | } |
893 | 893 | |
894 | 894 | /** |
895 | - * Create the notices, settings, and conditions by which admin notices should appear |
|
896 | - * |
|
897 | - */ |
|
895 | + * Create the notices, settings, and conditions by which admin notices should appear |
|
896 | + * |
|
897 | + */ |
|
898 | 898 | public function notices() { |
899 | 899 | |
900 | 900 | // before a notice is displayed, we should make sure we are on a page related to this plugin |
@@ -967,14 +967,14 @@ discard block |
||
967 | 967 | } |
968 | 968 | |
969 | 969 | /** |
970 | - * Get all the Salesforce object settings for fieldmapping |
|
971 | - * This takes either the $_POST array via ajax, or can be directly called with a $data array |
|
972 | - * |
|
973 | - * @param array $data |
|
974 | - * data must contain a salesforce_object |
|
975 | - * can optionally contain a type |
|
976 | - * @return array $object_settings |
|
977 | - */ |
|
970 | + * Get all the Salesforce object settings for fieldmapping |
|
971 | + * This takes either the $_POST array via ajax, or can be directly called with a $data array |
|
972 | + * |
|
973 | + * @param array $data |
|
974 | + * data must contain a salesforce_object |
|
975 | + * can optionally contain a type |
|
976 | + * @return array $object_settings |
|
977 | + */ |
|
978 | 978 | public function get_salesforce_object_description( $data = array() ) { |
979 | 979 | $ajax = false; |
980 | 980 | if ( empty( $data ) ) { |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | /** |
1025 | - * Get Salesforce object fields for fieldmapping |
|
1026 | - * |
|
1027 | - * @param array $data |
|
1028 | - * data must contain a salesforce_object |
|
1029 | - * can optionally contain a type for the field |
|
1030 | - * @return array $object_fields |
|
1031 | - */ |
|
1025 | + * Get Salesforce object fields for fieldmapping |
|
1026 | + * |
|
1027 | + * @param array $data |
|
1028 | + * data must contain a salesforce_object |
|
1029 | + * can optionally contain a type for the field |
|
1030 | + * @return array $object_fields |
|
1031 | + */ |
|
1032 | 1032 | public function get_salesforce_object_fields( $data = array() ) { |
1033 | 1033 | |
1034 | 1034 | if ( ! empty( $data['salesforce_object'] ) ) { |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | /** |
1059 | - * Get WordPress object fields for fieldmapping |
|
1060 | - * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field |
|
1061 | - * |
|
1062 | - * @param string $wordpress_object |
|
1063 | - * @return array $object_fields |
|
1064 | - */ |
|
1059 | + * Get WordPress object fields for fieldmapping |
|
1060 | + * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field |
|
1061 | + * |
|
1062 | + * @param string $wordpress_object |
|
1063 | + * @return array $object_fields |
|
1064 | + */ |
|
1065 | 1065 | public function get_wordpress_object_fields( $wordpress_object = '' ) { |
1066 | 1066 | $ajax = false; |
1067 | 1067 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1080,13 +1080,13 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /** |
1083 | - * Get WordPress and Salesforce object fields together for fieldmapping |
|
1084 | - * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields |
|
1085 | - * |
|
1086 | - * @param string $wordpress_object |
|
1087 | - * @param string $salesforce_object |
|
1088 | - * @return array $object_fields |
|
1089 | - */ |
|
1083 | + * Get WordPress and Salesforce object fields together for fieldmapping |
|
1084 | + * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields |
|
1085 | + * |
|
1086 | + * @param string $wordpress_object |
|
1087 | + * @param string $salesforce_object |
|
1088 | + * @return array $object_fields |
|
1089 | + */ |
|
1090 | 1090 | public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) { |
1091 | 1091 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1092 | 1092 | if ( empty( $wordpress_object ) ) { |
@@ -1111,12 +1111,12 @@ discard block |
||
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | /** |
1114 | - * Manually push the WordPress object to Salesforce |
|
1115 | - * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields |
|
1116 | - * |
|
1117 | - * @param string $wordpress_object |
|
1118 | - * @param int $wordpress_id |
|
1119 | - */ |
|
1114 | + * Manually push the WordPress object to Salesforce |
|
1115 | + * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields |
|
1116 | + * |
|
1117 | + * @param string $wordpress_object |
|
1118 | + * @param int $wordpress_id |
|
1119 | + */ |
|
1120 | 1120 | public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) { |
1121 | 1121 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1122 | 1122 | if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) { |
@@ -1135,12 +1135,12 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | /** |
1138 | - * Manually pull the Salesforce object into WordPress |
|
1139 | - * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields |
|
1140 | - * |
|
1141 | - * @param string $salesforce_id |
|
1142 | - * @param string $wordpress_object |
|
1143 | - */ |
|
1138 | + * Manually pull the Salesforce object into WordPress |
|
1139 | + * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields |
|
1140 | + * |
|
1141 | + * @param string $salesforce_id |
|
1142 | + * @param string $wordpress_object |
|
1143 | + */ |
|
1144 | 1144 | public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) { |
1145 | 1145 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1146 | 1146 | if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) { |
@@ -1157,11 +1157,11 @@ discard block |
||
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | /** |
1160 | - * Manually pull the Salesforce object into WordPress |
|
1161 | - * This takes an id for a mapping object row |
|
1162 | - * |
|
1163 | - * @param int $mapping_id |
|
1164 | - */ |
|
1160 | + * Manually pull the Salesforce object into WordPress |
|
1161 | + * This takes an id for a mapping object row |
|
1162 | + * |
|
1163 | + * @param int $mapping_id |
|
1164 | + */ |
|
1165 | 1165 | public function refresh_mapped_data( $mapping_id = '' ) { |
1166 | 1166 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1167 | 1167 | if ( empty( $mapping_id ) ) { |
@@ -1180,13 +1180,13 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | /** |
1183 | - * Prepare fieldmap data and redirect after processing |
|
1184 | - * This runs when the create or update forms are submitted |
|
1185 | - * It is public because it depends on an admin hook |
|
1186 | - * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1187 | - * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1188 | - * |
|
1189 | - */ |
|
1183 | + * Prepare fieldmap data and redirect after processing |
|
1184 | + * This runs when the create or update forms are submitted |
|
1185 | + * It is public because it depends on an admin hook |
|
1186 | + * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1187 | + * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1188 | + * |
|
1189 | + */ |
|
1190 | 1190 | public function prepare_fieldmap_data() { |
1191 | 1191 | $error = false; |
1192 | 1192 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1234,12 +1234,12 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | /** |
1237 | - * Delete fieldmap data and redirect after processing |
|
1238 | - * This runs when the delete link is clicked, after the user confirms |
|
1239 | - * It is public because it depends on an admin hook |
|
1240 | - * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1241 | - * |
|
1242 | - */ |
|
1237 | + * Delete fieldmap data and redirect after processing |
|
1238 | + * This runs when the delete link is clicked, after the user confirms |
|
1239 | + * It is public because it depends on an admin hook |
|
1240 | + * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1241 | + * |
|
1242 | + */ |
|
1243 | 1243 | public function delete_fieldmap() { |
1244 | 1244 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1245 | 1245 | if ( $post_data['id'] ) { |
@@ -1255,13 +1255,13 @@ discard block |
||
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
1258 | - * Prepare object data and redirect after processing |
|
1259 | - * This runs when the update form is submitted |
|
1260 | - * It is public because it depends on an admin hook |
|
1261 | - * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1262 | - * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1263 | - * |
|
1264 | - */ |
|
1258 | + * Prepare object data and redirect after processing |
|
1259 | + * This runs when the update form is submitted |
|
1260 | + * It is public because it depends on an admin hook |
|
1261 | + * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1262 | + * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1263 | + * |
|
1264 | + */ |
|
1265 | 1265 | public function prepare_object_map_data() { |
1266 | 1266 | $error = false; |
1267 | 1267 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1300,12 +1300,12 @@ discard block |
||
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | /** |
1303 | - * Delete object map data and redirect after processing |
|
1304 | - * This runs when the delete link is clicked on an error row, after the user confirms |
|
1305 | - * It is public because it depends on an admin hook |
|
1306 | - * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1307 | - * |
|
1308 | - */ |
|
1303 | + * Delete object map data and redirect after processing |
|
1304 | + * This runs when the delete link is clicked on an error row, after the user confirms |
|
1305 | + * It is public because it depends on an admin hook |
|
1306 | + * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1307 | + * |
|
1308 | + */ |
|
1309 | 1309 | public function delete_object_map() { |
1310 | 1310 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1311 | 1311 | if ( $post_data['id'] ) { |
@@ -1321,9 +1321,9 @@ discard block |
||
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | /** |
1324 | - * Import a json file and use it for plugin data |
|
1325 | - * |
|
1326 | - */ |
|
1324 | + * Import a json file and use it for plugin data |
|
1325 | + * |
|
1326 | + */ |
|
1327 | 1327 | public function import_json_file() { |
1328 | 1328 | |
1329 | 1329 | if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) { |
@@ -1421,9 +1421,9 @@ discard block |
||
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | /** |
1424 | - * Create a json file for exporting |
|
1425 | - * |
|
1426 | - */ |
|
1424 | + * Create a json file for exporting |
|
1425 | + * |
|
1426 | + */ |
|
1427 | 1427 | public function export_json_file() { |
1428 | 1428 | |
1429 | 1429 | if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) { |
@@ -1452,10 +1452,10 @@ discard block |
||
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | /** |
1455 | - * Default display for <input> fields |
|
1456 | - * |
|
1457 | - * @param array $args |
|
1458 | - */ |
|
1455 | + * Default display for <input> fields |
|
1456 | + * |
|
1457 | + * @param array $args |
|
1458 | + */ |
|
1459 | 1459 | public function display_input_field( $args ) { |
1460 | 1460 | $type = $args['type']; |
1461 | 1461 | $id = $args['label_for']; |
@@ -1502,11 +1502,11 @@ discard block |
||
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | /** |
1505 | - * Display for multiple checkboxes |
|
1506 | - * Above method can handle a single checkbox as it is |
|
1507 | - * |
|
1508 | - * @param array $args |
|
1509 | - */ |
|
1505 | + * Display for multiple checkboxes |
|
1506 | + * Above method can handle a single checkbox as it is |
|
1507 | + * |
|
1508 | + * @param array $args |
|
1509 | + */ |
|
1510 | 1510 | public function display_checkboxes( $args ) { |
1511 | 1511 | $type = 'checkbox'; |
1512 | 1512 | $name = $args['name']; |
@@ -1540,10 +1540,10 @@ discard block |
||
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | /** |
1543 | - * Display for a dropdown |
|
1544 | - * |
|
1545 | - * @param array $args |
|
1546 | - */ |
|
1543 | + * Display for a dropdown |
|
1544 | + * |
|
1545 | + * @param array $args |
|
1546 | + */ |
|
1547 | 1547 | public function display_select( $args ) { |
1548 | 1548 | $type = $args['type']; |
1549 | 1549 | $id = $args['label_for']; |
@@ -1587,10 +1587,10 @@ discard block |
||
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | /** |
1590 | - * Dropdown formatted list of Salesforce API versions |
|
1591 | - * |
|
1592 | - * @return array $args |
|
1593 | - */ |
|
1590 | + * Dropdown formatted list of Salesforce API versions |
|
1591 | + * |
|
1592 | + * @return array $args |
|
1593 | + */ |
|
1594 | 1594 | private function version_options() { |
1595 | 1595 | $versions = $this->salesforce['sfapi']->get_api_versions(); |
1596 | 1596 | $args = array(); |
@@ -1604,10 +1604,10 @@ discard block |
||
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | /** |
1607 | - * Default display for <a href> links |
|
1608 | - * |
|
1609 | - * @param array $args |
|
1610 | - */ |
|
1607 | + * Default display for <a href> links |
|
1608 | + * |
|
1609 | + * @param array $args |
|
1610 | + */ |
|
1611 | 1611 | public function display_link( $args ) { |
1612 | 1612 | $label = $args['label']; |
1613 | 1613 | $desc = $args['desc']; |
@@ -1634,10 +1634,10 @@ discard block |
||
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | /** |
1637 | - * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it |
|
1638 | - * |
|
1639 | - * @param object $sfapi |
|
1640 | - */ |
|
1637 | + * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it |
|
1638 | + * |
|
1639 | + * @param object $sfapi |
|
1640 | + */ |
|
1641 | 1641 | private function status( $sfapi ) { |
1642 | 1642 | |
1643 | 1643 | $versions = $sfapi->get_api_versions(); |
@@ -1696,10 +1696,10 @@ discard block |
||
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | /** |
1699 | - * Deauthorize WordPress from Salesforce. |
|
1700 | - * This deletes the tokens from the database; it does not currently do anything in Salesforce |
|
1701 | - * For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce |
|
1702 | - */ |
|
1699 | + * Deauthorize WordPress from Salesforce. |
|
1700 | + * This deletes the tokens from the database; it does not currently do anything in Salesforce |
|
1701 | + * For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce |
|
1702 | + */ |
|
1703 | 1703 | private function logout() { |
1704 | 1704 | $this->access_token = delete_option( $this->option_prefix . 'access_token' ); |
1705 | 1705 | $this->instance_url = delete_option( $this->option_prefix . 'instance_url' ); |
@@ -1711,8 +1711,8 @@ discard block |
||
1711 | 1711 | } |
1712 | 1712 | |
1713 | 1713 | /** |
1714 | - * Ajax call to clear the plugin cache. |
|
1715 | - */ |
|
1714 | + * Ajax call to clear the plugin cache. |
|
1715 | + */ |
|
1716 | 1716 | public function clear_sfwp_cache() { |
1717 | 1717 | $result = $this->clear_cache( true ); |
1718 | 1718 | $response = array( |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | /** |
1726 | - * Clear the plugin's cache. |
|
1727 | - * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data. |
|
1728 | - */ |
|
1726 | + * Clear the plugin's cache. |
|
1727 | + * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data. |
|
1728 | + */ |
|
1729 | 1729 | private function clear_cache( $ajax = false ) { |
1730 | 1730 | $result = (bool) $this->wordpress->sfwp_transients->flush(); |
1731 | 1731 | if ( true === $result ) { |
@@ -1745,9 +1745,9 @@ discard block |
||
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | /** |
1748 | - * Check WordPress Admin permissions |
|
1749 | - * Check if the current user is allowed to access the Salesforce plugin options |
|
1750 | - */ |
|
1748 | + * Check WordPress Admin permissions |
|
1749 | + * Check if the current user is allowed to access the Salesforce plugin options |
|
1750 | + */ |
|
1751 | 1751 | private function check_wordpress_admin_permissions() { |
1752 | 1752 | |
1753 | 1753 | // one programmatic way to give this capability to additional user roles is the |
@@ -1767,10 +1767,10 @@ discard block |
||
1767 | 1767 | } |
1768 | 1768 | |
1769 | 1769 | /** |
1770 | - * Show what we know about this user's relationship to a Salesforce object, if any |
|
1771 | - * @param object $user |
|
1772 | - * |
|
1773 | - */ |
|
1770 | + * Show what we know about this user's relationship to a Salesforce object, if any |
|
1771 | + * @param object $user |
|
1772 | + * |
|
1773 | + */ |
|
1774 | 1774 | public function show_salesforce_user_fields( $user ) { |
1775 | 1775 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
1776 | 1776 | if ( true === $this->check_wordpress_admin_permissions() ) { |
@@ -1794,10 +1794,10 @@ discard block |
||
1794 | 1794 | } |
1795 | 1795 | |
1796 | 1796 | /** |
1797 | - * If the user profile has been mapped to Salesforce, do it |
|
1798 | - * @param int $user_id |
|
1799 | - * |
|
1800 | - */ |
|
1797 | + * If the user profile has been mapped to Salesforce, do it |
|
1798 | + * @param int $user_id |
|
1799 | + * |
|
1800 | + */ |
|
1801 | 1801 | public function save_salesforce_user_fields( $user_id ) { |
1802 | 1802 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1803 | 1803 | if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) { |
@@ -1822,10 +1822,10 @@ discard block |
||
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | /** |
1825 | - * Render tabs for settings pages in admin |
|
1826 | - * @param array $tabs |
|
1827 | - * @param string $tab |
|
1828 | - */ |
|
1825 | + * Render tabs for settings pages in admin |
|
1826 | + * @param array $tabs |
|
1827 | + * @param string $tab |
|
1828 | + */ |
|
1829 | 1829 | private function tabs( $tabs, $tab = '' ) { |
1830 | 1830 | |
1831 | 1831 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
@@ -1855,9 +1855,9 @@ discard block |
||
1855 | 1855 | } |
1856 | 1856 | |
1857 | 1857 | /** |
1858 | - * Clear schedule |
|
1859 | - * This clears the schedule if the user clicks the button |
|
1860 | - */ |
|
1858 | + * Clear schedule |
|
1859 | + * This clears the schedule if the user clicks the button |
|
1860 | + */ |
|
1861 | 1861 | private function clear_schedule( $schedule_name = '' ) { |
1862 | 1862 | if ( '' !== $schedule_name ) { |
1863 | 1863 | $schedule = $this->schedule( $schedule_name ); |
@@ -1879,8 +1879,8 @@ discard block |
||
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | /** |
1882 | - * Load the schedule class |
|
1883 | - */ |
|
1882 | + * Load the schedule class |
|
1883 | + */ |
|
1884 | 1884 | private function schedule( $schedule_name ) { |
1885 | 1885 | if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) { |
1886 | 1886 | require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php'; |
@@ -1892,21 +1892,21 @@ discard block |
||
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | /** |
1895 | - * Create an object map between a WordPress object and a Salesforce object |
|
1896 | - * |
|
1897 | - * @param int $wordpress_id |
|
1898 | - * Unique identifier for the WordPress object |
|
1899 | - * @param string $wordpress_object |
|
1900 | - * What kind of object is it? |
|
1901 | - * @param string $salesforce_id |
|
1902 | - * Unique identifier for the Salesforce object |
|
1903 | - * @param string $action |
|
1904 | - * Did we push or pull? |
|
1905 | - * |
|
1906 | - * @return int $wpdb->insert_id |
|
1907 | - * This is the database row for the map object |
|
1908 | - * |
|
1909 | - */ |
|
1895 | + * Create an object map between a WordPress object and a Salesforce object |
|
1896 | + * |
|
1897 | + * @param int $wordpress_id |
|
1898 | + * Unique identifier for the WordPress object |
|
1899 | + * @param string $wordpress_object |
|
1900 | + * What kind of object is it? |
|
1901 | + * @param string $salesforce_id |
|
1902 | + * Unique identifier for the Salesforce object |
|
1903 | + * @param string $action |
|
1904 | + * Did we push or pull? |
|
1905 | + * |
|
1906 | + * @return int $wpdb->insert_id |
|
1907 | + * This is the database row for the map object |
|
1908 | + * |
|
1909 | + */ |
|
1910 | 1910 | private function create_object_map( $wordpress_id, $wordpress_object, $salesforce_id, $action = '' ) { |
1911 | 1911 | // Create object map and save it |
1912 | 1912 | $mapping_object = $this->mappings->create_object_map( |
@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | protected $schedulable_classes; |
25 | 25 | |
26 | 26 | /** |
27 | - * @var string |
|
28 | - */ |
|
27 | + * @var string |
|
28 | + */ |
|
29 | 29 | public $schedule_name; // allow for naming the queue in case there are multiple queues |
30 | 30 | |
31 | 31 | /** |
32 | - * Constructor which sets up push schedule |
|
33 | - * |
|
34 | - * @param object $wpdb |
|
35 | - * @param string $version |
|
36 | - * @param array $login_credentials |
|
37 | - * @param string $slug |
|
38 | - * @param object $wordpress |
|
39 | - * @param object $salesforce |
|
40 | - * @param object $mappings |
|
41 | - * @param object $logging |
|
42 | - * @param array $schedulable_classes |
|
43 | - * @throws \Object_Sync_Sf_Exception |
|
44 | - */ |
|
32 | + * Constructor which sets up push schedule |
|
33 | + * |
|
34 | + * @param object $wpdb |
|
35 | + * @param string $version |
|
36 | + * @param array $login_credentials |
|
37 | + * @param string $slug |
|
38 | + * @param object $wordpress |
|
39 | + * @param object $salesforce |
|
40 | + * @param object $mappings |
|
41 | + * @param object $logging |
|
42 | + * @param array $schedulable_classes |
|
43 | + * @throws \Object_Sync_Sf_Exception |
|
44 | + */ |
|
45 | 45 | public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes ) { |
46 | 46 | $this->wpdb = $wpdb; |
47 | 47 | $this->version = $version; |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | - * Create the action hooks based on what object maps exist from the admin settings. |
|
66 | - * We do not have any actions for blogroll at this time. |
|
67 | - * |
|
68 | - */ |
|
65 | + * Create the action hooks based on what object maps exist from the admin settings. |
|
66 | + * We do not have any actions for blogroll at this time. |
|
67 | + * |
|
68 | + */ |
|
69 | 69 | private function add_actions() { |
70 | 70 | $db_version = get_option( 'object_sync_for_salesforce_db_version', false ); |
71 | 71 | if ( $db_version === $this->version ) { |
@@ -97,54 +97,54 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | - * Method for ajax hooks to call for pushing manually |
|
101 | - * |
|
102 | - * @param array $object |
|
103 | - * @param string $type |
|
104 | - * |
|
105 | - */ |
|
100 | + * Method for ajax hooks to call for pushing manually |
|
101 | + * |
|
102 | + * @param array $object |
|
103 | + * @param string $type |
|
104 | + * |
|
105 | + */ |
|
106 | 106 | public function manual_object_update( $object, $type ) { |
107 | 107 | $this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update, true ); |
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | - * Callback method for adding a user |
|
112 | - * |
|
113 | - * @param string $user_id |
|
114 | - */ |
|
111 | + * Callback method for adding a user |
|
112 | + * |
|
113 | + * @param string $user_id |
|
114 | + */ |
|
115 | 115 | public function add_user( $user_id ) { |
116 | 116 | $user = $this->wordpress->get_wordpress_object_data( 'user', $user_id ); |
117 | 117 | $this->object_insert( $user, 'user' ); |
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | - * Callback method for editing a user |
|
122 | - * |
|
123 | - * @param string $user_id |
|
124 | - * @param object $old_user_data |
|
125 | - */ |
|
121 | + * Callback method for editing a user |
|
122 | + * |
|
123 | + * @param string $user_id |
|
124 | + * @param object $old_user_data |
|
125 | + */ |
|
126 | 126 | public function edit_user( $user_id, $old_user_data ) { |
127 | 127 | $user = $this->wordpress->get_wordpress_object_data( 'user', $user_id ); |
128 | 128 | $this->object_update( $user, 'user' ); |
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Callback method for deleting a user |
|
133 | - * |
|
134 | - * @param string $user_id |
|
135 | - */ |
|
132 | + * Callback method for deleting a user |
|
133 | + * |
|
134 | + * @param string $user_id |
|
135 | + */ |
|
136 | 136 | public function delete_user( $user_id ) { |
137 | 137 | $user = $this->wordpress->get_wordpress_object_data( 'user', $user_id ); |
138 | 138 | $this->object_delete( $user, 'user' ); |
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * Callback method for posts of any type |
|
143 | - * This can handle create, update, and delete actions |
|
144 | - * |
|
145 | - * @param string $post_id |
|
146 | - * @param object $post |
|
147 | - */ |
|
142 | + * Callback method for posts of any type |
|
143 | + * This can handle create, update, and delete actions |
|
144 | + * |
|
145 | + * @param string $post_id |
|
146 | + * @param object $post |
|
147 | + */ |
|
148 | 148 | public function post_actions( $post_id, $post ) { |
149 | 149 | |
150 | 150 | $post_type = $post->post_type; |
@@ -191,66 +191,66 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
194 | - * Callback method for adding an attachment |
|
195 | - * |
|
196 | - * @param string $post_id |
|
197 | - */ |
|
194 | + * Callback method for adding an attachment |
|
195 | + * |
|
196 | + * @param string $post_id |
|
197 | + */ |
|
198 | 198 | public function add_attachment( $post_id ) { |
199 | 199 | $attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id ); |
200 | 200 | $this->object_insert( $attachment, 'attachment' ); |
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
204 | - * Callback method for editing an attachment |
|
205 | - * |
|
206 | - * @param string $post_id |
|
207 | - */ |
|
204 | + * Callback method for editing an attachment |
|
205 | + * |
|
206 | + * @param string $post_id |
|
207 | + */ |
|
208 | 208 | public function edit_attachment( $post_id ) { |
209 | 209 | $attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id ); |
210 | 210 | $this->object_update( $attachment, 'attachment' ); |
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
214 | - * Callback method for editing an attachment |
|
215 | - * |
|
216 | - * @param string $post_id |
|
217 | - */ |
|
214 | + * Callback method for editing an attachment |
|
215 | + * |
|
216 | + * @param string $post_id |
|
217 | + */ |
|
218 | 218 | public function delete_attachment( $post_id ) { |
219 | 219 | $attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id ); |
220 | 220 | $this->object_delete( $attachment, 'attachment' ); |
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Callback method for adding a term |
|
225 | - * |
|
226 | - * @param string $term_id |
|
227 | - * @param string $tt_id |
|
228 | - * @param string $taxonomy |
|
229 | - */ |
|
224 | + * Callback method for adding a term |
|
225 | + * |
|
226 | + * @param string $term_id |
|
227 | + * @param string $tt_id |
|
228 | + * @param string $taxonomy |
|
229 | + */ |
|
230 | 230 | public function add_term( $term_id, $tt_id, $taxonomy ) { |
231 | 231 | $term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id ); |
232 | 232 | $this->object_insert( $term, $taxonomy ); |
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
236 | - * Callback method for editing a term |
|
237 | - * |
|
238 | - * @param string $term_id |
|
239 | - * @param string $taxonomy |
|
240 | - */ |
|
236 | + * Callback method for editing a term |
|
237 | + * |
|
238 | + * @param string $term_id |
|
239 | + * @param string $taxonomy |
|
240 | + */ |
|
241 | 241 | public function edit_term( $term_id, $taxonomy ) { |
242 | 242 | $term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id ); |
243 | 243 | $this->object_update( $term, $taxonomy ); |
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
247 | - * Callback method for deleting a term |
|
248 | - * |
|
249 | - * @param int $term (id) |
|
250 | - * @param int $term_taxonomy_id |
|
251 | - * @param string $taxonomy (slug) |
|
252 | - * @param object $deleted_term |
|
253 | - */ |
|
247 | + * Callback method for deleting a term |
|
248 | + * |
|
249 | + * @param int $term (id) |
|
250 | + * @param int $term_taxonomy_id |
|
251 | + * @param string $taxonomy (slug) |
|
252 | + * @param object $deleted_term |
|
253 | + */ |
|
254 | 254 | public function delete_term( $term, $tt_id, $taxonomy, $deleted_term ) { |
255 | 255 | $deleted_term = (array) $deleted_term; |
256 | 256 | $type = $deleted_term['taxonomy']; |
@@ -258,75 +258,75 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * Callback method for adding a comment |
|
262 | - * |
|
263 | - * @param string $comment_id |
|
264 | - * @param int|string comment_approved |
|
265 | - * @param array $commentdata |
|
266 | - */ |
|
261 | + * Callback method for adding a comment |
|
262 | + * |
|
263 | + * @param string $comment_id |
|
264 | + * @param int|string comment_approved |
|
265 | + * @param array $commentdata |
|
266 | + */ |
|
267 | 267 | public function add_comment( $comment_id, $comment_approved, $commentdata = array() ) { |
268 | 268 | $comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id ); |
269 | 269 | $this->object_insert( $comment, 'comment' ); |
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
273 | - * Callback method for editing a comment |
|
274 | - * |
|
275 | - * @param string $comment_id |
|
276 | - */ |
|
273 | + * Callback method for editing a comment |
|
274 | + * |
|
275 | + * @param string $comment_id |
|
276 | + */ |
|
277 | 277 | public function edit_comment( $comment_id ) { |
278 | 278 | $comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id ); |
279 | 279 | $this->object_update( $comment, 'comment' ); |
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
283 | - * Callback method for deleting a comment |
|
284 | - * |
|
285 | - * @param string $comment_id |
|
286 | - */ |
|
283 | + * Callback method for deleting a comment |
|
284 | + * |
|
285 | + * @param string $comment_id |
|
286 | + */ |
|
287 | 287 | public function delete_comment( $comment_id ) { |
288 | 288 | $comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id ); |
289 | 289 | $this->object_delete( $comment, 'comment' ); |
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
293 | - * Insert a new object |
|
294 | - * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class |
|
295 | - */ |
|
293 | + * Insert a new object |
|
294 | + * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class |
|
295 | + */ |
|
296 | 296 | private function object_insert( $object, $type ) { |
297 | 297 | $this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_create ); |
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
301 | - * Update an existing object |
|
302 | - * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class |
|
303 | - */ |
|
301 | + * Update an existing object |
|
302 | + * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class |
|
303 | + */ |
|
304 | 304 | private function object_update( $object, $type ) { |
305 | 305 | $this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update ); |
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * Delete an existing object |
|
310 | - * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class |
|
311 | - */ |
|
309 | + * Delete an existing object |
|
310 | + * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class |
|
311 | + */ |
|
312 | 312 | private function object_delete( $object, $type ) { |
313 | 313 | $this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_delete ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | - * Push objects to Salesforce. |
|
318 | - * This method decides whether to do the processing immediately or queue it to the schedule class (or skip it based on another plugin's activity) |
|
319 | - * |
|
320 | - * @param string $object_type |
|
321 | - * Type of WordPress object. |
|
322 | - * @param array $object |
|
323 | - * The WordPress data that needs to be sent to Salesforce. |
|
324 | - * @param int $sf_sync_trigger |
|
325 | - * The trigger being responded to. |
|
326 | - * @param bool $manual |
|
327 | - * Are we calling this manually? |
|
328 | - * |
|
329 | - */ |
|
317 | + * Push objects to Salesforce. |
|
318 | + * This method decides whether to do the processing immediately or queue it to the schedule class (or skip it based on another plugin's activity) |
|
319 | + * |
|
320 | + * @param string $object_type |
|
321 | + * Type of WordPress object. |
|
322 | + * @param array $object |
|
323 | + * The WordPress data that needs to be sent to Salesforce. |
|
324 | + * @param int $sf_sync_trigger |
|
325 | + * The trigger being responded to. |
|
326 | + * @param bool $manual |
|
327 | + * Are we calling this manually? |
|
328 | + * |
|
329 | + */ |
|
330 | 330 | private function salesforce_push_object_crud( $object_type, $object, $sf_sync_trigger, $manual = false ) { |
331 | 331 | |
332 | 332 | $structure = $this->wordpress->get_wordpress_table_structure( $object_type ); |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
454 | - * Sync WordPress objects and Salesforce objects using the REST API. |
|
455 | - * |
|
456 | - * @param string $object_type |
|
457 | - * Type of WordPress object. |
|
458 | - * @param object $object |
|
459 | - * The object object. |
|
460 | - * @param object $mapping |
|
461 | - * Salesforce mapping object. |
|
462 | - * @param int $sf_sync_trigger |
|
463 | - * Trigger for this sync. |
|
464 | - * |
|
465 | - * @return true or exit the method |
|
466 | - * |
|
467 | - */ |
|
454 | + * Sync WordPress objects and Salesforce objects using the REST API. |
|
455 | + * |
|
456 | + * @param string $object_type |
|
457 | + * Type of WordPress object. |
|
458 | + * @param object $object |
|
459 | + * The object object. |
|
460 | + * @param object $mapping |
|
461 | + * Salesforce mapping object. |
|
462 | + * @param int $sf_sync_trigger |
|
463 | + * Trigger for this sync. |
|
464 | + * |
|
465 | + * @return true or exit the method |
|
466 | + * |
|
467 | + */ |
|
468 | 468 | public function salesforce_push_sync_rest( $object_type, $object, $mapping, $sf_sync_trigger ) { |
469 | 469 | |
470 | 470 | // If Salesforce is not authorized, don't do anything. |
@@ -1006,21 +1006,21 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | /** |
1009 | - * Create an object map between a WordPress object and a Salesforce object |
|
1010 | - * |
|
1011 | - * @param array $wordpress_object |
|
1012 | - * Array of the WordPress object's data |
|
1013 | - * @param string $id_field_name |
|
1014 | - * How this object names its primary field. ie Id or comment_id or whatever |
|
1015 | - * @param string $salesforce_id |
|
1016 | - * Unique identifier for the Salesforce object |
|
1017 | - * @param array $field_mapping |
|
1018 | - * The row that maps the object types together, including which fields match which other fields |
|
1019 | - * |
|
1020 | - * @return int $wpdb->insert_id |
|
1021 | - * This is the database row for the map object |
|
1022 | - * |
|
1023 | - */ |
|
1009 | + * Create an object map between a WordPress object and a Salesforce object |
|
1010 | + * |
|
1011 | + * @param array $wordpress_object |
|
1012 | + * Array of the WordPress object's data |
|
1013 | + * @param string $id_field_name |
|
1014 | + * How this object names its primary field. ie Id or comment_id or whatever |
|
1015 | + * @param string $salesforce_id |
|
1016 | + * Unique identifier for the Salesforce object |
|
1017 | + * @param array $field_mapping |
|
1018 | + * The row that maps the object types together, including which fields match which other fields |
|
1019 | + * |
|
1020 | + * @return int $wpdb->insert_id |
|
1021 | + * This is the database row for the map object |
|
1022 | + * |
|
1023 | + */ |
|
1024 | 1024 | private function create_object_map( $wordpress_object, $id_field_name, $salesforce_id, $field_mapping, $pending = false ) { |
1025 | 1025 | |
1026 | 1026 | if ( true === $pending ) { |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | protected $version; |
19 | 19 | |
20 | 20 | /** |
21 | - * Constructor which sets up deactivate hooks |
|
22 | - * @param object $wpdb |
|
23 | - * @param string $version |
|
24 | - * @param string $slug |
|
25 | - * @param array $schedulable_classes |
|
26 | - * |
|
27 | - */ |
|
21 | + * Constructor which sets up deactivate hooks |
|
22 | + * @param object $wpdb |
|
23 | + * @param string $version |
|
24 | + * @param string $slug |
|
25 | + * @param array $schedulable_classes |
|
26 | + * |
|
27 | + */ |
|
28 | 28 | public function __construct( $wpdb, $version, $slug, $schedulable_classes ) { |
29 | 29 | $this->wpdb = $wpdb; |
30 | 30 | $this->version = $version; |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * Drop database tables for Salesforce |
|
46 | - * This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects) |
|
47 | - * |
|
48 | - */ |
|
45 | + * Drop database tables for Salesforce |
|
46 | + * This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects) |
|
47 | + * |
|
48 | + */ |
|
49 | 49 | public function wordpress_salesforce_drop_tables() { |
50 | 50 | $field_map_table = $this->wpdb->prefix . 'object_sync_sf_field_map'; |
51 | 51 | $object_map_table = $this->wpdb->prefix . 'object_sync_sf_object_map'; |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * Clear the scheduled tasks |
|
59 | - * This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array |
|
60 | - * |
|
61 | - */ |
|
58 | + * Clear the scheduled tasks |
|
59 | + * This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array |
|
60 | + * |
|
61 | + */ |
|
62 | 62 | public function clear_schedule() { |
63 | 63 | foreach ( $this->schedulable_classes as $key => $value ) { |
64 | 64 | wp_clear_scheduled_hook( $key ); |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | - * Delete the log post type |
|
70 | - * This removes the log post type |
|
71 | - * |
|
72 | - */ |
|
69 | + * Delete the log post type |
|
70 | + * This removes the log post type |
|
71 | + * |
|
72 | + */ |
|
73 | 73 | public function delete_log_post_type() { |
74 | 74 | unregister_post_type( 'wp_log' ); |
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * Remove roles and capabilities |
|
79 | - * This removes the configure_salesforce capability from the admin role |
|
80 | - * |
|
81 | - * It also allows other plugins to remove the capability from other roles |
|
82 | - * |
|
83 | - */ |
|
78 | + * Remove roles and capabilities |
|
79 | + * This removes the configure_salesforce capability from the admin role |
|
80 | + * |
|
81 | + * It also allows other plugins to remove the capability from other roles |
|
82 | + * |
|
83 | + */ |
|
84 | 84 | public function remove_roles_capabilities() { |
85 | 85 | |
86 | 86 | // by default, only administrators can configure the plugin |
@@ -100,18 +100,18 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Flush the plugin cache |
|
104 | - * |
|
105 | - */ |
|
103 | + * Flush the plugin cache |
|
104 | + * |
|
105 | + */ |
|
106 | 106 | public function flush_plugin_cache() { |
107 | 107 | $sfwp_transients = new Object_Sync_Sf_WordPress_Transient( 'sfwp_transients' ); |
108 | 108 | $sfwp_transients->flush(); |
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * Clear the plugin options |
|
113 | - * |
|
114 | - */ |
|
112 | + * Clear the plugin options |
|
113 | + * |
|
114 | + */ |
|
115 | 115 | public function delete_plugin_options() { |
116 | 116 | $table = $this->wpdb->prefix . 'options'; |
117 | 117 | $plugin_options = $this->wpdb->get_results( 'SELECT option_name FROM ' . $table . ' WHERE option_name LIKE "object_sync_for_salesforce_%"', ARRAY_A ); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | protected $logging; |
26 | 26 | |
27 | 27 | /** |
28 | - * Constructor which sets up schedule and handler for when schedule runs |
|
29 | - * |
|
30 | - * @param object $wpdb |
|
31 | - * @param string $version |
|
32 | - * @param array $login_credentials |
|
33 | - * @param string $slug |
|
34 | - * @param object $wordpress |
|
35 | - * @param object $salesforce |
|
36 | - * @param object $mappings |
|
37 | - * @param string $schedule_name |
|
38 | - * @throws \Exception |
|
39 | - */ |
|
28 | + * Constructor which sets up schedule and handler for when schedule runs |
|
29 | + * |
|
30 | + * @param object $wpdb |
|
31 | + * @param string $version |
|
32 | + * @param array $login_credentials |
|
33 | + * @param string $slug |
|
34 | + * @param object $wordpress |
|
35 | + * @param object $salesforce |
|
36 | + * @param object $mappings |
|
37 | + * @param string $schedule_name |
|
38 | + * @throws \Exception |
|
39 | + */ |
|
40 | 40 | |
41 | 41 | public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $schedule_name, $logging, $schedulable_classes ) { |
42 | 42 | |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * Create the filters we need to run |
|
63 | - * |
|
64 | - */ |
|
62 | + * Create the filters we need to run |
|
63 | + * |
|
64 | + */ |
|
65 | 65 | public function add_filters() { |
66 | 66 | add_filter( 'cron_schedules', array( $this, 'set_schedule_frequency' ) ); |
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | - * Convert the schedule frequency from the admin settings into an array |
|
71 | - * interval must be in seconds for the class to use it |
|
72 | - * |
|
73 | - */ |
|
70 | + * Convert the schedule frequency from the admin settings into an array |
|
71 | + * interval must be in seconds for the class to use it |
|
72 | + * |
|
73 | + */ |
|
74 | 74 | public function set_schedule_frequency( $schedules ) { |
75 | 75 | |
76 | 76 | // create an option in the core schedules array for each one the plugin defines |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | - * Convert the schedule frequency from the admin settings into an array |
|
112 | - * interval must be in seconds for the class to use it |
|
113 | - * |
|
114 | - */ |
|
111 | + * Convert the schedule frequency from the admin settings into an array |
|
112 | + * interval must be in seconds for the class to use it |
|
113 | + * |
|
114 | + */ |
|
115 | 115 | public function get_schedule_frequency_key( $name = '' ) { |
116 | 116 | |
117 | 117 | $schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' ); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * Convert the schedule frequency from the admin settings into seconds |
|
142 | - * |
|
143 | - */ |
|
141 | + * Convert the schedule frequency from the admin settings into seconds |
|
142 | + * |
|
143 | + */ |
|
144 | 144 | public function get_schedule_frequency_seconds( $name = '' ) { |
145 | 145 | |
146 | 146 | $schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' ); |
@@ -22,9 +22,9 @@ |
||
22 | 22 | public $wsdl; |
23 | 23 | |
24 | 24 | /** |
25 | - * Constructor which loads the SOAP client |
|
26 | - * |
|
27 | - */ |
|
25 | + * Constructor which loads the SOAP client |
|
26 | + * |
|
27 | + */ |
|
28 | 28 | public function __construct( Object_Sync_Sf_Salesforce $sfapi, $wsdl = null ) { |
29 | 29 | if ( ! class_exists( 'SforceBaseClient' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) { |
30 | 30 | require_once plugin_dir_path( __FILE__ ) . '../vendor/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php'; |