| @@ -6,9 +6,10 @@ | ||
| 6 | 6 | |
| 7 | 7 | class FluentCRMServices |
| 8 | 8 | { |
| 9 | 9 | /** |
| 10 | - * This `syncCrmTags` method is used to sync tags from FluentCRM to Fluent Support. | |
| 10 | + * Set the FluentCRM contact's tags to exactly $data['tags']. | |
| 11 | + * | |
| 11 | 12 | * @param array $data |
| 12 | 13 | * @return array |
| 13 | 14 | * @throws Exception |
| 14 | 15 | */ |
| @@ -33,9 +34,10 @@ | ||
| 33 | 34 | ]; |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | /** |
| 37 | - * This `syncCrmLists` method is used to sync lists from FluentCRM to Fluent Support. | |
| 38 | + * Set the FluentCRM contact's lists to exactly $data['lists']. | |
| 39 | + * | |
| 38 | 40 | * @param array $data |
| 39 | 41 | * @return array |
| 40 | 42 | * @throws Exception |
| 41 | 43 | */ |
| @@ -59,10 +61,9 @@ | ||
| 59 | 61 | ]; |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | 64 | /** |
| 63 | - * This `addOrRemoveTag` method will add or remove tags from FluentCRM contact from Fluent Support. | |
| 64 | - * @param array $contact | |
| 65 | + * @param \FluentCrm\App\Models\Subscriber $contact | |
| 65 | 66 | * @param array $tagIds |
| 66 | 67 | * @return mixed |
| 67 | 68 | */ |
| 68 | 69 | public function addOrRemoveTag ( $contact, $tagIds ) |
| @@ -86,10 +87,9 @@ | ||
| 86 | 87 | return $contact; |
| 87 | 88 | } |
| 88 | 89 | |
| 89 | 90 | /** |
| 90 | - * This `addOrRemoveList` method will add or remove lists from FluentCRM contact from Fluent Support. | |
| 91 | - * @param array $contact | |
| 91 | + * @param \FluentCrm\App\Models\Subscriber $contact | |
| 92 | 92 | * @param array $listIds |
| 93 | 93 | * @return mixed |
| 94 | 94 | */ |
| 95 | 95 | public function addOrRemoveList ( $contact, $listIds ) |
| @@ -113,9 +113,8 @@ | ||
| 113 | 113 | |
| 114 | 114 | return $contact; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - // This `checkCrmPermission` method will check current agent has permission to access to modify customer's FluentCRM data | |
| 118 | 117 | private function checkCrmPermission () |
| 119 | 118 | { |
| 120 | 119 | $canAddTags = \FluentCrm\App\Services\PermissionManager::currentUserCan('fcrm_manage_contacts'); |
| 121 | 120 | $canAddTags = apply_filters('fluent_support/can_user_add_tags_to_customer', $canAddTags); |
| @@ -120,29 +119,27 @@ | ||
| 120 | 119 | $canAddTags = \FluentCrm\App\Services\PermissionManager::currentUserCan('fcrm_manage_contacts'); |
| 121 | 120 | $canAddTags = apply_filters('fluent_support/can_user_add_tags_to_customer', $canAddTags); |
| 122 | 121 | |
| 123 | 122 | if (!$canAddTags) { |
| 124 | - throw new \Exception( 'Sorry you do not have permission to add contact tags' ); | |
| 123 | + throw new \Exception(esc_html__('Sorry you do not have permission to add contact tags', 'fluent-support')); | |
| 125 | 124 | } else { |
| 126 | 125 | return true; |
| 127 | 126 | } |
| 128 | 127 | } |
| 129 | 128 | |
| 130 | - // This `isCrmEnabled` method will check FluentCRM is enabled or not | |
| 131 | 129 | private function isCrmEnabled () |
| 132 | 130 | { |
| 133 | 131 | if ( !defined('FLUENTCRM') ) { |
| 134 | - throw new \Exception('FluentCRM is not installed or Enabled'); | |
| 132 | + throw new \Exception(esc_html__('FluentCRM is not installed or enabled', 'fluent-support')); | |
| 135 | 133 | } else { |
| 136 | 134 | return true; |
| 137 | 135 | } |
| 138 | 136 | } |
| 139 | 137 | |
| 140 | - // This `isContactAvailable` method will check if contact is valid or not | |
| 141 | 138 | private function isContactAvailable ( $contactId ) |
| 142 | 139 | { |
| 143 | 140 | if (!$contactId) { |
| 144 | - throw new \Exception('Contact could not be found'); | |
| 141 | + throw new \Exception(esc_html__('Contact could not be found', 'fluent-support')); | |
| 145 | 142 | } else { |
| 146 | 143 | return true; |
| 147 | 144 | } |
| 148 | 145 | } |