Test Setup Failed
Pull Request — master (#169)
by Jonathan
05:08 queued 01:05
created
classes/admin.php 1 patch
Spacing   +552 added lines, -552 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
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	* @param array $schedulable_classes
83 83
 	* @throws \Exception
84 84
 	*/
85
-	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes ) {
85
+	public function __construct($wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes) {
86 86
 		$this->wpdb                = $wpdb;
87 87
 		$this->version             = $version;
88 88
 		$this->login_credentials   = $login_credentials;
@@ -121,29 +121,29 @@  discard block
 block discarded – undo
121 121
 	*
122 122
 	*/
123 123
 	public function add_actions() {
124
-		add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) );
125
-		add_action( 'admin_init', array( $this, 'notices' ) );
126
-		add_action( 'admin_post_post_fieldmap', array( $this, 'prepare_fieldmap_data' ) );
127
-
128
-		add_action( 'admin_post_delete_fieldmap', array( $this, 'delete_fieldmap' ) );
129
-		add_action( 'wp_ajax_get_salesforce_object_description', array( $this, 'get_salesforce_object_description' ) );
130
-		add_action( 'wp_ajax_get_wordpress_object_description', array( $this, 'get_wordpress_object_fields' ) );
131
-		add_action( 'wp_ajax_get_wp_sf_object_fields', array( $this, 'get_wp_sf_object_fields' ) );
132
-		add_action( 'wp_ajax_push_to_salesforce', array( $this, 'push_to_salesforce' ) );
133
-		add_action( 'wp_ajax_pull_from_salesforce', array( $this, 'pull_from_salesforce' ) );
134
-		add_action( 'wp_ajax_refresh_mapped_data', array( $this, 'refresh_mapped_data' ) );
135
-		add_action( 'wp_ajax_clear_sfwp_cache', array( $this, 'clear_sfwp_cache' ) );
136
-
137
-		add_action( 'edit_user_profile', array( $this, 'show_salesforce_user_fields' ) );
138
-		add_action( 'personal_options_update', array( $this, 'save_salesforce_user_fields' ) );
139
-		add_action( 'edit_user_profile_update', array( $this, 'save_salesforce_user_fields' ) );
140
-
141
-		add_action( 'admin_post_delete_object_map', array( $this, 'delete_object_map' ) );
142
-		add_action( 'admin_post_post_object_map', array( $this, 'prepare_object_map_data' ) );
124
+		add_action('admin_init', array($this, 'salesforce_settings_forms'));
125
+		add_action('admin_init', array($this, 'notices'));
126
+		add_action('admin_post_post_fieldmap', array($this, 'prepare_fieldmap_data'));
127
+
128
+		add_action('admin_post_delete_fieldmap', array($this, 'delete_fieldmap'));
129
+		add_action('wp_ajax_get_salesforce_object_description', array($this, 'get_salesforce_object_description'));
130
+		add_action('wp_ajax_get_wordpress_object_description', array($this, 'get_wordpress_object_fields'));
131
+		add_action('wp_ajax_get_wp_sf_object_fields', array($this, 'get_wp_sf_object_fields'));
132
+		add_action('wp_ajax_push_to_salesforce', array($this, 'push_to_salesforce'));
133
+		add_action('wp_ajax_pull_from_salesforce', array($this, 'pull_from_salesforce'));
134
+		add_action('wp_ajax_refresh_mapped_data', array($this, 'refresh_mapped_data'));
135
+		add_action('wp_ajax_clear_sfwp_cache', array($this, 'clear_sfwp_cache'));
136
+
137
+		add_action('edit_user_profile', array($this, 'show_salesforce_user_fields'));
138
+		add_action('personal_options_update', array($this, 'save_salesforce_user_fields'));
139
+		add_action('edit_user_profile_update', array($this, 'save_salesforce_user_fields'));
140
+
141
+		add_action('admin_post_delete_object_map', array($this, 'delete_object_map'));
142
+		add_action('admin_post_post_object_map', array($this, 'prepare_object_map_data'));
143 143
 
144 144
 		// import and export plugin data
145
-		add_action( 'admin_post_object_sync_for_salesforce_import', array( $this, 'import_json_file' ) );
146
-		add_action( 'admin_post_object_sync_for_salesforce_export', array( $this, 'export_json_file' ) );
145
+		add_action('admin_post_object_sync_for_salesforce_import', array($this, 'import_json_file'));
146
+		add_action('admin_post_object_sync_for_salesforce_export', array($this, 'export_json_file'));
147 147
 
148 148
 	}
149 149
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	*
153 153
 	*/
154 154
 	public function create_admin_menu() {
155
-		$title = __( 'Salesforce', 'object-sync-for-salesforce' );
156
-		add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) );
155
+		$title = __('Salesforce', 'object-sync-for-salesforce');
156
+		add_options_page($title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array($this, 'show_admin_page'));
157 157
 	}
158 158
 
159 159
 	/**
@@ -164,114 +164,114 @@  discard block
 block discarded – undo
164 164
 	*
165 165
 	*/
