@@ -26,62 +26,62 @@ discard block |
||
26 | 26 | protected $schedulable_classes; |
27 | 27 | |
28 | 28 | /** |
29 | - * @var string |
|
30 | - * Default path for the Salesforce authorize URL |
|
31 | - */ |
|
29 | + * @var string |
|
30 | + * Default path for the Salesforce authorize URL |
|
31 | + */ |
|
32 | 32 | public $default_authorize_url_path; |
33 | 33 | |
34 | 34 | /** |
35 | - * @var string |
|
36 | - * Default path for the Salesforce token URL |
|
37 | - */ |
|
35 | + * @var string |
|
36 | + * Default path for the Salesforce token URL |
|
37 | + */ |
|
38 | 38 | public $default_token_url_path; |
39 | 39 | |
40 | 40 | /** |
41 | - * @var string |
|
42 | - * What version of the Salesforce API should be the default on the settings screen. |
|
43 | - * Users can edit this, but they won't see a correct list of all their available versions until WordPress has |
|
44 | - * been authenticated with Salesforce. |
|
45 | - */ |
|
41 | + * @var string |
|
42 | + * What version of the Salesforce API should be the default on the settings screen. |
|
43 | + * Users can edit this, but they won't see a correct list of all their available versions until WordPress has |
|
44 | + * been authenticated with Salesforce. |
|
45 | + */ |
|
46 | 46 | public $default_api_version; |
47 | 47 | |
48 | 48 | /** |
49 | - * @var bool |
|
50 | - * Default for whether to limit to triggerable items |
|
51 | - * Users can edit this |
|
52 | - */ |
|
49 | + * @var bool |
|
50 | + * Default for whether to limit to triggerable items |
|
51 | + * Users can edit this |
|
52 | + */ |
|
53 | 53 | public $default_triggerable; |
54 | 54 | |
55 | 55 | /** |
56 | - * @var bool |
|
57 | - * Default for whether to limit to updateable items |
|
58 | - * Users can edit this |
|
59 | - */ |
|
56 | + * @var bool |
|
57 | + * Default for whether to limit to updateable items |
|
58 | + * Users can edit this |
|
59 | + */ |
|
60 | 60 | public $default_updateable; |
61 | 61 | |
62 | 62 | /** |
63 | - * @var int |
|
64 | - * Default pull throttle for how often Salesforce can pull |
|
65 | - * Users can edit this |
|
66 | - */ |
|
63 | + * @var int |
|
64 | + * Default pull throttle for how often Salesforce can pull |
|
65 | + * Users can edit this |
|
66 | + */ |
|
67 | 67 | public $default_pull_throttle; |
68 | 68 | |
69 | 69 | /** |
70 | - * Constructor which sets up admin pages |
|
71 | - * |
|
72 | - * @param object $wpdb |
|
73 | - * @param string $version |
|
74 | - * @param array $login_credentials |
|
75 | - * @param string $slug |
|
76 | - * @param object $wordpress |
|
77 | - * @param object $salesforce |
|
78 | - * @param object $mappings |
|
79 | - * @param object $push |
|
80 | - * @param object $pull |
|
81 | - * @param object $logging |
|
82 | - * @param array $schedulable_classes |
|
83 | - * @throws \Exception |
|
84 | - */ |
|
70 | + * Constructor which sets up admin pages |
|
71 | + * |
|
72 | + * @param object $wpdb |
|
73 | + * @param string $version |
|
74 | + * @param array $login_credentials |
|
75 | + * @param string $slug |
|
76 | + * @param object $wordpress |
|
77 | + * @param object $salesforce |
|
78 | + * @param object $mappings |
|
79 | + * @param object $push |
|
80 | + * @param object $pull |
|
81 | + * @param object $logging |
|
82 | + * @param array $schedulable_classes |
|
83 | + * @throws \Exception |
|
84 | + */ |
|
85 | 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; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | - * Create the action hooks to create the admin page(s) |
|
121 | - * |
|
122 | - */ |
|
120 | + * Create the action hooks to create the admin page(s) |
|
121 | + * |
|
122 | + */ |
|
123 | 123 | public function add_actions() { |
124 | 124 | add_action( 'admin_init', array( $this, 'salesforce_settings_forms' ) ); |
125 | 125 | add_action( 'admin_init', array( $this, 'notices' ) ); |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * Create WordPress admin options page |
|
152 | - * |
|
153 | - */ |
|
151 | + * Create WordPress admin options page |
|
152 | + * |
|
153 | + */ |
|
154 | 154 | public function create_admin_menu() { |
155 | 155 | $title = __( 'Salesforce', 'object-sync-for-salesforce' ); |
156 | 156 | add_options_page( $title, $title, 'configure_salesforce', 'object-sync-salesforce-admin', array( $this, 'show_admin_page' ) ); |
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | - * Render full admin pages in WordPress |
|
161 | - * This allows other plugins to add tabs to the Salesforce settings screen |
|
162 | - * |
|
163 | - * todo: better front end: html, organization of html into templates, css, js |
|
164 | - * |
|
165 | - */ |
|
160 | + * Render full admin pages in WordPress |
|
161 | + * This allows other plugins to add tabs to the Salesforce settings screen |
|
162 | + * |
|
163 | + * todo: better front end: html, organization of html into templates, css, js |
|
164 | + * |
|
165 | + */ |
|
166 | 166 | public function show_admin_page() { |
167 | 167 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
168 | 168 | echo '<div class="wrap">'; |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
375 | - * Create default WordPress admin settings form for salesforce |
|
376 | - * This is for the Settings page/tab |
|
377 | - * |
|
378 | - */ |
|
375 | + * Create default WordPress admin settings form for salesforce |
|
376 | + * This is for the Settings page/tab |
|
377 | + * |
|
378 | + */ |
|
379 | 379 | public function salesforce_settings_forms() { |
380 | 380 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
381 | 381 | $page = isset( $get_data['tab'] ) ? sanitize_key( $get_data['tab'] ) : 'settings'; |
@@ -400,13 +400,13 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | - * Fields for the Settings tab |
|
404 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
405 | - * |
|
406 | - * @param string $page |
|
407 | - * @param string $section |
|
408 | - * @param string $input_callback |
|
409 | - */ |
|
403 | + * Fields for the Settings tab |
|
404 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
405 | + * |
|
406 | + * @param string $page |
|
407 | + * @param string $section |
|
408 | + * @param string $input_callback |
|
409 | + */ |
|
410 | 410 | private function fields_settings( $page, $section, $callbacks ) { |
411 | 411 | add_settings_section( $page, ucwords( $page ), null, $page ); |
412 | 412 | $salesforce_settings = array( |
@@ -611,25 +611,25 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
614 | - * Fields for the Fieldmaps tab |
|
615 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
616 | - * |
|
617 | - * @param string $page |
|
618 | - * @param string $section |
|
619 | - * @param string $input_callback |
|
620 | - */ |
|
614 | + * Fields for the Fieldmaps tab |
|
615 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
616 | + * |
|
617 | + * @param string $page |
|
618 | + * @param string $section |
|
619 | + * @param string $input_callback |
|
620 | + */ |
|
621 | 621 | private function fields_fieldmaps( $page, $section, $input_callback = '' ) { |
622 | 622 | add_settings_section( $page, ucwords( $page ), null, $page ); |
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
626 | - * Fields for the Scheduling tab |
|
627 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
628 | - * |
|
629 | - * @param string $page |
|
630 | - * @param string $section |
|
631 | - * @param string $input_callback |
|
632 | - */ |
|
626 | + * Fields for the Scheduling tab |
|
627 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
628 | + * |
|
629 | + * @param string $page |
|
630 | + * @param string $section |
|
631 | + * @param string $input_callback |
|
632 | + */ |
|
633 | 633 | private function fields_scheduling( $page, $section, $callbacks ) { |
634 | 634 | foreach ( $this->schedulable_classes as $key => $value ) { |
635 | 635 | add_settings_section( $key, $value['label'], null, $page ); |
@@ -708,13 +708,13 @@ discard block |
||
708 | 708 | } |
709 | 709 | |
710 | 710 | /** |
711 | - * Fields for the Log Settings tab |
|
712 | - * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
713 | - * |
|
714 | - * @param string $page |
|
715 | - * @param string $section |
|
716 | - * @param array $callbacks |
|
717 | - */ |
|
711 | + * Fields for the Log Settings tab |
|
712 | + * This runs add_settings_section once, as well as add_settings_field and register_setting methods for each option |
|
713 | + * |
|
714 | + * @param string $page |
|
715 | + * @param string $section |
|
716 | + * @param array $callbacks |
|
717 | + */ |
|
718 | 718 | private function fields_log_settings( $page, $section, $callbacks ) { |
719 | 719 | add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page ); |
720 | 720 | $log_settings = array( |
@@ -892,9 +892,9 @@ discard block |
||
892 | 892 | } |
893 | 893 | |
894 | 894 | /** |
895 | - * Create the notices, settings, and conditions by which admin notices should appear |
|
896 | - * |
|
897 | - */ |
|
895 | + * Create the notices, settings, and conditions by which admin notices should appear |
|
896 | + * |
|
897 | + */ |
|
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 |
@@ -967,14 +967,14 @@ discard block |
||
967 | 967 | } |
968 | 968 | |
969 | 969 | /** |
970 | - * Get all the Salesforce object settings for fieldmapping |
|
971 | - * This takes either the $_POST array via ajax, or can be directly called with a $data array |
|
972 | - * |
|
973 | - * @param array $data |
|
974 | - * data must contain a salesforce_object |
|
975 | - * can optionally contain a type |
|
976 | - * @return array $object_settings |
|
977 | - */ |
|
970 | + * Get all the Salesforce object settings for fieldmapping |
|
971 | + * This takes either the $_POST array via ajax, or can be directly called with a $data array |
|
972 | + * |
|
973 | + * @param array $data |
|
974 | + * data must contain a salesforce_object |
|
975 | + * can optionally contain a type |
|
976 | + * @return array $object_settings |
|
977 | + */ |
|
978 | 978 | public function get_salesforce_object_description( $data = array() ) { |
979 | 979 | $ajax = false; |
980 | 980 | if ( empty( $data ) ) { |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | /** |
1025 | - * Get Salesforce object fields for fieldmapping |
|
1026 | - * |
|
1027 | - * @param array $data |
|
1028 | - * data must contain a salesforce_object |
|
1029 | - * can optionally contain a type for the field |
|
1030 | - * @return array $object_fields |
|
1031 | - */ |
|
1025 | + * Get Salesforce object fields for fieldmapping |
|
1026 | + * |
|
1027 | + * @param array $data |
|
1028 | + * data must contain a salesforce_object |
|
1029 | + * can optionally contain a type for the field |
|
1030 | + * @return array $object_fields |
|
1031 | + */ |
|
1032 | 1032 | public function get_salesforce_object_fields( $data = array() ) { |
1033 | 1033 | |
1034 | 1034 | if ( ! empty( $data['salesforce_object'] ) ) { |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | /** |
1059 | - * Get WordPress object fields for fieldmapping |
|
1060 | - * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field |
|
1061 | - * |
|
1062 | - * @param string $wordpress_object |
|
1063 | - * @return array $object_fields |
|
1064 | - */ |
|
1059 | + * Get WordPress object fields for fieldmapping |
|
1060 | + * This takes either the $_POST array via ajax, or can be directly called with a $wordpress_object field |
|
1061 | + * |
|
1062 | + * @param string $wordpress_object |
|
1063 | + * @return array $object_fields |
|
1064 | + */ |
|
1065 | 1065 | public function get_wordpress_object_fields( $wordpress_object = '' ) { |
1066 | 1066 | $ajax = false; |
1067 | 1067 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1080,13 +1080,13 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /** |
1083 | - * Get WordPress and Salesforce object fields together for fieldmapping |
|
1084 | - * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields |
|
1085 | - * |
|
1086 | - * @param string $wordpress_object |
|
1087 | - * @param string $salesforce_object |
|
1088 | - * @return array $object_fields |
|
1089 | - */ |
|
1083 | + * Get WordPress and Salesforce object fields together for fieldmapping |
|
1084 | + * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $salesforce_object fields |
|
1085 | + * |
|
1086 | + * @param string $wordpress_object |
|
1087 | + * @param string $salesforce_object |
|
1088 | + * @return array $object_fields |
|
1089 | + */ |
|
1090 | 1090 | public function get_wp_sf_object_fields( $wordpress_object = '', $salesforce = '' ) { |
1091 | 1091 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1092 | 1092 | if ( empty( $wordpress_object ) ) { |
@@ -1111,12 +1111,12 @@ discard block |
||
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | /** |
1114 | - * Manually push the WordPress object to Salesforce |
|
1115 | - * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields |
|
1116 | - * |
|
1117 | - * @param string $wordpress_object |
|
1118 | - * @param int $wordpress_id |
|
1119 | - */ |
|
1114 | + * Manually push the WordPress object to Salesforce |
|
1115 | + * This takes either the $_POST array via ajax, or can be directly called with $wordpress_object and $wordpress_id fields |
|
1116 | + * |
|
1117 | + * @param string $wordpress_object |
|
1118 | + * @param int $wordpress_id |
|
1119 | + */ |
|
1120 | 1120 | public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '' ) { |
1121 | 1121 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1122 | 1122 | if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) { |
@@ -1135,12 +1135,12 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | /** |
1138 | - * Manually pull the Salesforce object into WordPress |
|
1139 | - * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields |
|
1140 | - * |
|
1141 | - * @param string $salesforce_id |
|
1142 | - * @param string $wordpress_object |
|
1143 | - */ |
|
1138 | + * Manually pull the Salesforce object into WordPress |
|
1139 | + * This takes either the $_POST array via ajax, or can be directly called with $salesforce_id fields |
|
1140 | + * |
|
1141 | + * @param string $salesforce_id |
|
1142 | + * @param string $wordpress_object |
|
1143 | + */ |
|
1144 | 1144 | public function pull_from_salesforce( $salesforce_id = '', $wordpress_object = '' ) { |
1145 | 1145 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1146 | 1146 | if ( empty( $wordpress_object ) && empty( $salesforce_id ) ) { |
@@ -1157,11 +1157,11 @@ discard block |
||
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | /** |
1160 | - * Manually pull the Salesforce object into WordPress |
|
1161 | - * This takes an id for a mapping object row |
|
1162 | - * |
|
1163 | - * @param int $mapping_id |
|
1164 | - */ |
|
1160 | + * Manually pull the Salesforce object into WordPress |
|
1161 | + * This takes an id for a mapping object row |
|
1162 | + * |
|
1163 | + * @param int $mapping_id |
|
1164 | + */ |
|
1165 | 1165 | public function refresh_mapped_data( $mapping_id = '' ) { |
1166 | 1166 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1167 | 1167 | if ( empty( $mapping_id ) ) { |
@@ -1180,13 +1180,13 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | /** |
1183 | - * Prepare fieldmap data and redirect after processing |
|
1184 | - * This runs when the create or update forms are submitted |
|
1185 | - * It is public because it depends on an admin hook |
|
1186 | - * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1187 | - * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1188 | - * |
|
1189 | - */ |
|
1183 | + * Prepare fieldmap data and redirect after processing |
|
1184 | + * This runs when the create or update forms are submitted |
|
1185 | + * It is public because it depends on an admin hook |
|
1186 | + * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1187 | + * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1188 | + * |
|
1189 | + */ |
|
1190 | 1190 | public function prepare_fieldmap_data() { |
1191 | 1191 | $error = false; |
1192 | 1192 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1234,12 +1234,12 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | /** |
1237 | - * Delete fieldmap data and redirect after processing |
|
1238 | - * This runs when the delete link is clicked, after the user confirms |
|
1239 | - * It is public because it depends on an admin hook |
|
1240 | - * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1241 | - * |
|
1242 | - */ |
|
1237 | + * Delete fieldmap data and redirect after processing |
|
1238 | + * This runs when the delete link is clicked, after the user confirms |
|
1239 | + * It is public because it depends on an admin hook |
|
1240 | + * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1241 | + * |
|
1242 | + */ |
|
1243 | 1243 | public function delete_fieldmap() { |
1244 | 1244 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1245 | 1245 | if ( $post_data['id'] ) { |
@@ -1255,13 +1255,13 @@ discard block |
||
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
1258 | - * Prepare object data and redirect after processing |
|
1259 | - * This runs when the update form is submitted |
|
1260 | - * It is public because it depends on an admin hook |
|
1261 | - * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1262 | - * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1263 | - * |
|
1264 | - */ |
|
1258 | + * Prepare object data and redirect after processing |
|
1259 | + * This runs when the update form is submitted |
|
1260 | + * It is public because it depends on an admin hook |
|
1261 | + * It then calls the Object_Sync_Sf_Mapping class and sends prepared data over to it, then redirects to the correct page |
|
1262 | + * This method does include error handling, by loading the submission in a transient if there is an error, and then deleting it upon success |
|
1263 | + * |
|
1264 | + */ |
|
1265 | 1265 | public function prepare_object_map_data() { |
1266 | 1266 | $error = false; |
1267 | 1267 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
@@ -1300,12 +1300,12 @@ discard block |
||
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | /** |
1303 | - * Delete object map data and redirect after processing |
|
1304 | - * This runs when the delete link is clicked on an error row, after the user confirms |
|
1305 | - * It is public because it depends on an admin hook |
|
1306 | - * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1307 | - * |
|
1308 | - */ |
|
1303 | + * Delete object map data and redirect after processing |
|
1304 | + * This runs when the delete link is clicked on an error row, after the user confirms |
|
1305 | + * It is public because it depends on an admin hook |
|
1306 | + * It then calls the Object_Sync_Sf_Mapping class and the delete method |
|
1307 | + * |
|
1308 | + */ |
|
1309 | 1309 | public function delete_object_map() { |
1310 | 1310 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1311 | 1311 | if ( $post_data['id'] ) { |
@@ -1321,9 +1321,9 @@ discard block |
||
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | /** |
1324 | - * Import a json file and use it for plugin data |
|
1325 | - * |
|
1326 | - */ |
|
1324 | + * Import a json file and use it for plugin data |
|
1325 | + * |
|
1326 | + */ |
|
1327 | 1327 | public function import_json_file() { |
1328 | 1328 | |
1329 | 1329 | if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) { |
@@ -1421,9 +1421,9 @@ discard block |
||
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | /** |
1424 | - * Create a json file for exporting |
|
1425 | - * |
|
1426 | - */ |
|
1424 | + * Create a json file for exporting |
|
1425 | + * |
|
1426 | + */ |
|
1427 | 1427 | public function export_json_file() { |
1428 | 1428 | |
1429 | 1429 | if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_export'], 'object_sync_for_salesforce_nonce_export' ) ) { |
@@ -1452,10 +1452,10 @@ discard block |
||
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | /** |
1455 | - * Default display for <input> fields |
|
1456 | - * |
|
1457 | - * @param array $args |
|
1458 | - */ |
|
1455 | + * Default display for <input> fields |
|
1456 | + * |
|
1457 | + * @param array $args |
|
1458 | + */ |
|
1459 | 1459 | public function display_input_field( $args ) { |
1460 | 1460 | $type = $args['type']; |
1461 | 1461 | $id = $args['label_for']; |
@@ -1502,11 +1502,11 @@ discard block |
||
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | /** |
1505 | - * Display for multiple checkboxes |
|
1506 | - * Above method can handle a single checkbox as it is |
|
1507 | - * |
|
1508 | - * @param array $args |
|
1509 | - */ |
|
1505 | + * Display for multiple checkboxes |
|
1506 | + * Above method can handle a single checkbox as it is |
|
1507 | + * |
|
1508 | + * @param array $args |
|
1509 | + */ |
|
1510 | 1510 | public function display_checkboxes( $args ) { |
1511 | 1511 | $type = 'checkbox'; |
1512 | 1512 | $name = $args['name']; |
@@ -1540,10 +1540,10 @@ discard block |
||
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | /** |
1543 | - * Display for a dropdown |
|
1544 | - * |
|
1545 | - * @param array $args |
|
1546 | - */ |
|
1543 | + * Display for a dropdown |
|
1544 | + * |
|
1545 | + * @param array $args |
|
1546 | + */ |
|
1547 | 1547 | public function display_select( $args ) { |
1548 | 1548 | $type = $args['type']; |
1549 | 1549 | $id = $args['label_for']; |
@@ -1587,10 +1587,10 @@ discard block |
||
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | /** |
1590 | - * Dropdown formatted list of Salesforce API versions |
|
1591 | - * |
|
1592 | - * @return array $args |
|
1593 | - */ |
|
1590 | + * Dropdown formatted list of Salesforce API versions |
|
1591 | + * |
|
1592 | + * @return array $args |
|
1593 | + */ |
|
1594 | 1594 | private function version_options() { |
1595 | 1595 | $versions = $this->salesforce['sfapi']->get_api_versions(); |
1596 | 1596 | $args = array(); |
@@ -1604,10 +1604,10 @@ discard block |
||
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | /** |
1607 | - * Default display for <a href> links |
|
1608 | - * |
|
1609 | - * @param array $args |
|
1610 | - */ |
|
1607 | + * Default display for <a href> links |
|
1608 | + * |
|
1609 | + * @param array $args |
|
1610 | + */ |
|
1611 | 1611 | public function display_link( $args ) { |
1612 | 1612 | $label = $args['label']; |
1613 | 1613 | $desc = $args['desc']; |
@@ -1634,11 +1634,11 @@ discard block |
||
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | /** |
1637 | - * Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline. |
|
1638 | - * |
|
1639 | - * @param string $option |
|
1640 | - * @return string $option |
|
1641 | - */ |
|
1637 | + * Allow for a standard sanitize/validate method. We could use more specific ones if need be, but this one provides a baseline. |
|
1638 | + * |
|
1639 | + * @param string $option |
|
1640 | + * @return string $option |
|
1641 | + */ |
|
1642 | 1642 | public function sanitize_validate_text( $option ) { |
1643 | 1643 | if ( is_array( $option ) ) { |
1644 | 1644 | $options = array(); |
@@ -1652,10 +1652,10 @@ discard block |
||
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | /** |
1655 | - * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it |
|
1656 | - * |
|
1657 | - * @param object $sfapi |
|
1658 | - */ |
|
1655 | + * Run a demo of Salesforce API call on the authenticate tab after WordPress has authenticated with it |
|
1656 | + * |
|
1657 | + * @param object $sfapi |
|
1658 | + */ |
|
1659 | 1659 | private function status( $sfapi ) { |
1660 | 1660 | |
1661 | 1661 | $versions = $sfapi->get_api_versions(); |
@@ -1714,10 +1714,10 @@ discard block |
||
1714 | 1714 | } |
1715 | 1715 | |
1716 | 1716 | /** |
1717 | - * Deauthorize WordPress from Salesforce. |
|
1718 | - * This deletes the tokens from the database; it does not currently do anything in Salesforce |
|
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 | - */ |
|
1717 | + * Deauthorize WordPress from Salesforce. |
|
1718 | + * This deletes the tokens from the database; it does not currently do anything in Salesforce |
|
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 | + */ |
|
1721 | 1721 | private function logout() { |
1722 | 1722 | $this->access_token = delete_option( $this->option_prefix . 'access_token' ); |
1723 | 1723 | $this->instance_url = delete_option( $this->option_prefix . 'instance_url' ); |
@@ -1729,8 +1729,8 @@ discard block |
||
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | /** |
1732 | - * Ajax call to clear the plugin cache. |
|
1733 | - */ |
|
1732 | + * Ajax call to clear the plugin cache. |
|
1733 | + */ |
|
1734 | 1734 | public function clear_sfwp_cache() { |
1735 | 1735 | $result = $this->clear_cache( true ); |
1736 | 1736 | $response = array( |
@@ -1741,9 +1741,9 @@ discard block |
||
1741 | 1741 | } |
1742 | 1742 | |
1743 | 1743 | /** |
1744 | - * Clear the plugin's cache. |
|
1745 | - * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data. |
|
1746 | - */ |
|
1744 | + * Clear the plugin's cache. |
|
1745 | + * This uses the flush method contained in the WordPress cache to clear all of this plugin's cached data. |
|
1746 | + */ |
|
1747 | 1747 | private function clear_cache( $ajax = false ) { |
1748 | 1748 | $result = (bool) $this->wordpress->sfwp_transients->flush(); |
1749 | 1749 | if ( true === $result ) { |
@@ -1763,9 +1763,9 @@ discard block |
||
1763 | 1763 | } |
1764 | 1764 | |
1765 | 1765 | /** |
1766 | - * Check WordPress Admin permissions |
|
1767 | - * Check if the current user is allowed to access the Salesforce plugin options |
|
1768 | - */ |
|
1766 | + * Check WordPress Admin permissions |
|
1767 | + * Check if the current user is allowed to access the Salesforce plugin options |
|
1768 | + */ |
|
1769 | 1769 | private function check_wordpress_admin_permissions() { |
1770 | 1770 | |
1771 | 1771 | // one programmatic way to give this capability to additional user roles is the |
@@ -1785,10 +1785,10 @@ discard block |
||
1785 | 1785 | } |
1786 | 1786 | |
1787 | 1787 | /** |
1788 | - * Show what we know about this user's relationship to a Salesforce object, if any |
|
1789 | - * @param object $user |
|
1790 | - * |
|
1791 | - */ |
|
1788 | + * Show what we know about this user's relationship to a Salesforce object, if any |
|
1789 | + * @param object $user |
|
1790 | + * |
|
1791 | + */ |
|
1792 | 1792 | public function show_salesforce_user_fields( $user ) { |
1793 | 1793 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
1794 | 1794 | if ( true === $this->check_wordpress_admin_permissions() ) { |
@@ -1812,10 +1812,10 @@ discard block |
||
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | /** |
1815 | - * If the user profile has been mapped to Salesforce, do it |
|
1816 | - * @param int $user_id |
|
1817 | - * |
|
1818 | - */ |
|
1815 | + * If the user profile has been mapped to Salesforce, do it |
|
1816 | + * @param int $user_id |
|
1817 | + * |
|
1818 | + */ |
|
1819 | 1819 | public function save_salesforce_user_fields( $user_id ) { |
1820 | 1820 | $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING ); |
1821 | 1821 | if ( isset( $post_data['salesforce_update_mapped_user'] ) && '1' === rawurlencode( $post_data['salesforce_update_mapped_user'] ) ) { |
@@ -1840,10 +1840,10 @@ discard block |
||
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | /** |
1843 | - * Render tabs for settings pages in admin |
|
1844 | - * @param array $tabs |
|
1845 | - * @param string $tab |
|
1846 | - */ |
|
1843 | + * Render tabs for settings pages in admin |
|
1844 | + * @param array $tabs |
|
1845 | + * @param string $tab |
|
1846 | + */ |
|
1847 | 1847 | private function tabs( $tabs, $tab = '' ) { |
1848 | 1848 | |
1849 | 1849 | $get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING ); |
@@ -1873,9 +1873,9 @@ discard block |
||
1873 | 1873 | } |
1874 | 1874 | |
1875 | 1875 | /** |
1876 | - * Clear schedule |
|
1877 | - * This clears the schedule if the user clicks the button |
|
1878 | - */ |
|
1876 | + * Clear schedule |
|
1877 | + * This clears the schedule if the user clicks the button |
|
1878 | + */ |
|
1879 | 1879 | private function clear_schedule( $schedule_name = '' ) { |
1880 | 1880 | if ( '' !== $schedule_name ) { |
1881 | 1881 | $schedule = $this->schedule( $schedule_name ); |
@@ -1897,8 +1897,8 @@ discard block |
||
1897 | 1897 | } |
1898 | 1898 | |
1899 | 1899 | /** |
1900 | - * Load the schedule class |
|
1901 | - */ |
|
1900 | + * Load the schedule class |
|
1901 | + */ |
|
1902 | 1902 | private function schedule( $schedule_name ) { |
1903 | 1903 | if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) { |
1904 | 1904 | require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php'; |
@@ -1910,21 +1910,21 @@ discard block |
||
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | /** |
1913 | - * Create an object map between a WordPress object and a Salesforce object |
|
1914 | - * |
|
1915 | - * @param int $wordpress_id |
|
1916 | - * Unique identifier for the WordPress object |
|
1917 | - * @param string $wordpress_object |
|
1918 | - * What kind of object is it? |
|
1919 | - * @param string $salesforce_id |
|
1920 | - * Unique identifier for the Salesforce object |
|
1921 | - * @param string $action |
|
1922 | - * Did we push or pull? |
|
1923 | - * |
|
1924 | - * @return int $wpdb->insert_id |
|
1925 | - * This is the database row for the map object |
|
1926 | - * |
|
1927 | - */ |
|
1913 | + * Create an object map between a WordPress object and a Salesforce object |
|
1914 | + * |
|
1915 | + * @param int $wordpress_id |
|
1916 | + * Unique identifier for the WordPress object |
|
1917 | + * @param string $wordpress_object |
|
1918 | + * What kind of object is it? |
|
1919 | + * @param string $salesforce_id |
|
1920 | + * Unique identifier for the Salesforce object |
|
1921 | + * @param string $action |
|
1922 | + * Did we push or pull? |
|
1923 | + * |
|
1924 | + * @return int $wpdb->insert_id |
|
1925 | + * This is the database row for the map object |
|
1926 | + * |
|
1927 | + */ |
|
1928 | 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( |