Passed
Pull Request — master (#195)
by Jonathan
03:30
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/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.
classes/deactivate.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	protected $schedulable_classes;
21 21
 
22 22
 	/**
23
-	* Constructor which sets up deactivate hooks
24
-	* @param object $wpdb
25
-	* @param string $version
26
-	* @param string $slug
27
-	* @param array $schedulable_classes
28
-	*
29
-	*/
23
+	 * Constructor which sets up deactivate hooks
24
+	 * @param object $wpdb
25
+	 * @param string $version
26
+	 * @param string $slug
27
+	 * @param array $schedulable_classes
28
+	 *
29
+	 */
30 30
 	public function __construct( $wpdb, $version, $slug, $schedulable_classes ) {
31 31
 		$this->wpdb                = $wpdb;
32 32
 		$this->version             = $version;
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	/**
48
-	* Drop database tables for Salesforce
49
-	* This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
50
-	*
51
-	*/
48
+	 * Drop database tables for Salesforce
49
+	 * This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
50
+	 *
51
+	 */
52 52
 	public function wordpress_salesforce_drop_tables() {
53 53
 		$field_map_table  = $this->wpdb->prefix . 'object_sync_sf_field_map';
54 54
 		$object_map_table = $this->wpdb->prefix . 'object_sync_sf_object_map';
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	/**
61
-	* Clear the scheduled tasks
62
-	* This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array
61
+	 * Clear the scheduled tasks
62
+	 * This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array
63 63
 	// todo: fix this so it uses action scheduler's scheduled tasks instead
64
-	*
65
-	*/
64
+	 *
65
+	 */
66 66
 	public function clear_schedule() {
67 67
 		foreach ( $this->schedulable_classes as $key => $value ) {
68 68
 			wp_clear_scheduled_hook( $key );
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	/**
73
-	* Delete the log post type
74
-	* This removes the log post type
75
-	*
76
-	*/
73
+	 * Delete the log post type
74
+	 * This removes the log post type
75
+	 *
76
+	 */
77 77
 	public function delete_log_post_type() {
78 78
 		unregister_post_type( 'wp_log' );
79 79
 	}
80 80
 
81 81
 	/**
82
-	* Remove roles and capabilities
83
-	* This removes the configure_salesforce capability from the admin role
84
-	*
85
-	* It also allows other plugins to remove the capability from other roles
86
-	*
87
-	*/
82
+	 * Remove roles and capabilities
83
+	 * This removes the configure_salesforce capability from the admin role
84
+	 *
85
+	 * It also allows other plugins to remove the capability from other roles
86
+	 *
87
+	 */
88 88
 	public function remove_roles_capabilities() {
89 89
 
90 90
 		// by default, only administrators can configure the plugin
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	/**
107
-	* Flush the plugin cache
108
-	*
109
-	*/
107
+	 * Flush the plugin cache
108
+	 *
109
+	 */
110 110
 	public function flush_plugin_cache() {
111 111
 		$sfwp_transients = new Object_Sync_Sf_WordPress_Transient( 'sfwp_transients' );
112 112
 		$sfwp_transients->flush();
113 113
 	}
114 114
 
115 115
 	/**
116
-	* Clear the plugin options
117
-	*
118
-	*/
116
+	 * Clear the plugin options
117
+	 *
118
+	 */
119 119
 	public function delete_plugin_options() {
120 120
 		$table          = $this->wpdb->prefix . 'options';
121 121
 		$plugin_options = $this->wpdb->get_results( 'SELECT option_name FROM ' . $table . ' WHERE option_name LIKE "object_sync_for_salesforce_%"', ARRAY_A );
Please login to merge, or discard this patch.