166 166
 	public function show_admin_page() {
167
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
167
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
168 168
 		echo '<div class="wrap">';
169
-		echo '<h1>' . esc_html( get_admin_page_title() ) . '</h1>';
169
+		echo '<h1>' . esc_html(get_admin_page_title()) . '</h1>';
170 170
 		$allowed = $this->check_wordpress_admin_permissions();
171
-		if ( false === $allowed ) {
171
+		if (false === $allowed) {
172 172
 			return;
173 173
 		}
174 174
 		$tabs = array(
175
-			'settings'      => __( 'Settings', 'object-sync-for-salesforce' ),
176
-			'authorize'     => __( 'Authorize', 'object-sync-for-salesforce' ),
177
-			'fieldmaps'     => __( 'Fieldmaps', 'object-sync-for-salesforce' ),
178
-			'schedule'      => __( 'Scheduling', 'object-sync-for-salesforce' ),
179
-			'import-export' => __( 'Import &amp; Export', 'object-sync-for-salesforce' ),
175
+			'settings'      => __('Settings', 'object-sync-for-salesforce'),
176
+			'authorize'     => __('Authorize', 'object-sync-for-salesforce'),
177
+			'fieldmaps'     => __('Fieldmaps', 'object-sync-for-salesforce'),
178
+			'schedule'      => __('Scheduling', 'object-sync-for-salesforce'),
179
+			'import-export' => __('Import &amp; Export', 'object-sync-for-salesforce'),
180 180
 		); // this creates the tabs for the admin
181 181
 
182 182
 		// optionally make tab(s) for logging and log settings
183
-		$logging_enabled      = get_option( $this->option_prefix . 'enable_logging', false );
184
-		$tabs['log_settings'] = __( 'Log Settings', 'object-sync-for-salesforce' );
183
+		$logging_enabled      = get_option($this->option_prefix . 'enable_logging', false);
184
+		$tabs['log_settings'] = __('Log Settings', 'object-sync-for-salesforce');
185 185
 
186 186
 		$mapping_errors = $this->mappings->get_failed_object_maps();
187
-		if ( ! empty( $mapping_errors ) ) {
188
-			$tabs['mapping_errors'] = __( 'Mapping Errors', 'object-sync-for-salesforce' );
187
+		if ( ! empty($mapping_errors)) {
188
+			$tabs['mapping_errors'] = __('Mapping Errors', 'object-sync-for-salesforce');
189 189
 		}
190 190
 
191 191
 		// filter for extending the tabs available on the page
192 192
 		// currently it will go into the default switch case for $tab
193
-		$tabs = apply_filters( 'object_sync_for_salesforce_settings_tabs', $tabs );
193
+		$tabs = apply_filters('object_sync_for_salesforce_settings_tabs', $tabs);
194 194
 
195
-		$tab = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
196
-		$this->tabs( $tabs, $tab );
195
+		$tab = isset($get_data['tab']) ? sanitize_key($get_data['tab']) : 'settings';
196
+		$this->tabs($tabs, $tab);
197 197
 
198 198
 		$consumer_key    = $this->login_credentials['consumer_key'];
199 199
 		$consumer_secret = $this->login_credentials['consumer_secret'];
200 200
 		$callback_url    = $this->login_credentials['callback_url'];
201 201
 
202
-		if ( true !== $this->salesforce['is_authorized'] ) {
203
-			$url     = esc_url( $callback_url );
204
-			$anchor  = esc_html__( 'Authorize tab', 'object-sync-for-salesforce' );
205
-			$message = sprintf( 'Salesforce needs to be authorized to connect to this website. Use the <a href="%s">%s</a> to connect.', $url, $anchor );
206
-			require( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
202
+		if (true !== $this->salesforce['is_authorized']) {
203
+			$url     = esc_url($callback_url);
204
+			$anchor  = esc_html__('Authorize tab', 'object-sync-for-salesforce');
205
+			$message = sprintf('Salesforce needs to be authorized to connect to this website. Use the <a href="%s">%s</a> to connect.', $url, $anchor);
206
+			require(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
207 207
 		}
208 208
 
209
-		if ( 0 === count( $this->mappings->get_fieldmaps() ) ) {
210
-			$url     = esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps' ) );
211
-			$anchor  = esc_html__( 'Fieldmaps tab', 'object-sync-for-salesforce' );
212
-			$message = sprintf( 'No fieldmaps exist yet. Use the <a href="%s">%s</a> to map WordPress and Salesforce objects to each other.', $url, $anchor );
213
-			require( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
209
+		if (0 === count($this->mappings->get_fieldmaps())) {
210
+			$url     = esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps'));
211
+			$anchor  = esc_html__('Fieldmaps tab', 'object-sync-for-salesforce');
212
+			$message = sprintf('No fieldmaps exist yet. Use the <a href="%s">%s</a> to map WordPress and Salesforce objects to each other.', $url, $anchor);
213
+			require(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
214 214
 		}
215 215
 
216
-		$push_schedule_number = get_option( $this->option_prefix . 'salesforce_push_schedule_number', '' );
217
-		$push_schedule_unit   = get_option( $this->option_prefix . 'salesforce_push_schedule_unit', '' );
218
-		$pull_schedule_number = get_option( $this->option_prefix . 'salesforce_pull_schedule_number', '' );
219
-		$pull_schedule_unit   = get_option( $this->option_prefix . 'salesforce_pull_schedule_unit', '' );
216
+		$push_schedule_number = get_option($this->option_prefix . 'salesforce_push_schedule_number', '');
217
+		$push_schedule_unit   = get_option($this->option_prefix . 'salesforce_push_schedule_unit', '');
218
+		$pull_schedule_number = get_option($this->option_prefix . 'salesforce_pull_schedule_number', '');
219
+		$pull_schedule_unit   = get_option($this->option_prefix . 'salesforce_pull_schedule_unit', '');
220 220
 
221
-		if ( '' === $push_schedule_number && '' === $push_schedule_unit && '' === $pull_schedule_number && '' === $pull_schedule_unit ) {
222
-			$url     = esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=schedule' ) );
223
-			$anchor  = esc_html__( 'Scheduling tab', 'object-sync-for-salesforce' );
224
-			$message = sprintf( 'Because the plugin schedule has not been saved, the plugin cannot run automatic operations. Use the <a href="%s">%s</a> to create schedules to run.', $url, $anchor );
225
-			require( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
221
+		if ('' === $push_schedule_number && '' === $push_schedule_unit && '' === $pull_schedule_number && '' === $pull_schedule_unit) {
222
+			$url     = esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=schedule'));
223
+			$anchor  = esc_html__('Scheduling tab', 'object-sync-for-salesforce');
224
+			$message = sprintf('Because the plugin schedule has not been saved, the plugin cannot run automatic operations. Use the <a href="%s">%s</a> to create schedules to run.', $url, $anchor);
225
+			require(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
226 226
 		}
227 227
 
228 228
 		try {
229
-			switch ( $tab ) {
229
+			switch ($tab) {
230 230
 				case 'authorize':
231
-					if ( isset( $get_data['code'] ) ) {
231
+					if (isset($get_data['code'])) {
232 232
 						// this string is an oauth token
233
-						$data          = esc_html( wp_unslash( $get_data['code'] ) );
234
-						$is_authorized = $this->salesforce['sfapi']->request_token( $data );
233
+						$data          = esc_html(wp_unslash($get_data['code']));
234
+						$is_authorized = $this->salesforce['sfapi']->request_token($data);
235 235
 						?>
236
-						<script>window.location = '<?php echo esc_url_raw( $callback_url ); ?>'</script>
236
+						<script>window.location = '<?php echo esc_url_raw($callback_url); ?>'</script>
237 237
 						<?php
238
-					} elseif ( true === $this->salesforce['is_authorized'] ) {
239
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/authorized.php' );
240
-							$this->status( $this->salesforce['sfapi'] );
241
-					} elseif ( true === is_object( $this->salesforce['sfapi'] ) && isset( $consumer_key ) && isset( $consumer_secret ) ) {
238
+					} elseif (true === $this->salesforce['is_authorized']) {
239
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/authorized.php');
240
+							$this->status($this->salesforce['sfapi']);
241
+					} elseif (true === is_object($this->salesforce['sfapi']) && isset($consumer_key) && isset($consumer_secret)) {
242 242
 						?>
243
-						<p><a class="button button-primary" href="<?php echo esc_url( $this->salesforce['sfapi']->get_authorization_code() ); ?>"><?php echo esc_html__( 'Connect to Salesforce', 'object-sync-for-salesforce' ); ?></a></p>
243
+						<p><a class="button button-primary" href="<?php echo esc_url($this->salesforce['sfapi']->get_authorization_code()); ?>"><?php echo esc_html__('Connect to Salesforce', 'object-sync-for-salesforce'); ?></a></p>
244 244
 						<?php
245 245
 					} else {
246
-						$url    = esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=settings' ) );
247
-						$anchor = esc_html__( 'Settings', 'object-sync-for-salesforce' );
246
+						$url    = esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=settings'));
247
+						$anchor = esc_html__('Settings', 'object-sync-for-salesforce');
248 248
 						// translators: placeholders are for the settings tab link: 1) the url, and 2) the anchor text
249
-						$message = sprintf( esc_html__( 'Salesforce needs to be authorized to connect to this website but the credentials are missing. Use the <a href="%1$s">%2$s</a> tab to add them.', 'object-sync-salesforce' ), $url, $anchor );
250
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/error.php' );
249
+						$message = sprintf(esc_html__('Salesforce needs to be authorized to connect to this website but the credentials are missing. Use the <a href="%1$s">%2$s</a> tab to add them.', 'object-sync-salesforce'), $url, $anchor);
250
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/error.php');
251 251
 					}
252 252
 					break;
253 253
 				case 'fieldmaps':
254
-					if ( isset( $get_data['method'] ) ) {
254
+					if (isset($get_data['method'])) {
255 255
 
256
-						$method      = sanitize_key( $get_data['method'] );
257
-						$error_url   = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=' . $method );
258
-						$success_url = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps' );
256
+						$method      = sanitize_key($get_data['method']);
257
+						$error_url   = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps&method=' . $method);
258
+						$success_url = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=fieldmaps');
259 259
 
260
-						if ( isset( $get_data['transient'] ) ) {
261
-							$transient = sanitize_key( $get_data['transient'] );
262
-							$posted    = $this->sfwp_transients->get( $transient );
260
+						if (isset($get_data['transient'])) {
261
+							$transient = sanitize_key($get_data['transient']);
262
+							$posted    = $this->sfwp_transients->get($transient);
263 263
 						}
264 264
 
265
-						if ( isset( $posted ) && is_array( $posted ) ) {
265
+						if (isset($posted) && is_array($posted)) {
266 266
 							$map = $posted;
267
-						} elseif ( 'edit' === $method || 'clone' === $method || 'delete' === $method ) {
268
-							$map = $this->mappings->get_fieldmaps( isset( $get_data['id'] ) ? sanitize_key( $get_data['id'] ) : '' );
267
+						} elseif ('edit' === $method || 'clone' === $method || 'delete' === $method) {
268
+							$map = $this->mappings->get_fieldmaps(isset($get_data['id']) ? sanitize_key($get_data['id']) : '');
269 269
 						}
270 270
 
271
-						if ( isset( $map ) && is_array( $map ) ) {
271
+						if (isset($map) && is_array($map)) {
272 272
 							$label                           = $map['label'];
273 273
 							$salesforce_object               = $map['salesforce_object'];
274
-							$salesforce_record_types_allowed = maybe_unserialize( $map['salesforce_record_types_allowed'] );
274
+							$salesforce_record_types_allowed = maybe_unserialize($map['salesforce_record_types_allowed']);
275 275
 							$salesforce_record_type_default  = $map['salesforce_record_type_default'];
276 276
 							$wordpress_object                = $map['wordpress_object'];
277 277
 							$pull_trigger_field              = $map['pull_trigger_field'];
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
 							$weight                          = $map['weight'];
283 283
 						}
284 284
 
285
-						if ( 'add' === $method || 'edit' === $method || 'clone' === $method ) {
286
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/fieldmaps-add-edit-clone.php' );
287
-						} elseif ( 'delete' === $method ) {
288
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/fieldmaps-delete.php' );
285
+						if ('add' === $method || 'edit' === $method || 'clone' === $method) {
286
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/fieldmaps-add-edit-clone.php');
287
+						} elseif ('delete' === $method) {
288
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/fieldmaps-delete.php');
289 289
 						}
290 290
 					} else {
291 291
 						$fieldmaps = $this->mappings->get_fieldmaps();
292
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/fieldmaps-list.php' );
292
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/fieldmaps-list.php');
293 293
 					} // End if().
294 294
 					break;
295 295
 				case 'logout':
@@ -299,73 +299,73 @@  discard block
 block discarded – undo
299 299
 					$this->clear_cache();
300 300
 					break;
301 301
 				case 'clear_schedule':
302
-					if ( isset( $get_data['schedule_name'] ) ) {
303
-						$schedule_name = sanitize_key( $get_data['schedule_name'] );
302
+					if (isset($get_data['schedule_name'])) {
303
+						$schedule_name = sanitize_key($get_data['schedule_name']);
304 304
 					}
305
-					$this->clear_schedule( $schedule_name );
305
+					$this->clear_schedule($schedule_name);
306 306
 					break;
307 307
 				case 'settings':
308
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/settings.php' );
308
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/settings.php');
309 309
 					break;
310 310
 				case 'mapping_errors':
311
-					if ( isset( $get_data['method'] ) ) {
311
+					if (isset($get_data['method'])) {
312 312
 
313
-						$method      = sanitize_key( $get_data['method'] );
314
-						$error_url   = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=' . $method );
315
-						$success_url = get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors' );
313
+						$method      = sanitize_key($get_data['method']);
314
+						$error_url   = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors&method=' . $method);
315
+						$success_url = get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=mapping_errors');
316 316
 
317
-						if ( isset( $get_data['map_transient'] ) ) {
318
-							$transient = sanitize_key( $get_data['map_transient'] );
319
-							$posted    = $this->sfwp_transients->get( $transient );
317
+						if (isset($get_data['map_transient'])) {
318
+							$transient = sanitize_key($get_data['map_transient']);
319
+							$posted    = $this->sfwp_transients->get($transient);
320 320
 						}
321 321
 
322
-						if ( isset( $posted ) && is_array( $posted ) ) {
322
+						if (isset($posted) && is_array($posted)) {
323 323
 							$map_row = $posted;
324
-						} elseif ( 'edit' === $method || 'delete' === $method ) {
325
-							$map_row = $this->mappings->get_failed_object_map( isset( $get_data['id'] ) ? sanitize_key( $get_data['id'] ) : '' );
324
+						} elseif ('edit' === $method || 'delete' === $method) {
325
+							$map_row = $this->mappings->get_failed_object_map(isset($get_data['id']) ? sanitize_key($get_data['id']) : '');
326 326
 						}
327 327
 
328
-						if ( isset( $map_row ) && is_array( $map_row ) ) {
328
+						if (isset($map_row) && is_array($map_row)) {
329 329
 							$salesforce_id = $map_row['salesforce_id'];
330 330
 							$wordpress_id  = $map_row['wordpress_id'];
331 331
 						}
332 332
 
333
-						if ( 'edit' === $method ) {
334
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/mapping-errors-edit.php' );
335
-						} elseif ( 'delete' === $method ) {
336
-							require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/mapping-errors-delete.php' );
333
+						if ('edit' === $method) {
334
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/mapping-errors-edit.php');
335
+						} elseif ('delete' === $method) {
336
+							require_once(plugin_dir_path(__FILE__) . '/../templates/admin/mapping-errors-delete.php');
337 337
 						}
338 338
 					} else {
339
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/mapping-errors.php' );
339
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/mapping-errors.php');
340 340
 					}
341 341
 					break;
342 342
 				case 'import-export':
343
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/import-export.php' );
343
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/import-export.php');
344 344
 					break;
345 345
 				default:
346
-					$include_settings = apply_filters( 'object_sync_for_salesforce_settings_tab_include_settings', true, $tab );
347
-					$content_before   = apply_filters( 'object_sync_for_salesforce_settings_tab_content_before', null, $tab );
348
-					$content_after    = apply_filters( 'object_sync_for_salesforce_settings_tab_content_after', null, $tab );
349
-					if ( null !== $content_before ) {
350
-						echo esc_html( $content_before );
346
+					$include_settings = apply_filters('object_sync_for_salesforce_settings_tab_include_settings', true, $tab);
347
+					$content_before   = apply_filters('object_sync_for_salesforce_settings_tab_content_before', null, $tab);
348
+					$content_after    = apply_filters('object_sync_for_salesforce_settings_tab_content_after', null, $tab);
349
+					if (null !== $content_before) {
350
+						echo esc_html($content_before);
351 351
 					}
352
-					if ( true === $include_settings ) {
353
-						require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/settings.php' );
352
+					if (true === $include_settings) {
353
+						require_once(plugin_dir_path(__FILE__) . '/../templates/admin/settings.php');
354 354
 					}
355
-					if ( null !== $content_after ) {
356
-						echo esc_html( $content_after );
355
+					if (null !== $content_after) {
356
+						echo esc_html($content_after);
357 357
 					}
358 358
 					break;
359 359
 			} // End switch().
360
-		} catch ( SalesforceApiException $ex ) {
361
-			echo sprintf( '<p>Error <strong>%1$s</strong>: %2$s</p>',
362
-				absint( $ex->getCode() ),
363
-				esc_html( $ex->getMessage() )
360
+		} catch (SalesforceApiException $ex) {
361
+			echo sprintf('<p>Error <strong>%1$s</strong>: %2$s</p>',
362
+				absint($ex->getCode()),
363
+				esc_html($ex->getMessage())
364 364
 			);
365
-		} catch ( Exception $ex ) {
366
-			echo sprintf( '<p>Error <strong>%1$s</strong>: %2$s</p>',
367
-				absint( $ex->getCode() ),
368
-				esc_html( $ex->getMessage() )
365
+		} catch (Exception $ex) {
366
+			echo sprintf('<p>Error <strong>%1$s</strong>: %2$s</p>',
367
+				absint($ex->getCode()),
368
+				esc_html($ex->getMessage())
369 369
 			);
370 370
 		} // End try().
371 371
 		echo '</div>';
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
 	*
378 378
 	*/
379 379
 	public function salesforce_settings_forms() {
380
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
381
-		$page     = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
382
-		$section  = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings';
380
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
381
+		$page     = isset($get_data['tab']) ? sanitize_key($get_data['tab']) : 'settings';
382
+		$section  = isset($get_data['tab']) ? sanitize_key($get_data['tab']) : 'settings';
383 383
 
384
-		$input_callback_default   = array( $this, 'display_input_field' );
385
-		$input_checkboxes_default = array( $this, 'display_checkboxes' );
386
-		$input_select_default     = array( $this, 'display_select' );
387
-		$link_default             = array( $this, 'display_link' );
384
+		$input_callback_default   = array($this, 'display_input_field');
385
+		$input_checkboxes_default = array($this, 'display_checkboxes');
386
+		$input_select_default     = array($this, 'display_select');
387
+		$link_default             = array($this, 'display_link');
388 388
 
389 389
 		$all_field_callbacks = array(
390 390
 			'text'       => $input_callback_default,
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 			'link'       => $link_default,
394 394
 		);
395 395
 
396
-		$this->fields_settings( 'settings', 'settings', $all_field_callbacks );
397
-		$this->fields_fieldmaps( 'fieldmaps', 'objects' );
398
-		$this->fields_scheduling( 'schedule', 'schedule', $all_field_callbacks );
399
-		$this->fields_log_settings( 'log_settings', 'log_settings', $all_field_callbacks );
396
+		$this->fields_settings('settings', 'settings', $all_field_callbacks);
397
+		$this->fields_fieldmaps('fieldmaps', 'objects');
398
+		$this->fields_scheduling('schedule', 'schedule', $all_field_callbacks);
399
+		$this->fields_log_settings('log_settings', 'log_settings', $all_field_callbacks);
400 400
 	}
401 401
 
402 402
 	/**
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	* @param string $section
408 408
 	* @param string $input_callback
409 409
 	*/
410
-	private function fields_settings( $page, $section, $callbacks ) {
411
-		add_settings_section( $page, ucwords( $page ), null, $page );
410
+	private function fields_settings($page, $section, $callbacks) {
411
+		add_settings_section($page, ucwords($page), null, $page);
412 412
 		$salesforce_settings = array(
413 413
 			'consumer_key'             => array(
414
-				'title'    => __( 'Consumer Key', 'object-sync-for-salesforce' ),
414
+				'title'    => __('Consumer Key', 'object-sync-for-salesforce'),
415 415
 				'callback' => $callbacks['text'],
416 416
 				'page'     => $page,
417 417
 				'section'  => $section,
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
 			),
426 426
 			'consumer_secret'          => array(
427
-				'title'    => __( 'Consumer Secret', 'object-sync-for-salesforce' ),
427
+				'title'    => __('Consumer Secret', 'object-sync-for-salesforce'),
428 428
 				'callback' => $callbacks['text'],
429 429
 				'page'     => $page,
430 430
 				'section'  => $section,
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 				),
437 437
 			),
438 438
 			'callback_url'             => array(
439
-				'title'    => __( 'Callback URL', 'object-sync-for-salesforce' ),
439
+				'title'    => __('Callback URL', 'object-sync-for-salesforce'),
440 440
 				'callback' => $callbacks['text'],
441 441
 				'page'     => $page,
442 442
 				'section'  => $section,
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				),
449 449
 			),
450 450
 			'login_base_url'           => array(
451
-				'title'    => __( 'Login Base URL', 'object-sync-for-salesforce' ),
451
+				'title'    => __('Login Base URL', 'object-sync-for-salesforce'),
452 452
 				'callback' => $callbacks['text'],
453 453
 				'page'     => $page,
454 454
 				'section'  => $section,
@@ -456,22 +456,22 @@  discard block
 block discarded – undo
456 456
 					'type'     => 'url',
457 457
 					'validate' => 'sanitize_validate_text',
458 458
 					// translators: 1) production salesforce login, 2) sandbox salesforce login
459
-					'desc'     => sprintf( __( 'For most Salesforce setups, you should use %1$s for production and %2$s for sandbox.', 'object-sync-for-salesforce' ),
460
-						esc_url( 'https://login.salesforce.com' ),
461
-						esc_url( 'https://test.salesforce.com' )
459
+					'desc'     => sprintf(__('For most Salesforce setups, you should use %1$s for production and %2$s for sandbox.', 'object-sync-for-salesforce'),
460
+						esc_url('https://login.salesforce.com'),
461
+						esc_url('https://test.salesforce.com')
462 462
 					),
463 463
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_LOGIN_BASE_URL',
464 464
 				),
465 465
 			),
466 466
 			'authorize_url_path'       => array(
467
-				'title'    => __( 'Authorize URL Path', 'object-sync-for-salesforce' ),
467
+				'title'    => __('Authorize URL Path', 'object-sync-for-salesforce'),
468 468
 				'callback' => $callbacks['text'],
469 469
 				'page'     => $page,
470 470
 				'section'  => $section,
471 471
 				'args'     => array(
472 472
 					'type'     => 'text',
473 473
 					'validate' => 'sanitize_validate_text',
474
-					'desc'     => __( 'For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce' ),
474
+					'desc'     => __('For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce'),
475 475
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_AUTHORIZE_URL_PATH',
476 476
 					'default'  => $this->default_authorize_url_path,
477 477
 				),
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 				'args'     => array(
485 485
 					'type'     => 'text',
486 486
 					'validate' => 'sanitize_validate_text',
487
-					'desc'     => __( 'For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce' ),
487
+					'desc'     => __('For most Salesforce installs, this should not be changed.', 'object-sync-for-salesforce'),
488 488
 					'constant' => 'OBJECT_SYNC_SF_SALESFORCE_TOKEN_URL_PATH',
489 489
 					'default'  => $this->default_token_url_path,
490 490
 				),
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 				'args'     => array(
511 511
 					'type'     => 'checkboxes',
512 512
 					'validate' => 'sanitize_validate_text',
513
-					'desc'     => __( 'Allows you to limit which Salesforce objects can be mapped', 'object-sync-for-salesforce' ),
513
+					'desc'     => __('Allows you to limit which Salesforce objects can be mapped', 'object-sync-for-salesforce'),
514 514
 					'items'    => array(
515 515
 						'triggerable' => array(
516 516
 							'text'    => 'Only Triggerable objects',
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				'args'     => array(
536 536
 					'type'     => 'number',
537 537
 					'validate' => 'sanitize_validate_text',
538
-					'desc'     => __( 'Number of seconds to wait between repeated salesforce pulls. Prevents the webserver from becoming overloaded in case of too many cron runs, or webhook usage.', 'object-sync-for-salesforce' ),
538
+					'desc'     => __('Number of seconds to wait between repeated salesforce pulls. Prevents the webserver from becoming overloaded in case of too many cron runs, or webhook usage.', 'object-sync-for-salesforce'),
539 539
 					'constant' => '',
540 540
 					'default'  => $this->default_pull_throttle,
541 541
 				),
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 				'args'     => array(
549 549
 					'type'     => 'checkbox',
550 550
 					'validate' => 'sanitize_validate_text',
551
-					'desc'     => __( 'Debug mode can, combined with the Log Settings, log things like Salesforce API requests. It can create a lot of entries if enabled; it is not recommended to use it in a production environment.', 'object-sync-for-salesforce' ),
551
+					'desc'     => __('Debug mode can, combined with the Log Settings, log things like Salesforce API requests. It can create a lot of entries if enabled; it is not recommended to use it in a production environment.', 'object-sync-for-salesforce'),
552 552
 					'constant' => '',
553 553
 				),
554 554
 			),
@@ -560,13 +560,13 @@  discard block
 block discarded – undo
560 560
 				'args'     => array(
561 561
 					'type'     => 'checkbox',
562 562
 					'validate' => 'sanitize_validate_text',
563
-					'desc'     => __( 'If checked, the plugin will delete the tables and other data it creates when you uninstall it. Unchecking this field can be useful if you need to reactivate the plugin for any reason without losing data.', 'object-sync-for-salesforce' ),
563
+					'desc'     => __('If checked, the plugin will delete the tables and other data it creates when you uninstall it. Unchecking this field can be useful if you need to reactivate the plugin for any reason without losing data.', 'object-sync-for-salesforce'),
564 564
 					'constant' => '',
565 565
 				),
566 566
 			),
567 567
 		);
568 568
 
569
-		if ( true === is_object( $this->salesforce['sfapi'] ) && true === $this->salesforce['sfapi']->is_authorized() ) {
569
+		if (true === is_object($this->salesforce['sfapi']) && true === $this->salesforce['sfapi']->is_authorized()) {
570 570
 			$salesforce_settings['api_version'] = array(
571 571
 				'title'    => 'Salesforce API Version',
572 572
 				'callback' => $callbacks['select'],
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 			);
583 583
 		}
584 584
 
585
-		foreach ( $salesforce_settings as $key => $attributes ) {
585
+		foreach ($salesforce_settings as $key => $attributes) {
586 586
 			$id       = $this->option_prefix . $key;
587 587
 			$name     = $this->option_prefix . $key;
588 588
 			$title    = $attributes['title'];
@@ -601,12 +601,12 @@  discard block
 block discarded – undo
601 601
 			);
602 602
 
603 603
 			// if there is a constant and it is defined, don't run a validate function
604
-			if ( isset( $attributes['args']['constant'] ) && defined( $attributes['args']['constant'] ) ) {
604
+			if (isset($attributes['args']['constant']) && defined($attributes['args']['constant'])) {
605 605
 				$validate = '';
606 606
 			}
607 607
 
608
-			add_settings_field( $id, $title, $callback, $page, $section, $args );
609
-			register_setting( $page, $id, array( $this, $validate ) );
608
+			add_settings_field($id, $title, $callback, $page, $section, $args);
609
+			register_setting($page, $id, array($this, $validate));
610 610
 		}
611 611
 	}
612 612
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	* @param string $section
619 619
 	* @param string $input_callback
620 620
 	*/
621
-	private function fields_fieldmaps( $page, $section, $input_callback = '' ) {
622
-		add_settings_section( $page, ucwords( $page ), null, $page );
621
+	private function fields_fieldmaps($page, $section, $input_callback = '') {
622
+		add_settings_section($page, ucwords($page), null, $page);
623 623
 	}
624 624
 
625 625
 	/**
@@ -630,12 +630,12 @@  discard block
 block discarded – undo
630 630
 	* @param string $section
631 631
 	* @param string $input_callback
632 632
 	*/
633
-	private function fields_scheduling( $page, $section, $callbacks ) {
634
-		foreach ( $this->schedulable_classes as $key => $value ) {
635
-			add_settings_section( $key, $value['label'], null, $page );
633
+	private function fields_scheduling($page, $section, $callbacks) {
634
+		foreach ($this->schedulable_classes as $key => $value) {
635
+			add_settings_section($key, $value['label'], null, $page);
636 636
 			$schedule_settings = array(
637 637
 				$key . '_schedule_number' => array(
638
-					'title'    => __( 'Run schedule every', 'object-sync-for-salesforce' ),
638
+					'title'    => __('Run schedule every', 'object-sync-for-salesforce'),
639 639
 					'callback' => $callbacks['text'],
640 640
 					'page'     => $page,
641 641
 					'section'  => $key,
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 					),
648 648
 				),
649 649
 				$key . '_schedule_unit'   => array(
650
-					'title'    => __( 'Time unit', 'object-sync-for-salesforce' ),
650
+					'title'    => __('Time unit', 'object-sync-for-salesforce'),
651 651
 					'callback' => $callbacks['select'],
652 652
 					'page'     => $page,
653 653
 					'section'  => $key,
@@ -673,19 +673,19 @@  discard block
 block discarded – undo
673 673
 				),
674 674
 				$key . '_clear_button'    => array(
675 675
 					// translators: $this->get_schedule_count is an integer showing how many items are in the current queue
676
-					'title'    => sprintf( 'This queue has ' . _n( '%s item', '%s items', $this->get_schedule_count( $key ), 'object-sync-for-salesforce' ), $this->get_schedule_count( $key ) ),
676
+					'title'    => sprintf('This queue has ' . _n('%s item', '%s items', $this->get_schedule_count($key), 'object-sync-for-salesforce'), $this->get_schedule_count($key)),
677 677
 					'callback' => $callbacks['link'],
678 678
 					'page'     => $page,
679 679
 					'section'  => $key,
680 680
 					'args'     => array(
681 681
 						'label'      => 'Clear this queue',
682 682
 						'desc'       => '',
683
-						'url'        => esc_url( '?page=object-sync-salesforce-admin&amp;tab=clear_schedule&amp;schedule_name=' . $key ),
683
+						'url'        => esc_url('?page=object-sync-salesforce-admin&amp;tab=clear_schedule&amp;schedule_name=' . $key),
684 684
 						'link_class' => 'button button-secondary',
685 685
 					),
686 686
 				),
687 687
 			);
688
-			foreach ( $schedule_settings as $key => $attributes ) {
688
+			foreach ($schedule_settings as $key => $attributes) {
689 689
 				$id       = $this->option_prefix . $key;
690 690
 				$name     = $this->option_prefix . $key;
691 691
 				$title    = $attributes['title'];
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
 						'name'      => $name,
702 702
 					)
703 703
 				);
704
-				add_settings_field( $id, $title, $callback, $page, $section, $args );
705
-				register_setting( $page, $id );
704
+				add_settings_field($id, $title, $callback, $page, $section, $args);
705
+				register_setting($page, $id);
706 706
 			}
707 707
 		} // End foreach().
708 708
 	}
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
 	* @param string $section
716 716
 	* @param array $callbacks
717 717
 	*/
718
-	private function fields_log_settings( $page, $section, $callbacks ) {
719
-		add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page );
718
+	private function fields_log_settings($page, $section, $callbacks) {
719
+		add_settings_section($page, ucwords(str_replace('_', ' ', $page)), null, $page);
720 720
 		$log_settings = array(
721 721
 			'enable_logging'        => array(
722
-				'title'    => __( 'Enable Logging?', 'object-sync-for-salesforce' ),
722
+				'title'    => __('Enable Logging?', 'object-sync-for-salesforce'),
723 723
 				'callback' => $callbacks['text'],
724 724
 				'page'     => $page,
725 725
 				'section'  => $section,
@@ -731,32 +731,32 @@  discard block
 block discarded – undo
731 731
 				),
732 732
 			),
733 733
 			'statuses_to_log'       => array(
734
-				'title'    => __( 'Statuses to log', 'object-sync-for-salesforce' ),
734
+				'title'    => __('Statuses to log', 'object-sync-for-salesforce'),
735 735
 				'callback' => $callbacks['checkboxes'],
736 736
 				'page'     => $page,
737 737
 				'section'  => $section,
738 738
 				'args'     => array(
739 739
 					'type'     => 'checkboxes',
740 740
 					'validate' => 'sanitize_validate_text',
741
-					'desc'     => __( 'these are the statuses to log', 'object-sync-for-salesforce' ),
741
+					'desc'     => __('these are the statuses to log', 'object-sync-for-salesforce'),
742 742
 					'items'    => array(
743 743
 						'error'   => array(
744
-							'text' => __( 'Error', 'object-sync-for-salesforce' ),
744
+							'text' => __('Error', 'object-sync-for-salesforce'),
745 745
 							'id'   => 'error',
746 746
 							'desc' => '',
747 747
 						),
748 748
 						'success' => array(
749
-							'text' => __( 'Success', 'object-sync-for-salesforce' ),
749
+							'text' => __('Success', 'object-sync-for-salesforce'),
750 750
 							'id'   => 'success',
751 751
 							'desc' => '',
752 752
 						),
753 753
 						'notice'  => array(
754
-							'text' => __( 'Notice', 'object-sync-for-salesforce' ),
754
+							'text' => __('Notice', 'object-sync-for-salesforce'),
755 755
 							'id'   => 'notice',
756 756
 							'desc' => '',
757 757
 						),
758 758
 						'debug'   => array(
759
-							'text' => __( 'Debug', 'object-sync-for-salesforce' ),
759
+							'text' => __('Debug', 'object-sync-for-salesforce'),
760 760
 							'id'   => 'debug',
761 761
 							'desc' => '',
762 762
 						),
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 				),
765 765
 			),
766 766
 			'prune_logs'            => array(
767
-				'title'    => __( 'Automatically delete old log entries?', 'object-sync-for-salesforce' ),
767
+				'title'    => __('Automatically delete old log entries?', 'object-sync-for-salesforce'),
768 768
 				'callback' => $callbacks['text'],
769 769
 				'page'     => $page,
770 770
 				'section'  => $section,
@@ -776,20 +776,20 @@  discard block
 block discarded – undo
776 776
 				),
777 777
 			),
778 778
 			'logs_how_old'          => array(
779
-				'title'    => __( 'Age to delete log entries', 'object-sync-for-salesforce' ),
779
+				'title'    => __('Age to delete log entries', 'object-sync-for-salesforce'),
780 780
 				'callback' => $callbacks['text'],
781 781
 				'page'     => $page,
782 782
 				'section'  => $section,
783 783
 				'args'     => array(
784 784
 					'type'     => 'text',
785 785
 					'validate' => 'sanitize_validate_text',
786
-					'desc'     => __( 'If automatic deleting is enabled, it will affect logs this old.', 'object-sync-for-salesforce' ),
786
+					'desc'     => __('If automatic deleting is enabled, it will affect logs this old.', 'object-sync-for-salesforce'),
787 787
 					'default'  => '2 weeks',
788 788
 					'constant' => '',
789 789
 				),
790 790
 			),
791 791
 			'logs_how_often_number' => array(
792
-				'title'    => __( 'Check for old logs every', 'object-sync-for-salesforce' ),
792
+				'title'    => __('Check for old logs every', 'object-sync-for-salesforce'),
793 793
 				'callback' => $callbacks['text'],
794 794
 				'page'     => $page,
795 795
 				'section'  => $section,
@@ -802,67 +802,67 @@  discard block
 block discarded – undo
802 802
 				),
803 803
 			),
804 804
 			'logs_how_often_unit'   => array(
805
-				'title'    => __( 'Time unit', 'object-sync-for-salesforce' ),
805
+				'title'    => __('Time unit', 'object-sync-for-salesforce'),
806 806
 				'callback' => $callbacks['select'],
807 807
 				'page'     => $page,
808 808
 				'section'  => $section,
809 809
 				'args'     => array(
810 810
 					'type'     => 'select',
811 811
 					'validate' => 'sanitize_validate_text',
812
-					'desc'     => __( 'These two fields are how often the site will check for logs to delete.', 'object-sync-for-salesforce' ),
812
+					'desc'     => __('These two fields are how often the site will check for logs to delete.', 'object-sync-for-salesforce'),
813 813
 					'items'    => array(
814 814
 						'minutes' => array(
815
-							'text'  => __( 'Minutes', 'object-sync-for-salesforce' ),
815
+							'text'  => __('Minutes', 'object-sync-for-salesforce'),
816 816
 							'value' => 'minutes',
817 817
 						),
818 818
 						'hours'   => array(
819
-							'text'  => __( 'Hours', 'object-sync-for-salesforce' ),
819
+							'text'  => __('Hours', 'object-sync-for-salesforce'),
820 820
 							'value' => 'hours',
821 821
 						),
822 822
 						'days'    => array(
823
-							'text'  => __( 'Days', 'object-sync-for-salesforce' ),
823
+							'text'  => __('Days', 'object-sync-for-salesforce'),
824 824
 							'value' => 'days',
825 825
 						),
826 826
 					),
827 827
 				),
828 828
 			),
829 829
 			'triggers_to_log'       => array(
830
-				'title'    => __( 'Triggers to log', 'object-sync-for-salesforce' ),
830
+				'title'    => __('Triggers to log', 'object-sync-for-salesforce'),
831 831
 				'callback' => $callbacks['checkboxes'],
832 832
 				'page'     => $page,
833 833
 				'section'  => $section,
834 834
 				'args'     => array(
835 835
 					'type'     => 'checkboxes',
836 836
 					'validate' => 'sanitize_validate_text',
837
-					'desc'     => __( 'these are the triggers to log', 'object-sync-for-salesforce' ),
837
+					'desc'     => __('these are the triggers to log', 'object-sync-for-salesforce'),
838 838
 					'items'    => array(
839 839
 						$this->mappings->sync_wordpress_create => array(
840
-							'text' => __( 'WordPress create', 'object-sync-for-salesforce' ),
840
+							'text' => __('WordPress create', 'object-sync-for-salesforce'),
841 841
 							'id'   => 'wordpress_create',
842 842
 							'desc' => '',
843 843
 						),
844 844
 						$this->mappings->sync_wordpress_update => array(
845
-							'text' => __( 'WordPress update', 'object-sync-for-salesforce' ),
845
+							'text' => __('WordPress update', 'object-sync-for-salesforce'),
846 846
 							'id'   => 'wordpress_update',
847 847
 							'desc' => '',
848 848
 						),
849 849
 						$this->mappings->sync_wordpress_delete => array(
850
-							'text' => __( 'WordPress delete', 'object-sync-for-salesforce' ),
850
+							'text' => __('WordPress delete', 'object-sync-for-salesforce'),
851 851
 							'id'   => 'wordpress_delete',
852 852
 							'desc' => '',
853 853
 						),
854 854
 						$this->mappings->sync_sf_create => array(
855
-							'text' => __( 'Salesforce create', 'object-sync-for-salesforce' ),
855
+							'text' => __('Salesforce create', 'object-sync-for-salesforce'),
856 856
 							'id'   => 'sf_create',
857 857
 							'desc' => '',
858 858
 						),
859 859
 						$this->mappings->sync_sf_update => array(
860
-							'text' => __( 'Salesforce update', 'object-sync-for-salesforce' ),
860
+							'text' => __('Salesforce update', 'object-sync-for-salesforce'),
861 861
 							'id'   => 'sf_update',
862 862
 							'desc' => '',
863 863
 						),
864 864
 						$this->mappings->sync_sf_delete => array(
865
-							'text' => __( 'Salesforce delete', 'object-sync-for-salesforce' ),
865
+							'text' => __('Salesforce delete', 'object-sync-for-salesforce'),
866 866
 							'id'   => 'sf_delete',
867 867
 							'desc' => '',
868 868
 						),
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 				),
871 871
 			),
872 872
 		);
873
-		foreach ( $log_settings as $key => $attributes ) {
873
+		foreach ($log_settings as $key => $attributes) {
874 874
 			$id       = $this->option_prefix . $key;
875 875
 			$name     = $this->option_prefix . $key;
876 876
 			$title    = $attributes['title'];
@@ -886,8 +886,8 @@  discard block
 block discarded – undo
886 886
 					'name'      => $name,
887 887
 				)
888 888
 			);
889
-			add_settings_field( $id, $title, $callback, $page, $section, $args );
890
-			register_setting( $page, $id );
889
+			add_settings_field($id, $title, $callback, $page, $section, $args);
890
+			register_setting($page, $id);
891 891
 		}
892 892
 	}
893 893
 
@@ -898,69 +898,69 @@  discard block
 block discarded – undo
898 898
 	public function notices() {
899 899
 
900 900
 		// before a notice is displayed, we should make sure we are on a page related to this plugin
901
-		if ( ! isset( $_GET['page'] ) || 'object-sync-salesforce-admin' !== $_GET['page'] ) {
901
+		if ( ! isset($_GET['page']) || 'object-sync-salesforce-admin' !== $_GET['page']) {
902 902
 			return;
903 903
 		}
904 904
 
905
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
906
-		require_once plugin_dir_path( __FILE__ ) . '../classes/admin-notice.php';
905
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
906
+		require_once plugin_dir_path(__FILE__) . '../classes/admin-notice.php';
907 907
 
908 908
 		$notices = array(
909 909
 			'permission'      => array(
910 910
 				'condition'   => false === $this->check_wordpress_admin_permissions(),
911
-				'message'     => __( "Your account does not have permission to edit the Salesforce REST API plugin's settings.", 'object-sync-for-salesforce' ),
911
+				'message'     => __("Your account does not have permission to edit the Salesforce REST API plugin's settings.", 'object-sync-for-salesforce'),
912 912
 				'type'        => 'error',
913 913
 				'dismissible' => false,
914 914
 			),
915 915
 			'fieldmap'        => array(
916
-				'condition'   => isset( $get_data['transient'] ),
917
-				'message'     => __( 'Errors kept this fieldmap from being saved.', 'object-sync-for-salesforce' ),
916
+				'condition'   => isset($get_data['transient']),
917
+				'message'     => __('Errors kept this fieldmap from being saved.', 'object-sync-for-salesforce'),
918 918
 				'type'        => 'error',
919 919
 				'dismissible' => true,
920 920
 			),
921 921
 			'object_map'      => array(
922
-				'condition'   => isset( $get_data['map_transient'] ),
923
-				'message'     => __( 'Errors kept this object map from being saved.', 'object-sync-for-salesforce' ),
922
+				'condition'   => isset($get_data['map_transient']),
923
+				'message'     => __('Errors kept this object map from being saved.', 'object-sync-for-salesforce'),
924 924
 				'type'        => 'error',
925 925
 				'dismissible' => true,
926 926
 			),
927 927
 			'data_saved'      => array(
928
-				'condition'   => isset( $get_data['data_saved'] ) && 'true' === $get_data['data_saved'],
929
-				'message'     => __( 'This data was successfully saved.', 'object-sync-for-salesforce' ),
928
+				'condition'   => isset($get_data['data_saved']) && 'true' === $get_data['data_saved'],
929
+				'message'     => __('This data was successfully saved.', 'object-sync-for-salesforce'),
930 930
 				'type'        => 'success',
931 931
 				'dismissible' => true,
932 932
 			),
933 933
 			'data_save_error' => array(
934
-				'condition'   => isset( $get_data['data_saved'] ) && 'false' === $get_data['data_saved'],
935
-				'message'     => __( 'This data was not successfully saved. Try again.', 'object-sync-for-salesforce' ),
934
+				'condition'   => isset($get_data['data_saved']) && 'false' === $get_data['data_saved'],
935
+				'message'     => __('This data was not successfully saved. Try again.', 'object-sync-for-salesforce'),
936 936
 				'type'        => 'error',
937 937
 				'dismissible' => true,
938 938
 			),
939 939
 		);
940 940
 
941
-		foreach ( $notices as $key => $value ) {
941
+		foreach ($notices as $key => $value) {
942 942
 
943 943
 			$condition = $value['condition'];
944 944
 			$message   = $value['message'];
945 945
 
946
-			if ( isset( $value['dismissible'] ) ) {
946
+			if (isset($value['dismissible'])) {
947 947
 				$dismissible = $value['dismissible'];
948 948
 			} else {
949 949
 				$dismissible = false;
950 950
 			}
951 951
 
952
-			if ( isset( $value['type'] ) ) {
952
+			if (isset($value['type'])) {
953 953
 				$type = $value['type'];
954 954
 			} else {
955 955
 				$type = '';
956 956
 			}
957 957
 
958
-			if ( ! isset( $value['template'] ) ) {
958
+			if ( ! isset($value['template'])) {
959 959
 				$template = '';
960 960
 			}
961 961
 
962
-			if ( $condition ) {
963
-				new Object_Sync_Sf_Admin_Notice( $condition, $message, $dismissible, $type, $template );
962
+			if ($condition) {
963
+				new Object_Sync_Sf_Admin_Notice($condition, $message, $dismissible, $type, $template);
964 964
 			}
965 965
 		}
966 966
 
@@ -975,47 +975,47 @@  discard block
 block discarded – undo
975 975
 	* can optionally contain a type
976 976
 	* @return array $object_settings
977 977
 	*/
978
-	public function get_salesforce_object_description( $data = array() ) {
978
+	public function get_salesforce_object_description($data = array()) {
979 979
 		$ajax = false;
980
-		if ( empty( $data ) ) {
981
-			$data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
980
+		if (empty($data)) {
981
+			$data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
982 982
 			$ajax = true;
983 983
 		}
984 984
 
985 985
 		$object_description = array();
986 986
 
987
-		if ( ! empty( $data['salesforce_object'] ) ) {
988
-			$object = $this->salesforce['sfapi']->object_describe( esc_attr( $data['salesforce_object'] ) );
987
+		if ( ! empty($data['salesforce_object'])) {
988
+			$object = $this->salesforce['sfapi']->object_describe(esc_attr($data['salesforce_object']));
989 989
 
990 990
 			$object_fields        = array();
991 991
 			$include_record_types = array();
992 992
 
993 993
 			// these can come from ajax
994
-			$include = isset( $data['include'] ) ? (array) $data['include'] : array();
995
-			$include = array_map( 'esc_attr', $include );
996
-
997
-			if ( in_array( 'fields', $include, true ) || empty( $include ) ) {
998
-				$type = isset( $data['field_type'] ) ? esc_attr( $data['field_type'] ) : ''; // can come from ajax
999
-				foreach ( $object['data']['fields'] as $key => $value ) {
1000
-					if ( '' === $type || $type === $value['type'] ) {
1001
-						$object_fields[ $key ] = $value;
994
+			$include = isset($data['include']) ? (array) $data['include'] : array();
995
+			$include = array_map('esc_attr', $include);
996
+
997
+			if (in_array('fields', $include, true) || empty($include)) {
998
+				$type = isset($data['field_type']) ? esc_attr($data['field_type']) : ''; // can come from ajax
999
+				foreach ($object['data']['fields'] as $key => $value) {
1000
+					if ('' === $type || $type === $value['type']) {
1001
+						$object_fields[$key] = $value;
1002 1002
 					}
1003 1003
 				}
1004 1004
 				$object_description['fields'] = $object_fields;
1005 1005
 			}
1006 1006
 
1007
-			if ( in_array( 'recordTypeInfos', $include, true ) ) {
1008
-				if ( isset( $object['data']['recordTypeInfos'] ) && count( $object['data']['recordTypeInfos'] ) > 1 ) {
1009
-					foreach ( $object['data']['recordTypeInfos'] as $type ) {
1010
-						$object_record_types[ $type['recordTypeId'] ] = $type['name'];
1007
+			if (in_array('recordTypeInfos', $include, true)) {
1008
+				if (isset($object['data']['recordTypeInfos']) && count($object['data']['recordTypeInfos']) > 1) {
1009
+					foreach ($object['data']['recordTypeInfos'] as $type) {
1010
+						$object_record_types[$type['recordTypeId']] = $type['name'];
1011 1011
 					}
1012 1012
 					$object_description['recordTypeInfos'] = $object_record_types;
1013 1013
 				}
1014 1014
 			}
1015 1015
 		}
1016 1016
 
1017
-		if ( true === $ajax ) {
1018
-			wp_send_json_success( $object_description );
1017
+		if (true === $ajax) {
1018
+			wp_send_json_success($object_description);
1019 1019
 		} else {
1020 1020
 			return $object_description;
1021 1021
 		}
@@ -1029,23 +1029,23 @@  discard block
 block discarded – undo
1029 1029
 	* can optionally contain a type for the field
1030 1030
 	* @return array $object_fields
1031 1031
 	*/
1032
-	public function get_salesforce_object_fields( $data = array() ) {
1032
+	public function get_salesforce_object_fields($data = array()) {
1033 1033
 
1034
-		if ( ! empty( $data['salesforce_object'] ) ) {
1035
-			$object               = $this->salesforce['sfapi']->object_describe( esc_attr( $data['salesforce_object'] ) );
1034
+		if ( ! empty($data['salesforce_object'])) {
1035
+			$object               = $this->salesforce['sfapi']->object_describe(esc_attr($data['salesforce_object']));
1036 1036
 			$object_fields        = array();
1037
-			$type                 = isset( $data['type'] ) ? esc_attr( $data['type'] ) : '';
1038
-			$include_record_types = isset( $data['include_record_types'] ) ? esc_attr( $data['include_record_types'] ) : false;
1039
-			foreach ( $object['data']['fields'] as $key => $value ) {
1040
-				if ( '' === $type || $type === $value['type'] ) {
1041
-					$object_fields[ $key ] = $value;
1037
+			$type                 = isset($data['type']) ? esc_attr($data['type']) : '';
1038
+			$include_record_types = isset($data['include_record_types']) ? esc_attr($data['include_record_types']) : false;
1039
+			foreach ($object['data']['fields'] as $key => $value) {
1040
+				if ('' === $type || $type === $value['type']) {
1041
+					$object_fields[$key] = $value;
1042 1042
 				}
1043 1043
 			}
1044
-			if ( true === $include_record_types ) {
1044
+			if (true === $include_record_types) {
1045 1045
 				$object_record_types = array();
1046
-				if ( isset( $object['data']['recordTypeInfos'] ) && count( $object['data']['recordTypeInfos'] ) > 1 ) {
1047
-					foreach ( $object['data']['recordTypeInfos'] as $type ) {
1048
-						$object_record_types[ $type['recordTypeId'] ] = $type['name'];
1046
+				if (isset($object['data']['recordTypeInfos']) && count($object['data']['recordTypeInfos']) > 1) {
1047
+					foreach ($object['data']['recordTypeInfos'] as $type) {
1048
+						$object_record_types[$type['recordTypeId']] = $type['name'];
1049 1049
 					}
1050 1050
 				}
1051 1051
 			}
@@ -1062,18 +1062,18 @@  discard block
 block discarded – undo
1062 1062
 	* @param string $wordpress_object
1063 1063
 	* @return array $object_fields
1064 1064
 	*/
1065
-	public function get_wordpress_object_fields( $wordpress_object = '' ) {
1065
+	public function get_wordpress_object_fields($wordpress_object = '') {
1066 1066
 		$ajax      = false;
1067
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1068
-		if ( empty( $wordpress_object ) ) {
1069
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1067
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1068
+		if (empty($wordpress_object)) {
1069
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1070 1070
 			$ajax             = true;
1071 1071
 		}
1072 1072
 
1073
-		$object_fields = $this->wordpress->get_wordpress_object_fields( $wordpress_object );
1073
+		$object_fields = $this->wordpress->get_wordpress_object_fields($wordpress_object);
1074 1074
 
1075
-		if ( true === $ajax ) {
1076
-			wp_send_json_success( $object_fields );
1075
+		if (true === $ajax) {
1076
+			wp_send_json_success($object_fields);
1077 1077
 		} else {
1078 1078
 			return $object_fields;
1079 1079
 		}
@@ -1087,24 +1087,24 @@  discard block
 block discarded – undo
1087 1087
 	* @param string $salesforce_object
1088 1088
 	* @return array $object_fields
1089 1089
 	*/
1090
-	public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) {
1091
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1092
-		if ( empty( $wordpress_object ) ) {
1093
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1090
+	public function get_wp_sf_object_fields($wordpress_object = '', $salesforce = '') {
1091
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1092
+		if (empty($wordpress_object)) {
1093
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1094 1094
 		}
1095
-		if ( empty( $salesforce_object ) ) {
1096
-			$salesforce_object = isset( $post_data['salesforce_object'] ) ? sanitize_text_field( wp_unslash( $post_data['salesforce_object'] ) ) : '';
1095
+		if (empty($salesforce_object)) {
1096
+			$salesforce_object = isset($post_data['salesforce_object']) ? sanitize_text_field(wp_unslash($post_data['salesforce_object'])) : '';
1097 1097
 		}
1098 1098
 
1099
-		$object_fields['wordpress']  = $this->get_wordpress_object_fields( $wordpress_object );
1099
+		$object_fields['wordpress']  = $this->get_wordpress_object_fields($wordpress_object);
1100 1100
 		$object_fields['salesforce'] = $this->get_salesforce_object_fields(
1101 1101
 			array(
1102 1102
 				'salesforce_object' => $salesforce_object,
1103 1103
 			)
1104 1104
 		);
1105 1105
 
1106
-		if ( ! empty( $post_data ) ) {
1107
-			wp_send_json_success( $object_fields );
1106
+		if ( ! empty($post_data)) {
1107
+			wp_send_json_success($object_fields);
1108 1108
 		} else {
1109 1109
 			return $object_fields;
1110 1110
 		}
@@ -1117,17 +1117,17 @@  discard block
 block discarded – undo
1117 1117
 	* @param string $wordpress_object
1118 1118
 	* @param int $wordpress_id
1119 1119
 	*/
1120
-	public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) {
1121
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1122
-		if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
1123
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1124
-			$wordpress_id     = isset( $post_data['wordpress_id'] ) ? absint( $post_data['wordpress_id'] ) : '';
1120
+	public function push_to_salesforce($wordpress_object = '', $wordpress_id = '') {
1121
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1122
+		if (empty($wordpress_object) && empty($wordpress_id)) {
1123
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1124
+			$wordpress_id     = isset($post_data['wordpress_id']) ? absint($post_data['wordpress_id']) : '';
1125 1125
 		}
1126
-		$data   = $this->wordpress->get_wordpress_object_data( $wordpress_object, $wordpress_id );
1127
-		$result = $this->push->manual_object_update( $data, $wordpress_object );
1126
+		$data   = $this->wordpress->get_wordpress_object_data($wordpress_object, $wordpress_id);
1127
+		$result = $this->push->manual_object_update($data, $wordpress_object);
1128 1128
 
1129
-		if ( ! empty( $post_data['wordpress_object'] ) && ! empty( $post_data['wordpress_id'] ) ) {
1130
-			wp_send_json_success( $result );
1129
+		if ( ! empty($post_data['wordpress_object']) && ! empty($post_data['wordpress_id'])) {
1130
+			wp_send_json_success($result);
1131 1131
 		} else {
1132 1132
 			return $result;
1133 1133
 		}
@@ -1141,16 +1141,16 @@  discard block
 block discarded – undo
1141 1141
 	* @param string $salesforce_id
1142 1142
 	* @param string $wordpress_object
1143 1143
 	*/
1144
-	public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) {
1145
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1146
-		if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) {
1147
-			$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
1148
-			$salesforce_id    = isset( $post_data['salesforce_id'] ) ? sanitize_text_field( wp_unslash( $post_data['salesforce_id'] ) ) : '';
1149
-		}
1150
-		$type   = $this->salesforce['sfapi']->get_sobject_type( $salesforce_id );
1151
-		$result = $this->pull->manual_pull( $type, $salesforce_id, $wordpress_object ); // we want the wp object to make sure we get the right fieldmap
1152
-		if ( ! empty( $post_data ) ) {
1153
-			wp_send_json_success( $result );
1144
+	public function pull_from_salesforce($salesforce_id = '', $wordpress_object = '') {
1145
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1146
+		if (empty($wordpress_object) && empty($salesforce_id)) {
1147
+			$wordpress_object = isset($post_data['wordpress_object']) ? sanitize_text_field(wp_unslash($post_data['wordpress_object'])) : '';
1148
+			$salesforce_id    = isset($post_data['salesforce_id']) ? sanitize_text_field(wp_unslash($post_data['salesforce_id'])) : '';
1149
+		}
1150
+		$type   = $this->salesforce['sfapi']->get_sobject_type($salesforce_id);
1151
+		$result = $this->pull->manual_pull($type, $salesforce_id, $wordpress_object); // we want the wp object to make sure we get the right fieldmap
1152
+		if ( ! empty($post_data)) {
1153
+			wp_send_json_success($result);
1154 1154
 		} else {
1155 1155
 			return $result;
1156 1156
 		}
@@ -1162,18 +1162,18 @@  discard block
 block discarded – undo
1162 1162
 	*
1163 1163
 	* @param int $mapping_id
1164 1164
 	*/
1165
-	public function refresh_mapped_data( $mapping_id = '' ) {
1166
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1167
-		if ( empty( $mapping_id ) ) {
1168
-			$mapping_id = isset( $post_data['mapping_id'] ) ? absint( $post_data['mapping_id'] ) : '';
1165
+	public function refresh_mapped_data($mapping_id = '') {
1166
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1167
+		if (empty($mapping_id)) {
1168
+			$mapping_id = isset($post_data['mapping_id']) ? absint($post_data['mapping_id']) : '';
1169 1169
 		}
1170 1170
 		$result = $this->mappings->get_object_maps(
1171 1171
 			array(
1172 1172
 				'id' => $mapping_id,
1173 1173
 			)
1174 1174
 		);
1175
-		if ( ! empty( $post_data ) ) {
1176
-			wp_send_json_success( $result );
1175
+		if ( ! empty($post_data)) {
1176
+			wp_send_json_success($result);
1177 1177
 		} else {
1178 1178
 			return $result;
1179 1179
 		}
@@ -1189,47 +1189,47 @@  discard block
 block discarded – undo
1189 1189
 	*/
1190 1190
 	public function prepare_fieldmap_data() {
1191 1191
 		$error     = false;
1192
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1193
-		$cachekey  = md5( wp_json_encode( $post_data ) );
1192
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1193
+		$cachekey  = md5(wp_json_encode($post_data));
1194 1194
 
1195
-		if ( ! isset( $post_data['label'] ) || ! isset( $post_data['salesforce_object'] ) || ! isset( $post_data['wordpress_object'] ) ) {
1195
+		if ( ! isset($post_data['label']) || ! isset($post_data['salesforce_object']) || ! isset($post_data['wordpress_object'])) {
1196 1196
 			$error = true;
1197 1197
 		}
1198
-		if ( true === $error ) {
1199
-			$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1200
-			if ( '' !== $cachekey ) {
1201
-				$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&transient=' . $cachekey;
1198
+		if (true === $error) {
1199
+			$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1200
+			if ('' !== $cachekey) {
1201
+				$url = esc_url_raw($post_data['redirect_url_error']) . '&transient=' . $cachekey;
1202 1202
 			}
1203 1203
 		} else { // there are no errors
1204 1204
 			// send the row to the fieldmap class
1205 1205
 			// if it is add or clone, use the create method
1206
-			$method            = esc_attr( $post_data['method'] );
1206
+			$method            = esc_attr($post_data['method']);
1207 1207
 			$salesforce_fields = $this->get_salesforce_object_fields(
1208 1208
 				array(
1209 1209
 					'salesforce_object' => $post_data['salesforce_object'],
1210 1210
 				)
1211 1211
 			);
1212
-			$wordpress_fields  = $this->get_wordpress_object_fields( $post_data['wordpress_object'] );
1213
-			if ( 'add' === $method || 'clone' === $method ) {
1214
-				$result = $this->mappings->create_fieldmap( $post_data, $wordpress_fields, $salesforce_fields );
1215
-			} elseif ( 'edit' === $method ) { // if it is edit, use the update method
1216
-				$id     = esc_attr( $post_data['id'] );
1217
-				$result = $this->mappings->update_fieldmap( $post_data, $wordpress_fields, $salesforce_fields, $id );
1212
+			$wordpress_fields = $this->get_wordpress_object_fields($post_data['wordpress_object']);
1213
+			if ('add' === $method || 'clone' === $method) {
1214
+				$result = $this->mappings->create_fieldmap($post_data, $wordpress_fields, $salesforce_fields);
1215
+			} elseif ('edit' === $method) { // if it is edit, use the update method
1216
+				$id     = esc_attr($post_data['id']);
1217
+				$result = $this->mappings->update_fieldmap($post_data, $wordpress_fields, $salesforce_fields, $id);
1218 1218
 			}
1219
-			if ( false === $result ) { // if the database didn't save, it's still an error
1220
-				$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1221
-				if ( '' !== $cachekey ) {
1222
-					$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&transient=' . $cachekey;
1219
+			if (false === $result) { // if the database didn't save, it's still an error
1220
+				$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1221
+				if ('' !== $cachekey) {
1222
+					$url = esc_url_raw($post_data['redirect_url_error']) . '&transient=' . $cachekey;
1223 1223
 				}
1224 1224
 			} else {
1225
-				if ( isset( $post_data['transient'] ) ) { // there was previously an error saved. can delete it now.
1226
-					$this->sfwp_transients->delete( esc_attr( $post_data['map_transient'] ) );
1225
+				if (isset($post_data['transient'])) { // there was previously an error saved. can delete it now.
1226
+					$this->sfwp_transients->delete(esc_attr($post_data['map_transient']));
1227 1227
 				}
1228 1228
 				// then send the user to the list of fieldmaps
1229
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1229
+				$url = esc_url_raw($post_data['redirect_url_success']);
1230 1230
 			}
1231 1231
 		}
1232
-		wp_safe_redirect( $url );
1232
+		wp_safe_redirect($url);
1233 1233
 		exit();
1234 1234
 	}
1235 1235
 
@@ -1241,15 +1241,15 @@  discard block
 block discarded – undo
1241 1241
 	*
1242 1242
 	*/
1243 1243
 	public function delete_fieldmap() {
1244
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1245
-		if ( $post_data['id'] ) {
1246
-			$result = $this->mappings->delete_fieldmap( $post_data['id'] );
1247
-			if ( true === $result ) {
1248
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1244
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1245
+		if ($post_data['id']) {
1246
+			$result = $this->mappings->delete_fieldmap($post_data['id']);
1247
+			if (true === $result) {
1248
+				$url = esc_url_raw($post_data['redirect_url_success']);
1249 1249
 			} else {
1250
-				$url = esc_url_raw( $post_data['redirect_url_error'] . '&id=' . $post_data['id'] );
1250
+				$url = esc_url_raw($post_data['redirect_url_error'] . '&id=' . $post_data['id']);
1251 1251
 			}
1252
-			wp_safe_redirect( $url );
1252
+			wp_safe_redirect($url);
1253 1253
 			exit();
1254 1254
 		}
1255 1255
 	}
@@ -1264,38 +1264,38 @@  discard block
 block discarded – undo
1264 1264
 	*/
1265 1265
 	public function prepare_object_map_data() {
1266 1266
 		$error     = false;
1267
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1268
-		$cachekey  = md5( wp_json_encode( $post_data ) );
1267
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1268
+		$cachekey  = md5(wp_json_encode($post_data));
1269 1269
 
1270
-		if ( ! isset( $post_data['wordpress_id'] ) || ! isset( $post_data['salesforce_id'] ) ) {
1270
+		if ( ! isset($post_data['wordpress_id']) || ! isset($post_data['salesforce_id'])) {
1271 1271
 			$error = true;
1272 1272
 		}
1273
-		if ( true === $error ) {
1274
-			$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1275
-			if ( '' !== $cachekey ) {
1276
-				$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&map_transient=' . $cachekey;
1273
+		if (true === $error) {
1274
+			$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1275
+			if ('' !== $cachekey) {
1276
+				$url = esc_url_raw($post_data['redirect_url_error']) . '&map_transient=' . $cachekey;
1277 1277
 			}
1278 1278
 		} else { // there are no errors
1279 1279
 			// send the row to the object map class
1280
-			$method = esc_attr( $post_data['method'] );
1281
-			if ( 'edit' === $method ) { // if it is edit, use the update method
1282
-				$id     = esc_attr( $post_data['id'] );
1283
-				$result = $this->mappings->update_object_map( $post_data, $id );
1280
+			$method = esc_attr($post_data['method']);
1281
+			if ('edit' === $method) { // if it is edit, use the update method
1282
+				$id     = esc_attr($post_data['id']);
1283
+				$result = $this->mappings->update_object_map($post_data, $id);
1284 1284
 			}
1285
-			if ( false === $result ) { // if the database didn't save, it's still an error
1286
-				$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1287
-				if ( '' !== $cachekey ) {
1288
-					$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&map_transient=' . $cachekey;
1285
+			if (false === $result) { // if the database didn't save, it's still an error
1286
+				$this->sfwp_transients->set($cachekey, $post_data, $this->wordpress->options['cache_expiration']);
1287
+				if ('' !== $cachekey) {
1288
+					$url = esc_url_raw($post_data['redirect_url_error']) . '&map_transient=' . $cachekey;
1289 1289
 				}
1290 1290
 			} else {
1291
-				if ( isset( $post_data['map_transient'] ) ) { // there was previously an error saved. can delete it now.
1292
-					$this->sfwp_transients->delete( esc_attr( $post_data['map_transient'] ) );
1291
+				if (isset($post_data['map_transient'])) { // there was previously an error saved. can delete it now.
1292
+					$this->sfwp_transients->delete(esc_attr($post_data['map_transient']));
1293 1293
 				}
1294 1294
 				// then send the user to the success redirect url
1295
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1295
+				$url = esc_url_raw($post_data['redirect_url_success']);
1296 1296
 			}
1297 1297
 		}
1298
-		wp_safe_redirect( $url );
1298
+		wp_safe_redirect($url);
1299 1299
 		exit();
1300 1300
 	}
1301 1301
 
@@ -1307,15 +1307,15 @@  discard block
 block discarded – undo
1307 1307
 	*
1308 1308
 	*/
1309 1309
 	public function delete_object_map() {
1310
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1311
-		if ( $post_data['id'] ) {
1312
-			$result = $this->mappings->delete_object_map( $post_data['id'] );
1313
-			if ( true === $result ) {
1314
-				$url = esc_url_raw( $post_data['redirect_url_success'] );
1310
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1311
+		if ($post_data['id']) {
1312
+			$result = $this->mappings->delete_object_map($post_data['id']);
1313
+			if (true === $result) {
1314
+				$url = esc_url_raw($post_data['redirect_url_success']);
1315 1315
 			} else {
1316
-				$url = esc_url_raw( $post_data['redirect_url_error'] . '&id=' . $post_data['id'] );
1316
+				$url = esc_url_raw($post_data['redirect_url_error'] . '&id=' . $post_data['id']);
1317 1317
 			}
1318
-			wp_safe_redirect( $url );
1318
+			wp_safe_redirect($url);
1319 1319
 			exit();
1320 1320
 		}
1321 1321
 	}
@@ -1326,95 +1326,95 @@  discard block
 block discarded – undo
1326 1326
 	*/
1327 1327
 	public function import_json_file() {
1328 1328
 
1329
-		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) {
1329
+		if ( ! wp_verify_nonce($_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import')) {
1330 1330
 			return;
1331 1331
 		}
1332
-		if ( ! current_user_can( 'manage_options' ) ) {
1332
+		if ( ! current_user_can('manage_options')) {
1333 1333
 			return;
1334 1334
 		}
1335 1335
 		$path      = $_FILES['import_file']['name'];
1336
-		$extension = pathinfo( $path, PATHINFO_EXTENSION );
1337
-		if ( 'json' !== $extension ) {
1338
-			wp_die( __( 'Please upload a valid .json file' ) );
1336
+		$extension = pathinfo($path, PATHINFO_EXTENSION);
1337
+		if ('json' !== $extension) {
1338
+			wp_die(__('Please upload a valid .json file'));
1339 1339
 		}
1340 1340
 
1341 1341
 		$import_file = $_FILES['import_file']['tmp_name'];
1342
-		if ( empty( $import_file ) ) {
1343
-			wp_die( __( 'Please upload a file to import' ) );
1342
+		if (empty($import_file)) {
1343
+			wp_die(__('Please upload a file to import'));
1344 1344
 		}
1345 1345
 
1346 1346
 		// Retrieve the data from the file and convert the json object to an array.
1347
-		$data = (array) json_decode( file_get_contents( $import_file ), true );
1347
+		$data = (array) json_decode(file_get_contents($import_file), true);
1348 1348
 
1349 1349
 		// if there is only one object map, fix the array
1350
-		if ( isset( $data['object_maps'] ) ) {
1351
-			if ( count( $data['object_maps'] ) === count( $data['object_maps'], COUNT_RECURSIVE ) ) {
1352
-				$data['object_maps'] = array( 0 => $data['object_maps'] );
1350
+		if (isset($data['object_maps'])) {
1351
+			if (count($data['object_maps']) === count($data['object_maps'], COUNT_RECURSIVE)) {
1352
+				$data['object_maps'] = array(0 => $data['object_maps']);
1353 1353
 			}
1354 1354
 		}
1355 1355
 
1356
-		$overwrite = isset( $_POST['overwrite'] ) ? esc_attr( $_POST['overwrite'] ) : '';
1357
-		if ( '1' === $overwrite ) {
1358
-			if ( isset( $data['fieldmaps'] ) ) {
1356
+		$overwrite = isset($_POST['overwrite']) ? esc_attr($_POST['overwrite']) : '';
1357
+		if ('1' === $overwrite) {
1358
+			if (isset($data['fieldmaps'])) {
1359 1359
 				$fieldmaps = $this->mappings->get_fieldmaps();
1360
-				foreach ( $fieldmaps as $fieldmap ) {
1360
+				foreach ($fieldmaps as $fieldmap) {
1361 1361
 					$id     = $fieldmap['id'];
1362
-					$delete = $this->mappings->delete_fieldmap( $id );
1362
+					$delete = $this->mappings->delete_fieldmap($id);
1363 1363
 				}
1364 1364
 			}
1365
-			if ( isset( $data['object_maps'] ) ) {
1365
+			if (isset($data['object_maps'])) {
1366 1366
 				$object_maps = $this->mappings->get_object_maps();
1367 1367
 
1368 1368
 				// if there is only one existing object map, fix the array
1369
-				if ( count( $object_maps ) === count( $object_maps, COUNT_RECURSIVE ) ) {
1370
-					$object_maps = array( 0 => $object_maps );
1369
+				if (count($object_maps) === count($object_maps, COUNT_RECURSIVE)) {
1370
+					$object_maps = array(0 => $object_maps);
1371 1371
 				}
1372 1372
 
1373
-				foreach ( $object_maps as $object_map ) {
1373
+				foreach ($object_maps as $object_map) {
1374 1374
 					$id     = $object_map['id'];
1375
-					$delete = $this->mappings->delete_object_map( $id );
1375
+					$delete = $this->mappings->delete_object_map($id);
1376 1376
 				}
1377 1377
 			}
1378
-			if ( isset( $data['plugin_settings'] ) ) {
1379
-				foreach ( $data['plugin_settings'] as $key => $value ) {
1380
-					delete_option( $value['option_name'] );
1378
+			if (isset($data['plugin_settings'])) {
1379
+				foreach ($data['plugin_settings'] as $key => $value) {
1380
+					delete_option($value['option_name']);
1381 1381
 				}
1382 1382
 			}
1383 1383
 		}
1384 1384
 
1385 1385
 		$success = true;
1386 1386
 
1387
-		if ( isset( $data['fieldmaps'] ) ) {
1388
-			foreach ( $data['fieldmaps'] as $fieldmap ) {
1389
-				unset( $fieldmap['id'] );
1390
-				$create = $this->mappings->create_fieldmap( $fieldmap );
1391
-				if ( false === $create ) {
1387
+		if (isset($data['fieldmaps'])) {
1388
+			foreach ($data['fieldmaps'] as $fieldmap) {
1389
+				unset($fieldmap['id']);
1390
+				$create = $this->mappings->create_fieldmap($fieldmap);
1391
+				if (false === $create) {
1392 1392
 					$success = false;
1393 1393
 				}
1394 1394
 			}
1395 1395
 		}
1396 1396
 
1397
-		if ( isset( $data['object_maps'] ) ) {
1398
-			foreach ( $data['object_maps'] as $object_map ) {
1399
-				unset( $object_map['id'] );
1400
-				$create = $this->mappings->create_object_map( $object_map );
1401
-				if ( false === $create ) {
1397
+		if (isset($data['object_maps'])) {
1398
+			foreach ($data['object_maps'] as $object_map) {
1399
+				unset($object_map['id']);
1400
+				$create = $this->mappings->create_object_map($object_map);
1401
+				if (false === $create) {
1402 1402
 					$success = false;
1403 1403
 				}
1404 1404
 			}
1405 1405
 		}
1406 1406
 
1407
-		if ( isset( $data['plugin_settings'] ) ) {
1408
-			foreach ( $data['plugin_settings'] as $key => $value ) {
1409
-				update_option( $value['option_name'], maybe_unserialize( $value['option_value'] ), $value['autoload'] );
1407
+		if (isset($data['plugin_settings'])) {
1408
+			foreach ($data['plugin_settings'] as $key => $value) {
1409
+				update_option($value['option_name'], maybe_unserialize($value['option_value']), $value['autoload']);
1410 1410
 			}
1411 1411
 		}
1412 1412
 
1413
-		if ( true === $success ) {
1414
-			wp_safe_redirect( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=true' ) );
1413
+		if (true === $success) {
1414
+			wp_safe_redirect(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=true'));
1415 1415
 			exit;
1416 1416
 		} else {
1417
-			wp_safe_redirect( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=false' ) );
1417
+			wp_safe_redirect(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=import-export&data_saved=false'));
1418 1418
 			exit;
1419 1419
 		}
1420 1420
 
@@ -1426,28 +1426,28 @@  discard block
 block discarded – undo
1426 1426
 	*/
1427 1427
 	public function export_json_file() {
1428 1428
 
1429
-		if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) {
1429
+		if ( ! wp_verify_nonce($_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export')) {
1430 1430
 			return;
1431 1431
 		}
1432
-		if ( ! current_user_can( 'manage_options' ) ) {
1432
+		if ( ! current_user_can('manage_options')) {
1433 1433
 			return;
1434 1434
 		}
1435
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1435
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1436 1436
 		$export    = array();
1437
-		if ( in_array( 'fieldmaps', $post_data['export'] ) ) {
1437
+		if (in_array('fieldmaps', $post_data['export'])) {
1438 1438
 			$export['fieldmaps'] = $this->mappings->get_fieldmaps();
1439 1439
 		}
1440
-		if ( in_array( 'object_maps', $post_data['export'] ) ) {
1440
+		if (in_array('object_maps', $post_data['export'])) {
1441 1441
 			$export['object_maps'] = $this->mappings->get_object_maps();
1442 1442
 		}
1443
-		if ( in_array( 'plugin_settings', $post_data['export'] ) ) {
1444
-			$export['plugin_settings'] = $this->wpdb->get_results( 'SELECT * FROM ' . $this->wpdb->prefix . 'options' . ' WHERE option_name like "' . $this->option_prefix . '%"', ARRAY_A );
1443
+		if (in_array('plugin_settings', $post_data['export'])) {
1444
+			$export['plugin_settings'] = $this->wpdb->get_results('SELECT * FROM ' . $this->wpdb->prefix . 'options' . ' WHERE option_name like "' . $this->option_prefix . '%"', ARRAY_A);
1445 1445
 		}
1446 1446
 		nocache_headers();
1447
-		header( 'Content-Type: application/json; charset=utf-8' );
1448
-		header( 'Content-Disposition: attachment; filename=object-sync-for-salesforce-data-export-' . date( 'm-d-Y' ) . '.json' );
1449
-		header( 'Expires: 0' );
1450
-		echo wp_json_encode( $export );
1447
+		header('Content-Type: application/json; charset=utf-8');
1448
+		header('Content-Disposition: attachment; filename=object-sync-for-salesforce-data-export-' . date('m-d-Y') . '.json');
1449
+		header('Expires: 0');
1450
+		echo wp_json_encode($export);
1451 1451
 		exit;
1452 1452
 	}
1453 1453
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	*
1457 1457
 	* @param array $args
1458 1458
 	*/
1459
-	public function display_input_field( $args ) {
1459
+	public function display_input_field($args) {
1460 1460
 		$type    = $args['type'];
1461 1461
 		$id      = $args['label_for'];
1462 1462
 		$name    = $args['name'];
@@ -1465,38 +1465,38 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 		$class = 'regular-text';
1467 1467
 
1468
-		if ( 'checkbox' === $type ) {
1468
+		if ('checkbox' === $type) {
1469 1469
 			$class = 'checkbox';
1470 1470
 		}
1471 1471
 
1472
-		if ( ! isset( $args['constant'] ) || ! defined( $args['constant'] ) ) {
1473
-			$value = esc_attr( get_option( $id, '' ) );
1474
-			if ( 'checkbox' === $type ) {
1475
-				if ( '1' === $value ) {
1472
+		if ( ! isset($args['constant']) || ! defined($args['constant'])) {
1473
+			$value = esc_attr(get_option($id, ''));
1474
+			if ('checkbox' === $type) {
1475
+				if ('1' === $value) {
1476 1476
 					$checked = 'checked ';
1477 1477
 				}
1478 1478
 				$value = 1;
1479 1479
 			}
1480
-			if ( '' === $value && isset( $args['default'] ) && '' !== $args['default'] ) {
1480
+			if ('' === $value && isset($args['default']) && '' !== $args['default']) {
1481 1481
 				$value = $args['default'];
1482 1482
 			}
1483 1483
 
1484
-			echo sprintf( '<input type="%1$s" value="%2$s" name="%3$s" id="%4$s" class="%5$s"%6$s>',
1485
-				esc_attr( $type ),
1486
-				esc_attr( $value ),
1487
-				esc_attr( $name ),
1488
-				esc_attr( $id ),
1489
-				sanitize_html_class( $class . esc_html( ' code' ) ),
1490
-				esc_html( $checked )
1484
+			echo sprintf('<input type="%1$s" value="%2$s" name="%3$s" id="%4$s" class="%5$s"%6$s>',
1485
+				esc_attr($type),
1486
+				esc_attr($value),
1487
+				esc_attr($name),
1488
+				esc_attr($id),
1489
+				sanitize_html_class($class . esc_html(' code')),
1490
+				esc_html($checked)
1491 1491
 			);
1492
-			if ( '' !== $desc ) {
1493
-				echo sprintf( '<p class="description">%1$s</p>',
1494
-					esc_html( $desc )
1492
+			if ('' !== $desc) {
1493
+				echo sprintf('<p class="description">%1$s</p>',
1494
+					esc_html($desc)
1495 1495
 				);
1496 1496
 			}
1497 1497
 		} else {
1498
-			echo sprintf( '<p><code>%1$s</code></p>',
1499
-				esc_html__( 'Defined in wp-config.php', 'object-sync-for-salesforce' )
1498
+			echo sprintf('<p><code>%1$s</code></p>',
1499
+				esc_html__('Defined in wp-config.php', 'object-sync-for-salesforce')
1500 1500
 			);
1501 1501
 		}
1502 1502
 	}
@@ -1507,33 +1507,33 @@  discard block
 block discarded – undo
1507 1507
 	*
1508 1508
 	* @param array $args
1509 1509
 	*/
1510
-	public function display_checkboxes( $args ) {
1510
+	public function display_checkboxes($args) {
1511 1511
 		$type    = 'checkbox';
1512 1512
 		$name    = $args['name'];
1513
-		$options = get_option( $name, array() );
1514
-		foreach ( $args['items'] as $key => $value ) {
1513
+		$options = get_option($name, array());
1514
+		foreach ($args['items'] as $key => $value) {
1515 1515
 			$text    = $value['text'];
1516 1516
 			$id      = $value['id'];
1517 1517
 			$desc    = $value['desc'];
1518 1518
 			$checked = '';
1519
-			if ( is_array( $options ) && in_array( (string) $key, $options, true ) ) {
1519
+			if (is_array($options) && in_array((string) $key, $options, true)) {
1520 1520
 				$checked = 'checked';
1521
-			} elseif ( is_array( $options ) && empty( $options ) ) {
1522
-				if ( isset( $value['default'] ) && true === $value['default'] ) {
1521
+			} elseif (is_array($options) && empty($options)) {
1522
+				if (isset($value['default']) && true === $value['default']) {
1523 1523
 					$checked = 'checked';
1524 1524
 				}
1525 1525
 			}
1526
-			echo sprintf( '<div class="checkbox"><label><input type="%1$s" value="%2$s" name="%3$s[]" id="%4$s"%5$s>%6$s</label></div>',
1527
-				esc_attr( $type ),
1528
-				esc_attr( $key ),
1529
-				esc_attr( $name ),
1530
-				esc_attr( $id ),
1531
-				esc_html( $checked ),
1532
-				esc_html( $text )
1526
+			echo sprintf('<div class="checkbox"><label><input type="%1$s" value="%2$s" name="%3$s[]" id="%4$s"%5$s>%6$s</label></div>',
1527
+				esc_attr($type),
1528
+				esc_attr($key),
1529
+				esc_attr($name),
1530
+				esc_attr($id),
1531
+				esc_html($checked),
1532
+				esc_html($text)
1533 1533
 			);
1534
-			if ( '' !== $desc ) {
1535
-				echo sprintf( '<p class="description">%1$s</p>',
1536
-					esc_html( $desc )
1534
+			if ('' !== $desc) {
1535
+				echo sprintf('<p class="description">%1$s</p>',
1536
+					esc_html($desc)
1537 1537
 				);
1538 1538
 			}
1539 1539
 		}
@@ -1544,44 +1544,44 @@  discard block
 block discarded – undo
1544 1544
 	*
1545 1545
 	* @param array $args
1546 1546
 	*/
1547
-	public function display_select( $args ) {
1547
+	public function display_select($args) {
1548 1548
 		$type = $args['type'];
1549 1549
 		$id   = $args['label_for'];
1550 1550
 		$name = $args['name'];
1551 1551
 		$desc = $args['desc'];
1552
-		if ( ! isset( $args['constant'] ) || ! defined( $args['constant'] ) ) {
1553
-			$current_value = get_option( $name );
1552
+		if ( ! isset($args['constant']) || ! defined($args['constant'])) {
1553
+			$current_value = get_option($name);
1554 1554
 
1555
-			echo sprintf( '<div class="select"><select id="%1$s" name="%2$s"><option value="">- ' . __( 'Select one', 'object-sync-for-salesforce' ) . ' -</option>',
1556
-				esc_attr( $id ),
1557
-				esc_attr( $name )
1555
+			echo sprintf('<div class="select"><select id="%1$s" name="%2$s"><option value="">- ' . __('Select one', 'object-sync-for-salesforce') . ' -</option>',
1556
+				esc_attr($id),
1557
+				esc_attr($name)
1558 1558
 			);
1559 1559
 
1560
-			foreach ( $args['items'] as $key => $value ) {
1560
+			foreach ($args['items'] as $key => $value) {
1561 1561
 				$text     = $value['text'];
1562 1562
 				$value    = $value['value'];
1563 1563
 				$selected = '';
1564
-				if ( $key === $current_value || $value === $current_value ) {
1564
+				if ($key === $current_value || $value === $current_value) {
1565 1565
 					$selected = ' selected';
1566 1566
 				}
1567 1567
 
1568
-				echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
1569
-					esc_attr( $value ),
1570
-					esc_attr( $selected ),
1571
-					esc_html( $text )
1568
+				echo sprintf('<option value="%1$s"%2$s>%3$s</option>',
1569
+					esc_attr($value),
1570
+					esc_attr($selected),
1571
+					esc_html($text)
1572 1572
 				);
1573 1573
 
1574 1574
 			}
1575 1575
 			echo '</select>';
1576
-			if ( '' !== $desc ) {
1577
-				echo sprintf( '<p class="description">%1$s</p>',
1578
-					esc_html( $desc )
1576
+			if ('' !== $desc) {
1577
+				echo sprintf('<p class="description">%1$s</p>',
1578
+					esc_html($desc)
1579 1579
 				);
1580 1580
 			}
1581 1581
 			echo '</div>';
1582 1582
 		} else {
1583
-			echo sprintf( '<p><code>%1$s</code></p>',
1584
-				esc_html__( 'Defined in wp-config.php', 'object-sync-for-salesforce' )
1583
+			echo sprintf('<p><code>%1$s</code></p>',
1584
+				esc_html__('Defined in wp-config.php', 'object-sync-for-salesforce')
1585 1585
 			);
1586 1586
 		}
1587 1587
 	}
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 	private function version_options() {
1595 1595
 		$versions = $this->salesforce['sfapi']->get_api_versions();
1596 1596
 		$args     = array();
1597
-		foreach ( $versions['data'] as $key => $value ) {
1597
+		foreach ($versions['data'] as $key => $value) {
1598 1598
 			$args[] = array(
1599 1599
 				'value' => $value['version'],
1600 1600
 				'text'  => $value['label'] . ' (' . $value['version'] . ')',
@@ -1608,26 +1608,26 @@  discard block
 block discarded – undo
1608 1608
 	*
1609 1609
 	* @param array $args
1610 1610
 	*/
1611
-	public function display_link( $args ) {
1611
+	public function display_link($args) {
1612 1612
 		$label = $args['label'];
1613 1613
 		$desc  = $args['desc'];
1614 1614
 		$url   = $args['url'];
1615
-		if ( isset( $args['link_class'] ) ) {
1616
-			echo sprintf( '<p><a class="%1$s" href="%2$s">%3$s</a></p>',
1617
-				esc_attr( $args['link_class'] ),
1618
-				esc_url( $url ),
1619
-				esc_html( $label )
1615
+		if (isset($args['link_class'])) {
1616
+			echo sprintf('<p><a class="%1$s" href="%2$s">%3$s</a></p>',
1617
+				esc_attr($args['link_class']),
1618
+				esc_url($url),
1619
+				esc_html($label)
1620 1620
 			);
1621 1621
 		} else {
1622
-			echo sprintf( '<p><a href="%1$s">%2$s</a></p>',
1623
-				esc_url( $url ),
1624
-				esc_html( $label )
1622
+			echo sprintf('<p><a href="%1$s">%2$s</a></p>',
1623
+				esc_url($url),
1624
+				esc_html($label)
1625 1625
 			);
1626 1626
 		}
1627 1627
 
1628
-		if ( '' !== $desc ) {
1629
-			echo sprintf( '<p class="description">%1$s</p>',
1630
-				esc_html( $desc )
1628
+		if ('' !== $desc) {
1629
+			echo sprintf('<p class="description">%1$s</p>',
1630
+				esc_html($desc)
1631 1631
 			);
1632 1632
 		}
1633 1633
 
@@ -1639,15 +1639,15 @@  discard block
 block discarded – undo
1639 1639
 	* @param string $option
1640 1640
 	* @return string $option
1641 1641
 	*/
1642
-	public function sanitize_validate_text( $option ) {
1643
-		if ( is_array( $option ) ) {
1642
+	public function sanitize_validate_text($option) {
1643
+		if (is_array($option)) {
1644 1644
 			$options = array();
1645
-			foreach ( $option as $key => $value ) {
1646
-				$options[ $key ] = sanitize_text_field( $value );
1645
+			foreach ($option as $key => $value) {
1646
+				$options[$key] = sanitize_text_field($value);
1647 1647
 			}
1648 1648
 			return $options;
1649 1649
 		}
1650
-		$option = sanitize_text_field( $option );
1650
+		$option = sanitize_text_field($option);
1651 1651
 		return $option;
1652 1652
 	}
1653 1653
 
@@ -1656,60 +1656,60 @@  discard block
 block discarded – undo
1656 1656
 	*
1657 1657
 	* @param object $sfapi
1658 1658
 	*/
1659
-	private function status( $sfapi ) {
1659
+	private function status($sfapi) {
1660 1660
 
1661 1661
 		$versions = $sfapi->get_api_versions();
1662 1662
 
1663 1663
 		// format this array into text so users can see the versions
1664
-		if ( true === $versions['cached'] ) {
1665
-			$versions_is_cached = esc_html__( 'This list is cached, and', 'object-sync-salesforce' );
1664
+		if (true === $versions['cached']) {
1665
+			$versions_is_cached = esc_html__('This list is cached, and', 'object-sync-salesforce');
1666 1666
 		} else {
1667
-			$versions_is_cached = esc_html__( 'This list is not cached, but', 'object-sync-salesforce' );
1667
+			$versions_is_cached = esc_html__('This list is not cached, but', 'object-sync-salesforce');
1668 1668
 		}
1669 1669
 
1670
-		if ( true === $versions['from_cache'] ) {
1671
-			$versions_from_cache = esc_html__( 'items were loaded from the cache', 'object-sync-salesforce' );
1670
+		if (true === $versions['from_cache']) {
1671
+			$versions_from_cache = esc_html__('items were loaded from the cache', 'object-sync-salesforce');
1672 1672
 		} else {
1673
-			$versions_from_cache = esc_html__( 'items were not loaded from the cache', 'object-sync-salesforce' );
1673
+			$versions_from_cache = esc_html__('items were not loaded from the cache', 'object-sync-salesforce');
1674 1674
 		}
1675 1675
 
1676 1676
 		// translators: 1) $versions_is_cached is the "This list is/is not cached, and/but" line, 2) $versions_from_cache is the "items were/were not loaded from the cache" line
1677
-		$versions_apicall_summary = sprintf( esc_html__( 'Available Salesforce API versions. %1$s %2$s. This is not an authenticated request, so it does not touch the Salesforce token.', 'object-sync-for-salesforce' ),
1677
+		$versions_apicall_summary = sprintf(esc_html__('Available Salesforce API versions. %1$s %2$s. This is not an authenticated request, so it does not touch the Salesforce token.', 'object-sync-for-salesforce'),
1678 1678
 			$versions_is_cached,
1679 1679
 			$versions_from_cache
1680 1680
 		);
1681 1681
 
1682
-		$contacts = $sfapi->query( 'SELECT Name, Id from Contact LIMIT 100' );
1682
+		$contacts = $sfapi->query('SELECT Name, Id from Contact LIMIT 100');
1683 1683
 
1684 1684
 		// format this array into html so users can see the contacts
1685
-		if ( true === $contacts['cached'] ) {
1686
-			$contacts_is_cached = esc_html__( 'They are cached, and', 'object-sync-salesforce' );
1685
+		if (true === $contacts['cached']) {
1686
+			$contacts_is_cached = esc_html__('They are cached, and', 'object-sync-salesforce');
1687 1687
 		} else {
1688
-			$contacts_is_cached = esc_html__( 'They are not cached, but', 'object-sync-salesforce' );
1688
+			$contacts_is_cached = esc_html__('They are not cached, but', 'object-sync-salesforce');
1689 1689
 		}
1690 1690
 
1691
-		if ( true === $contacts['from_cache'] ) {
1692
-			$contacts_from_cache = esc_html__( 'they were loaded from the cache', 'object-sync-salesforce' );
1691
+		if (true === $contacts['from_cache']) {
1692
+			$contacts_from_cache = esc_html__('they were loaded from the cache', 'object-sync-salesforce');
1693 1693
 		} else {
1694
-			$contacts_from_cache = esc_html__( 'they were not loaded from the cache', 'object-sync-salesforce' );
1694
+			$contacts_from_cache = esc_html__('they were not loaded from the cache', 'object-sync-salesforce');
1695 1695
 		}
1696 1696
 
1697
-		if ( true === $contacts['is_redo'] ) {
1698
-			$contacts_refreshed_token = esc_html__( 'This request did require refreshing the Salesforce token', 'object-sync-salesforce' );
1697
+		if (true === $contacts['is_redo']) {
1698
+			$contacts_refreshed_token = esc_html__('This request did require refreshing the Salesforce token', 'object-sync-salesforce');
1699 1699
 		} else {
1700
-			$contacts_refreshed_token = esc_html__( 'This request did not require refreshing the Salesforce token', 'object-sync-salesforce' );
1700
+			$contacts_refreshed_token = esc_html__('This request did not require refreshing the Salesforce token', 'object-sync-salesforce');
1701 1701
 		}
1702 1702
 
1703 1703
 		// translators: 1) $contacts['data']['totalSize'] is the number of items loaded, 2) $contacts['data']['records'][0]['attributes']['type'] is the name of the Salesforce object, 3) $contacts_is_cached is the "They are/are not cached, and/but" line, 4) $contacts_from_cache is the "they were/were not loaded from the cache" line, 5) is the "this request did/did not require refreshing the Salesforce token" line
1704
-		$contacts_apicall_summary = sprintf( esc_html__( 'Salesforce successfully returned %1$s %2$s records. %3$s %4$s. %5$s.', 'object-sync-for-salesforce' ),
1705
-			absint( $contacts['data']['totalSize'] ),
1706
-			esc_html( $contacts['data']['records'][0]['attributes']['type'] ),
1704
+		$contacts_apicall_summary = sprintf(esc_html__('Salesforce successfully returned %1$s %2$s records. %3$s %4$s. %5$s.', 'object-sync-for-salesforce'),
1705
+			absint($contacts['data']['totalSize']),
1706
+			esc_html($contacts['data']['records'][0]['attributes']['type']),
1707 1707
 			$contacts_is_cached,
1708 1708
 			$contacts_from_cache,
1709 1709
 			$contacts_refreshed_token
1710 1710
 		);
1711 1711
 
1712
-		require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/status.php' );
1712
+		require_once(plugin_dir_path(__FILE__) . '/../templates/admin/status.php');
1713 1713
 
1714 1714
 	}
1715 1715
 
@@ -1719,12 +1719,12 @@  discard block
 block discarded – undo
1719 1719
 	* For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce
1720 1720
 	*/
1721 1721
 	private function logout() {
1722
-		$this->access_token  = delete_option( $this->option_prefix . 'access_token' );
1723
-		$this->instance_url  = delete_option( $this->option_prefix . 'instance_url' );
1724
-		$this->refresh_token = delete_option( $this->option_prefix . 'refresh_token' );
1725
-		echo sprintf( '<p>You have been logged out. You can use the <a href="%1$s">%2$s</a> tab to log in again.</p>',
1726
-			esc_url( get_admin_url( null, 'options-general.php?page=object-sync-salesforce-admin&tab=authorize' ) ),
1727
-			esc_html__( 'Authorize', 'object-sync-for-salesforce' )
1722
+		$this->access_token  = delete_option($this->option_prefix . 'access_token');
1723
+		$this->instance_url  = delete_option($this->option_prefix . 'instance_url');
1724
+		$this->refresh_token = delete_option($this->option_prefix . 'refresh_token');
1725
+		echo sprintf('<p>You have been logged out. You can use the <a href="%1$s">%2$s</a> tab to log in again.</p>',
1726
+			esc_url(get_admin_url(null, 'options-general.php?page=object-sync-salesforce-admin&tab=authorize')),
1727
+			esc_html__('Authorize', 'object-sync-for-salesforce')
1728 1728
 		);
1729 1729
 	}
1730 1730
 
@@ -1732,28 +1732,28 @@  discard block
 block discarded – undo
1732 1732
 	* Ajax call to clear the plugin cache.
1733 1733
 	*/
1734 1734
 	public function clear_sfwp_cache() {
1735
-		$result   = $this->clear_cache( true );
1735
+		$result   = $this->clear_cache(true);
1736 1736
 		$response = array(
1737 1737
 			'message' => $result['message'],
1738 1738
 			'success' => $result['success'],
1739 1739
 		);
1740
-		wp_send_json_success( $response );
1740
+		wp_send_json_success($response);
1741 1741
 	}
1742 1742
 
1743 1743
 	/**
1744 1744
 	* Clear the plugin's cache.
1745 1745
 	* This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data.
1746 1746
 	*/
1747
-	private function clear_cache( $ajax = false ) {
1747
+	private function clear_cache($ajax = false) {
1748 1748
 		$result = (bool) $this->wordpress->sfwp_transients->flush();
1749
-		if ( true === $result ) {
1750
-			$message = __( 'The plugin cache has been cleared.', 'object-sync-for-salesforce' );
1749
+		if (true === $result) {
1750
+			$message = __('The plugin cache has been cleared.', 'object-sync-for-salesforce');
1751 1751
 		} else {
1752
-			$message = __( 'There was an error clearing the plugin cache. Try refreshing this page.', 'object-sync-for-salesforce' );
1752
+			$message = __('There was an error clearing the plugin cache. Try refreshing this page.', 'object-sync-for-salesforce');
1753 1753
 		}
1754
-		if ( false === $ajax ) {
1754
+		if (false === $ajax) {
1755 1755
 			// translators: parameter 1 is the result message
1756
-			echo sprintf( '<p>%1$s</p>', $message );
1756
+			echo sprintf('<p>%1$s</p>', $message);
1757 1757
 		} else {
1758 1758
 			return array(
1759 1759
 				'message' => $message,
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 		// alternatively, other roles can get this capability in whatever other way you like
1777 1777
 		// point is: to administer this plugin, you need this capability
1778 1778
 
1779
-		if ( ! current_user_can( 'configure_salesforce' ) ) {
1779
+		if ( ! current_user_can('configure_salesforce')) {
1780 1780
 			return false;
1781 1781
 		} else {
1782 1782
 			return true;
@@ -1789,23 +1789,23 @@  discard block
 block discarded – undo
1789 1789
 	* @param object $user
1790 1790
 	*
1791 1791
 	*/
1792
-	public function show_salesforce_user_fields( $user ) {
1793
-		$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
1794
-		if ( true === $this->check_wordpress_admin_permissions() ) {
1795
-			$mapping  = $this->mappings->load_by_wordpress( 'user', $user->ID );
1792
+	public function show_salesforce_user_fields($user) {
1793
+		$get_data = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
1794
+		if (true === $this->check_wordpress_admin_permissions()) {
1795
+			$mapping  = $this->mappings->load_by_wordpress('user', $user->ID);
1796 1796
 			$fieldmap = $this->mappings->get_fieldmaps(
1797 1797
 				null, // id field must be null for multiples
1798 1798
 				array(
1799 1799
 					'wordpress_object' => 'user',
1800 1800
 				)
1801 1801
 			);
1802
-			if ( isset( $mapping['id'] ) && ! isset( $get_data['edit_salesforce_mapping'] ) ) {
1803
-				require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/user-profile-salesforce.php' );
1804
-			} elseif ( ! empty( $fieldmap ) ) { // is the user mapped to something already?
1805
-				if ( isset( $get_data['edit_salesforce_mapping'] ) && 'true' === sanitize_key( $get_data['edit_salesforce_mapping'] ) ) {
1806
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/user-profile-salesforce-change.php' );
1802
+			if (isset($mapping['id']) && ! isset($get_data['edit_salesforce_mapping'])) {
1803
+				require_once(plugin_dir_path(__FILE__) . '/../templates/admin/user-profile-salesforce.php');
1804
+			} elseif ( ! empty($fieldmap)) { // is the user mapped to something already?
1805
+				if (isset($get_data['edit_salesforce_mapping']) && 'true' === sanitize_key($get_data['edit_salesforce_mapping'])) {
1806
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/user-profile-salesforce-change.php');
1807 1807
 				} else {
1808
-					require_once( plugin_dir_path( __FILE__ ) . '/../templates/admin/user-profile-salesforce-map.php' );
1808
+					require_once(plugin_dir_path(__FILE__) . '/../templates/admin/user-profile-salesforce-map.php');
1809 1809
 				}
1810 1810
 			}
1811 1811
 		}
@@ -1816,10 +1816,10 @@  discard block
 block discarded – undo
1816 1816
 	* @param int $user_id
1817 1817
 	*
1818 1818
 	*/
1819
-	public function save_salesforce_user_fields( $user_id ) {
1820
-		$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
1821
-		if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) {
1822
-			$mapping_object                  = $this->mappings->get_object_maps(
1819
+	public function save_salesforce_user_fields($user_id) {
1820
+		$post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
1821
+		if (isset($post_data['salesforce_update_mapped_user']) && '1' === rawurlencode($post_data['salesforce_update_mapped_user'])) {
1822
+			$mapping_object = $this->mappings->get_object_maps(
1823 1823
 				array(
1824 1824
 					'wordpress_id'     => $user_id,
1825 1825
 					'wordpress_object' => 'user',
@@ -1827,14 +1827,14 @@  discard block
 block discarded – undo
1827 1827
 			);
1828 1828
 			$mapping_object['salesforce_id'] = $post_data['salesforce_id'];
1829 1829
 
1830
-			$result = $this->mappings->update_object_map( $mapping_object, $mapping_object['id'] );
1831
-		} elseif ( isset( $post_data['salesforce_create_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_create_mapped_user'] ) ) {
1830
+			$result = $this->mappings->update_object_map($mapping_object, $mapping_object['id']);
1831
+		} elseif (isset($post_data['salesforce_create_mapped_user']) && '1' === rawurlencode($post_data['salesforce_create_mapped_user'])) {
1832 1832
 			// if a Salesforce ID was entered
1833
-			if ( isset( $post_data['salesforce_id'] ) && ! empty( $post_data['salesforce_id'] ) ) {
1834
-				$mapping_object = $this->create_object_map( $user_id, 'user', $post_data['salesforce_id'] );
1835
-			} elseif ( isset( $post_data['push_new_user_to_salesforce'] ) ) {
1833
+			if (isset($post_data['salesforce_id']) && ! empty($post_data['salesforce_id'])) {
1834
+				$mapping_object = $this->create_object_map($user_id, 'user', $post_data['salesforce_id']);
1835
+			} elseif (isset($post_data['push_new_user_to_salesforce'])) {
1836 1836
 				// otherwise, create a new record in Salesforce
1837
-				$result = $this->push_to_salesforce( 'user', $user_id );
1837
+				$result = $this->push_to_salesforce('user', $user_id);
1838 1838
 			}
1839 1839
 		}
1840 1840
 	}
@@ -1844,29 +1844,29 @@  discard block
 block discarded – undo
1844 1844
 	* @param array $tabs
1845 1845
 	* @param string $tab
1846 1846
 	*/
1847
-	private function tabs( $tabs, $tab = '' ) {
1847
+	private function tabs($tabs, $tab = '') {
1848 1848
 
1849
-		$get_data        = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
1849
+		$get_data        = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
1850 1850
 		$consumer_key    = $this->login_credentials['consumer_key'];
1851 1851
 		$consumer_secret = $this->login_credentials['consumer_secret'];
1852 1852
 		$callback_url    = $this->login_credentials['callback_url'];
1853 1853
 
1854 1854
 		$current_tab = $tab;
1855 1855
 		echo '<h2 class="nav-tab-wrapper">';
1856
-		foreach ( $tabs as $tab_key => $tab_caption ) {
1856
+		foreach ($tabs as $tab_key => $tab_caption) {
1857 1857
 			$active = $current_tab === $tab_key ? ' nav-tab-active' : '';
1858
-			if ( 'settings' === $tab_key || ( isset( $consumer_key ) && isset( $consumer_secret ) && ! empty( $consumer_key ) && ! empty( $consumer_secret ) ) ) {
1859
-				echo sprintf( '<a class="nav-tab%1$s" href="%2$s">%3$s</a>',
1860
-					esc_attr( $active ),
1861
-					esc_url( '?page=object-sync-salesforce-admin&tab=' . $tab_key ),
1862
-					esc_html( $tab_caption )
1858
+			if ('settings' === $tab_key || (isset($consumer_key) && isset($consumer_secret) && ! empty($consumer_key) && ! empty($consumer_secret))) {
1859
+				echo sprintf('<a class="nav-tab%1$s" href="%2$s">%3$s</a>',
1860
+					esc_attr($active),
1861
+					esc_url('?page=object-sync-salesforce-admin&tab=' . $tab_key),
1862
+					esc_html($tab_caption)
1863 1863
 				);
1864 1864
 			}
1865 1865
 		}
1866 1866
 		echo '</h2>';
1867 1867
 
1868
-		if ( isset( $get_data['tab'] ) ) {
1869
-			$tab = sanitize_key( $get_data['tab'] );
1868
+		if (isset($get_data['tab'])) {
1869
+			$tab = sanitize_key($get_data['tab']);
1870 1870
 		} else {
1871 1871
 			$tab = '';
1872 1872
 		}
@@ -1876,21 +1876,21 @@  discard block
 block discarded – undo
1876 1876
 	* Clear schedule
1877 1877
 	* This clears the schedule if the user clicks the button
1878 1878
 	*/
1879
-	private function clear_schedule( $schedule_name = '' ) {
1880
-		if ( '' !== $schedule_name ) {
1881
-			$schedule = $this->schedule( $schedule_name );
1882
-			$schedule->cancel_by_name( $schedule_name );
1879
+	private function clear_schedule($schedule_name = '') {
1880
+		if ('' !== $schedule_name) {
1881
+			$schedule = $this->schedule($schedule_name);
1882
+			$schedule->cancel_by_name($schedule_name);
1883 1883
 			// translators: $schedule_name is the name of the current queue. Defaults: salesforce_pull, salesforce_push, salesforce
1884
-			echo sprintf( esc_html__( 'You have cleared the %s schedule.', 'object-sync-for-salesforce' ), esc_html( $schedule_name ) );
1884
+			echo sprintf(esc_html__('You have cleared the %s schedule.', 'object-sync-for-salesforce'), esc_html($schedule_name));
1885 1885
 		} else {
1886
-			echo esc_html__( 'You need to specify the name of the schedule you want to clear.', 'object-sync-for-salesforce' );
1886
+			echo esc_html__('You need to specify the name of the schedule you want to clear.', 'object-sync-for-salesforce');
1887 1887
 		}
1888 1888
 	}
1889 1889
 
1890
-	private function get_schedule_count( $schedule_name = '' ) {
1891
-		if ( '' !== $schedule_name ) {
1892
-			$schedule = $this->schedule( $schedule_name );
1893
-			return $this->schedule->count_queue_items( $schedule_name );
1890
+	private function get_schedule_count($schedule_name = '') {
1891
+		if ('' !== $schedule_name) {
1892
+			$schedule = $this->schedule($schedule_name);
1893
+			return $this->schedule->count_queue_items($schedule_name);
1894 1894
 		} else {
1895 1895
 			return 'unknown';
1896 1896
 		}
@@ -1899,12 +1899,12 @@  discard block
 block discarded – undo
1899 1899
 	/**
1900 1900
 	* Load the schedule class
1901 1901
 	*/
1902
-	private function schedule( $schedule_name ) {
1903
-		if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
1904
-			require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php';
1905
-			require_once plugin_dir_path( __FILE__ ) . '../classes/schedule.php';
1902
+	private function schedule($schedule_name) {
1903
+		if ( ! class_exists('Object_Sync_Sf_Schedule') && file_exists(plugin_dir_path(__FILE__) . '../vendor/autoload.php')) {
1904
+			require_once plugin_dir_path(__FILE__) . '../vendor/autoload.php';
1905
+			require_once plugin_dir_path(__FILE__) . '../classes/schedule.php';
1906 1906
 		}
1907
-		$schedule       = new Object_Sync_Sf_Schedule( $this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $schedule_name, $this->logging, $this->schedulable_classes );
1907
+		$schedule       = new Object_Sync_Sf_Schedule($this->wpdb, $this->version, $this->login_credentials, $this->slug, $this->wordpress, $this->salesforce, $this->mappings, $schedule_name, $this->logging, $this->schedulable_classes);
1908 1908
 		$this->schedule = $schedule;
1909 1909
 		return $schedule;
1910 1910
 	}
@@ -1925,17 +1925,17 @@  discard block
 block discarded – undo
1925 1925
 	*   This is the database row for the map object
1926 1926
 	*
1927 1927
 	*/
1928
-	private function create_object_map( $wordpress_id, $wordpress_object, $salesforce_id, $action = '' ) {
1928
+	private function create_object_map($wordpress_id, $wordpress_object, $salesforce_id, $action = '') {
1929 1929
 		// Create object map and save it
1930 1930
 		$mapping_object = $this->mappings->create_object_map(
1931 1931
 			array(
1932 1932
 				'wordpress_id'      => $wordpress_id, // wordpress unique id
1933 1933
 				'salesforce_id'     => $salesforce_id, // salesforce unique id. we don't care what kind of object it is at this point
1934 1934
 				'wordpress_object'  => $wordpress_object, // keep track of what kind of wp object this is
1935
-				'last_sync'         => current_time( 'mysql' ),
1935
+				'last_sync'         => current_time('mysql'),
1936 1936
 				'last_sync_action'  => $action,
1937 1937
 				'last_sync_status'  => $this->mappings->status_success,
1938
-				'last_sync_message' => __( 'Mapping object updated via function: ', 'object-sync-for-salesforce' ) . __FUNCTION__,
1938
+				'last_sync_message' => __('Mapping object updated via function: ', 'object-sync-for-salesforce') . __FUNCTION__,
1939 1939
 			)
1940 1940
 		);
1941 1941
 
Please login to merge, or discard this patch.