Passed
Pull Request — master (#195)
by Jonathan
03:31
created
classes/salesforce_query.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,27 +22,27 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 ';
Please login to merge, or discard this patch.
classes/admin-notice.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
classes/salesforce_soap_partner.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
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';
Please login to merge, or discard this patch.
classes/salesforce.php 1 patch
Indentation   +406 added lines, -406 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@  discard block
 block discarded – undo
17 17
 	public $response;
18 18
 
19 19
 	/**
20
-	* Constructor which initializes the Salesforce APIs.
21
-	*
22
-	* @param string $consumer_key
23
-	*   Salesforce key to connect to your Salesforce instance.
24
-	* @param string $consumer_secret
25
-	*   Salesforce secret to connect to your Salesforce instance.
26
-	* @param string $login_url
27
-	*   Login URL for Salesforce auth requests - differs for production and sandbox
28
-	* @param string $callback_url
29
-	*   WordPress URL where Salesforce should send you after authentication
30
-	* @param string $authorize_path
31
-	*   Oauth path that Salesforce wants
32
-	* @param string $token_path
33
-	*   Path Salesforce uses to give you a token
34
-	* @param string $rest_api_version
35
-	*   What version of the Salesforce REST API to use
36
-	* @param object $wordpress
37
-	*   Object for doing things to WordPress - retrieving data, cache, etc.
38
-	* @param string $slug
39
-	*   Slug for this plugin. Can be used for file including, especially
40
-	* @param object $logging
41
-	*   Logging object for this plugin.
42
-	* @param array $schedulable_classes
43
-	*   array of classes that can have scheduled tasks specific to them
44
-	*/
20
+	 * Constructor which initializes the Salesforce APIs.
21
+	 *
22
+	 * @param string $consumer_key
23
+	 *   Salesforce key to connect to your Salesforce instance.
24
+	 * @param string $consumer_secret
25
+	 *   Salesforce secret to connect to your Salesforce instance.
26
+	 * @param string $login_url
27
+	 *   Login URL for Salesforce auth requests - differs for production and sandbox
28
+	 * @param string $callback_url
29
+	 *   WordPress URL where Salesforce should send you after authentication
30
+	 * @param string $authorize_path
31
+	 *   Oauth path that Salesforce wants
32
+	 * @param string $token_path
33
+	 *   Path Salesforce uses to give you a token
34
+	 * @param string $rest_api_version
35
+	 *   What version of the Salesforce REST API to use
36
+	 * @param object $wordpress
37
+	 *   Object for doing things to WordPress - retrieving data, cache, etc.
38
+	 * @param string $slug
39
+	 *   Slug for this plugin. Can be used for file including, especially
40
+	 * @param object $logging
41
+	 *   Logging object for this plugin.
42
+	 * @param array $schedulable_classes
43
+	 *   array of classes that can have scheduled tasks specific to them
44
+	 */
45 45
 	public function __construct( $consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $logging, $schedulable_classes ) {
46 46
 		$this->consumer_key        = $consumer_key;
47 47
 		$this->consumer_secret     = $consumer_secret;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	/**
73
-	* Converts a 15-character case-sensitive Salesforce ID to 18-character
74
-	* case-insensitive ID. If input is not 15-characters, return input unaltered.
75
-	*
76
-	* @param string $sf_id_15
77
-	*   15-character case-sensitive Salesforce ID
78
-	* @return string
79
-	*   18-character case-insensitive Salesforce ID
80
-	*/
73
+	 * Converts a 15-character case-sensitive Salesforce ID to 18-character
74
+	 * case-insensitive ID. If input is not 15-characters, return input unaltered.
75
+	 *
76
+	 * @param string $sf_id_15
77
+	 *   15-character case-sensitive Salesforce ID
78
+	 * @return string
79
+	 *   18-character case-insensitive Salesforce ID
80
+	 */
81 81
 	public static function convert_id( $sf_id_15 ) {
82 82
 		if ( strlen( $sf_id_15 ) !== 15 ) {
83 83
 			return $sf_id_15;
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	/**
100
-	* Given a Salesforce ID, return the corresponding SObject name. (Based on
101
-	*  keyPrefix from object definition, @see
102
-	*  https://developer.salesforce.com/forums/?id=906F0000000901ZIAQ )
103
-	*
104
-	* @param string $sf_id
105
-	*   15- or 18-character Salesforce ID
106
-	* @return string
107
-	*   sObject name, e.g. "Account", "Contact", "my__Custom_Object__c" or FALSE
108
-	*   if no match could be found.
109
-	* @throws Object_Sync_Sf_Exception
110
-	*/
100
+	 * Given a Salesforce ID, return the corresponding SObject name. (Based on
101
+	 *  keyPrefix from object definition, @see
102
+	 *  https://developer.salesforce.com/forums/?id=906F0000000901ZIAQ )
103
+	 *
104
+	 * @param string $sf_id
105
+	 *   15- or 18-character Salesforce ID
106
+	 * @return string
107
+	 *   sObject name, e.g. "Account", "Contact", "my__Custom_Object__c" or FALSE
108
+	 *   if no match could be found.
109
+	 * @throws Object_Sync_Sf_Exception
110
+	 */
111 111
 	public function get_sobject_type( $sf_id ) {
112 112
 		$objects = $this->objects(
113 113
 			array(
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	}
125 125
 
126 126
 	/**
127
-	* Determine if this SF instance is fully configured.
128
-	*
129
-	*/
127
+	 * Determine if this SF instance is fully configured.
128
+	 *
129
+	 */
130 130
 	public function is_authorized() {
131 131
 		return ! empty( $this->consumer_key ) && ! empty( $this->consumer_secret ) && $this->get_refresh_token();
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Get REST API versions available on this Salesforce organization
136
-	* This is not an authenticated call, so it would not be a helpful test
137
-	*/
135
+	 * Get REST API versions available on this Salesforce organization
136
+	 * This is not an authenticated call, so it would not be a helpful test
137
+	 */
138 138
 	public function get_api_versions() {
139 139
 		$options = array(
140 140
 			'authenticated' => false,
@@ -144,26 +144,26 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	/**
147
-	* Make a call to the Salesforce REST API.
148
-	*
149
-	* @param string $path
150
-	*   Path to resource.
151
-	* @param array $params
152
-	*   Parameters to provide.
153
-	* @param string $method
154
-	*   Method to initiate the call, such as GET or POST. Defaults to GET.
155
-	* @param array $options
156
-	*   Any method can supply options for the API call, and they'll be preserved as far as the curl request
157
-	*   They get merged with the class options
158
-	* @param string $type
159
-	*   Type of call. Defaults to 'rest' - currently we don't support other types.
160
-	*   Other exammple in Drupal is 'apexrest'
161
-	*
162
-	* @return mixed
163
-	*   The requested response.
164
-	*
165
-	* @throws Object_Sync_Sf_Exception
166
-	*/
147
+	 * Make a call to the Salesforce REST API.
148
+	 *
149
+	 * @param string $path
150
+	 *   Path to resource.
151
+	 * @param array $params
152
+	 *   Parameters to provide.
153
+	 * @param string $method
154
+	 *   Method to initiate the call, such as GET or POST. Defaults to GET.
155
+	 * @param array $options
156
+	 *   Any method can supply options for the API call, and they'll be preserved as far as the curl request
157
+	 *   They get merged with the class options
158
+	 * @param string $type
159
+	 *   Type of call. Defaults to 'rest' - currently we don't support other types.
160
+	 *   Other exammple in Drupal is 'apexrest'
161
+	 *
162
+	 * @return mixed
163
+	 *   The requested response.
164
+	 *
165
+	 * @throws Object_Sync_Sf_Exception
166
+	 */
167 167
 	public function api_call( $path, $params = array(), $method = 'GET', $options = array(), $type = 'rest' ) {
168 168
 		if ( ! $this->get_access_token() ) {
169 169
 			$this->refresh_token();
@@ -214,25 +214,25 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* Private helper to issue an SF API request.
218
-	* This method is the only place where we read to or write from the cache
219
-	*
220
-	* @param string $path
221
-	*   Path to resource.
222
-	* @param array $params
223
-	*   Parameters to provide.
224
-	* @param string $method
225
-	*   Method to initiate the call, such as GET or POST.  Defaults to GET.
226
-	* @param array $options
227
-	*   This is the options array from the api_call method
228
-	*   This is where it gets merged with $this->options
229
-	* @param string $type
230
-	*   Type of call. Defaults to 'rest' - currently we don't support other types
231
-	*   Other exammple in Drupal is 'apexrest'
232
-	*
233
-	* @return array
234
-	*   The requested data.
235
-	*/
217
+	 * Private helper to issue an SF API request.
218
+	 * This method is the only place where we read to or write from the cache
219
+	 *
220
+	 * @param string $path
221
+	 *   Path to resource.
222
+	 * @param array $params
223
+	 *   Parameters to provide.
224
+	 * @param string $method
225
+	 *   Method to initiate the call, such as GET or POST.  Defaults to GET.
226
+	 * @param array $options
227
+	 *   This is the options array from the api_call method
228
+	 *   This is where it gets merged with $this->options
229
+	 * @param string $type
230
+	 *   Type of call. Defaults to 'rest' - currently we don't support other types
231
+	 *   Other exammple in Drupal is 'apexrest'
232
+	 *
233
+	 * @return array
234
+	 *   The requested data.
235
+	 */
236 236
 	protected function api_http_request( $path, $params, $method, $options = array(), $type = 'rest' ) {
237 237
 		$options = array_merge( $this->options, $options ); // this will override a value in $this->options with the one in $options if there is a matching key
238 238
 		$url     = $this->get_api_endpoint( $type ) . $path;
@@ -310,22 +310,22 @@  discard block
 block discarded – undo
310 310
 	}
311 311
 
312 312
 	/**
313
-	* Make the HTTP request. Wrapper around curl().
314
-	*
315
-	* @param string $url
316
-	*   Path to make request from.
317
-	* @param array $data
318
-	*   The request body.
319
-	* @param array $headers
320
-	*   Request headers to send as name => value.
321
-	* @param string $method
322
-	*   Method to initiate the call, such as GET or POST. Defaults to GET.
323
-	* @param array $options
324
-	*   This is the options array from the api_http_request method
325
-	*
326
-	* @return array
327
-	*   Salesforce response object.
328
-	*/
313
+	 * Make the HTTP request. Wrapper around curl().
314
+	 *
315
+	 * @param string $url
316
+	 *   Path to make request from.
317
+	 * @param array $data
318
+	 *   The request body.
319
+	 * @param array $headers
320
+	 *   Request headers to send as name => value.
321
+	 * @param string $method
322
+	 *   Method to initiate the call, such as GET or POST. Defaults to GET.
323
+	 * @param array $options
324
+	 *   This is the options array from the api_http_request method
325
+	 *
326
+	 * @return array
327
+	 *   Salesforce response object.
328
+	 */
329 329
 	protected function http_request( $url, $data, $headers = array(), $method = 'GET', $options = array() ) {
330 330
 		// Build the request, including path and headers. Internal use.
331 331
 
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 	}
461 461
 
462 462
 	/**
463
-	* Get the API end point for a given type of the API.
464
-	*
465
-	* @param string $api_type
466
-	*   E.g., rest, partner, enterprise.
467
-	*
468
-	* @return string
469
-	*   Complete URL endpoint for API access.
470
-	*/
463
+	 * Get the API end point for a given type of the API.
464
+	 *
465
+	 * @param string $api_type
466
+	 *   E.g., rest, partner, enterprise.
467
+	 *
468
+	 * @return string
469
+	 *   Complete URL endpoint for API access.
470
+	 */
471 471
 	public function get_api_endpoint( $api_type = 'rest' ) {
472 472
 		// Special handling for apexrest, since it's not in the identity object.
473 473
 		if ( 'apexrest' === $api_type ) {
@@ -483,67 +483,67 @@  discard block
 block discarded – undo
483 483
 	}
484 484
 
485 485
 	/**
486
-	* Get the SF instance URL. Useful for linking to objects.
487
-	*/
486
+	 * Get the SF instance URL. Useful for linking to objects.
487
+	 */
488 488
 	public function get_instance_url() {
489 489
 		return get_option( 'object_sync_for_salesforce_instance_url', '' );
490 490
 	}
491 491
 
492 492
 	/**
493
-	* Set the SF instanc URL.
494
-	*
495
-	* @param string $url
496
-	*   URL to set.
497
-	*/
493
+	 * Set the SF instanc URL.
494
+	 *
495
+	 * @param string $url
496
+	 *   URL to set.
497
+	 */
498 498
 	protected function set_instance_url( $url ) {
499 499
 		update_option( 'object_sync_for_salesforce_instance_url', $url );
500 500
 	}
501 501
 
502 502
 	/**
503
-	* Get the access token.
504
-	*/
503
+	 * Get the access token.
504
+	 */
505 505
 	public function get_access_token() {
506 506
 		return get_option( 'object_sync_for_salesforce_access_token', '' );
507 507
 	}
508 508
 
509 509
 	/**
510
-	* Set the access token.
511
-	*
512
-	* It is stored in session.
513
-	*
514
-	* @param string $token
515
-	*   Access token from Salesforce.
516
-	*/
510
+	 * Set the access token.
511
+	 *
512
+	 * It is stored in session.
513
+	 *
514
+	 * @param string $token
515
+	 *   Access token from Salesforce.
516
+	 */
517 517
 	protected function set_access_token( $token ) {
518 518
 		update_option( 'object_sync_for_salesforce_access_token', $token );
519 519
 	}
520 520
 
521 521
 	/**
522
-	* Get refresh token.
523
-	*/
522
+	 * Get refresh token.
523
+	 */
524 524
 	protected function get_refresh_token() {
525 525
 		return get_option( 'object_sync_for_salesforce_refresh_token', '' );
526 526
 	}
527 527
 
528 528
 	/**
529
-	* Set refresh token.
530
-	*
531
-	* @param string $token
532
-	*   Refresh token from Salesforce.
533
-	*/
529
+	 * Set refresh token.
530
+	 *
531
+	 * @param string $token
532
+	 *   Refresh token from Salesforce.
533
+	 */
534 534
 	protected function set_refresh_token( $token ) {
535 535
 		update_option( 'object_sync_for_salesforce_refresh_token', $token );
536 536
 	}
537 537
 
538 538
 	/**
539
-	* Refresh access token based on the refresh token. Updates session variable.
540
-	*
541
-	* todo: figure out how to do this as part of the schedule class
542
-	* this is a scheduleable class and so we could add a method from this class to run every 24 hours, but it's unclear to me that we need it. salesforce seems to refresh itself as it needs to.
543
-	* but it could be a performance boost to do it at scheduleable intervals instead.
544
-	*
545
-	* @throws Object_Sync_Sf_Exception
546
-	*/
539
+	 * Refresh access token based on the refresh token. Updates session variable.
540
+	 *
541
+	 * todo: figure out how to do this as part of the schedule class
542
+	 * this is a scheduleable class and so we could add a method from this class to run every 24 hours, but it's unclear to me that we need it. salesforce seems to refresh itself as it needs to.
543
+	 * but it could be a performance boost to do it at scheduleable intervals instead.
544
+	 *
545
+	 * @throws Object_Sync_Sf_Exception
546
+	 */
547 547
 	protected function refresh_token() {
548 548
 		$refresh_token = $this->get_refresh_token();
549 549
 		if ( empty( $refresh_token ) ) {
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
 	}
591 591
 
592 592
 	/**
593
-	* Retrieve and store the Salesforce identity given an ID url.
594
-	*
595
-	* @param string $id
596
-	*   Identity URL.
597
-	*
598
-	* @throws Object_Sync_Sf_Exception
599
-	*/
593
+	 * Retrieve and store the Salesforce identity given an ID url.
594
+	 *
595
+	 * @param string $id
596
+	 *   Identity URL.
597
+	 *
598
+	 * @throws Object_Sync_Sf_Exception
599
+	 */
600 600
 	protected function set_identity( $id ) {
601 601
 		$headers  = array(
602 602
 			'Authorization'   => 'Authorization: OAuth ' . $this->get_access_token(),
@@ -612,18 +612,18 @@  discard block
 block discarded – undo
612 612
 	}
613 613
 
614 614
 	/**
615
-	* Return the Salesforce identity, which is stored in a variable.
616
-	*
617
-	* @return array
618
-	*   Returns FALSE if no identity has been stored.
619
-	*/
615
+	 * Return the Salesforce identity, which is stored in a variable.
616
+	 *
617
+	 * @return array
618
+	 *   Returns FALSE if no identity has been stored.
619
+	 */
620 620
 	public function get_identity() {
621 621
 		return get_option( 'object_sync_for_salesforce_identity', false );
622 622
 	}
623 623
 
624 624
 	/**
625
-	* OAuth step 1: Redirect to Salesforce and request and authorization code.
626
-	*/
625
+	 * OAuth step 1: Redirect to Salesforce and request and authorization code.
626
+	 */
627 627
 	public function get_authorization_code() {
628 628
 		$url = add_query_arg(
629 629
 			array(
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
 	}
638 638
 
639 639
 	/**
640
-	* OAuth step 2: Exchange an authorization code for an access token.
641
-	*
642
-	* @param string $code
643
-	*   Code from Salesforce.
644
-	*/
640
+	 * OAuth step 2: Exchange an authorization code for an access token.
641
+	 *
642
+	 * @param string $code
643
+	 *   Code from Salesforce.
644
+	 */
645 645
 	public function request_token( $code ) {
646 646
 		$data = array(
647 647
 			'code'          => $code,
@@ -686,22 +686,22 @@  discard block
 block discarded – undo
686 686
 	/* Core API calls */
687 687
 
688 688
 	/**
689
-	* Available objects and their metadata for your organization's data.
690
-	*
691
-	* @param array $conditions
692
-	*   Associative array of filters to apply to the returned objects. Filters
693
-	*   are applied after the list is returned from Salesforce.
694
-	* @param bool $reset
695
-	*   Whether to reset the cache and retrieve a fresh version from Salesforce.
696
-	*
697
-	* @return array
698
-	*   Available objects and metadata.
699
-	*
700
-	* part of core API calls. this call does require authentication, and the basic url it becomes is like this:
701
-	* https://instance.salesforce.com/services/data/v#.0/sobjects
702
-	*
703
-	* updateable is really how the api spells it
704
-	*/
689
+	 * Available objects and their metadata for your organization's data.
690
+	 *
691
+	 * @param array $conditions
692
+	 *   Associative array of filters to apply to the returned objects. Filters
693
+	 *   are applied after the list is returned from Salesforce.
694
+	 * @param bool $reset
695
+	 *   Whether to reset the cache and retrieve a fresh version from Salesforce.
696
+	 *
697
+	 * @return array
698
+	 *   Available objects and metadata.
699
+	 *
700
+	 * part of core API calls. this call does require authentication, and the basic url it becomes is like this:
701
+	 * https://instance.salesforce.com/services/data/v#.0/sobjects
702
+	 *
703
+	 * updateable is really how the api spells it
704
+	 */
705 705
 	public function objects(
706 706
 		$conditions = array(
707 707
 			'updateable'  => true,
@@ -731,22 +731,22 @@  discard block
 block discarded – undo
731 731
 	}
732 732
 
733 733
 	/**
734
-	* Use SOQL to get objects based on query string.
735
-	*
736
-	* @param string $query
737
-	*   The SOQL query.
738
-	* @param array $options
739
-	*   Allow for the query to have options based on what the user needs from it, ie caching, read/write, etc.
740
-	* @param boolean $all
741
-	*   Whether this should get all results for the query
742
-	* @param boolean $explain
743
-	*   If set, Salesforce will return feedback on the query performance
744
-	*
745
-	* @return array
746
-	*   Array of Salesforce objects that match the query.
747
-	*
748
-	* part of core API calls
749
-	*/
734
+	 * Use SOQL to get objects based on query string.
735
+	 *
736
+	 * @param string $query
737
+	 *   The SOQL query.
738
+	 * @param array $options
739
+	 *   Allow for the query to have options based on what the user needs from it, ie caching, read/write, etc.
740
+	 * @param boolean $all
741
+	 *   Whether this should get all results for the query
742
+	 * @param boolean $explain
743
+	 *   If set, Salesforce will return feedback on the query performance
744
+	 *
745
+	 * @return array
746
+	 *   Array of Salesforce objects that match the query.
747
+	 *
748
+	 * part of core API calls
749
+	 */
750 750
 	public function query( $query, $options = array(), $all = false, $explain = false ) {
751 751
 		$search_data = [
752 752
 			'q' => (string) $query,
@@ -766,19 +766,19 @@  discard block
 block discarded – undo
766 766
 	}
767 767
 
768 768
 	/**
769
-	* Retrieve all the metadata for an object.
770
-	*
771
-	* @param string $name
772
-	*   Object type name, E.g., Contact, Account, etc.
773
-	* @param bool $reset
774
-	*   Whether to reset the cache and retrieve a fresh version from Salesforce.
775
-	*
776
-	* @return array
777
-	*   All the metadata for an object, including information about each field,
778
-	*   URLs, and child relationships.
779
-	*
780
-	* part of core API calls
781
-	*/
769
+	 * Retrieve all the metadata for an object.
770
+	 *
771
+	 * @param string $name
772
+	 *   Object type name, E.g., Contact, Account, etc.
773
+	 * @param bool $reset
774
+	 *   Whether to reset the cache and retrieve a fresh version from Salesforce.
775
+	 *
776
+	 * @return array
777
+	 *   All the metadata for an object, including information about each field,
778
+	 *   URLs, and child relationships.
779
+	 *
780
+	 * part of core API calls
781
+	 */
782 782
 	public function object_describe( $name, $reset = false ) {
783 783
 		if ( empty( $name ) ) {
784 784
 			return array();
@@ -806,26 +806,26 @@  discard block
 block discarded – undo
806 806
 	}
807 807
 
808 808
 	/**
809
-	* Create a new object of the given type.
810
-	*
811
-	* @param string $name
812
-	*   Object type name, E.g., Contact, Account, etc.
813
-	* @param array $params
814
-	*   Values of the fields to set for the object.
815
-	*
816
-	* @return array
817
-	*   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
818
-	*   code: 201
819
-	*   data:
820
-	*     "id" : "00190000001pPvHAAU",
821
-	*     "success" : true
822
-	*     "errors" : [ ],
823
-	*   from_cache:
824
-	*   cached:
825
-	*   is_redo:
826
-	*
827
-	* part of core API calls
828
-	*/
809
+	 * Create a new object of the given type.
810
+	 *
811
+	 * @param string $name
812
+	 *   Object type name, E.g., Contact, Account, etc.
813
+	 * @param array $params
814
+	 *   Values of the fields to set for the object.
815
+	 *
816
+	 * @return array
817
+	 *   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
818
+	 *   code: 201
819
+	 *   data:
820
+	 *     "id" : "00190000001pPvHAAU",
821
+	 *     "success" : true
822
+	 *     "errors" : [ ],
823
+	 *   from_cache:
824
+	 *   cached:
825
+	 *   is_redo:
826
+	 *
827
+	 * part of core API calls
828
+	 */
829 829
 	public function object_create( $name, $params ) {
830 830
 		$options = array(
831 831
 			'type' => 'write',
@@ -835,34 +835,34 @@  discard block
 block discarded – undo
835 835
 	}
836 836
 
837 837
 	/**
838
-	* Create new records or update existing records.
839
-	*
840
-	* The new records or updated records are based on the value of the specified
841
-	* field.  If the value is not unique, REST API returns a 300 response with
842
-	* the list of matching records.
843
-	*
844
-	* @param string $name
845
-	*   Object type name, E.g., Contact, Account.
846
-	* @param string $key
847
-	*   The field to check if this record should be created or updated.
848
-	* @param string $value
849
-	*   The value for this record of the field specified for $key.
850
-	* @param array $params
851
-	*   Values of the fields to set for the object.
852
-	*
853
-	* @return array
854
-	*   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
855
-	*   code: 201
856
-	*   data:
857
-	*     "id" : "00190000001pPvHAAU",
858
-	*     "success" : true
859
-	*     "errors" : [ ],
860
-	*   from_cache:
861
-	*   cached:
862
-	*   is_redo:
863
-	*
864
-	* part of core API calls
865
-	*/
838
+	 * Create new records or update existing records.
839
+	 *
840
+	 * The new records or updated records are based on the value of the specified
841
+	 * field.  If the value is not unique, REST API returns a 300 response with
842
+	 * the list of matching records.
843
+	 *
844
+	 * @param string $name
845
+	 *   Object type name, E.g., Contact, Account.
846
+	 * @param string $key
847
+	 *   The field to check if this record should be created or updated.
848
+	 * @param string $value
849
+	 *   The value for this record of the field specified for $key.
850
+	 * @param array $params
851
+	 *   Values of the fields to set for the object.
852
+	 *
853
+	 * @return array
854
+	 *   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
855
+	 *   code: 201
856
+	 *   data:
857
+	 *     "id" : "00190000001pPvHAAU",
858
+	 *     "success" : true
859
+	 *     "errors" : [ ],
860
+	 *   from_cache:
861
+	 *   cached:
862
+	 *   is_redo:
863
+	 *
864
+	 * part of core API calls
865
+	 */
866 866
 	public function object_upsert( $name, $key, $value, $params ) {
867 867
 		$options = array(
868 868
 			'type' => 'write',
@@ -884,27 +884,27 @@  discard block
 block discarded – undo
884 884
 	}
885 885
 
886 886
 	/**
887
-	* Update an existing object.
888
-	*
889
-	* @param string $name
890
-	*   Object type name, E.g., Contact, Account.
891
-	* @param string $id
892
-	*   Salesforce id of the object.
893
-	* @param array $params
894
-	*   Values of the fields to set for the object.
895
-	*
896
-	* part of core API calls
897
-	*
898
-	* @return array
899
-	*   json: {"success":true,"body":""}
900
-	*   code: 204
901
-	*   data:
887
+	 * Update an existing object.
888
+	 *
889
+	 * @param string $name
890
+	 *   Object type name, E.g., Contact, Account.
891
+	 * @param string $id
892
+	 *   Salesforce id of the object.
893
+	 * @param array $params
894
+	 *   Values of the fields to set for the object.
895
+	 *
896
+	 * part of core API calls
897
+	 *
898
+	 * @return array
899
+	 *   json: {"success":true,"body":""}
900
+	 *   code: 204
901
+	 *   data:
902 902
 		success: 1
903 903
 		body:
904
-	*   from_cache:
905
-	*   cached:
906
-	*   is_redo:
907
-	*/
904
+	 *   from_cache:
905
+	 *   cached:
906
+	 *   is_redo:
907
+	 */
908 908
 	public function object_update( $name, $id, $params ) {
909 909
 		$options = array(
910 910
 			'type' => 'write',
@@ -914,62 +914,62 @@  discard block
 block discarded – undo
914 914
 	}
915 915
 
916 916
 	/**
917
-	* Return a full loaded Salesforce object.
918
-	*
919
-	* @param string $name
920
-	*   Object type name, E.g., Contact, Account.
921
-	* @param string $id
922
-	*   Salesforce id of the object.
923
-	*
924
-	* @return object
925
-	*   Object of the requested Salesforce object.
926
-	*
927
-	* part of core API calls
928
-	*/
917
+	 * Return a full loaded Salesforce object.
918
+	 *
919
+	 * @param string $name
920
+	 *   Object type name, E.g., Contact, Account.
921
+	 * @param string $id
922
+	 *   Salesforce id of the object.
923
+	 *
924
+	 * @return object
925
+	 *   Object of the requested Salesforce object.
926
+	 *
927
+	 * part of core API calls
928
+	 */
929 929
 	public function object_read( $name, $id ) {
930 930
 		return $this->api_call( "sobjects/{$name}/{$id}", array(), 'GET' );
931 931
 	}
932 932
 
933 933
 	/**
934
-	* Make a call to the Analytics API
935
-	*
936
-	* @param string $name
937
-	*   Object type name, E.g., Report
938
-	* @param string $id
939
-	*   Salesforce id of the object.
940
-	* @param string $route
941
-	*   What comes after the ID? E.g. instances, ?includeDetails=True
942
-	* @param array $params
943
-	*   Params to put with the request
944
-	* @param string $method
945
-	*   GET or POST
946
-	*
947
-	* @return object
948
-	*   Object of the requested Salesforce object.
949
-	*
950
-	* part of core API calls
951
-	*/
934
+	 * Make a call to the Analytics API
935
+	 *
936
+	 * @param string $name
937
+	 *   Object type name, E.g., Report
938
+	 * @param string $id
939
+	 *   Salesforce id of the object.
940
+	 * @param string $route
941
+	 *   What comes after the ID? E.g. instances, ?includeDetails=True
942
+	 * @param array $params
943
+	 *   Params to put with the request
944
+	 * @param string $method
945
+	 *   GET or POST
946
+	 *
947
+	 * @return object
948
+	 *   Object of the requested Salesforce object.
949
+	 *
950
+	 * part of core API calls
951
+	 */
952 952
 	public function analytics_api( $name, $id, $route = '', $params = array(), $method = 'GET' ) {
953 953
 		return $this->api_call( "analytics/{$name}/{$id}/{$route}", $params, $method );
954 954
 	}
955 955
 
956 956
 	/**
957
-	* Run a specific Analytics report
958
-	*
959
-	* @param string $id
960
-	*   Salesforce id of the object.
961
-	* @param bool $async
962
-	*   Whether the report is asynchronous
963
-	* @param array $params
964
-	*   Params to put with the request
965
-	* @param string $method
966
-	*   GET or POST
967
-	*
968
-	* @return object
969
-	*   Object of the requested Salesforce object.
970
-	*
971
-	* part of core API calls
972
-	*/
957
+	 * Run a specific Analytics report
958
+	 *
959
+	 * @param string $id
960
+	 *   Salesforce id of the object.
961
+	 * @param bool $async
962
+	 *   Whether the report is asynchronous
963
+	 * @param array $params
964
+	 *   Params to put with the request
965
+	 * @param string $method
966
+	 *   GET or POST
967
+	 *
968
+	 * @return object
969
+	 *   Object of the requested Salesforce object.
970
+	 *
971
+	 * part of core API calls
972
+	 */
973 973
 	public function run_analytics_report( $id, $async = true, $clear_cache = false, $params = array(), $method = 'GET', $report_cache_expiration = '', $cache_instance = true, $instance_cache_expiration = '' ) {
974 974
 
975 975
 		$id         = $this->convert_id( $id );
@@ -1055,36 +1055,36 @@  discard block
 block discarded – undo
1055 1055
 	}
1056 1056
 
1057 1057
 	/**
1058
-	* Return a full loaded Salesforce object from External ID.
1059
-	*
1060
-	* @param string $name
1061
-	*   Object type name, E.g., Contact, Account.
1062
-	* @param string $field
1063
-	*   Salesforce external id field name.
1064
-	* @param string $value
1065
-	*   Value of external id.
1066
-	*
1067
-	* @return object
1068
-	*   Object of the requested Salesforce object.
1069
-	*
1070
-	* part of core API calls
1071
-	*/
1058
+	 * Return a full loaded Salesforce object from External ID.
1059
+	 *
1060
+	 * @param string $name
1061
+	 *   Object type name, E.g., Contact, Account.
1062
+	 * @param string $field
1063
+	 *   Salesforce external id field name.
1064
+	 * @param string $value
1065
+	 *   Value of external id.
1066
+	 *
1067
+	 * @return object
1068
+	 *   Object of the requested Salesforce object.
1069
+	 *
1070
+	 * part of core API calls
1071
+	 */
1072 1072
 	public function object_readby_external_id( $name, $field, $value ) {
1073 1073
 		return $this->api_call( "sobjects/{$name}/{$field}/{$value}" );
1074 1074
 	}
1075 1075
 
1076 1076
 	/**
1077
-	* Delete a Salesforce object.
1078
-	*
1079
-	* @param string $name
1080
-	*   Object type name, E.g., Contact, Account.
1081
-	* @param string $id
1082
-	*   Salesforce id of the object.
1083
-	*
1084
-	* @return array
1085
-	*
1086
-	* part of core API calls
1087
-	*/
1077
+	 * Delete a Salesforce object.
1078
+	 *
1079
+	 * @param string $name
1080
+	 *   Object type name, E.g., Contact, Account.
1081
+	 * @param string $id
1082
+	 *   Salesforce id of the object.
1083
+	 *
1084
+	 * @return array
1085
+	 *
1086
+	 * part of core API calls
1087
+	 */
1088 1088
 	public function object_delete( $name, $id ) {
1089 1089
 		$options = array(
1090 1090
 			'type' => 'write',
@@ -1094,17 +1094,17 @@  discard block
 block discarded – undo
1094 1094
 	}
1095 1095
 
1096 1096
 	/**
1097
-	* Retrieves the list of individual objects that have been deleted within the
1098
-	* given timespan for a specified object type.
1099
-	*
1100
-	* @param string $type
1101
-	*   Object type name, E.g., Contact, Account.
1102
-	* @param string $startDate
1103
-	*   Start date to check for deleted objects (in ISO 8601 format).
1104
-	* @param string $endDate
1105
-	*   End date to check for deleted objects (in ISO 8601 format).
1106
-	* @return GetDeletedResult
1107
-	*/
1097
+	 * Retrieves the list of individual objects that have been deleted within the
1098
+	 * given timespan for a specified object type.
1099
+	 *
1100
+	 * @param string $type
1101
+	 *   Object type name, E.g., Contact, Account.
1102
+	 * @param string $startDate
1103
+	 *   Start date to check for deleted objects (in ISO 8601 format).
1104
+	 * @param string $endDate
1105
+	 *   End date to check for deleted objects (in ISO 8601 format).
1106
+	 * @return GetDeletedResult
1107
+	 */
1108 1108
 	public function get_deleted( $type, $start_date, $end_date ) {
1109 1109
 		$options = array(
1110 1110
 			'cache' => false,
@@ -1114,13 +1114,13 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
 
1116 1116
 	/**
1117
-	* Return a list of available resources for the configured API version.
1118
-	*
1119
-	* @return array
1120
-	*   Associative array keyed by name with a URI value.
1121
-	*
1122
-	* part of core API calls
1123
-	*/
1117
+	 * Return a list of available resources for the configured API version.
1118
+	 *
1119
+	 * @return array
1120
+	 *   Associative array keyed by name with a URI value.
1121
+	 *
1122
+	 * part of core API calls
1123
+	 */
1124 1124
 	public function list_resources() {
1125 1125
 		$resources = $this->api_call( '' );
1126 1126
 		foreach ( $resources as $key => $path ) {
@@ -1130,31 +1130,31 @@  discard block
 block discarded – undo
1130 1130
 	}
1131 1131
 
1132 1132
 	/**
1133
-	* Return a list of SFIDs for the given object, which have been created or
1134
-	* updated in the given timeframe.
1135
-	*
1136
-	* @param string $type
1137
-	*   Object type name, E.g., Contact, Account.
1138
-	*
1139
-	* @param int $start
1140
-	*   unix timestamp for older timeframe for updates.
1141
-	*   Defaults to "-29 days" if empty.
1142
-	*
1143
-	* @param int $end
1144
-	*   unix timestamp for end of timeframe for updates.
1145
-	*   Defaults to now if empty
1146
-	*
1147
-	* @return array
1148
-	*   return array has 2 indexes:
1149
-	*     "ids": a list of SFIDs of those records which have been created or
1150
-	*       updated in the given timeframe.
1151
-	*     "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date
1152
-	*       covered in the request.
1153
-	*
1154
-	* @see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
1155
-	*
1156
-	* part of core API calls
1157
-	*/
1133
+	 * Return a list of SFIDs for the given object, which have been created or
1134
+	 * updated in the given timeframe.
1135
+	 *
1136
+	 * @param string $type
1137
+	 *   Object type name, E.g., Contact, Account.
1138
+	 *
1139
+	 * @param int $start
1140
+	 *   unix timestamp for older timeframe for updates.
1141
+	 *   Defaults to "-29 days" if empty.
1142
+	 *
1143
+	 * @param int $end
1144
+	 *   unix timestamp for end of timeframe for updates.
1145
+	 *   Defaults to now if empty
1146
+	 *
1147
+	 * @return array
1148
+	 *   return array has 2 indexes:
1149
+	 *     "ids": a list of SFIDs of those records which have been created or
1150
+	 *       updated in the given timeframe.
1151
+	 *     "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date
1152
+	 *       covered in the request.
1153
+	 *
1154
+	 * @see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
1155
+	 *
1156
+	 * part of core API calls
1157
+	 */
1158 1158
 	public function get_updated( $type, $start = null, $end = null ) {
1159 1159
 		if ( empty( $start ) ) {
1160 1160
 			$start = strtotime( '-29 days' );
@@ -1173,19 +1173,19 @@  discard block
 block discarded – undo
1173 1173
 	}
1174 1174
 
1175 1175
 	/**
1176
-	* Given a DeveloperName and SObject Name, return the SFID of the
1177
-	* corresponding RecordType. DeveloperName doesn't change between Salesforce
1178
-	* environments, so it's safer to rely on compared to SFID.
1179
-	*
1180
-	* @param string $name
1181
-	*   Object type name, E.g., Contact, Account.
1182
-	*
1183
-	* @param string $devname
1184
-	*   RecordType DeveloperName, e.g. Donation, Membership, etc.
1185
-	*
1186
-	* @return string SFID
1187
-	*   The Salesforce ID of the given Record Type, or null.
1188
-	*/
1176
+	 * Given a DeveloperName and SObject Name, return the SFID of the
1177
+	 * corresponding RecordType. DeveloperName doesn't change between Salesforce
1178
+	 * environments, so it's safer to rely on compared to SFID.
1179
+	 *
1180
+	 * @param string $name
1181
+	 *   Object type name, E.g., Contact, Account.
1182
+	 *
1183
+	 * @param string $devname
1184
+	 *   RecordType DeveloperName, e.g. Donation, Membership, etc.
1185
+	 *
1186
+	 * @return string SFID
1187
+	 *   The Salesforce ID of the given Record Type, or null.
1188
+	 */
1189 1189
 
1190 1190
 	public function get_record_type_id_by_developer_name( $name, $devname, $reset = false ) {
1191 1191
 
@@ -1213,10 +1213,10 @@  discard block
 block discarded – undo
1213 1213
 	}
1214 1214
 
1215 1215
 	/**
1216
-	* If there is a WordPress setting for how long to keep the cache, return it and set the object property
1217
-	* Otherwise, return seconds in 24 hours
1218
-	*
1219
-	*/
1216
+	 * If there is a WordPress setting for how long to keep the cache, return it and set the object property
1217
+	 * Otherwise, return seconds in 24 hours
1218
+	 *
1219
+	 */
1220 1220
 	private function cache_expiration() {
1221 1221
 		$cache_expiration = $this->wordpress->cache_expiration( 'object_sync_for_salesforce_cache_expiration', 86400 );
1222 1222
 		return $cache_expiration;
Please login to merge, or discard this patch.
classes/admin.php 1 patch
Indentation   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -27,63 +27,63 @@  discard block
 block discarded – undo
27 27
 	protected $queue;
28 28
 
29 29
 	/**
30
-	* @var string
31
-	* Default path for the Salesforce authorize URL
32
-	*/
30
+	 * @var string
31
+	 * Default path for the Salesforce authorize URL
32
+	 */
33 33
 	public $default_authorize_url_path;
34 34
 
35 35
 	/**
36
-	* @var string
37
-	* Default path for the Salesforce token URL
38
-	*/
36
+	 * @var string
37
+	 * Default path for the Salesforce token URL
38
+	 */
39 39
 	public $default_token_url_path;
40 40
 
41 41
 	/**
42
-	* @var string
43
-	* What version of the Salesforce API should be the default on the settings screen.
44
-	* Users can edit this, but they won't see a correct list of all their available versions until WordPress has
45
-	* been authenticated with Salesforce.
46
-	*/
42
+	 * @var string
43
+	 * What version of the Salesforce API should be the default on the settings screen.
44
+	 * Users can edit this, but they won't see a correct list of all their available versions until WordPress has
45
+	 * been authenticated with Salesforce.
46
+	 */
47 47
 	public $default_api_version;
48 48
 
49 49
 	/**
50
-	* @var bool
51
-	* Default for whether to limit to triggerable items
52
-	* Users can edit this
53
-	*/
50
+	 * @var bool
51
+	 * Default for whether to limit to triggerable items
52
+	 * Users can edit this
53
+	 */
54 54
 	public $default_triggerable;
55 55
 
56 56
 	/**
57
-	* @var bool
58
-	* Default for whether to limit to updateable items
59
-	* Users can edit this
60
-	*/
57
+	 * @var bool
58
+	 * Default for whether to limit to updateable items
59
+	 * Users can edit this
60
+	 */
61 61
 	public $default_updateable;
62 62
 
63 63
 	/**
64
-	* @var int
65
-	* Default pull throttle for how often Salesforce can pull
66
-	* Users can edit this
67
-	*/
64
+	 * @var int
65
+	 * Default pull throttle for how often Salesforce can pull
66
+	 * Users can edit this
67
+	 */
68 68
 	public $default_pull_throttle;
69 69
 
70 70
 	/**
71
-	* Constructor which sets up admin pages
72
-	*
73
-	* @param object $wpdb
74
-	* @param string $version
75
-	* @param array $login_credentials
76
-	* @param string $slug
77
-	* @param object $wordpress
78
-	* @param object $salesforce
79
-	* @param object $mappings
80
-	* @param object $push
81
-	* @param object $pull
82
-	* @param object $logging
83
-	* @param array $schedulable_classes
84
-	* @param object $queue
85
-	* @throws \Exception
86
-	*/
71
+	 * Constructor which sets up admin pages
72
+	 *
73
+	 * @param object $wpdb
74
+	 * @param string $version
75
+	 * @param array $login_credentials
76
+	 * @param string $slug
77
+	 * @param object $wordpress
78
+	 * @param object $salesforce
79
+	 * @param object $mappings
80
+	 * @param object $push
81
+	 * @param object $pull
82
+	 * @param object $logging
83
+	 * @param array $schedulable_classes
84
+	 * @param object $queue
85
+	 * @throws \Exception
86
+	 */
87 87
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ) {
88 88
 		$this->wpdb                = $wpdb;
89 89
 		$this->version             = $version;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 
122 122
 	/**
123
-	* Create the action hooks to create the admin page(s)
124
-	*
125
-	*/
123
+	 * Create the action hooks to create the admin page(s)
124
+	 *
125
+	 */
126 126
 	public function add_actions() {
127 127
 		add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) );
128 128
 		add_action( 'admin_init', array( $this, 'notices' ) );
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	}
158 158
 
159 159
 	/**
160
-	* Recurring task to check Salesforce for data
161
-	*
162
-	*/
160
+	 * Recurring task to check Salesforce for data
161
+	 *
162
+	 */
163 163
 	public function change_action_schedule( $old_schedule, $new_schedule, $option_name ) {
164 164
 
165 165
 		// exit if nothing changed
@@ -195,21 +195,21 @@  discard block
 block discarded – undo
195 195
 	}
196 196
 
197 197
 	/**
198
-	* Create WordPress admin options page
199
-	*
200
-	*/
198
+	 * Create WordPress admin options page
199
+	 *
200
+	 */
201 201
 	public function create_admin_menu() {
202 202
 		$title = __( 'Salesforce', 'object-sync-for-salesforce' );
203 203
 		add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) );
204 204
 	}
205 205
 
206 206
 	/**
207
-	* Render full admin pages in WordPress
208
-	* This allows other plugins to add tabs to the Salesforce settings screen
209
-	*
210
-	* todo: better front end: html, organization of html into templates, css, js
211
-	*
212
-	*/
207
+	 * Render full admin pages in WordPress
208
+	 * This allows other plugins to add tabs to the Salesforce settings screen
209
+	 *
210
+	 * todo: better front end: html, organization of html into templates, css, js
211
+	 *
212
+	 */
213 213
 	public function show_admin_page() {
214 214
 		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
215 215
 		echo '<div class="wrap">';
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 	}
420 420
 
421 421
 	/**
422
-	* Create default WordPress admin settings form for salesforce
423
-	* This is for the Settings page/tab
424
-	*
425
-	*/
422
+	 * Create default WordPress admin settings form for salesforce
423
+	 * This is for the Settings page/tab
424
+	 *
425
+	 */
426 426
 	public function salesforce_settings_forms() {
427 427
 		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
428 428
 		$page     = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
 	}
448 448
 
449 449
 	/**
450
-	* Fields for the Settings tab
451
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
452
-	*
453
-	* @param string $page
454
-	* @param string $section
455
-	* @param string $input_callback
456
-	*/
450
+	 * Fields for the Settings tab
451
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
452
+	 *
453
+	 * @param string $page
454
+	 * @param string $section
455
+	 * @param string $input_callback
456
+	 */
457 457
 	private function fields_settings( $page, $section, $callbacks ) {
458 458
 		add_settings_section( $page, ucwords( $page ), null, $page );
459 459
 		$salesforce_settings = array(
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 	}
688 688
 
689 689
 	/**
690
-	* Fields for the Fieldmaps tab
691
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
692
-	*
693
-	* @param string $page
694
-	* @param string $section
695
-	* @param string $input_callback
696
-	*/
690
+	 * Fields for the Fieldmaps tab
691
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
692
+	 *
693
+	 * @param string $page
694
+	 * @param string $section
695
+	 * @param string $input_callback
696
+	 */
697 697
 	private function fields_fieldmaps( $page, $section, $input_callback = '' ) {
698 698
 		add_settings_section( $page, ucwords( $page ), null, $page );
699 699
 	}
700 700
 
701 701
 	/**
702
-	* Fields for the Scheduling tab
703
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
704
-	*
705
-	* @param string $page
706
-	* @param string $section
707
-	* @param string $input_callback
708
-	*/
702
+	 * Fields for the Scheduling tab
703
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
704
+	 *
705
+	 * @param string $page
706
+	 * @param string $section
707
+	 * @param string $input_callback
708
+	 */
709 709
 	private function fields_scheduling( $page, $section, $callbacks ) {
710 710
 		foreach ( $this->schedulable_classes as $key => $value ) {
711 711
 			add_settings_section( $key, $value['label'], null, $page );
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
 	}
785 785
 
786 786
 	/**
787
-	* Fields for the Log Settings tab
788
-	* This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
789
-	*
790
-	* @param string $page
791
-	* @param string $section
792
-	* @param array $callbacks
793
-	*/
787
+	 * Fields for the Log Settings tab
788
+	 * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option
789
+	 *
790
+	 * @param string $page
791
+	 * @param string $section
792
+	 * @param array $callbacks
793
+	 */
794 794
 	private function fields_log_settings( $page, $section, $callbacks ) {
795 795
 		add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page );
796 796
 		$log_settings = array(
@@ -968,9 +968,9 @@  discard block
 block discarded – undo
968 968
 	}
969 969
 
970 970
 	/**
971
-	* Create the notices, settings, and conditions by which admin notices should appear
972
-	*
973
-	*/
971
+	 * Create the notices, settings, and conditions by which admin notices should appear
972
+	 *
973
+	 */
974 974
 	public function notices() {
975 975
 
976 976
 		// before a notice is displayed, we should make sure we are on a page related to this plugin
@@ -1043,14 +1043,14 @@  discard block
 block discarded – undo
1043 1043
 	}
1044 1044
 
1045 1045
 	/**
1046
-	* Get all the Salesforce object settings for fieldmapping
1047
-	* This takes either the $_POST array via ajax, or can be directly called with a $data array
1048
-	*
1049
-	* @param array $data
1050
-	* data must contain a salesforce_object
1051
-	* can optionally contain a type
1052
-	* @return array $object_settings
1053
-	*/
1046
+	 * Get all the Salesforce object settings for fieldmapping
1047
+	 * This takes either the $_POST array via ajax, or can be directly called with a $data array
1048
+	 *
1049
+	 * @param array $data
1050
+	 * data must contain a salesforce_object
1051
+	 * can optionally contain a type
1052
+	 * @return array $object_settings
1053
+	 */
1054 1054
 	public function get_salesforce_object_description( $data = array() ) {
1055 1055
 		$ajax = false;
1056 1056
 		if ( empty( $data ) ) {
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 	}
1099 1099
 
1100 1100
 	/**
1101
-	* Get Salesforce object fields for fieldmapping
1102
-	*
1103
-	* @param array $data
1104
-	* data must contain a salesforce_object
1105
-	* can optionally contain a type for the field
1106
-	* @return array $object_fields
1107
-	*/
1101
+	 * Get Salesforce object fields for fieldmapping
1102
+	 *
1103
+	 * @param array $data
1104
+	 * data must contain a salesforce_object
1105
+	 * can optionally contain a type for the field
1106
+	 * @return array $object_fields
1107
+	 */
1108 1108
 	public function get_salesforce_object_fields( $data = array() ) {
1109 1109
 
1110 1110
 		if ( ! empty( $data['salesforce_object'] ) ) {
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
 	}
1133 1133
 
1134 1134
 	/**
1135
-	* Get WordPress object fields for fieldmapping
1136
-	* This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field
1137
-	*
1138
-	* @param string $wordpress_object
1139
-	* @return array $object_fields
1140
-	*/
1135
+	 * Get WordPress object fields for fieldmapping
1136
+	 * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field
1137
+	 *
1138
+	 * @param string $wordpress_object
1139
+	 * @return array $object_fields
1140
+	 */
1141 1141
 	public function get_wordpress_object_fields( $wordpress_object = '' ) {
1142 1142
 		$ajax      = false;
1143 1143
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
@@ -1156,13 +1156,13 @@  discard block
 block discarded – undo
1156 1156
 	}
1157 1157
 
1158 1158
 	/**
1159
-	* Get WordPress and Salesforce object fields together for fieldmapping
1160
-	* This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields
1161
-	*
1162
-	* @param string $wordpress_object
1163
-	* @param string $salesforce_object
1164
-	* @return array $object_fields
1165
-	*/
1159
+	 * Get WordPress and Salesforce object fields together for fieldmapping
1160
+	 * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields
1161
+	 *
1162
+	 * @param string $wordpress_object
1163
+	 * @param string $salesforce_object
1164
+	 * @return array $object_fields
1165
+	 */
1166 1166
 	public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) {
1167 1167
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1168 1168
 		if ( empty( $wordpress_object ) ) {
@@ -1187,12 +1187,12 @@  discard block
 block discarded – undo
1187 1187
 	}
1188 1188
 
1189 1189
 	/**
1190
-	* Manually push the WordPress object to Salesforce
1191
-	* This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields
1192
-	*
1193
-	* @param string $wordpress_object
1194
-	* @param int $wordpress_id
1195
-	*/
1190
+	 * Manually push the WordPress object to Salesforce
1191
+	 * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields
1192
+	 *
1193
+	 * @param string $wordpress_object
1194
+	 * @param int $wordpress_id
1195
+	 */
1196 1196
 	public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) {
1197 1197
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1198 1198
 		if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
@@ -1211,12 +1211,12 @@  discard block
 block discarded – undo
1211 1211
 	}
1212 1212
 
1213 1213
 	/**
1214
-	* Manually pull the Salesforce object into WordPress
1215
-	* This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields
1216
-	*
1217
-	* @param string $salesforce_id
1218
-	* @param string $wordpress_object
1219
-	*/
1214
+	 * Manually pull the Salesforce object into WordPress
1215
+	 * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields
1216
+	 *
1217
+	 * @param string $salesforce_id
1218
+	 * @param string $wordpress_object
1219
+	 */
1220 1220
 	public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) {
1221 1221
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1222 1222
 		if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) {
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	}
1234 1234
 
1235 1235
 	/**
1236
-	* Manually pull the Salesforce object into WordPress
1237
-	* This takes an id for a mapping object row
1238
-	*
1239
-	* @param int $mapping_id
1240
-	*/
1236
+	 * Manually pull the Salesforce object into WordPress
1237
+	 * This takes an id for a mapping object row
1238
+	 *
1239
+	 * @param int $mapping_id
1240
+	 */
1241 1241
 	public function refresh_mapped_data( $mapping_id = '' ) {
1242 1242
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1243 1243
 		if ( empty( $mapping_id ) ) {
@@ -1256,13 +1256,13 @@  discard block
 block discarded – undo
1256 1256
 	}
1257 1257
 
1258 1258
 	/**
1259
-	* Prepare fieldmap data and redirect after processing
1260
-	* This runs when the create or update forms are submitted
1261
-	* It is public because it depends on an admin hook
1262
-	* It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1263
-	* This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1264
-	*
1265
-	*/
1259
+	 * Prepare fieldmap data and redirect after processing
1260
+	 * This runs when the create or update forms are submitted
1261
+	 * It is public because it depends on an admin hook
1262
+	 * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1263
+	 * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1264
+	 *
1265
+	 */
1266 1266
 	public function prepare_fieldmap_data() {
1267 1267
 		$error     = false;
1268 1268
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
@@ -1310,12 +1310,12 @@  discard block
 block discarded – undo
1310 1310
 	}
1311 1311
 
1312 1312
 	/**
1313
-	* Delete fieldmap data and redirect after processing
1314
-	* This runs when the delete link is clicked, after the user confirms
1315
-	* It is public because it depends on an admin hook
1316
-	* It then calls the Object_Sync_Sf_Mapping class and the delete method
1317
-	*
1318
-	*/
1313
+	 * Delete fieldmap data and redirect after processing
1314
+	 * This runs when the delete link is clicked, after the user confirms
1315
+	 * It is public because it depends on an admin hook
1316
+	 * It then calls the Object_Sync_Sf_Mapping class and the delete method
1317
+	 *
1318
+	 */
1319 1319
 	public function delete_fieldmap() {
1320 1320
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1321 1321
 		if ( $post_data['id'] ) {
@@ -1331,13 +1331,13 @@  discard block
 block discarded – undo
1331 1331
 	}
1332 1332
 
1333 1333
 	/**
1334
-	* Prepare object data and redirect after processing
1335
-	* This runs when the update form is submitted
1336
-	* It is public because it depends on an admin hook
1337
-	* It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1338
-	* This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1339
-	*
1340
-	*/
1334
+	 * Prepare object data and redirect after processing
1335
+	 * This runs when the update form is submitted
1336
+	 * It is public because it depends on an admin hook
1337
+	 * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page
1338
+	 * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success
1339
+	 *
1340
+	 */
1341 1341
 	public function prepare_object_map_data() {
1342 1342
 		$error     = false;
1343 1343
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
@@ -1376,12 +1376,12 @@  discard block
 block discarded – undo
1376 1376
 	}
1377 1377
 
1378 1378
 	/**
1379
-	* Delete object map data and redirect after processing
1380
-	* This runs when the delete link is clicked on an error row, after the user confirms
1381
-	* It is public because it depends on an admin hook
1382
-	* It then calls the Object_Sync_Sf_Mapping class and the delete method
1383
-	*
1384
-	*/
1379
+	 * Delete object map data and redirect after processing
1380
+	 * This runs when the delete link is clicked on an error row, after the user confirms
1381
+	 * It is public because it depends on an admin hook
1382
+	 * It then calls the Object_Sync_Sf_Mapping class and the delete method
1383
+	 *
1384
+	 */
1385 1385
 	public function delete_object_map() {
1386 1386
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1387 1387
 		if ( $post_data['id'] ) {
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
 	}
1398 1398
 
1399 1399
 	/**
1400
-	* Import a json file and use it for plugin data
1401
-	*
1402
-	*/
1400
+	 * Import a json file and use it for plugin data
1401
+	 *
1402
+	 */
1403 1403
 	public function import_json_file() {
1404 1404
 
1405 1405
 		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) {
@@ -1497,9 +1497,9 @@  discard block
 block discarded – undo
1497 1497
 	}
1498 1498
 
1499 1499
 	/**
1500
-	* Create a json file for exporting
1501
-	*
1502
-	*/
1500
+	 * Create a json file for exporting
1501
+	 *
1502
+	 */
1503 1503
 	public function export_json_file() {
1504 1504
 
1505 1505
 		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) {
@@ -1528,10 +1528,10 @@  discard block
 block discarded – undo
1528 1528
 	}
1529 1529
 
1530 1530
 	/**
1531
-	* Default display for <input> fields
1532
-	*
1533
-	* @param array $args
1534
-	*/
1531
+	 * Default display for <input> fields
1532
+	 *
1533
+	 * @param array $args
1534
+	 */
1535 1535
 	public function display_input_field( $args ) {
1536 1536
 		$type    = $args['type'];
1537 1537
 		$id      = $args['label_for'];
@@ -1578,11 +1578,11 @@  discard block
 block discarded – undo
1578 1578
 	}
1579 1579
 
1580 1580
 	/**
1581
-	* Display for multiple checkboxes
1582
-	* Above method can handle a single checkbox as it is
1583
-	*
1584
-	* @param array $args
1585
-	*/
1581
+	 * Display for multiple checkboxes
1582
+	 * Above method can handle a single checkbox as it is
1583
+	 *
1584
+	 * @param array $args
1585
+	 */
1586 1586
 	public function display_checkboxes( $args ) {
1587 1587
 		$type    = 'checkbox';
1588 1588
 		$name    = $args['name'];
@@ -1616,10 +1616,10 @@  discard block
 block discarded – undo
1616 1616
 	}
1617 1617
 
1618 1618
 	/**
1619
-	* Display for a dropdown
1620
-	*
1621
-	* @param array $args
1622
-	*/
1619
+	 * Display for a dropdown
1620
+	 *
1621
+	 * @param array $args
1622
+	 */
1623 1623
 	public function display_select( $args ) {
1624 1624
 		$type = $args['type'];
1625 1625
 		$id   = $args['label_for'];
@@ -1663,10 +1663,10 @@  discard block
 block discarded – undo
1663 1663
 	}
1664 1664
 
1665 1665
 	/**
1666
-	* Dropdown formatted list of Salesforce API versions
1667
-	*
1668
-	* @return array $args
1669
-	*/
1666
+	 * Dropdown formatted list of Salesforce API versions
1667
+	 *
1668
+	 * @return array $args
1669
+	 */
1670 1670
 	private function version_options() {
1671 1671
 		$versions = $this->salesforce['sfapi']->get_api_versions();
1672 1672
 		$args     = array();
@@ -1680,10 +1680,10 @@  discard block
 block discarded – undo
1680 1680
 	}
1681 1681
 
1682 1682
 	/**
1683
-	* Default display for <a href> links
1684
-	*
1685
-	* @param array $args
1686
-	*/
1683
+	 * Default display for <a href> links
1684
+	 *
1685
+	 * @param array $args
1686
+	 */
1687 1687
 	public function display_link( $args ) {
1688 1688
 		$label = $args['label'];
1689 1689
 		$desc  = $args['desc'];
@@ -1710,11 +1710,11 @@  discard block
 block discarded – undo
1710 1710
 	}
1711 1711
 
1712 1712
 	/**
1713
-	* Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline.
1714
-	*
1715
-	* @param string $option
1716
-	* @return string $option
1717
-	*/
1713
+	 * Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline.
1714
+	 *
1715
+	 * @param string $option
1716
+	 * @return string $option
1717
+	 */
1718 1718
 	public function sanitize_validate_text( $option ) {
1719 1719
 		if ( is_array( $option ) ) {
1720 1720
 			$options = array();
@@ -1728,10 +1728,10 @@  discard block
 block discarded – undo
1728 1728
 	}
1729 1729
 
1730 1730
 	/**
1731
-	* Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it
1732
-	*
1733
-	* @param object $sfapi
1734
-	*/
1731
+	 * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it
1732
+	 *
1733
+	 * @param object $sfapi
1734
+	 */
1735 1735
 	private function status( $sfapi ) {
1736 1736
 
1737 1737
 		$versions = $sfapi->get_api_versions();
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 	}
1791 1791
 
1792 1792
 	/**
1793
-	* Deauthorize WordPress from Salesforce.
1794
-	* This deletes the tokens from the database; it does not currently do anything in Salesforce
1795
-	* For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce
1796
-	*/
1793
+	 * Deauthorize WordPress from Salesforce.
1794
+	 * This deletes the tokens from the database; it does not currently do anything in Salesforce
1795
+	 * For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce
1796
+	 */
1797 1797
 	private function logout() {
1798 1798
 		$this->access_token  = delete_option( $this->option_prefix . 'access_token' );
1799 1799
 		$this->instance_url  = delete_option( $this->option_prefix . 'instance_url' );
@@ -1805,8 +1805,8 @@  discard block
 block discarded – undo
1805 1805
 	}
1806 1806
 
1807 1807
 	/**
1808
-	* Ajax call to clear the plugin cache.
1809
-	*/
1808
+	 * Ajax call to clear the plugin cache.
1809
+	 */
1810 1810
 	public function clear_sfwp_cache() {
1811 1811
 		$result   = $this->clear_cache( true );
1812 1812
 		$response = array(
@@ -1817,9 +1817,9 @@  discard block
 block discarded – undo
1817 1817
 	}
1818 1818
 
1819 1819
 	/**
1820
-	* Clear the plugin's cache.
1821
-	* This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data.
1822
-	*/
1820
+	 * Clear the plugin's cache.
1821
+	 * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data.
1822
+	 */
1823 1823
 	private function clear_cache( $ajax = false ) {
1824 1824
 		$result = (bool) $this->wordpress->sfwp_transients->flush();
1825 1825
 		if ( true === $result ) {
@@ -1839,9 +1839,9 @@  discard block
 block discarded – undo
1839 1839
 	}
1840 1840
 
1841 1841
 	/**
1842
-	* Check WordPress Admin permissions
1843
-	* Check if the current user is allowed to access the Salesforce plugin options
1844
-	*/
1842
+	 * Check WordPress Admin permissions
1843
+	 * Check if the current user is allowed to access the Salesforce plugin options
1844
+	 */
1845 1845
 	private function check_wordpress_admin_permissions() {
1846 1846
 
1847 1847
 		// one programmatic way to give this capability to additional user roles is the
@@ -1861,10 +1861,10 @@  discard block
 block discarded – undo
1861 1861
 	}
1862 1862
 
1863 1863
 	/**
1864
-	* Show what we know about this user's relationship to a Salesforce object, if any
1865
-	* @param object $user
1866
-	*
1867
-	*/
1864
+	 * Show what we know about this user's relationship to a Salesforce object, if any
1865
+	 * @param object $user
1866
+	 *
1867
+	 */
1868 1868
 	public function show_salesforce_user_fields( $user ) {
1869 1869
 		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
1870 1870
 		if ( true === $this->check_wordpress_admin_permissions() ) {
@@ -1888,10 +1888,10 @@  discard block
 block discarded – undo
1888 1888
 	}
1889 1889
 
1890 1890
 	/**
1891
-	* If the user profile has been mapped to Salesforce, do it
1892
-	* @param int $user_id
1893
-	*
1894
-	*/
1891
+	 * If the user profile has been mapped to Salesforce, do it
1892
+	 * @param int $user_id
1893
+	 *
1894
+	 */
1895 1895
 	public function save_salesforce_user_fields( $user_id ) {
1896 1896
 		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1897 1897
 		if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) {
@@ -1916,10 +1916,10 @@  discard block
 block discarded – undo
1916 1916
 	}
1917 1917
 
1918 1918
 	/**
1919
-	* Render tabs for settings pages in admin
1920
-	* @param array $tabs
1921
-	* @param string $tab
1922
-	*/
1919
+	 * Render tabs for settings pages in admin
1920
+	 * @param array $tabs
1921
+	 * @param string $tab
1922
+	 */
1923 1923
 	private function tabs( $tabs, $tab = '' ) {
1924 1924
 
1925 1925
 		$get_data        = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
@@ -1949,9 +1949,9 @@  discard block
 block discarded – undo
1949 1949
 	}
1950 1950
 
1951 1951
 	/**
1952
-	* Clear schedule
1953
-	* This clears the schedule if the user clicks the button
1954
-	*/
1952
+	 * Clear schedule
1953
+	 * This clears the schedule if the user clicks the button
1954
+	 */
1955 1955
 	private function clear_schedule( $schedule_name = '' ) {
1956 1956
 		if ( '' !== $schedule_name ) {
1957 1957
 			$schedule = $this->schedule( $schedule_name );
@@ -1973,8 +1973,8 @@  discard block
 block discarded – undo
1973 1973
 	}
1974 1974
 
1975 1975
 	/**
1976
-	* Load the schedule class
1977
-	*/
1976
+	 * Load the schedule class
1977
+	 */
1978 1978
 	private function schedule( $schedule_name ) {
1979 1979
 		if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
1980 1980
 			require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php';
@@ -1986,21 +1986,21 @@  discard block
 block discarded – undo
1986 1986
 	}
1987 1987
 
1988 1988
 	/**
1989
-	* Create an object map between a WordPress object and a Salesforce object
1990
-	*
1991
-	* @param int $wordpress_id
1992
-	*   Unique identifier for the WordPress object
1993
-	* @param string $wordpress_object
1994
-	*   What kind of object is it?
1995
-	* @param string $salesforce_id
1996
-	*   Unique identifier for the Salesforce object
1997
-	* @param string $action
1998
-	*   Did we push or pull?
1999
-	*
2000
-	* @return int $wpdb->insert_id
2001
-	*   This is the database row for the map object
2002
-	*
2003
-	*/
1989
+	 * Create an object map between a WordPress object and a Salesforce object
1990
+	 *
1991
+	 * @param int $wordpress_id
1992
+	 *   Unique identifier for the WordPress object
1993
+	 * @param string $wordpress_object
1994
+	 *   What kind of object is it?
1995
+	 * @param string $salesforce_id
1996
+	 *   Unique identifier for the Salesforce object
1997
+	 * @param string $action
1998
+	 *   Did we push or pull?
1999
+	 *
2000
+	 * @return int $wpdb->insert_id
2001
+	 *   This is the database row for the map object
2002
+	 *
2003
+	 */
2004 2004
 	private function create_object_map( $wordpress_id, $wordpress_object, $salesforce_id, $action = '' ) {
2005 2005
 		// Create object map and save it
2006 2006
 		$mapping_object = $this->mappings->create_object_map(
Please login to merge, or discard this patch.
classes/activate.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	private $installed_version;
22 22
 
23 23
 	/**
24
-	* Constructor which sets up activate hooks
25
-	*
26
-	* @param object $wpdb
27
-	* @param string $version
28
-	* @param string $slug
29
-	*
30
-	*/
24
+	 * Constructor which sets up activate hooks
25
+	 *
26
+	 * @param object $wpdb
27
+	 * @param string $version
28
+	 * @param string $slug
29
+	 *
30
+	 */
31 31
 	public function __construct( $wpdb, $version, $slug ) {
32 32
 		$this->wpdb    = $wpdb;
33 33
 		$this->version = $version;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	/**
42
-	* Activation hooks
43
-	*/
42
+	 * Activation hooks
43
+	 */
44 44
 	private function add_actions() {
45 45
 
46 46
 		// on initial activation, run these hooks
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	/**
56
-	* Check for the minimum required version of php
57
-	*/
56
+	 * Check for the minimum required version of php
57
+	 */
58 58
 	public function php_requirements() {
59 59
 		if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
60 60
 			deactivate_plugins( plugin_basename( __FILE__ ) );
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	/**
66
-	* Create database tables for Salesforce
67
-	* This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
68
-	*
69
-	*/
66
+	 * Create database tables for Salesforce
67
+	 * This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
68
+	 *
69
+	 */
70 70
 	public function wordpress_salesforce_tables() {
71 71
 
72 72
 		$charset_collate = $this->wpdb->get_charset_collate();
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	/**
130
-	* Add roles and capabilities
131
-	* This adds the configure_salesforce capability to the admin role
132
-	*
133
-	* It also allows other plugins to add the capability to other roles
134
-	*
135
-	*/
130
+	 * Add roles and capabilities
131
+	 * This adds the configure_salesforce capability to the admin role
132
+	 *
133
+	 * It also allows other plugins to add the capability to other roles
134
+	 *
135
+	 */
136 136
 	public function add_roles_capabilities() {
137 137
 
138 138
 		// by default, only administrators can configure the plugin
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	}
154 154
 
155 155
 	/**
156
-	* Check for database version on plugin upgrade
157
-	* When the plugin is upgraded, if the database version does not match the current version, perform these methods
158
-	*
159
-	* @param object $upgrader_object
160
-	* @param array $hook_extra
161
-	*
162
-	* See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163
-	*
164
-	*/
156
+	 * Check for database version on plugin upgrade
157
+	 * When the plugin is upgraded, if the database version does not match the current version, perform these methods
158
+	 *
159
+	 * @param object $upgrader_object
160
+	 * @param array $hook_extra
161
+	 *
162
+	 * See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163
+	 *
164
+	 */
165 165
 	public function wordpress_salesforce_update_db_check( $upgrader_object, $hook_extra ) {
166 166
 		if ( get_site_option( 'object_sync_for_salesforce_db_version' ) !== $this->version ) {
167 167
 			$this->wordpress_salesforce_tables();
Please login to merge, or discard this patch.
classes/salesforce_push.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
 	protected $queue;
26 26
 
27 27
 	/**
28
-	* @var string
29
-	*/
28
+	 * @var string
29
+	 */
30 30
 	public $schedule_name; // allow for naming the queue in case there are multiple queues
31 31
 
32 32
 	/**
33
-	* Constructor which sets up push schedule
34
-	*
35
-	* @param object $wpdb
36
-	* @param string $version
37
-	* @param array $login_credentials
38
-	* @param string $slug
39
-	* @param object $wordpress
40
-	* @param object $salesforce
41
-	* @param object $mappings
42
-	* @param object $logging
43
-	* @param array $schedulable_classes
44
-	* @param object $queue
45
-	* @throws \Object_Sync_Sf_Exception
46
-	*/
33
+	 * Constructor which sets up push schedule
34
+	 *
35
+	 * @param object $wpdb
36
+	 * @param string $version
37
+	 * @param array $login_credentials
38
+	 * @param string $slug
39
+	 * @param object $wordpress
40
+	 * @param object $salesforce
41
+	 * @param object $mappings
42
+	 * @param object $logging
43
+	 * @param array $schedulable_classes
44
+	 * @param object $queue
45
+	 * @throws \Object_Sync_Sf_Exception
46
+	 */
47 47
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ) {
48 48
 		$this->wpdb                = $wpdb;
49 49
 		$this->version             = $version;
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	/**
69
-	* Create the action hooks based on what object maps exist from the admin settings.
70
-	* We do not have any actions for blogroll at this time.
71
-	*
72
-	*/
69
+	 * Create the action hooks based on what object maps exist from the admin settings.
70
+	 * We do not have any actions for blogroll at this time.
71
+	 *
72
+	 */
73 73
 	public function add_actions() {
74 74
 		$db_version = get_option( 'object_sync_for_salesforce_db_version', false );
75 75
 		if ( $db_version === $this->version ) {
@@ -110,63 +110,63 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	/**
113
-	* Method for ajax hooks to call for pushing manually
114
-	*
115
-	* @param array $object
116
-	* @param string $type
117
-	*
118
-	*/
113
+	 * Method for ajax hooks to call for pushing manually
114
+	 *
115
+	 * @param array $object
116
+	 * @param string $type
117
+	 *
118
+	 */
119 119
 	public function manual_object_update( $object, $type ) {
120 120
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update, true );
121 121
 	}
122 122
 
123 123
 	/**
124
-	* Callback method for adding a user
125
-	*
126
-	* @param string $user_id
127
-	*/
124
+	 * Callback method for adding a user
125
+	 *
126
+	 * @param string $user_id
127
+	 */
128 128
 	public function add_user( $user_id ) {
129 129
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
130 130
 		$this->object_insert( $user, 'user' );
131 131
 	}
132 132
 
133 133
 	/**
134
-	* Callback method for adding a user via the Ultimate Member plugin
135
-	*
136
-	* @param string $user_id
137
-	*/
134
+	 * Callback method for adding a user via the Ultimate Member plugin
135
+	 *
136
+	 * @param string $user_id
137
+	 */
138 138
 	public function um_add_user( $user_id, $form_data = array() ) {
139 139
 		$this->object_insert( $form_data, 'user' );
140 140
 	}
141 141
 
142 142
 	/**
143
-	* Callback method for editing a user
144
-	*
145
-	* @param string $user_id
146
-	* @param object $old_user_data
147
-	*/
143
+	 * Callback method for editing a user
144
+	 *
145
+	 * @param string $user_id
146
+	 * @param object $old_user_data
147
+	 */
148 148
 	public function edit_user( $user_id, $old_user_data ) {
149 149
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
150 150
 		$this->object_update( $user, 'user' );
151 151
 	}
152 152
 
153 153
 	/**
154
-	* Callback method for deleting a user
155
-	*
156
-	* @param string $user_id
157
-	*/
154
+	 * Callback method for deleting a user
155
+	 *
156
+	 * @param string $user_id
157
+	 */
158 158
 	public function delete_user( $user_id ) {
159 159
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
160 160
 		$this->object_delete( $user, 'user' );
161 161
 	}
162 162
 
163 163
 	/**
164
-	* Callback method for posts of any type
165
-	* This can handle create, update, and delete actions
166
-	*
167
-	* @param string $post_id
168
-	* @param object $post
169
-	*/
164
+	 * Callback method for posts of any type
165
+	 * This can handle create, update, and delete actions
166
+	 *
167
+	 * @param string $post_id
168
+	 * @param object $post
169
+	 */
170 170
 	public function post_actions( $post_id, $post ) {
171 171
 
172 172
 		$post_type = $post->post_type;
@@ -213,66 +213,66 @@  discard block
 block discarded – undo
213 213
 	}
214 214
 
215 215
 	/**
216
-	* Callback method for adding an attachment
217
-	*
218
-	* @param string $post_id
219
-	*/
216
+	 * Callback method for adding an attachment
217
+	 *
218
+	 * @param string $post_id
219
+	 */
220 220
 	public function add_attachment( $post_id ) {
221 221
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
222 222
 		$this->object_insert( $attachment, 'attachment' );
223 223
 	}
224 224
 
225 225
 	/**
226
-	* Callback method for editing an attachment
227
-	*
228
-	* @param string $post_id
229
-	*/
226
+	 * Callback method for editing an attachment
227
+	 *
228
+	 * @param string $post_id
229
+	 */
230 230
 	public function edit_attachment( $post_id ) {
231 231
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
232 232
 		$this->object_update( $attachment, 'attachment' );
233 233
 	}
234 234
 
235 235
 	/**
236
-	* Callback method for editing an attachment
237
-	*
238
-	* @param string $post_id
239
-	*/
236
+	 * Callback method for editing an attachment
237
+	 *
238
+	 * @param string $post_id
239
+	 */
240 240
 	public function delete_attachment( $post_id ) {
241 241
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
242 242
 		$this->object_delete( $attachment, 'attachment' );
243 243
 	}
244 244
 
245 245
 	/**
246
-	* Callback method for adding a term
247
-	*
248
-	* @param string $term_id
249
-	* @param string $tt_id
250
-	* @param string $taxonomy
251
-	*/
246
+	 * Callback method for adding a term
247
+	 *
248
+	 * @param string $term_id
249
+	 * @param string $tt_id
250
+	 * @param string $taxonomy
251
+	 */
252 252
 	public function add_term( $term_id, $tt_id, $taxonomy ) {
253 253
 		$term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id );
254 254
 		$this->object_insert( $term, $taxonomy );
255 255
 	}
256 256
 
257 257
 	/**
258
-	* Callback method for editing a term
259
-	*
260
-	* @param string $term_id
261
-	* @param string $taxonomy
262
-	*/
258
+	 * Callback method for editing a term
259
+	 *
260
+	 * @param string $term_id
261
+	 * @param string $taxonomy
262
+	 */
263 263
 	public function edit_term( $term_id, $taxonomy ) {
264 264
 		$term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id );
265 265
 		$this->object_update( $term, $taxonomy );
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Callback method for deleting a term
270
-	*
271
-	* @param int $term (id)
272
-	* @param int $term_taxonomy_id
273
-	* @param string $taxonomy (slug)
274
-	* @param object $deleted_term
275
-	*/
269
+	 * Callback method for deleting a term
270
+	 *
271
+	 * @param int $term (id)
272
+	 * @param int $term_taxonomy_id
273
+	 * @param string $taxonomy (slug)
274
+	 * @param object $deleted_term
275
+	 */
276 276
 	public function delete_term( $term, $tt_id, $taxonomy, $deleted_term ) {
277 277
 		$deleted_term = (array) $deleted_term;
278 278
 		$type         = $deleted_term['taxonomy'];
@@ -280,75 +280,75 @@  discard block
 block discarded – undo
280 280
 	}
281 281
 
282 282
 	/**
283
-	* Callback method for adding a comment
284
-	*
285
-	* @param string $comment_id
286
-	* @param int|string comment_approved
287
-	* @param array $commentdata
288
-	*/
283
+	 * Callback method for adding a comment
284
+	 *
285
+	 * @param string $comment_id
286
+	 * @param int|string comment_approved
287
+	 * @param array $commentdata
288
+	 */
289 289
 	public function add_comment( $comment_id, $comment_approved, $commentdata = array() ) {
290 290
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
291 291
 		$this->object_insert( $comment, 'comment' );
292 292
 	}
293 293
 
294 294
 	/**
295
-	* Callback method for editing a comment
296
-	*
297
-	* @param string $comment_id
298
-	*/
295
+	 * Callback method for editing a comment
296
+	 *
297
+	 * @param string $comment_id
298
+	 */
299 299
 	public function edit_comment( $comment_id ) {
300 300
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
301 301
 		$this->object_update( $comment, 'comment' );
302 302
 	}
303 303
 
304 304
 	/**
305
-	* Callback method for deleting a comment
306
-	*
307
-	* @param string $comment_id
308
-	*/
305
+	 * Callback method for deleting a comment
306
+	 *
307
+	 * @param string $comment_id
308
+	 */
309 309
 	public function delete_comment( $comment_id ) {
310 310
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
311 311
 		$this->object_delete( $comment, 'comment' );
312 312
 	}
313 313
 
314 314
 	/**
315
-	* Insert a new object
316
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
317
-	*/
315
+	 * Insert a new object
316
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
317
+	 */
318 318
 	private function object_insert( $object, $type ) {
319 319
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_create );
320 320
 	}
321 321
 
322 322
 	/**
323
-	* Update an existing object
324
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
325
-	*/
323
+	 * Update an existing object
324
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
325
+	 */
326 326
 	private function object_update( $object, $type ) {
327 327
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update );
328 328
 	}
329 329
 
330 330
 	/**
331
-	* Delete an existing object
332
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
333
-	*/
331
+	 * Delete an existing object
332
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
333
+	 */
334 334
 	private function object_delete( $object, $type ) {
335 335
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_delete );
336 336
 	}
337 337
 
338 338
 	/**
339
-	* Push objects to Salesforce.
340
-	* 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)
341
-	*
342
-	* @param string $object_type
343
-	*   Type of WordPress object.
344
-	* @param array $object
345
-	*   The WordPress data that needs to be sent to Salesforce.
346
-	* @param int $sf_sync_trigger
347
-	*   The trigger being responded to.
348
-	* @param bool $manual
349
-	*   Are we calling this manually?
350
-	*
351
-	*/
339
+	 * Push objects to Salesforce.
340
+	 * 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)
341
+	 *
342
+	 * @param string $object_type
343
+	 *   Type of WordPress object.
344
+	 * @param array $object
345
+	 *   The WordPress data that needs to be sent to Salesforce.
346
+	 * @param int $sf_sync_trigger
347
+	 *   The trigger being responded to.
348
+	 * @param bool $manual
349
+	 *   Are we calling this manually?
350
+	 *
351
+	 */
352 352
 	private function salesforce_push_object_crud( $object_type, $object, $sf_sync_trigger, $manual = false ) {
353 353
 
354 354
 		$structure       = $this->wordpress->get_wordpress_table_structure( $object_type );
@@ -472,20 +472,20 @@  discard block
 block discarded – undo
472 472
 	}
473 473
 
474 474
 	/**
475
-	* Sync WordPress objects and Salesforce objects using the REST API.
476
-	*
477
-	* @param string $object_type
478
-	*   Type of WordPress object.
479
-	* @param array|int $object|$object_id
480
-	*   The WordPress object data or its ID.
481
-	* @param array $mapping|$mapping_id
482
-	*   Salesforce field mapping data array or ID.
483
-	* @param int $sf_sync_trigger
484
-	*   Trigger for this sync.
485
-	*
486
-	* @return true or exit the method
487
-	*
488
-	*/
475
+	 * Sync WordPress objects and Salesforce objects using the REST API.
476
+	 *
477
+	 * @param string $object_type
478
+	 *   Type of WordPress object.
479
+	 * @param array|int $object|$object_id
480
+	 *   The WordPress object data or its ID.
481
+	 * @param array $mapping|$mapping_id
482
+	 *   Salesforce field mapping data array or ID.
483
+	 * @param int $sf_sync_trigger
484
+	 *   Trigger for this sync.
485
+	 *
486
+	 * @return true or exit the method
487
+	 *
488
+	 */
489 489
 	public function salesforce_push_sync_rest( $object_type, $object, $mapping, $sf_sync_trigger ) {
490 490
 
491 491
 		if ( is_int( $object ) ) {
@@ -1037,21 +1037,21 @@  discard block
 block discarded – undo
1037 1037
 	}
1038 1038
 
1039 1039
 	/**
1040
-	* Create an object map between a WordPress object and a Salesforce object
1041
-	*
1042
-	* @param array $wordpress_object
1043
-	*   Array of the WordPress object's data
1044
-	* @param string $id_field_name
1045
-	*   How this object names its primary field. ie Id or comment_id or whatever
1046
-	* @param string $salesforce_id
1047
-	*   Unique identifier for the Salesforce object
1048
-	* @param array $field_mapping
1049
-	*   The row that maps the object types together, including which fields match which other fields
1050
-	*
1051
-	* @return int $wpdb->insert_id
1052
-	*   This is the database row for the map object
1053
-	*
1054
-	*/
1040
+	 * Create an object map between a WordPress object and a Salesforce object
1041
+	 *
1042
+	 * @param array $wordpress_object
1043
+	 *   Array of the WordPress object's data
1044
+	 * @param string $id_field_name
1045
+	 *   How this object names its primary field. ie Id or comment_id or whatever
1046
+	 * @param string $salesforce_id
1047
+	 *   Unique identifier for the Salesforce object
1048
+	 * @param array $field_mapping
1049
+	 *   The row that maps the object types together, including which fields match which other fields
1050
+	 *
1051
+	 * @return int $wpdb->insert_id
1052
+	 *   This is the database row for the map object
1053
+	 *
1054
+	 */
1055 1055
 	private function create_object_map( $wordpress_object, $id_field_name, $salesforce_id, $field_mapping, $pending = false ) {
1056 1056
 
1057 1057
 		if ( true === $pending ) {
Please login to merge, or discard this patch.
classes/schedule.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
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
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	/**
63
-	* Create the actions to run
64
-	*
65
-	*/
63
+	 * Create the actions to run
64
+	 *
65
+	 */
66 66
 	public function add_actions() {
67 67
 
68 68
 		// create a recurring action for each schedulable item
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 	/**
106
-	* Convert the schedule frequency from the admin settings into an array
107
-	* interval must be in seconds for the class to use it
108
-	*
109
-	*/
106
+	 * Convert the schedule frequency from the admin settings into an array
107
+	 * interval must be in seconds for the class to use it
108
+	 *
109
+	 */
110 110
 	public function set_schedule_frequency( $schedules ) {
111 111
 
112 112
 		// create an option in the core schedules array for each one the plugin defines
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	/**
147
-	* Convert the schedule frequency from the admin settings into an array
148
-	* interval must be in seconds for the class to use it
149
-	*
150
-	*/
147
+	 * Convert the schedule frequency from the admin settings into an array
148
+	 * interval must be in seconds for the class to use it
149
+	 *
150
+	 */
151 151
 	public function get_schedule_frequency_key( $name = '' ) {
152 152
 
153 153
 		$schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' );
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 
176 176
 	/**
177
-	* Convert the schedule frequency from the admin settings into seconds
178
-	*
179
-	*/
177
+	 * Convert the schedule frequency from the admin settings into seconds
178
+	 *
179
+	 */
180 180
 	public function get_schedule_frequency_seconds( $name = '' ) {
181 181
 
182 182
 		$schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' );
Please login to merge, or discard this patch.
classes/salesforce_pull.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
 	protected $queue;
26 26
 
27 27
 	/**
28
-	* @var string
29
-	*/
28
+	 * @var string
29
+	 */
30 30
 	public $schedule_name; // allow for naming the queue in case there are multiple queues
31 31
 
32 32
 	/**
33
-	* Constructor which sets up pull schedule
34
-	*
35
-	* @param object $wpdb
36
-	* @param string $version
37
-	* @param array $login_credentials
38
-	* @param string $slug
39
-	* @param object $wordpress
40
-	* @param object $salesforce
41
-	* @param object $mappings
42
-	* @param object $logging
43
-	* @param array $schedulable_classes
44
-	* @param object $queue
45
-	* @throws \Exception
46
-	*/
33
+	 * Constructor which sets up pull schedule
34
+	 *
35
+	 * @param object $wpdb
36
+	 * @param string $version
37
+	 * @param array $login_credentials
38
+	 * @param string $slug
39
+	 * @param object $wordpress
40
+	 * @param object $salesforce
41
+	 * @param object $mappings
42
+	 * @param object $logging
43
+	 * @param array $schedulable_classes
44
+	 * @param object $queue
45
+	 * @throws \Exception
46
+	 */
47 47
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ) {
48 48
 		$this->wpdb                = $wpdb;
49 49
 		$this->version             = $version;
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	/**
69
-	* Create the action hooks based on what object maps exist from the admin settings
70
-	*
71
-	*/
69
+	 * Create the action hooks based on what object maps exist from the admin settings
70
+	 *
71
+	 */
72 72
 	public function add_actions() {
73 73
 
74 74
 		// ajax hook
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Ajax callback for salesforce pull. Returns status of 200 for successful
84
-	* attempt or 403 for a failed pull attempt (SF not authorized, threshhold
85
-	* reached, etc.
86
-	* this is the ajax callback; not a cron run
87
-	*/
83
+	 * Ajax callback for salesforce pull. Returns status of 200 for successful
84
+	 * attempt or 403 for a failed pull attempt (SF not authorized, threshhold
85
+	 * reached, etc.
86
+	 * this is the ajax callback; not a cron run
87
+	 */
88 88
 	public function salesforce_pull_webhook() {
89 89
 
90 90
 		if ( true === $this->salesforce_pull() ) {
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	/**
113
-	* Callback for the standard pull process used by webhooks and cron.
114
-	*/
113
+	 * Callback for the standard pull process used by webhooks and cron.
114
+	 */
115 115
 	public function salesforce_pull() {
116 116
 		$sfapi = $this->salesforce['sfapi'];
117 117
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	/**
134
-	* Determines if the Salesforce pull should be allowed, or throttled.
135
-	*
136
-	* Prevents too many pull processes from running at once.
137
-	*
138
-	* @return bool
139
-	*    Returns false if the time elapsed between recent pulls is too short.
140
-	*/
134
+	 * Determines if the Salesforce pull should be allowed, or throttled.
135
+	 *
136
+	 * Prevents too many pull processes from running at once.
137
+	 *
138
+	 * @return bool
139
+	 *    Returns false if the time elapsed between recent pulls is too short.
140
+	 */
141 141
 	private function check_throttle() {
142 142
 		$pull_throttle = get_option( 'object_sync_for_salesforce_pull_throttle', 5 );
143 143
 		$last_sync     = get_option( 'object_sync_for_salesforce_pull_last_sync', 0 );
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	/**
153
-	* Pull updated records from Salesforce and place them in the queue.
154
-	*
155
-	* Executes a SOQL query based on defined mappings, loops through the results,
156
-	* and places each updated SF object into the queue for later processing.
157
-	*
158
-	* We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF
159
-	*
160
-	*/
153
+	 * Pull updated records from Salesforce and place them in the queue.
154
+	 *
155
+	 * Executes a SOQL query based on defined mappings, loops through the results,
156
+	 * and places each updated SF object into the queue for later processing.
157
+	 *
158
+	 * We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF
159
+	 *
160
+	 */
161 161
 	private function get_updated_records() {
162 162
 		$sfapi = $this->salesforce['sfapi'];
163 163
 		foreach ( $this->mappings->get_fieldmaps() as $salesforce_mapping ) {
@@ -341,18 +341,18 @@  discard block
 block discarded – undo
341 341
 	}
342 342
 
343 343
 	/**
344
-	* Given a SObject type name, build an SOQL query to include all fields for all
345
-	* SalesforceMappings mapped to that SObject.
346
-	*
347
-	* @param string $type
348
-	*   e.g. "Contact", "Account", etc.
349
-	*
350
-	* @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields
351
-	*   were found.
352
-	*
353
-	* @see Object_Sync_Sf_Mapping::get_mapped_fields
354
-	* @see Object_Sync_Sf_Mapping::get_mapped_record_types
355
-	*/
344
+	 * Given a SObject type name, build an SOQL query to include all fields for all
345
+	 * SalesforceMappings mapped to that SObject.
346
+	 *
347
+	 * @param string $type
348
+	 *   e.g. "Contact", "Account", etc.
349
+	 *
350
+	 * @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields
351
+	 *   were found.
352
+	 *
353
+	 * @see Object_Sync_Sf_Mapping::get_mapped_fields
354
+	 * @see Object_Sync_Sf_Mapping::get_mapped_record_types
355
+	 */
356 356
 	private function get_pull_query( $type, $salesforce_mapping = array() ) {
357 357
 		$mapped_fields       = array();
358 358
 		$mapped_record_types = array();
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 	}
435 435
 
436 436
 	/**
437
-	* Get deleted records from salesforce.
438
-	* Note that deletions can only be queried via REST with an API version >= 29.0.
439
-	*
440
-	*/
437
+	 * Get deleted records from salesforce.
438
+	 * Note that deletions can only be queried via REST with an API version >= 29.0.
439
+	 *
440
+	 */
441 441
 	private function get_deleted_records() {
442 442
 
443 443
 		$sfapi = $this->salesforce['sfapi'];
@@ -538,13 +538,13 @@  discard block
 block discarded – undo
538 538
 	}
539 539
 
540 540
 	/**
541
-	* Method for ajax hooks to call for pulling manually
542
-	*
543
-	* @param string $object_type
544
-	* @param string $salesforce_id
545
-	* @param string $wordpress_object
546
-	*
547
-	*/
541
+	 * Method for ajax hooks to call for pulling manually
542
+	 *
543
+	 * @param string $object_type
544
+	 * @param string $salesforce_id
545
+	 * @param string $wordpress_object
546
+	 *
547
+	 */
548 548
 	public function manual_pull( $object_type, $salesforce_id, $wordpress_object ) {
549 549
 		$sfapi   = $this->salesforce['sfapi'];
550 550
 		$object  = $sfapi->api_call( 'sobjects/' . $object_type . '/' . $salesforce_id );
@@ -559,20 +559,20 @@  discard block
 block discarded – undo
559 559
 	}
560 560
 
561 561
 	/**
562
-	* Sync WordPress objects and Salesforce objects from the queue using the REST API.
563
-	*
564
-	* @param string $object_type
565
-	*   Type of Salesforce object.
566
-	* @param array|string $object
567
-	*   The Salesforce data or its Id value.
568
-	* @param array|int $mapping
569
-	*   Salesforce/WP mapping data or its id.
570
-	* @param int $sf_sync_trigger
571
-	*   Trigger for this sync.
572
-	*
573
-	* @return true or exit the method
574
-	*
575
-	*/
562
+	 * Sync WordPress objects and Salesforce objects from the queue using the REST API.
563
+	 *
564
+	 * @param string $object_type
565
+	 *   Type of Salesforce object.
566
+	 * @param array|string $object
567
+	 *   The Salesforce data or its Id value.
568
+	 * @param array|int $mapping
569
+	 *   Salesforce/WP mapping data or its id.
570
+	 * @param int $sf_sync_trigger
571
+	 *   Trigger for this sync.
572
+	 *
573
+	 * @return true or exit the method
574
+	 *
575
+	 */
576 576
 	public function salesforce_pull_process_records( $object_type, $object, $mapping, $sf_sync_trigger ) {
577 577
 
578 578
 		$sfapi = $this->salesforce['sfapi'];
@@ -1301,19 +1301,19 @@  discard block
 block discarded – undo
1301 1301
 	}
1302 1302
 
1303 1303
 	/**
1304
-	* Create an object map between a Salesforce object and a WordPress object
1305
-	*
1306
-	* @param array $salesforce_object
1307
-	*   Array of the salesforce object's data
1308
-	* @param string $wordpress_id
1309
-	*   Unique identifier for the WordPress object
1310
-	* @param array $field_mapping
1311
-	*   The row that maps the object types together, including which fields match which other fields
1312
-	*
1313
-	* @return int $wpdb->insert_id
1314
-	*   This is the database row for the map object
1315
-	*
1316
-	*/
1304
+	 * Create an object map between a Salesforce object and a WordPress object
1305
+	 *
1306
+	 * @param array $salesforce_object
1307
+	 *   Array of the salesforce object's data
1308
+	 * @param string $wordpress_id
1309
+	 *   Unique identifier for the WordPress object
1310
+	 * @param array $field_mapping
1311
+	 *   The row that maps the object types together, including which fields match which other fields
1312
+	 *
1313
+	 * @return int $wpdb->insert_id
1314
+	 *   This is the database row for the map object
1315
+	 *
1316
+	 */
1317 1317
 	private function create_object_map( $salesforce_object, $wordpress_id, $field_mapping ) {
1318 1318
 		// Create object map and save it
1319 1319
 		$mapping_object = $this->mappings->create_object_map(
Please login to merge, or discard this patch.