@@ -27,63 +27,63 @@ discard block |
||
27 | 27 | protected $queue; |
28 | 28 | |
29 | 29 | /** |
30 | - * @var string |
|
31 | - * Default path for the Salesforce authorize URL |
|
32 | - */ |
|
30 | + * @var string |
|
31 | + * Default path for the Salesforce authorize URL |
|
32 | + */ |
|
33 | 33 | public $default_authorize_url_path; |
34 | 34 | |
35 | 35 | /** |
36 | - * @var string |
|
37 | - * Default path for the Salesforce token URL |
|
38 | - */ |
|
36 | + * @var string |
|
37 | + * Default path for the Salesforce token URL |
|
38 | + */ |
|
39 | 39 | public $default_token_url_path; |
40 | 40 | |
41 | 41 | /** |
42 | - * @var string |
|
43 | - * What version of the Salesforce API should be the default on the settings screen. |
|
44 | - * Users can edit this, but they won't see a correct list of all their available versions until WordPress has |
|
45 | - * been authenticated with Salesforce. |
|
46 | - */ |
|
42 | + * @var string |
|
43 | + * What version of the Salesforce API should be the default on the settings screen. |
|
44 | + * Users can edit this, but they won't see a correct list of all their available versions until WordPress has |
|
45 | + * been authenticated with Salesforce. |
|
46 | + */ |
|
47 | 47 | public $default_api_version; |
48 | 48 | |
49 | 49 | /** |
50 | - * @var bool |
|
51 | - * Default for whether to limit to triggerable items |
|
52 | - * Users can edit this |
|
53 | - */ |
|
50 | + * @var bool |
|
51 | + * Default for whether to limit to triggerable items |
|
52 | + * Users can edit this |
|
53 | + */ |
|
54 | 54 | public $default_triggerable; |
55 | 55 | |
56 | 56 | /** |
57 | - * @var bool |
|
58 | - * Default for whether to limit to updateable items |
|
59 | - * Users can edit this |
|
60 | - */ |
|
57 | + * @var bool |
|
58 | + * Default for whether to limit to updateable items |
|
59 | + * Users can edit this |
|
60 | + */ |
|
61 | 61 | public $default_updateable; |
62 | 62 | |
63 | 63 | /** |
64 | - * @var int |
|
65 | - * Default pull throttle for how often Salesforce can pull |
|
66 | - * Users can edit this |
|
67 | - */ |
|
64 | + * @var int |
|
65 | + * Default pull throttle for how often Salesforce can pull |
|
66 | + * Users can edit this |
|
67 | + */ |
|
68 | 68 | public $default_pull_throttle; |
69 | 69 | |
70 | 70 | /** |
71 | - * Constructor which sets up admin pages |
|
72 | - * |
|
73 | - * @param object $wpdb |
|
74 | - * @param string $version |
|
75 | - * @param array $login_credentials |
|
76 | - * @param string $slug |
|
77 | - * @param object $wordpress |
|
78 | - * @param object $salesforce |
|
79 | - * @param object $mappings |
|
80 | - * @param object $push |
|
81 | - * @param object $pull |
|
82 | - * @param object $logging |
|
83 | - * @param array $schedulable_classes |
|
84 | - * @param object $queue |
|
85 | - * @throws \Exception |
|
86 | - */ |
|
71 | + * Constructor which sets up admin pages |
|
72 | + * |
|
73 | + * @param object $wpdb |
|
74 | + * @param string $version |
|
75 | + * @param array $login_credentials |
|
76 | + * @param string $slug |
|
77 | + * @param object $wordpress |
|
78 | + * @param object $salesforce |
|
79 | + * @param object $mappings |
|
80 | + * @param object $push |
|
81 | + * @param object $pull |
|
82 | + * @param object $logging |
|
83 | + * @param array $schedulable_classes |
|
84 | + * @param object $queue |
|
85 | + * @throws \Exception |
|
86 | + */ |
|
87 | 87 | public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $push, $pull, $logging, $schedulable_classes, $queue ) { |
88 | 88 | $this->wpdb = $wpdb; |
89 | 89 | $this->version = $version; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * Create the action hooks to create the admin page(s) |
|
124 | - * |
|
125 | - */ |
|
123 | + * Create the action hooks to create the admin page(s) |
|
124 | + * |
|
125 | + */ |
|
126 | 126 | public function add_actions() { |
127 | 127 | add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) ); |
128 | 128 | add_action( 'admin_init', array( $this, 'notices' ) ); |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | - * Recurring task to check Salesforce for data |
|
161 | - * |
|
162 | - */ |
|
160 | + * Recurring task to check Salesforce for data |
|
161 | + * |
|
162 | + */ |
|
163 | 163 | public function change_action_schedule( $old_schedule, $new_schedule, $option_name ) { |
164 | 164 | |
165 | 165 | // exit if nothing changed |
@@ -195,21 +195,21 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Create WordPress admin options page |
|
199 | - * |
|
200 | - */ |
|
198 | + * Create WordPress admin options page |
|
199 | + * |
|
200 | + */ |
|
201 | 201 | public function create_admin_menu() { |
202 | 202 | $title = __( 'Salesforce', 'object-sync-for-salesforce' ); |
203 | 203 | add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) ); |
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
207 | - * Render full admin pages in WordPress |
|
208 | - * This allows other plugins to add tabs to the Salesforce settings screen |
|
209 | - * |
|
210 | - * todo: better front end: html, organization of html into templates, css, js |
|
211 | - * |
|
212 | - */ |
|
207 | + * Render full admin pages in WordPress |
|
208 | + * This allows other plugins to add tabs to the Salesforce settings screen |
|
209 | + * |
|
210 | + * todo: better front end: html, organization of html into templates, css, js |
|
211 | + * |
|
212 | + */ |
|
213 | 213 | public function show_admin_page() { |
214 | 214 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
215 | 215 | echo '<div class="wrap">'; |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
422 | - * Create default WordPress admin settings form for salesforce |
|
423 | - * This is for the Settings page/tab |
|
424 | - * |
|
425 | - */ |
|
422 | + * Create default WordPress admin settings form for salesforce |
|
423 | + * This is for the Settings page/tab |
|
424 | + * |
|
425 | + */ |
|
426 | 426 | public function salesforce_settings_forms() { |
427 | 427 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
428 | 428 | $page = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings'; |
@@ -447,13 +447,13 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | - * Fields for the Settings tab |
|
451 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
452 | - * |
|
453 | - * @param string $page |
|
454 | - * @param string $section |
|
455 | - * @param string $input_callback |
|
456 | - */ |
|
450 | + * Fields for the Settings tab |
|
451 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
452 | + * |
|
453 | + * @param string $page |
|
454 | + * @param string $section |
|
455 | + * @param string $input_callback |
|
456 | + */ |
|
457 | 457 | private function fields_settings( $page, $section, $callbacks ) { |
458 | 458 | add_settings_section( $page, ucwords( $page ), null, $page ); |
459 | 459 | $salesforce_settings = array( |
@@ -687,25 +687,25 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
690 | - * Fields for the Fieldmaps tab |
|
691 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
692 | - * |
|
693 | - * @param string $page |
|
694 | - * @param string $section |
|
695 | - * @param string $input_callback |
|
696 | - */ |
|
690 | + * Fields for the Fieldmaps tab |
|
691 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
692 | + * |
|
693 | + * @param string $page |
|
694 | + * @param string $section |
|
695 | + * @param string $input_callback |
|
696 | + */ |
|
697 | 697 | private function fields_fieldmaps( $page, $section, $input_callback = '' ) { |
698 | 698 | add_settings_section( $page, ucwords( $page ), null, $page ); |
699 | 699 | } |
700 | 700 | |
701 | 701 | /** |
702 | - * Fields for the Scheduling tab |
|
703 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
704 | - * |
|
705 | - * @param string $page |
|
706 | - * @param string $section |
|
707 | - * @param string $input_callback |
|
708 | - */ |
|
702 | + * Fields for the Scheduling tab |
|
703 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
704 | + * |
|
705 | + * @param string $page |
|
706 | + * @param string $section |
|
707 | + * @param string $input_callback |
|
708 | + */ |
|
709 | 709 | private function fields_scheduling( $page, $section, $callbacks ) { |
710 | 710 | foreach ( $this->schedulable_classes as $key => $value ) { |
711 | 711 | add_settings_section( $key, $value['label'], null, $page ); |
@@ -798,13 +798,13 @@ discard block |
||
798 | 798 | } |
799 | 799 | |
800 | 800 | /** |
801 | - * Fields for the Log Settings tab |
|
802 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
803 | - * |
|
804 | - * @param string $page |
|
805 | - * @param string $section |
|
806 | - * @param array $callbacks |
|
807 | - */ |
|
801 | + * Fields for the Log Settings tab |
|
802 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
803 | + * |
|
804 | + * @param string $page |
|
805 | + * @param string $section |
|
806 | + * @param array $callbacks |
|
807 | + */ |
|
808 | 808 | private function fields_log_settings( $page, $section, $callbacks ) { |
809 | 809 | add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page ); |
810 | 810 | $log_settings = array( |
@@ -982,9 +982,9 @@ discard block |
||
982 | 982 | } |
983 | 983 | |
984 | 984 | /** |
985 | - * Create the notices, settings, and conditions by which admin notices should appear |
|
986 | - * |
|
987 | - */ |
|
985 | + * Create the notices, settings, and conditions by which admin notices should appear |
|
986 | + * |
|
987 | + */ |
|
988 | 988 | public function notices() { |
989 | 989 | |
990 | 990 | // before a notice is displayed, we should make sure we are on a page related to this plugin |
@@ -1057,14 +1057,14 @@ discard block |
||
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | /** |
1060 | - * Get all the Salesforce object settings for fieldmapping |
|
1061 | - * This takes either the $_POST array via ajax, or can be directly called with a $data array |
|
1062 | - * |
|
1063 | - * @param array $data |
|
1064 | - * data must contain a salesforce_object |
|
1065 | - * can optionally contain a type |
|
1066 | - * @return array $object_settings |
|
1067 | - */ |
|
1060 | + * Get all the Salesforce object settings for fieldmapping |
|
1061 | + * This takes either the $_POST array via ajax, or can be directly called with a $data array |
|
1062 | + * |
|
1063 | + * @param array $data |
|
1064 | + * data must contain a salesforce_object |
|
1065 | + * can optionally contain a type |
|
1066 | + * @return array $object_settings |
|
1067 | + */ |
|
1068 | 1068 | public function get_salesforce_object_description( $data = array() ) { |
1069 | 1069 | $ajax = false; |
1070 | 1070 | if ( empty( $data ) ) { |
@@ -1112,13 +1112,13 @@ discard block |
||
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | /** |
1115 | - * Get Salesforce object fields for fieldmapping |
|
1116 | - * |
|
1117 | - * @param array $data |
|
1118 | - * data must contain a salesforce_object |
|
1119 | - * can optionally contain a type for the field |
|
1120 | - * @return array $object_fields |
|
1121 | - */ |
|
1115 | + * Get Salesforce object fields for fieldmapping |
|
1116 | + * |
|
1117 | + * @param array $data |
|
1118 | + * data must contain a salesforce_object |
|
1119 | + * can optionally contain a type for the field |
|
1120 | + * @return array $object_fields |
|
1121 | + */ |
|
1122 | 1122 | public function get_salesforce_object_fields( $data = array() ) { |
1123 | 1123 | |
1124 | 1124 | if ( ! empty( $data['salesforce_object'] ) ) { |
@@ -1146,12 +1146,12 @@ discard block |
||
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | /** |
1149 | - * Get WordPress object fields for fieldmapping |
|
1150 | - * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field |
|
1151 | - * |
|
1152 | - * @param string $wordpress_object |
|
1153 | - * @return array $object_fields |
|
1154 | - */ |
|
1149 | + * Get WordPress object fields for fieldmapping |
|
1150 | + * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field |
|
1151 | + * |
|
1152 | + * @param string $wordpress_object |
|
1153 | + * @return array $object_fields |
|
1154 | + */ |
|
1155 | 1155 | public function get_wordpress_object_fields( $wordpress_object = '' ) { |
1156 | 1156 | $ajax = false; |
1157 | 1157 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1170,13 +1170,13 @@ discard block |
||
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | /** |
1173 | - * Get WordPress and Salesforce object fields together for fieldmapping |
|
1174 | - * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields |
|
1175 | - * |
|
1176 | - * @param string $wordpress_object |
|
1177 | - * @param string $salesforce_object |
|
1178 | - * @return array $object_fields |
|
1179 | - */ |
|
1173 | + * Get WordPress and Salesforce object fields together for fieldmapping |
|
1174 | + * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields |
|
1175 | + * |
|
1176 | + * @param string $wordpress_object |
|
1177 | + * @param string $salesforce_object |
|
1178 | + * @return array $object_fields |
|
1179 | + */ |
|
1180 | 1180 | public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) { |
1181 | 1181 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1182 | 1182 | if ( empty( $wordpress_object ) ) { |
@@ -1201,12 +1201,12 @@ discard block |
||
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | /** |
1204 | - * Manually push the WordPress object to Salesforce |
|
1205 | - * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields |
|
1206 | - * |
|
1207 | - * @param string $wordpress_object |
|
1208 | - * @param int $wordpress_id |
|
1209 | - */ |
|
1204 | + * Manually push the WordPress object to Salesforce |
|
1205 | + * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields |
|
1206 | + * |
|
1207 | + * @param string $wordpress_object |
|
1208 | + * @param int $wordpress_id |
|
1209 | + */ |
|
1210 | 1210 | public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) { |
1211 | 1211 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1212 | 1212 | if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) { |
@@ -1225,12 +1225,12 @@ discard block |
||
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | /** |
1228 | - * Manually pull the Salesforce object into WordPress |
|
1229 | - * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields |
|
1230 | - * |
|
1231 | - * @param string $salesforce_id |
|
1232 | - * @param string $wordpress_object |
|
1233 | - */ |
|
1228 | + * Manually pull the Salesforce object into WordPress |
|
1229 | + * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields |
|
1230 | + * |
|
1231 | + * @param string $salesforce_id |
|
1232 | + * @param string $wordpress_object |
|
1233 | + */ |
|
1234 | 1234 | public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) { |
1235 | 1235 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1236 | 1236 | if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) { |
@@ -1247,11 +1247,11 @@ discard block |
||
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | /** |
1250 | - * Manually pull the Salesforce object into WordPress |
|
1251 | - * This takes an id for a mapping object row |
|
1252 | - * |
|
1253 | - * @param int $mapping_id |
|
1254 | - */ |
|
1250 | + * Manually pull the Salesforce object into WordPress |
|
1251 | + * This takes an id for a mapping object row |
|
1252 | + * |
|
1253 | + * @param int $mapping_id |
|
1254 | + */ |
|
1255 | 1255 | public function refresh_mapped_data( $mapping_id = '' ) { |
1256 | 1256 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1257 | 1257 | if ( empty( $mapping_id ) ) { |
@@ -1270,13 +1270,13 @@ discard block |
||
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | /** |
1273 | - * Prepare fieldmap data and redirect after processing |
|
1274 | - * This runs when the create or update forms are submitted |
|
1275 | - * It is public because it depends on an admin hook |
|
1276 | - * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1277 | - * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1278 | - * |
|
1279 | - */ |
|
1273 | + * Prepare fieldmap data and redirect after processing |
|
1274 | + * This runs when the create or update forms are submitted |
|
1275 | + * It is public because it depends on an admin hook |
|
1276 | + * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1277 | + * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1278 | + * |
|
1279 | + */ |
|
1280 | 1280 | public function prepare_fieldmap_data() { |
1281 | 1281 | $error = false; |
1282 | 1282 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1324,12 +1324,12 @@ discard block |
||
1324 | 1324 | } |
1325 | 1325 | |
1326 | 1326 | /** |
1327 | - * Delete fieldmap data and redirect after processing |
|
1328 | - * This runs when the delete link is clicked, after the user confirms |
|
1329 | - * It is public because it depends on an admin hook |
|
1330 | - * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1331 | - * |
|
1332 | - */ |
|
1327 | + * Delete fieldmap data and redirect after processing |
|
1328 | + * This runs when the delete link is clicked, after the user confirms |
|
1329 | + * It is public because it depends on an admin hook |
|
1330 | + * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1331 | + * |
|
1332 | + */ |
|
1333 | 1333 | public function delete_fieldmap() { |
1334 | 1334 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1335 | 1335 | if ( $post_data['id'] ) { |
@@ -1345,13 +1345,13 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | /** |
1348 | - * Prepare object data and redirect after processing |
|
1349 | - * This runs when the update form is submitted |
|
1350 | - * It is public because it depends on an admin hook |
|
1351 | - * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1352 | - * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1353 | - * |
|
1354 | - */ |
|
1348 | + * Prepare object data and redirect after processing |
|
1349 | + * This runs when the update form is submitted |
|
1350 | + * It is public because it depends on an admin hook |
|
1351 | + * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1352 | + * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1353 | + * |
|
1354 | + */ |
|
1355 | 1355 | public function prepare_object_map_data() { |
1356 | 1356 | $error = false; |
1357 | 1357 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1390,12 +1390,12 @@ discard block |
||
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | /** |
1393 | - * Delete object map data and redirect after processing |
|
1394 | - * This runs when the delete link is clicked on an error row, after the user confirms |
|
1395 | - * It is public because it depends on an admin hook |
|
1396 | - * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1397 | - * |
|
1398 | - */ |
|
1393 | + * Delete object map data and redirect after processing |
|
1394 | + * This runs when the delete link is clicked on an error row, after the user confirms |
|
1395 | + * It is public because it depends on an admin hook |
|
1396 | + * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1397 | + * |
|
1398 | + */ |
|
1399 | 1399 | public function delete_object_map() { |
1400 | 1400 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1401 | 1401 | if ( $post_data['id'] ) { |
@@ -1411,9 +1411,9 @@ discard block |
||
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | /** |
1414 | - * Import a json file and use it for plugin data |
|
1415 | - * |
|
1416 | - */ |
|
1414 | + * Import a json file and use it for plugin data |
|
1415 | + * |
|
1416 | + */ |
|
1417 | 1417 | public function import_json_file() { |
1418 | 1418 | |
1419 | 1419 | if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) { |
@@ -1511,9 +1511,9 @@ discard block |
||
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | /** |
1514 | - * Create a json file for exporting |
|
1515 | - * |
|
1516 | - */ |
|
1514 | + * Create a json file for exporting |
|
1515 | + * |
|
1516 | + */ |
|
1517 | 1517 | public function export_json_file() { |
1518 | 1518 | |
1519 | 1519 | if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) { |
@@ -1542,10 +1542,10 @@ discard block |
||
1542 | 1542 | } |
1543 | 1543 | |
1544 | 1544 | /** |
1545 | - * Default display for <input> fields |
|
1546 | - * |
|
1547 | - * @param array $args |
|
1548 | - */ |
|
1545 | + * Default display for <input> fields |
|
1546 | + * |
|
1547 | + * @param array $args |
|
1548 | + */ |
|
1549 | 1549 | public function display_input_field( $args ) { |
1550 | 1550 | $type = $args['type']; |
1551 | 1551 | $id = $args['label_for']; |
@@ -1592,11 +1592,11 @@ discard block |
||
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | /** |
1595 | - * Display for multiple checkboxes |
|
1596 | - * Above method can handle a single checkbox as it is |
|
1597 | - * |
|
1598 | - * @param array $args |
|
1599 | - */ |
|
1595 | + * Display for multiple checkboxes |
|
1596 | + * Above method can handle a single checkbox as it is |
|
1597 | + * |
|
1598 | + * @param array $args |
|
1599 | + */ |
|
1600 | 1600 | public function display_checkboxes( $args ) { |
1601 | 1601 | $type = 'checkbox'; |
1602 | 1602 | $name = $args['name']; |
@@ -1630,10 +1630,10 @@ discard block |
||
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | /** |
1633 | - * Display for a dropdown |
|
1634 | - * |
|
1635 | - * @param array $args |
|
1636 | - */ |
|
1633 | + * Display for a dropdown |
|
1634 | + * |
|
1635 | + * @param array $args |
|
1636 | + */ |
|
1637 | 1637 | public function display_select( $args ) { |
1638 | 1638 | $type = $args['type']; |
1639 | 1639 | $id = $args['label_for']; |
@@ -1677,10 +1677,10 @@ discard block |
||
1677 | 1677 | } |
1678 | 1678 | |
1679 | 1679 | /** |
1680 | - * Dropdown formatted list of Salesforce API versions |
|
1681 | - * |
|
1682 | - * @return array $args |
|
1683 | - */ |
|
1680 | + * Dropdown formatted list of Salesforce API versions |
|
1681 | + * |
|
1682 | + * @return array $args |
|
1683 | + */ |
|
1684 | 1684 | private function version_options() { |
1685 | 1685 | $versions = $this->salesforce['sfapi']->get_api_versions(); |
1686 | 1686 | $args = array(); |
@@ -1694,10 +1694,10 @@ discard block |
||
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | /** |
1697 | - * Default display for <a href> links |
|
1698 | - * |
|
1699 | - * @param array $args |
|
1700 | - */ |
|
1697 | + * Default display for <a href> links |
|
1698 | + * |
|
1699 | + * @param array $args |
|
1700 | + */ |
|
1701 | 1701 | public function display_link( $args ) { |
1702 | 1702 | $label = $args['label']; |
1703 | 1703 | $desc = $args['desc']; |
@@ -1724,11 +1724,11 @@ discard block |
||
1724 | 1724 | } |
1725 | 1725 | |
1726 | 1726 | /** |
1727 | - * Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline. |
|
1728 | - * |
|
1729 | - * @param string $option |
|
1730 | - * @return string $option |
|
1731 | - */ |
|
1727 | + * Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline. |
|
1728 | + * |
|
1729 | + * @param string $option |
|
1730 | + * @return string $option |
|
1731 | + */ |
|
1732 | 1732 | public function sanitize_validate_text( $option ) { |
1733 | 1733 | if ( is_array( $option ) ) { |
1734 | 1734 | $options = array(); |
@@ -1742,10 +1742,10 @@ discard block |
||
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | /** |
1745 | - * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it |
|
1746 | - * |
|
1747 | - * @param object $sfapi |
|
1748 | - */ |
|
1745 | + * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it |
|
1746 | + * |
|
1747 | + * @param object $sfapi |
|
1748 | + */ |
|
1749 | 1749 | private function status( $sfapi ) { |
1750 | 1750 | |
1751 | 1751 | $versions = $sfapi->get_api_versions(); |
@@ -1804,10 +1804,10 @@ discard block |
||
1804 | 1804 | } |
1805 | 1805 | |
1806 | 1806 | /** |
1807 | - * Deauthorize WordPress from Salesforce. |
|
1808 | - * This deletes the tokens from the database; it does not currently do anything in Salesforce |
|
1809 | - * For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce |
|
1810 | - */ |
|
1807 | + * Deauthorize WordPress from Salesforce. |
|
1808 | + * This deletes the tokens from the database; it does not currently do anything in Salesforce |
|
1809 | + * For this plugin at this time, that is the decision we are making: don't do any kind of authorization stuff inside Salesforce |
|
1810 | + */ |
|
1811 | 1811 | private function logout() { |
1812 | 1812 | $this->access_token = delete_option( $this->option_prefix . 'access_token' ); |
1813 | 1813 | $this->instance_url = delete_option( $this->option_prefix . 'instance_url' ); |
@@ -1819,8 +1819,8 @@ discard block |
||
1819 | 1819 | } |
1820 | 1820 | |
1821 | 1821 | /** |
1822 | - * Ajax call to clear the plugin cache. |
|
1823 | - */ |
|
1822 | + * Ajax call to clear the plugin cache. |
|
1823 | + */ |
|
1824 | 1824 | public function clear_sfwp_cache() { |
1825 | 1825 | $result = $this->clear_cache( true ); |
1826 | 1826 | $response = array( |
@@ -1831,9 +1831,9 @@ discard block |
||
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | /** |
1834 | - * Clear the plugin's cache. |
|
1835 | - * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data. |
|
1836 | - */ |
|
1834 | + * Clear the plugin's cache. |
|
1835 | + * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data. |
|
1836 | + */ |
|
1837 | 1837 | private function clear_cache( $ajax = false ) { |
1838 | 1838 | $result = (bool) $this->wordpress->sfwp_transients->flush(); |
1839 | 1839 | if ( true === $result ) { |
@@ -1853,9 +1853,9 @@ discard block |
||
1853 | 1853 | } |
1854 | 1854 | |
1855 | 1855 | /** |
1856 | - * Check WordPress Admin permissions |
|
1857 | - * Check if the current user is allowed to access the Salesforce plugin options |
|
1858 | - */ |
|
1856 | + * Check WordPress Admin permissions |
|
1857 | + * Check if the current user is allowed to access the Salesforce plugin options |
|
1858 | + */ |
|
1859 | 1859 | private function check_wordpress_admin_permissions() { |
1860 | 1860 | |
1861 | 1861 | // one programmatic way to give this capability to additional user roles is the |
@@ -1875,10 +1875,10 @@ discard block |
||
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | /** |
1878 | - * Show what we know about this user's relationship to a Salesforce object, if any |
|
1879 | - * @param object $user |
|
1880 | - * |
|
1881 | - */ |
|
1878 | + * Show what we know about this user's relationship to a Salesforce object, if any |
|
1879 | + * @param object $user |
|
1880 | + * |
|
1881 | + */ |
|
1882 | 1882 | public function show_salesforce_user_fields( $user ) { |
1883 | 1883 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
1884 | 1884 | if ( true === $this->check_wordpress_admin_permissions() ) { |
@@ -1902,10 +1902,10 @@ discard block |
||
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | /** |
1905 | - * If the user profile has been mapped to Salesforce, do it |
|
1906 | - * @param int $user_id |
|
1907 | - * |
|
1908 | - */ |
|
1905 | + * If the user profile has been mapped to Salesforce, do it |
|
1906 | + * @param int $user_id |
|
1907 | + * |
|
1908 | + */ |
|
1909 | 1909 | public function save_salesforce_user_fields( $user_id ) { |
1910 | 1910 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1911 | 1911 | if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) { |
@@ -1930,10 +1930,10 @@ discard block |
||
1930 | 1930 | } |
1931 | 1931 | |
1932 | 1932 | /** |
1933 | - * Render tabs for settings pages in admin |
|
1934 | - * @param array $tabs |
|
1935 | - * @param string $tab |
|
1936 | - */ |
|
1933 | + * Render tabs for settings pages in admin |
|
1934 | + * @param array $tabs |
|
1935 | + * @param string $tab |
|
1936 | + */ |
|
1937 | 1937 | private function tabs( $tabs, $tab = '' ) { |
1938 | 1938 | |
1939 | 1939 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
@@ -1963,10 +1963,10 @@ discard block |
||
1963 | 1963 | } |
1964 | 1964 | |
1965 | 1965 | /** |
1966 | - * Clear schedule |
|
1967 | - * This clears the schedule if the user clicks the button |
|
1968 | - * @param string $schedule_name |
|
1969 | - */ |
|
1966 | + * Clear schedule |
|
1967 | + * This clears the schedule if the user clicks the button |
|
1968 | + * @param string $schedule_name |
|
1969 | + */ |
|
1970 | 1970 | private function clear_schedule( $schedule_name = '' ) { |
1971 | 1971 | if ( '' !== $schedule_name ) { |
1972 | 1972 | $this->queue->cancel( $schedule_name ); |
@@ -1978,10 +1978,10 @@ discard block |
||
1978 | 1978 | } |
1979 | 1979 | |
1980 | 1980 | /** |
1981 | - * Get count of schedule items |
|
1982 | - * @param string $schedule_name |
|
1983 | - * @return int $count |
|
1984 | - */ |
|
1981 | + * Get count of schedule items |
|
1982 | + * @param string $schedule_name |
|
1983 | + * @return int $count |
|
1984 | + */ |
|
1985 | 1985 | private function get_schedule_count( $schedule_name = '' ) { |
1986 | 1986 | if ( '' !== $schedule_name ) { |
1987 | 1987 | $args = array( |
@@ -1996,21 +1996,21 @@ discard block |
||
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | /** |
1999 | - * Create an object map between a WordPress object and a Salesforce object |
|
2000 | - * |
|
2001 | - * @param int $wordpress_id |
|
2002 | - * Unique identifier for the WordPress object |
|
2003 | - * @param string $wordpress_object |
|
2004 | - * What kind of object is it? |
|
2005 | - * @param string $salesforce_id |
|
2006 | - * Unique identifier for the Salesforce object |
|
2007 | - * @param string $action |
|
2008 | - * Did we push or pull? |
|
2009 | - * |
|
2010 | - * @return int $wpdb->insert_id |
|
2011 | - * This is the database row for the map object |
|
2012 | - * |
|
2013 | - */ |
|
1999 | + * Create an object map between a WordPress object and a Salesforce object |
|
2000 | + * |
|
2001 | + * @param int $wordpress_id |
|
2002 | + * Unique identifier for the WordPress object |
|
2003 | + * @param string $wordpress_object |
|
2004 | + * What kind of object is it? |
|
2005 | + * @param string $salesforce_id |
|
2006 | + * Unique identifier for the Salesforce object |
|
2007 | + * @param string $action |
|
2008 | + * Did we push or pull? |
|
2009 | + * |
|
2010 | + * @return int $wpdb->insert_id |
|
2011 | + * This is the database row for the map object |
|
2012 | + * |
|
2013 | + */ |
|
2014 | 2014 | private function create_object_map( $wordpress_id, $wordpress_object, $salesforce_id, $action = '' ) { |
2015 | 2015 | // Create object map and save it |
2016 | 2016 | $mapping_object = $this->mappings->create_object_map( |