Passed
Pull Request — master (#195)
by Jonathan
02:56
created
templates/admin/user-profile-salesforce-change.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <input type="hidden" name="salesforce_update_mapped_user" value="1" />
2
-<h2><?php echo esc_html__( 'Salesforce', 'object-sync-for-salesforce' ); ?></h2>
3
-<p><?php echo esc_html__( 'You can change the Salesforce object that this WordPress user maps to by changing the ID and updating this user.', 'object-sync-for-salesforce' ); ?></p>
2
+<h2><?php echo esc_html__('Salesforce', 'object-sync-for-salesforce'); ?></h2>
3
+<p><?php echo esc_html__('You can change the Salesforce object that this WordPress user maps to by changing the ID and updating this user.', 'object-sync-for-salesforce'); ?></p>
4 4
 <table class="form-table">
5 5
 	<tr>
6
-		<th><label for="salesforce_id"><?php echo esc_html__( 'Salesforce ID', 'object-sync-for-salesforce' ); ?></label></th>
6
+		<th><label for="salesforce_id"><?php echo esc_html__('Salesforce ID', 'object-sync-for-salesforce'); ?></label></th>
7 7
 		<td>
8
-			<input type="text" name="salesforce_id" id="salesforce_id" value="<?php if ( isset( $mapping['id'] ) ) { echo esc_html( $mapping['salesforce_id'] ); } ?>" class="regular-text" /><br />
9
-			<span class="description"><?php echo esc_html__( 'Enter a Salesforce object ID.', 'object-sync-for-salesforce' ); ?></span>
8
+			<input type="text" name="salesforce_id" id="salesforce_id" value="<?php if (isset($mapping['id'])) { echo esc_html($mapping['salesforce_id']); } ?>" class="regular-text" /><br />
9
+			<span class="description"><?php echo esc_html__('Enter a Salesforce object ID.', 'object-sync-for-salesforce'); ?></span>
10 10
 		</td>
11 11
 	</tr>
12 12
 </table>
Please login to merge, or discard this patch.
templates/admin/authorized.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,2 +1,2 @@
 block discarded – undo
1
-<div class="success"><h2><?php echo esc_html__( 'Salesforce is successfully authenticated.' ); ?></h2></div>
2
-<p><a class="button button-primary" href="<?php echo esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=logout' ) ); ?>"><?php echo esc_html__( 'Disconnect from Salesforce', 'object-sync-for-salesforce' ); ?></a></p>
1
+<div class="success"><h2><?php echo esc_html__('Salesforce is successfully authenticated.'); ?></h2></div>
2
+<p><a class="button button-primary" href="<?php echo esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=logout')); ?>"><?php echo esc_html__('Disconnect from Salesforce', 'object-sync-for-salesforce'); ?></a></p>
Please login to merge, or discard this patch.
templates/admin/user-profile-salesforce-map.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <input type="hidden" name="salesforce_create_mapped_user" value="1" />
2
-<h2><?php echo esc_html__( 'Salesforce', 'object-sync-for-salesforce' ); ?></h2>
3
-<p><?php echo esc_html__( "This user is not mapped to an object in Salesforce. You can run a push to send this object to Salesforce, which will cause it to follow the plugin's normal mapping conventions, or you can create a manual link to a Salesforce object.", 'object-sync-for-salesforce' ); ?></p>
2
+<h2><?php echo esc_html__('Salesforce', 'object-sync-for-salesforce'); ?></h2>
3
+<p><?php echo esc_html__("This user is not mapped to an object in Salesforce. You can run a push to send this object to Salesforce, which will cause it to follow the plugin's normal mapping conventions, or you can create a manual link to a Salesforce object.", 'object-sync-for-salesforce'); ?></p>
4 4
 <table class="form-table">
5 5
 	<tr>
6
-		<th><label for="salesforce_id"><?php echo esc_html__( 'Salesforce ID', 'object-sync-for-salesforce' ); ?></label></th>
6
+		<th><label for="salesforce_id"><?php echo esc_html__('Salesforce ID', 'object-sync-for-salesforce'); ?></label></th>
7 7
 		<td>
8 8
 			<input type="text" name="salesforce_id" id="salesforce_id" value="" class="regular-text" /><br />
9
-			<span class="description"><?php echo esc_html__( 'Enter a Salesforce object ID.', 'object-sync-for-salesforce' ); ?></span>
9
+			<span class="description"><?php echo esc_html__('Enter a Salesforce object ID.', 'object-sync-for-salesforce'); ?></span>
10 10
 			<p><strong>or</strong></p>
11
-			<p><button type="submit" class="button button-secondary push_to_salesforce_button" name="push_new_user_to_salesforce"><?php echo esc_html__( 'Push to Salesforce as new record', 'object-sync-for-salesforce' ); ?></button></p>
11
+			<p><button type="submit" class="button button-secondary push_to_salesforce_button" name="push_new_user_to_salesforce"><?php echo esc_html__('Push to Salesforce as new record', 'object-sync-for-salesforce'); ?></button></p>
12 12
 		</td>
13 13
 	</tr>
14 14
 </table>
Please login to merge, or discard this patch.
classes/salesforce_query.php 2 patches
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.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @file
6 6
  */
7 7
 
8
-if ( ! class_exists( 'Object_Sync_Salesforce' ) ) {
8
+if ( ! class_exists('Object_Sync_Salesforce')) {
9 9
 	die();
10 10
 }
11 11
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	* @param string $object_type
28 28
 	*   Salesforce object type to query.
29 29
 	*/
30
-	public function __construct( $object_type = '' ) {
30
+	public function __construct($object_type = '') {
31 31
 		$this->object_type = $object_type;
32 32
 	}
33 33
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	* @param string $operator
44 44
 	*   Conditional operator. One of '=', '!=', '<', '>', 'LIKE, 'IN', 'NOT IN'.
45 45
 	*/
46
-	public function add_condition( $field, $value, $operator = '=' ) {
47
-		if ( is_array( $value ) ) {
48
-			$value = "('" . implode( "','", $value ) . "')";
46
+	public function add_condition($field, $value, $operator = '=') {
47
+		if (is_array($value)) {
48
+			$value = "('" . implode("','", $value) . "')";
49 49
 
50 50
 			// Set operator to IN if wasn't already changed from the default.
51
-			if ( '=' === $operator ) {
51
+			if ('=' === $operator) {
52 52
 				$operator = 'IN';
53 53
 			}
54 54
 		}
@@ -70,31 +70,31 @@  discard block
 block discarded – undo
70 70
 	public function __toString() {
71 71
 
72 72
 		$query  = 'SELECT ';
73
-		$query .= implode( ', ', $this->fields );
73
+		$query .= implode(', ', $this->fields);
74 74
 		$query .= ' FROM ' . $this->object_type;
75 75
 
76
-		if ( count( $this->conditions ) > 0 ) {
76
+		if (count($this->conditions) > 0) {
77 77
 			$where = array();
78
-			foreach ( $this->conditions as $condition ) {
79
-				$where[] = implode( ' ', $condition );
78
+			foreach ($this->conditions as $condition) {
79
+				$where[] = implode(' ', $condition);
80 80
 			}
81
-			$query .= ' WHERE ' . implode( ' AND ', $where );
81
+			$query .= ' WHERE ' . implode(' AND ', $where);
82 82
 		}
83 83
 
84
-		if ( $this->order ) {
84
+		if ($this->order) {
85 85
 			$query .= ' ORDER BY ';
86 86
 			$fields = array();
87
-			foreach ( $this->order as $field => $direction ) {
87
+			foreach ($this->order as $field => $direction) {
88 88
 				$fields[] = $field . ' ' . $direction;
89 89
 			}
90
-			$query .= implode( ', ', $fields );
90
+			$query .= implode(', ', $fields);
91 91
 		}
92 92
 
93
-		if ( $this->limit ) {
93
+		if ($this->limit) {
94 94
 			$query .= ' LIMIT ' . (int) $this->limit;
95 95
 		}
96 96
 
97
-		if ( $this->offset ) {
97
+		if ($this->offset) {
98 98
 			$query .= ' OFFSET ' . (int) $this->offset;
99 99
 		}
100 100
 
Please login to merge, or discard this patch.
classes/admin-notice.php 2 patches
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.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @file
6 6
  */
7 7
 
8
-if ( ! class_exists( 'Object_Sync_Salesforce' ) ) {
8
+if ( ! class_exists('Object_Sync_Salesforce')) {
9 9
 	die();
10 10
 }
11 11
 
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	* @param string $template
31 31
 	*
32 32
 	*/
33
-	public function __construct( $condition, $message, $dismissible = false, $type = '', $template = '' ) {
33
+	public function __construct($condition, $message, $dismissible = false, $type = '', $template = '') {
34 34
 		$this->condition   = $condition;
35 35
 		$this->message     = $message;
36 36
 		$this->dismissible = $dismissible;
37 37
 		$this->type        = $type;
38 38
 		$this->template    = $template;
39 39
 
40
-		add_action( 'admin_notices', array( $this, 'render' ) );
40
+		add_action('admin_notices', array($this, 'render'));
41 41
 
42 42
 	}
43 43
 
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
 
50 50
 		// class for the notice to use
51 51
 		$class = '';
52
-		if ( '' !== $this->type ) {
52
+		if ('' !== $this->type) {
53 53
 			$class = ' notice-' . $this->type;
54 54
 		}
55 55
 
56 56
 		$dismissible = '';
57
-		if ( true === $this->dismissible ) {
57
+		if (true === $this->dismissible) {
58 58
 			$dismissible = ' is-dismissible';
59 59
 		}
60 60
 
61 61
 		// template for notice has a default
62
-		if ( '' === $this->template ) {
63
-			$template = plugin_dir_path( __FILE__ ) . '/../templates/admin/notice.php';
62
+		if ('' === $this->template) {
63
+			$template = plugin_dir_path(__FILE__) . '/../templates/admin/notice.php';
64 64
 		} else {
65 65
 			$template = $this->template;
66 66
 		}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		$condition = $this->condition;
69 69
 		$message   = $this->message;
70 70
 
71
-		require_once( $template );
71
+		require_once($template);
72 72
 
73 73
 	}
74 74
 
Please login to merge, or discard this patch.
classes/salesforce_soap_partner.php 2 patches
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.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @file
6 6
  */
7 7
 
8
-if ( ! class_exists( 'Object_Sync_Salesforce' ) ) {
8
+if ( ! class_exists('Object_Sync_Salesforce')) {
9 9
 	die();
10 10
 }
11 11
 
@@ -25,33 +25,33 @@  discard block
 block discarded – undo
25 25
 	* Constructor which loads the SOAP client
26 26
 	*
27 27
 	*/
28
-	public function __construct( Object_Sync_Sf_Salesforce $sfapi, $wsdl = null ) {
29
-		if ( ! class_exists( 'SforceBaseClient' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
30
-			require_once plugin_dir_path( __FILE__ ) . '../vendor/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php';
28
+	public function __construct(Object_Sync_Sf_Salesforce $sfapi, $wsdl = null) {
29
+		if ( ! class_exists('SforceBaseClient') && file_exists(plugin_dir_path(__FILE__) . '../vendor/autoload.php')) {
30
+			require_once plugin_dir_path(__FILE__) . '../vendor/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php';
31 31
 		}
32 32
 		parent::__construct();
33
-		if ( empty( $wsdl ) ) {
34
-			$wsdl = plugin_dir_path( __FILE__ ) . '../vendor/developerforce/force.com-toolkit-for-php/soapclient/partner.wsdl.xml';
33
+		if (empty($wsdl)) {
34
+			$wsdl = plugin_dir_path(__FILE__) . '../vendor/developerforce/force.com-toolkit-for-php/soapclient/partner.wsdl.xml';
35 35
 		}
36
-		$this->set_authorized( false );
37
-		$this->createConnection( $wsdl );
36
+		$this->set_authorized(false);
37
+		$this->createConnection($wsdl);
38 38
 		$this->salesforce_api = $sfapi;
39 39
 
40
-		if ( $this->salesforce_api->is_authorized() ) {
40
+		if ($this->salesforce_api->is_authorized()) {
41 41
 			$token = $this->salesforce_api->get_access_token();
42
-			if ( ! $token ) {
42
+			if ( ! $token) {
43 43
 				$token = $this->salesforce_api->refresh_token();
44 44
 			}
45
-			$this->setSessionHeader( $token );
46
-			$this->setEndPoint( $this->salesforce_api->get_api_endpoint( 'partner' ) );
47
-			$this->set_authorized( true );
45
+			$this->setSessionHeader($token);
46
+			$this->setEndPoint($this->salesforce_api->get_api_endpoint('partner'));
47
+			$this->set_authorized(true);
48 48
 		} else {
49
-			error_log( 'salesforce is not authorized so we cannot use soap' );
50
-			$this->set_authorized( false );
49
+			error_log('salesforce is not authorized so we cannot use soap');
50
+			$this->set_authorized(false);
51 51
 		}
52 52
 	}
53 53
 
54
-	protected function set_authorized( $is_authorized ) {
54
+	protected function set_authorized($is_authorized) {
55 55
 		$this->is_authorized = $is_authorized;
56 56
 	}
57 57
 
@@ -59,35 +59,35 @@  discard block
 block discarded – undo
59 59
 		return $this->is_authorized;
60 60
 	}
61 61
 
62
-	public function try_soap( $function ) {
62
+	public function try_soap($function) {
63 63
 		$args = func_get_args();
64
-		array_shift( $args );
64
+		array_shift($args);
65 65
 		try {
66
-			$results = call_user_func_array( array( $this, $function ), $args );
66
+			$results = call_user_func_array(array($this, $function), $args);
67 67
 			// If returned without exceptions, reset the refreshed flag.
68 68
 			$this->refreshed = false;
69 69
 			return $results;
70
-		} catch ( SoapFault $e ) {
70
+		} catch (SoapFault $e) {
71 71
 			// sf:INVALID_SESSION_ID is thrown on expired login (and other reasons).
72 72
 			// Our only recourse is to try refreshing our auth token. If we get any
73 73
 			// other exception, bubble it up.
74
-			if ( 'sf:INVALID_SESSION_ID' !== $e->faultcode ) {
74
+			if ('sf:INVALID_SESSION_ID' !== $e->faultcode) {
75 75
 				throw $e;
76 76
 			}
77 77
 
78
-			if ( ! $this->refreshed ) {
78
+			if ( ! $this->refreshed) {
79 79
 				// If we got an invalid session exception, try to refresh the auth
80 80
 				// token through REST API. The "refreshed" flag will make sure we retry
81 81
 				// only once.
82 82
 				$this->refreshed = true;
83 83
 				$this->salesforce_api->refresh_token();
84
-				return $this->trySoap( $function, $args );
84
+				return $this->trySoap($function, $args);
85 85
 			}
86 86
 
87 87
 			// If we've already tried a refresh, this refresh token is probably
88 88
 			// invalid. Kill it, log, and bubble the exception.
89
-			$this->set_authorized( false );
90
-			error_log( 'website is not authorized to connect to salesforce. visit authorize page.' );
89
+			$this->set_authorized(false);
90
+			error_log('website is not authorized to connect to salesforce. visit authorize page.');
91 91
 			throw $e;
92 92
 
93 93
 		}
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
  * @package Object_Sync_Salesforce
6 6
  */
7 7
 
8
-$_tests_dir = getenv( 'WP_TESTS_DIR' );
9
-if ( ! $_tests_dir ) {
8
+$_tests_dir = getenv('WP_TESTS_DIR');
9
+if ( ! $_tests_dir) {
10 10
 	$_tests_dir = '/tmp/wordpress-tests-lib';
11 11
 }
12 12
 
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
  * Manually load the plugin being tested.
18 18
  */
19 19
 function _manually_load_plugin() {
20
-	require dirname( dirname( __FILE__ ) ) . '/object-sync-for-salesforce.php';
20
+	require dirname(dirname(__FILE__)) . '/object-sync-for-salesforce.php';
21 21
 }
22
-tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
22
+tests_add_filter('muplugins_loaded', '_manually_load_plugin');
23 23
 
24 24
 // Start up the WP testing environment.
25 25
 require $_tests_dir . '/includes/bootstrap.php';
Please login to merge, or discard this patch.
tests/test-sample.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 	 */
16 16
 	function test_sample() {
17 17
 		// Replace this with some actual testing code.
18
-		$this->assertTrue( true );
18
+		$this->assertTrue(true);
19 19
 	}
20 20
 }
Please login to merge, or discard this patch.
templates/admin/fieldmaps-add-edit-clone.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1
-<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="fieldmap">
2
-	<input type="hidden" name="redirect_url_error" value="<?php echo esc_url( $error_url ); ?>" />
3
-	<input type="hidden" name="redirect_url_success" value="<?php echo esc_url( $success_url ); ?>" />
4
-	<?php if ( isset( $transient ) ) { ?>
5
-	<input type="hidden" name="transient" value="<?php echo esc_html( $transient ); ?>" />
1
+<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="fieldmap">
2
+	<input type="hidden" name="redirect_url_error" value="<?php echo esc_url($error_url); ?>" />
3
+	<input type="hidden" name="redirect_url_success" value="<?php echo esc_url($success_url); ?>" />
4
+	<?php if (isset($transient)) { ?>
5
+	<input type="hidden" name="transient" value="<?php echo esc_html($transient); ?>" />
6 6
 	<?php } ?>
7 7
 	<input type="hidden" name="action" value="post_fieldmap" >
8
-	<input type="hidden" name="method" value="<?php echo esc_attr( $method ); ?>" />
9
-	<?php if ( 'edit' === $method ) { ?>
10
-	<input type="hidden" name="id" value="<?php echo absint( $map['id'] ); ?>" />
8
+	<input type="hidden" name="method" value="<?php echo esc_attr($method); ?>" />
9
+	<?php if ('edit' === $method) { ?>
10
+	<input type="hidden" name="id" value="<?php echo absint($map['id']); ?>" />
11 11
 	<?php } ?>
12 12
 	<div class="fieldmap_label">
13
-		<label for="label"><?php echo esc_html__( 'Label', 'object-sync-for-salesforce' ); ?>: </label>
14
-		<input type="text" id="label" name="label" required value="<?php echo isset( $label ) ? esc_html( $label ) : ''; ?>" />
13
+		<label for="label"><?php echo esc_html__('Label', 'object-sync-for-salesforce'); ?>: </label>
14
+		<input type="text" id="label" name="label" required value="<?php echo isset($label) ? esc_html($label) : ''; ?>" />
15 15
 	</div>
16 16
 	<fieldset class="wordpress_side">
17 17
 		<div class="wordpress_object">
18
-			<label for="wordpress_object"><?php echo esc_html__( 'WordPress Object', 'object-sync-for-salesforce' ); ?>: </label>
18
+			<label for="wordpress_object"><?php echo esc_html__('WordPress Object', 'object-sync-for-salesforce'); ?>: </label>
19 19
 			<select id="wordpress_object" name="wordpress_object" required>
20
-				<option value="">- <?php echo esc_html__( 'Select object type', 'object-sync-for-salesforce' ); ?> -</option>
20
+				<option value="">- <?php echo esc_html__('Select object type', 'object-sync-for-salesforce'); ?> -</option>
21 21
 				<?php
22 22
 				$wordpress_objects = $this->wordpress->wordpress_objects;
23
-				foreach ( $wordpress_objects as $object ) {
24
-					if ( isset( $wordpress_object ) && $wordpress_object === $object ) {
23
+				foreach ($wordpress_objects as $object) {
24
+					if (isset($wordpress_object) && $wordpress_object === $object) {
25 25
 						$selected = ' selected';
26 26
 					} else {
27 27
 						$selected = '';
28 28
 					}
29
-					echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
30
-						esc_html( $object ),
31
-						esc_attr( $selected ),
32
-						esc_html( $object )
29
+					echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
30
+						esc_html($object),
31
+						esc_attr($selected),
32
+						esc_html($object)
33 33
 					);
34 34
 				}
35 35
 				?>
@@ -38,31 +38,31 @@  discard block
 block discarded – undo
38 38
 	</fieldset>
39 39
 	<fieldset class="salesforce_side">
40 40
 		<div class="salesforce_object">
41
-			<label for="salesforce_object"><?php echo esc_html__( 'Salesforce Object', 'object-sync-for-salesforce' ); ?>: </label>
41
+			<label for="salesforce_object"><?php echo esc_html__('Salesforce Object', 'object-sync-for-salesforce'); ?>: </label>
42 42
 			<div class="spinner"></div>
43 43
 			<select id="salesforce_object" name="salesforce_object" required>
44
-				<option value="">- <?php echo esc_html__( 'Select object type', 'object-sync-for-salesforce' ); ?> -</option>
44
+				<option value="">- <?php echo esc_html__('Select object type', 'object-sync-for-salesforce'); ?> -</option>
45 45
 				<?php
46 46
 				$sfapi          = $this->salesforce['sfapi'];
47
-				$object_filters = maybe_unserialize( get_option( 'salesforce_api_object_filters' ), array() );
47
+				$object_filters = maybe_unserialize(get_option('salesforce_api_object_filters'), array());
48 48
 				$conditions     = array();
49
-				if ( is_array( $object_filters ) && in_array( 'updateable', $object_filters, true ) ) {
49
+				if (is_array($object_filters) && in_array('updateable', $object_filters, true)) {
50 50
 					$conditions['updateable'] = true;
51 51
 				}
52
-				if ( is_array( $object_filters ) && in_array( 'triggerable', $object_filters, true ) ) {
52
+				if (is_array($object_filters) && in_array('triggerable', $object_filters, true)) {
53 53
 					$conditions['triggerable'] = true;
54 54
 				}
55
-				$salesforce_objects = $sfapi->objects( $conditions );
56
-				foreach ( $salesforce_objects as $object ) {
57
-					if ( isset( $salesforce_object ) && $salesforce_object === $object['name'] ) {
55
+				$salesforce_objects = $sfapi->objects($conditions);
56
+				foreach ($salesforce_objects as $object) {
57
+					if (isset($salesforce_object) && $salesforce_object === $object['name']) {
58 58
 						$selected = ' selected';
59 59
 					} else {
60 60
 						$selected = '';
61 61
 					}
62
-					echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
63
-						esc_html( $object['name'] ),
64
-						esc_attr( $selected ),
65
-						esc_html( $object['label'] )
62
+					echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
63
+						esc_html($object['name']),
64
+						esc_attr($selected),
65
+						esc_html($object['label'])
66 66
 					);
67 67
 				}
68 68
 				?>
@@ -70,30 +70,30 @@  discard block
 block discarded – undo
70 70
 		</div>
71 71
 		<div class="salesforce_record_types_allowed">
72 72
 			<?php
73
-			if ( isset( $salesforce_record_types_allowed ) ) :
73
+			if (isset($salesforce_record_types_allowed)) :
74 74
 				$record_types = $this->get_salesforce_object_description(
75 75
 					array(
76 76
 						'salesforce_object' => $salesforce_object,
77 77
 						'include'           => 'recordTypeInfos',
78 78
 					)
79 79
 				);
80
-				if ( isset( $record_types['recordTypeInfos'] ) ) :
80
+				if (isset($record_types['recordTypeInfos'])) :
81 81
 					?>
82
-					<label for="salesforce_record_types_allowed"><?php echo __( 'Allowed Record Types', 'object-sync-for-salesforce' ); ?>:</label>
82
+					<label for="salesforce_record_types_allowed"><?php echo __('Allowed Record Types', 'object-sync-for-salesforce'); ?>:</label>
83 83
 					<div class="checkboxes">
84
-					<?php foreach ( $record_types['recordTypeInfos'] as $key => $value ) : ?>
84
+					<?php foreach ($record_types['recordTypeInfos'] as $key => $value) : ?>
85 85
 						<?php
86
-						if ( in_array( $key, $salesforce_record_types_allowed, true ) ) {
86
+						if (in_array($key, $salesforce_record_types_allowed, true)) {
87 87
 							$checked = ' checked';
88 88
 						} else {
89 89
 							$checked = '';
90 90
 						}
91
-						echo sprintf( '<label><input type="checkbox" class="form-checkbox" value="%1$s" name="%2$s" id="%3$s"%4$s>%5$s</label>',
92
-							esc_html( $key ),
93
-							esc_attr( 'salesforce_record_types_allowed[' . $key . ']' ),
94
-							esc_attr( 'salesforce_record_types_allowed-' . $key ),
95
-							esc_html( $checked ),
96
-							esc_html( $value )
91
+						echo sprintf('<label><input type="checkbox" class="form-checkbox" value="%1$s" name="%2$s" id="%3$s"%4$s>%5$s</label>',
92
+							esc_html($key),
93
+							esc_attr('salesforce_record_types_allowed[' . $key . ']'),
94
+							esc_attr('salesforce_record_types_allowed-' . $key),
95
+							esc_html($checked),
96
+							esc_html($value)
97 97
 						);
98 98
 						?>
99 99
 					<?php endforeach; ?>
@@ -103,29 +103,29 @@  discard block
 block discarded – undo
103 103
 		</div>
104 104
 		<div class="salesforce_record_type_default">
105 105
 			<?php
106
-			if ( isset( $salesforce_record_type_default ) ) :
106
+			if (isset($salesforce_record_type_default)) :
107 107
 				$record_types = $this->get_salesforce_object_description(
108 108
 					array(
109 109
 						'salesforce_object' => $salesforce_object,
110 110
 						'include'           => 'recordTypeInfos',
111 111
 					)
112 112
 				);
113
-				if ( isset( $record_types['recordTypeInfos'] ) ) :
113
+				if (isset($record_types['recordTypeInfos'])) :
114 114
 					?>
115
-					<label for="salesforce_record_type_default"><?php echo __( 'Default Record Type', 'object-sync-for-salesforce' ); ?>:</label>
116
-					<select id="salesforce_record_type_default" name="salesforce_record_type_default" required><option value="">- <?php echo __( 'Select record type', 'object-sync-for-salesforce' ); ?> -</option>
115
+					<label for="salesforce_record_type_default"><?php echo __('Default Record Type', 'object-sync-for-salesforce'); ?>:</label>
116
+					<select id="salesforce_record_type_default" name="salesforce_record_type_default" required><option value="">- <?php echo __('Select record type', 'object-sync-for-salesforce'); ?> -</option>
117 117
 					<?php
118
-					foreach ( $record_types['recordTypeInfos'] as $key => $value ) :
119
-						if ( isset( $salesforce_record_type_default ) && $salesforce_record_type_default === $key ) {
118
+					foreach ($record_types['recordTypeInfos'] as $key => $value) :
119
+						if (isset($salesforce_record_type_default) && $salesforce_record_type_default === $key) {
120 120
 							$selected = ' selected';
121 121
 						} else {
122 122
 							$selected = '';
123 123
 						}
124
-						if ( ! isset( $salesforce_record_types_allowed ) || in_array( $key, $salesforce_record_types_allowed, true ) ) {
125
-							echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
126
-								esc_attr( $key ),
127
-								esc_attr( $selected ),
128
-								esc_html( $value )
124
+						if ( ! isset($salesforce_record_types_allowed) || in_array($key, $salesforce_record_types_allowed, true)) {
125
+							echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
126
+								esc_attr($key),
127
+								esc_attr($selected),
128
+								esc_html($value)
129 129
 							);
130 130
 						}
131 131
 					endforeach;
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 			?>
138 138
 		</div>
139 139
 		<div class="pull_trigger_field">
140
-			<?php if ( isset( $pull_trigger_field ) ) : ?>
141
-				<label for="pull_trigger_field"><?php echo __( 'Date field to trigger pull', 'object-sync-for-salesforce' ); ?>:</label>
140
+			<?php if (isset($pull_trigger_field)) : ?>
141
+				<label for="pull_trigger_field"><?php echo __('Date field to trigger pull', 'object-sync-for-salesforce'); ?>:</label>
142 142
 				<?php
143 143
 				$object_fields = $this->get_salesforce_object_fields(
144 144
 					array(
@@ -149,35 +149,35 @@  discard block
 block discarded – undo
149 149
 				?>
150 150
 				<select name="pull_trigger_field" id="pull_trigger_field">
151 151
 				<?php
152
-				foreach ( $object_fields as $key => $value ) {
153
-					if ( $pull_trigger_field === $value['name'] ) {
152
+				foreach ($object_fields as $key => $value) {
153
+					if ($pull_trigger_field === $value['name']) {
154 154
 						$selected = ' selected';
155 155
 					} else {
156 156
 						$selected = '';
157 157
 					}
158
-					echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
159
-						esc_attr( $value['name'] ),
160
-						esc_attr( $selected ),
161
-						esc_html( $value['label'] )
158
+					echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
159
+						esc_attr($value['name']),
160
+						esc_attr($selected),
161
+						esc_html($value['label'])
162 162
 					);
163 163
 				}
164 164
 				?>
165 165
 				</select>
166
-				<p class="description"><?php echo esc_html__( 'When the plugin checks for data to bring from Salesforce into WordPress, it will use the selected field to determine what relevant changes have occurred in Salesforce.', 'object-sync-for-salesforce' ); ?></p>
166
+				<p class="description"><?php echo esc_html__('When the plugin checks for data to bring from Salesforce into WordPress, it will use the selected field to determine what relevant changes have occurred in Salesforce.', 'object-sync-for-salesforce'); ?></p>
167 167
 			<?php endif; ?>
168 168
 		</div>
169 169
 	</fieldset>
170 170
 	<fieldset class="fields">
171
-		<legend><?php echo esc_html__( 'Fieldmap', 'object-sync-for-salesforce' ); ?></legend>
171
+		<legend><?php echo esc_html__('Fieldmap', 'object-sync-for-salesforce'); ?></legend>
172 172
 		<table class="wp-list-table widefat striped fields">
173 173
 			<thead>
174 174
 				<tr>
175
-					<th class="column-wordpress_field"><?php echo esc_html__( 'WordPress Field', 'object-sync-for-salesforce' ); ?></th>
176
-					<th class="column-salesforce_field"><?php echo esc_html__( 'Salesforce Field', 'object-sync-for-salesforce' ); ?></th>
177
-					<th class="column-is_prematch"><?php echo esc_html__( 'Prematch', 'object-sync-for-salesforce' ); ?></th>
178
-					<th class="column-is_key"><?php echo esc_html__( 'Salesforce Key', 'object-sync-for-salesforce' ); ?></th>
179
-					<th class="column-direction"><?php echo esc_html__( 'Direction', 'object-sync-for-salesforce' ); ?></th>
180
-					<th class="column-is_delete"><?php echo esc_html__( 'Delete', 'object-sync-for-salesforce' ); ?></th>
175
+					<th class="column-wordpress_field"><?php echo esc_html__('WordPress Field', 'object-sync-for-salesforce'); ?></th>
176
+					<th class="column-salesforce_field"><?php echo esc_html__('Salesforce Field', 'object-sync-for-salesforce'); ?></th>
177
+					<th class="column-is_prematch"><?php echo esc_html__('Prematch', 'object-sync-for-salesforce'); ?></th>
178
+					<th class="column-is_key"><?php echo esc_html__('Salesforce Key', 'object-sync-for-salesforce'); ?></th>
179
+					<th class="column-direction"><?php echo esc_html__('Direction', 'object-sync-for-salesforce'); ?></th>
180
+					<th class="column-is_delete"><?php echo esc_html__('Delete', 'object-sync-for-salesforce'); ?></th>
181 181
 				</tr>
182 182
 			</thead>
183 183
 			<tfoot>
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 						<p><small>
187 187
 							<?php
188 188
 							// translators: the placeholders refer to: 1) the cache clear link, 2) the cache clear link text
189
-							echo sprintf( '<strong>' . esc_html__( 'Note:', 'object-sync-for-salesforce' ) . '</strong>' . esc_html__( ' to map a custom meta field (such as wp_postmeta, wp_usermeta, wp_termmeta, etc.), WordPress must have at least one value for that field. If you add a new meta field and want to map it, make sure to add a value for it and ', 'object-sync-for-salesforce' ) . '<a href="%1$s" id="clear-sfwp-cache">%2$s</a>' . esc_html__( ' to see the field listed here', 'object-sync-for-salesforce' ),
190
-								esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=clear_cache' ) ),
191
-								esc_html__( 'clear the plugin cache', 'object-sync-for-salesforce' )
189
+							echo sprintf('<strong>' . esc_html__('Note:', 'object-sync-for-salesforce') . '</strong>' . esc_html__(' to map a custom meta field (such as wp_postmeta, wp_usermeta, wp_termmeta, etc.), WordPress must have at least one value for that field. If you add a new meta field and want to map it, make sure to add a value for it and ', 'object-sync-for-salesforce') . '<a href="%1$s" id="clear-sfwp-cache">%2$s</a>' . esc_html__(' to see the field listed here', 'object-sync-for-salesforce'),
190
+								esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=clear_cache')),
191
+								esc_html__('clear the plugin cache', 'object-sync-for-salesforce')
192 192
 							);
193 193
 							?>
194 194
 						</small></p>
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
 			</tfoot>
198 198
 			<tbody>
199 199
 				<?php
200
-				if ( isset( $fieldmap_fields ) && null !== $fieldmap_fields && is_array( $fieldmap_fields ) ) {
201
-					foreach ( $fieldmap_fields as $key => $value ) {
202
-						$key = md5( $key . time() );
200
+				if (isset($fieldmap_fields) && null !== $fieldmap_fields && is_array($fieldmap_fields)) {
201
+					foreach ($fieldmap_fields as $key => $value) {
202
+						$key = md5($key . time());
203 203
 				?>
204 204
 				<tr>
205 205
 					<td class="column-wordpress_field">
206
-						<select name="wordpress_field[<?php echo esc_attr( $key ); ?>]" id="wordpress_field-<?php echo esc_attr( $key ); ?>">
207
-							<option value="">- <?php echo esc_html__( 'Select WordPress field', 'object-sync-for-salesforce' ); ?> -</option>
206
+						<select name="wordpress_field[<?php echo esc_attr($key); ?>]" id="wordpress_field-<?php echo esc_attr($key); ?>">
207
+							<option value="">- <?php echo esc_html__('Select WordPress field', 'object-sync-for-salesforce'); ?> -</option>
208 208
 							<?php
209
-							$wordpress_fields = $this->get_wordpress_object_fields( $wordpress_object );
210
-							foreach ( $wordpress_fields as $wordpress_field ) {
211
-								if ( isset( $value['wordpress_field']['label'] ) && $value['wordpress_field']['label'] === $wordpress_field['key'] ) {
209
+							$wordpress_fields = $this->get_wordpress_object_fields($wordpress_object);
210
+							foreach ($wordpress_fields as $wordpress_field) {
211
+								if (isset($value['wordpress_field']['label']) && $value['wordpress_field']['label'] === $wordpress_field['key']) {
212 212
 									$selected = ' selected';
213 213
 								} else {
214 214
 									$selected = '';
215 215
 								}
216
-								echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
217
-									esc_attr( $wordpress_field['key'] ),
218
-									esc_attr( $selected ),
219
-									esc_html( $wordpress_field['key'] )
216
+								echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
217
+									esc_attr($wordpress_field['key']),
218
+									esc_attr($selected),
219
+									esc_html($wordpress_field['key'])
220 220
 								);
221 221
 							}
222 222
 							?>
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 
225 225
 					</td>
226 226
 					<td class="column-salesforce_field">
227
-						<select name="salesforce_field[<?php echo esc_attr( $key ); ?>]" id="salesforce_field-<?php echo esc_attr( $key ); ?>">
228
-							<option value="">- <?php echo esc_html__( 'Select Salesforce field', 'object-sync-for-salesforce' ); ?> -</option>
227
+						<select name="salesforce_field[<?php echo esc_attr($key); ?>]" id="salesforce_field-<?php echo esc_attr($key); ?>">
228
+							<option value="">- <?php echo esc_html__('Select Salesforce field', 'object-sync-for-salesforce'); ?> -</option>
229 229
 							<?php
230 230
 							$salesforce_fields = $this->get_salesforce_object_fields(
231 231
 								array(
@@ -233,25 +233,25 @@  discard block
 block discarded – undo
233 233
 								)
234 234
 							);
235 235
 							// allow for api name or field label to be the display value in the <select>
236
-							$display_value = get_option( $this->option_prefix . 'salesforce_field_display_value', 'field_label' );
237
-							foreach ( $salesforce_fields as $salesforce_field ) {
238
-								if ( isset( $value['salesforce_field']['name'] ) && $value['salesforce_field']['name'] === $salesforce_field['name'] ) {
236
+							$display_value = get_option($this->option_prefix . 'salesforce_field_display_value', 'field_label');
237
+							foreach ($salesforce_fields as $salesforce_field) {
238
+								if (isset($value['salesforce_field']['name']) && $value['salesforce_field']['name'] === $salesforce_field['name']) {
239 239
 									$selected = ' selected';
240
-								} elseif ( isset( $value['salesforce_field']['label'] ) && $value['salesforce_field']['label'] === $salesforce_field['name'] ) {
240
+								} elseif (isset($value['salesforce_field']['label']) && $value['salesforce_field']['label'] === $salesforce_field['name']) {
241 241
 									// this conditional is for versions up to 1.1.2, but i think it's fine to leave it for now. if we remove it, people's fieldmaps will not show correctly in the admin.
242 242
 									$selected = ' selected';
243 243
 								} else {
244 244
 									$selected = '';
245 245
 								}
246 246
 
247
-								if ( 'api_name' === $display_value ) {
247
+								if ('api_name' === $display_value) {
248 248
 									$salesforce_field['label'] = $salesforce_field['name'];
249 249
 								}
250 250
 
251
-								echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
252
-									esc_attr( $salesforce_field['name'] ),
253
-									esc_attr( $selected ),
254
-									esc_html( $salesforce_field['label'] )
251
+								echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
252
+									esc_attr($salesforce_field['name']),
253
+									esc_attr($selected),
254
+									esc_html($salesforce_field['label'])
255 255
 								);
256 256
 							}
257 257
 							?>
@@ -260,32 +260,32 @@  discard block
 block discarded – undo
260 260
 					</td>
261 261
 					<td class="column-is_prematch">
262 262
 						<?php
263
-						if ( isset( $value['is_prematch'] ) && '1' === $value['is_prematch'] ) {
263
+						if (isset($value['is_prematch']) && '1' === $value['is_prematch']) {
264 264
 							$checked = ' checked';
265 265
 						} else {
266 266
 							$checked = '';
267 267
 						}
268 268
 						?>
269
-						<input type="checkbox" name="is_prematch[<?php echo esc_attr( $key ); ?>]" id="is_prematch-<?php echo esc_attr( $key ); ?>" value="1" <?php echo esc_attr( $checked ); ?> title="<?php echo esc_html__( 'This pair should be checked for existing matches in Salesforce before adding', 'object-sync-for-salesforce' ); ?>" />
269
+						<input type="checkbox" name="is_prematch[<?php echo esc_attr($key); ?>]" id="is_prematch-<?php echo esc_attr($key); ?>" value="1" <?php echo esc_attr($checked); ?> title="<?php echo esc_html__('This pair should be checked for existing matches in Salesforce before adding', 'object-sync-for-salesforce'); ?>" />
270 270
 					</td>
271 271
 					<td class="column-is_key">
272 272
 						<?php
273
-						if ( isset( $value['is_key'] ) && '1' === $value['is_key'] ) {
273
+						if (isset($value['is_key']) && '1' === $value['is_key']) {
274 274
 							$checked = ' checked';
275 275
 						} else {
276 276
 							$checked = '';
277 277
 						}
278 278
 						?>
279
-						<input type="checkbox" name="is_key[<?php echo esc_attr( $key ); ?>]" id="is_key-<?php echo esc_attr( $key ); ?>" value="1" <?php echo esc_attr( $checked ); ?> title="<?php echo esc_html__( 'This Salesforce field is an External ID in Salesforce', 'object-sync-for-salesforce' ); ?>" />
279
+						<input type="checkbox" name="is_key[<?php echo esc_attr($key); ?>]" id="is_key-<?php echo esc_attr($key); ?>" value="1" <?php echo esc_attr($checked); ?> title="<?php echo esc_html__('This Salesforce field is an External ID in Salesforce', 'object-sync-for-salesforce'); ?>" />
280 280
 					</td>
281 281
 					<td class="column-direction">
282 282
 						<?php
283
-						if ( isset( $value['direction'] ) ) {
284
-							if ( 'sf_wp' === $value['direction'] ) {
283
+						if (isset($value['direction'])) {
284
+							if ('sf_wp' === $value['direction']) {
285 285
 								$checked_sf_wp = ' checked';
286 286
 								$checked_wp_sf = '';
287 287
 								$checked_sync  = '';
288
-							} elseif ( 'wp_sf' === $value['direction'] ) {
288
+							} elseif ('wp_sf' === $value['direction']) {
289 289
 								$checked_sf_wp = '';
290 290
 								$checked_wp_sf = ' checked';
291 291
 								$checked_sync  = '';
@@ -301,29 +301,29 @@  discard block
 block discarded – undo
301 301
 						}
302 302
 						?>
303 303
 						<div class="radios">
304
-							<label><input type="radio" value="sf_wp" name="direction[<?php echo esc_attr( $key ); ?>]" id="direction-<?php echo esc_attr( $key ); ?>-sf-wp" <?php echo esc_attr( $checked_sf_wp ); ?> required> <?php echo esc_html__( 'Salesforce to WordPress', 'object-sync-for-salesforce' ); ?></label>
305
-							<label><input type="radio" value="wp_sf" name="direction[<?php echo esc_attr( $key ); ?>]" id="direction-<?php echo esc_attr( $key ); ?>-wp-sf" <?php echo esc_attr( $checked_wp_sf ); ?> required> <?php echo esc_html__( 'WordPress to Salesforce', 'object-sync-for-salesforce' ); ?></label>
306
-							<label><input type="radio" value="sync" name="direction[<?php echo esc_attr( $key ); ?>]" id="direction-<?php echo esc_attr( $key ); ?>-sync" <?php echo esc_attr( $checked_sync ); ?> required> <?php echo esc_html__( 'Sync', 'object-sync-for-salesforce' ); ?></label>
304
+							<label><input type="radio" value="sf_wp" name="direction[<?php echo esc_attr($key); ?>]" id="direction-<?php echo esc_attr($key); ?>-sf-wp" <?php echo esc_attr($checked_sf_wp); ?> required> <?php echo esc_html__('Salesforce to WordPress', 'object-sync-for-salesforce'); ?></label>
305
+							<label><input type="radio" value="wp_sf" name="direction[<?php echo esc_attr($key); ?>]" id="direction-<?php echo esc_attr($key); ?>-wp-sf" <?php echo esc_attr($checked_wp_sf); ?> required> <?php echo esc_html__('WordPress to Salesforce', 'object-sync-for-salesforce'); ?></label>
306
+							<label><input type="radio" value="sync" name="direction[<?php echo esc_attr($key); ?>]" id="direction-<?php echo esc_attr($key); ?>-sync" <?php echo esc_attr($checked_sync); ?> required> <?php echo esc_html__('Sync', 'object-sync-for-salesforce'); ?></label>
307 307
 						</div>
308 308
 					</td>
309 309
 					<td class="column-is_delete">
310
-						<input type="checkbox" name="is_delete[<?php echo esc_attr( $key ); ?>]" id="is_delete-<?php echo esc_attr( $key ); ?>" value="1" />
310
+						<input type="checkbox" name="is_delete[<?php echo esc_attr($key); ?>]" id="is_delete-<?php echo esc_attr($key); ?>" value="1" />
311 311
 					</td>
312 312
 				</tr>
313 313
 				<?php
314 314
 					} // End foreach().
315
-				} elseif ( isset( $wordpress_object ) && isset( $salesforce_object ) ) {
315
+				} elseif (isset($wordpress_object) && isset($salesforce_object)) {
316 316
 				?>
317 317
 				<tr>
318 318
 					<td class="column-wordpress_field">
319 319
 						<select name="wordpress_field[0]" id="wordpress_field-0">
320
-							<option value="">- <?php echo esc_html__( 'Select WordPress field', 'object-sync-for-salesforce' ); ?> -</option>
320
+							<option value="">- <?php echo esc_html__('Select WordPress field', 'object-sync-for-salesforce'); ?> -</option>
321 321
 							<?php
322
-							$wordpress_fields = $this->get_wordpress_object_fields( $wordpress_object );
323
-							foreach ( $wordpress_fields as $wordpress_field ) {
324
-								echo sprintf( '<option value="%1$s">%2$s</option>',
325
-									esc_attr( $wordpress_field['key'] ),
326
-									esc_html( $wordpress_field['key'] )
322
+							$wordpress_fields = $this->get_wordpress_object_fields($wordpress_object);
323
+							foreach ($wordpress_fields as $wordpress_field) {
324
+								echo sprintf('<option value="%1$s">%2$s</option>',
325
+									esc_attr($wordpress_field['key']),
326
+									esc_html($wordpress_field['key'])
327 327
 								);
328 328
 							}
329 329
 							?>
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
 					</td>
332 332
 					<td class="column-salesforce_field">
333 333
 						<select name="salesforce_field[0]" id="salesforce_field-0">
334
-							<option value="">- <?php echo esc_html__( 'Select Salesforce field', 'object-sync-for-salesforce' ); ?> -</option>
334
+							<option value="">- <?php echo esc_html__('Select Salesforce field', 'object-sync-for-salesforce'); ?> -</option>
335 335
 							<?php
336 336
 							$salesforce_fields = $this->get_salesforce_object_fields(
337 337
 								array(
338 338
 									'salesforce_object' => $salesforce_object,
339 339
 								)
340 340
 							);
341
-							foreach ( $salesforce_fields as $salesforce_field ) {
342
-								echo sprintf( '<option value="%1$s">%2$s</option>',
343
-									esc_attr( $salesforce_field['name'] ),
344
-									esc_html( $salesforce_field['label'] )
341
+							foreach ($salesforce_fields as $salesforce_field) {
342
+								echo sprintf('<option value="%1$s">%2$s</option>',
343
+									esc_attr($salesforce_field['name']),
344
+									esc_html($salesforce_field['label'])
345 345
 								);
346 346
 							}
347 347
 							?>
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 					</td>
356 356
 					<td class="column-direction">
357 357
 						<div class="radios">
358
-							<label><input type="radio" value="sf_wp" name="direction[0]" id="direction-0-sf-wp" required> <?php echo esc_html__( 'Salesforce to WordPress', 'object-sync-for-salesforce' ); ?></label>
359
-							<label><input type="radio" value="wp_sf" name="direction[0]" id="direction-0-wp-sf" required> <?php echo esc_html__( 'WordPress to Salesforce', 'object-sync-for-salesforce' ); ?></label>
360
-							<label><input type="radio" value="sync" name="direction[0]" id="direction-0-sync" required checked> <?php echo esc_html__( 'Sync', 'object-sync-for-salesforce' ); ?></label>
358
+							<label><input type="radio" value="sf_wp" name="direction[0]" id="direction-0-sf-wp" required> <?php echo esc_html__('Salesforce to WordPress', 'object-sync-for-salesforce'); ?></label>
359
+							<label><input type="radio" value="wp_sf" name="direction[0]" id="direction-0-wp-sf" required> <?php echo esc_html__('WordPress to Salesforce', 'object-sync-for-salesforce'); ?></label>
360
+							<label><input type="radio" value="sync" name="direction[0]" id="direction-0-sync" required checked> <?php echo esc_html__('Sync', 'object-sync-for-salesforce'); ?></label>
361 361
 						</div>
362 362
 					</td>
363 363
 					<td class="column-is_delete">
@@ -371,17 +371,17 @@  discard block
 block discarded – undo
371 371
 		</table>
372 372
 		<!--<div class="spinner"></div>-->
373 373
 		<?php
374
-		if ( isset( $fieldmap_fields ) && null !== $fieldmap_fields ) {
375
-			$add_button_label = esc_html__( 'Add another field mapping', 'object-sync-for-salesforce' );
374
+		if (isset($fieldmap_fields) && null !== $fieldmap_fields) {
375
+			$add_button_label = esc_html__('Add another field mapping', 'object-sync-for-salesforce');
376 376
 		} else {
377
-			$add_button_label = esc_html__( 'Add field mapping', 'object-sync-for-salesforce' );
377
+			$add_button_label = esc_html__('Add field mapping', 'object-sync-for-salesforce');
378 378
 		}
379 379
 		?>
380 380
 		<p><button type="button" id="add-field-mapping" class="button button-secondary"><?php echo $add_button_label; ?></button></p>
381
-		<p class="description"><?php echo esc_html__( 'Prematch tells the plugin to match records that have the same value before sending data to Salesforce. Salesforce Key indicates the Salesforce field is an External ID. If either of these is checked, the plugin will do an UPSERT to avoid duplicate data when possible.', 'object-sync-for-salesforce' ); ?></p>
381
+		<p class="description"><?php echo esc_html__('Prematch tells the plugin to match records that have the same value before sending data to Salesforce. Salesforce Key indicates the Salesforce field is an External ID. If either of these is checked, the plugin will do an UPSERT to avoid duplicate data when possible.', 'object-sync-for-salesforce'); ?></p>
382 382
 	</fieldset>
383 383
 	<fieldset class="sync_triggers">
384
-		<legend><?php echo esc_html__( 'Action triggers', 'object-sync-for-salesforce' ); ?></legend>
384
+		<legend><?php echo esc_html__('Action triggers', 'object-sync-for-salesforce'); ?></legend>
385 385
 		<div class="checkboxes">
386 386
 			<?php
387 387
 			$wordpress_create_checked  = '';
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 			$salesforce_create_checked = '';
391 391
 			$salesforce_update_checked = '';
392 392
 			$salesforce_delete_checked = '';
393
-			if ( isset( $sync_triggers ) && is_array( $sync_triggers ) ) {
394
-				foreach ( $sync_triggers as $trigger ) {
395
-					switch ( $trigger ) {
393
+			if (isset($sync_triggers) && is_array($sync_triggers)) {
394
+				foreach ($sync_triggers as $trigger) {
395
+					switch ($trigger) {
396 396
 						case $this->mappings->sync_wordpress_create:
397 397
 							$wordpress_create_checked = ' checked';
398 398
 							break;
@@ -415,31 +415,31 @@  discard block
 block discarded – undo
415 415
 				}
416 416
 			}
417 417
 			?>
418
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_wordpress_create ); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-create" <?php echo esc_attr( $wordpress_create_checked ); ?>><?php echo esc_html__( 'WordPress create', 'object-sync-for-salesforce' ); ?></label>
419
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_wordpress_update ); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-update" <?php echo esc_attr( $wordpress_update_checked ); ?>><?php echo esc_html__( 'WordPress update', 'object-sync-for-salesforce' ); ?></label>
420
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_wordpress_delete ); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-delete" <?php echo esc_attr( $wordpress_delete_checked ); ?>><?php echo esc_html__( 'WordPress delete', 'object-sync-for-salesforce' ); ?></label>
421
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_sf_create ); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-create" <?php echo esc_attr( $salesforce_create_checked ); ?>><?php echo esc_html__( 'Salesforce create', 'object-sync-for-salesforce' ); ?></label>
422
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_sf_update ); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-update" <?php echo esc_attr( $salesforce_update_checked ); ?>><?php echo esc_html__( 'Salesforce update', 'object-sync-for-salesforce' ); ?></label>
423
-			<label><input type="checkbox" value="<?php echo esc_html( $this->mappings->sync_sf_delete ); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-delete" <?php echo esc_attr( $salesforce_delete_checked ); ?>><?php echo esc_html__( 'Salesforce delete', 'object-sync-for-salesforce' ); ?></label>
418
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_wordpress_create); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-create" <?php echo esc_attr($wordpress_create_checked); ?>><?php echo esc_html__('WordPress create', 'object-sync-for-salesforce'); ?></label>
419
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_wordpress_update); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-update" <?php echo esc_attr($wordpress_update_checked); ?>><?php echo esc_html__('WordPress update', 'object-sync-for-salesforce'); ?></label>
420
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_wordpress_delete); ?>" name="sync_triggers[]" id="sync_triggers-wordpress-delete" <?php echo esc_attr($wordpress_delete_checked); ?>><?php echo esc_html__('WordPress delete', 'object-sync-for-salesforce'); ?></label>
421
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_sf_create); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-create" <?php echo esc_attr($salesforce_create_checked); ?>><?php echo esc_html__('Salesforce create', 'object-sync-for-salesforce'); ?></label>
422
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_sf_update); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-update" <?php echo esc_attr($salesforce_update_checked); ?>><?php echo esc_html__('Salesforce update', 'object-sync-for-salesforce'); ?></label>
423
+			<label><input type="checkbox" value="<?php echo esc_html($this->mappings->sync_sf_delete); ?>" name="sync_triggers[]" id="sync_triggers-salesforce-delete" <?php echo esc_attr($salesforce_delete_checked); ?>><?php echo esc_html__('Salesforce delete', 'object-sync-for-salesforce'); ?></label>
424 424
 			<p class="description">
425 425
 				<?php
426 426
 				// translators: placeholders are for the class names: salesforce_push and salesforce_pull
427
-				echo sprintf( esc_html__( 'Select which actions on WordPress objects and Salesforce objects should trigger a synchronization. These settings are used by the %1$s and %2$s classes respectively.', 'object-sync-for-salesforce' ), '<code>salesforce_push</code>', '<code>salesforce_pull</code>' );
427
+				echo sprintf(esc_html__('Select which actions on WordPress objects and Salesforce objects should trigger a synchronization. These settings are used by the %1$s and %2$s classes respectively.', 'object-sync-for-salesforce'), '<code>salesforce_push</code>', '<code>salesforce_pull</code>');
428 428
 				?>
429 429
 			</p>
430 430
 		</div>
431 431
 		<div class="checkboxes">
432
-			<label><input type="checkbox" name="push_async" id="process-async" value="1" <?php echo isset( $push_async ) && '1' === $push_async ? ' checked' : ''; ?>><?php echo esc_html__( 'Process asynchronously', 'object-sync-for-salesforce' ); ?></label>
432
+			<label><input type="checkbox" name="push_async" id="process-async" value="1" <?php echo isset($push_async) && '1' === $push_async ? ' checked' : ''; ?>><?php echo esc_html__('Process asynchronously', 'object-sync-for-salesforce'); ?></label>
433 433
 			<p class="description">
434 434
 				<?php
435 435
 				// translators: placeholder is for WordPress cron method name
436
-				echo sprintf( esc_html__( 'If selected, push data will be queued for processing and synchronized when %s is run. This may increase site performance, but changes will not be reflected in real time.', 'object-sync-for-salesforce' ), '<code>wp_cron</code>' );
436
+				echo sprintf(esc_html__('If selected, push data will be queued for processing and synchronized when %s is run. This may increase site performance, but changes will not be reflected in real time.', 'object-sync-for-salesforce'), '<code>wp_cron</code>');
437 437
 				?>
438 438
 			</p>
439 439
 		</div>
440 440
 		<div class="checkboxes">
441
-			<label><input type="checkbox" name="push_drafts" id="push-drafts" value="1" <?php echo isset( $push_drafts ) && '1' === $push_drafts ? ' checked' : ''; ?>><?php echo esc_html__( 'Push drafts', 'object-sync-for-salesforce' ); ?></label>
442
-			<p class="description"><?php echo esc_html__( 'If selected, WordPress will send drafts of this object type (if it creates drafts for it) to Salesforce.', 'object-sync-for-salesforce' ); ?></p>
441
+			<label><input type="checkbox" name="push_drafts" id="push-drafts" value="1" <?php echo isset($push_drafts) && '1' === $push_drafts ? ' checked' : ''; ?>><?php echo esc_html__('Push drafts', 'object-sync-for-salesforce'); ?></label>
442
+			<p class="description"><?php echo esc_html__('If selected, WordPress will send drafts of this object type (if it creates drafts for it) to Salesforce.', 'object-sync-for-salesforce'); ?></p>
443 443
 		</div>
444 444
 		<?php
445 445
 		/*
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	<?php
459 459
 		submit_button(
460 460
 			// translators: the placeholder refers to the currently selected method (add, edit, or clone)
461
-			sprintf( esc_html__( '%1$s fieldmap', 'object-sync-for-salesforce' ), ucfirst( $method ) )
461
+			sprintf(esc_html__('%1$s fieldmap', 'object-sync-for-salesforce'), ucfirst($method))
462 462
 		);
463 463
 	?>
464 464
 </form>
Please login to merge, or discard this patch.