fluentcrm.php
85 lines
| 1 | <?php |
| 2 | /** |
| 3 | * FluentCRM core integrations file |
| 4 | * |
| 5 | * @since 1.0.0 |
| 6 | * @package SureTrigger |
| 7 | */ |
| 8 | |
| 9 | namespace SureTriggers\Integrations\FluentCRM; |
| 10 | |
| 11 | use FluentCrm\App\Models\Lists; |
| 12 | use FluentCrm\App\Models\Tag; |
| 13 | use SureTriggers\Controllers\IntegrationsController; |
| 14 | use SureTriggers\Integrations\Integrations; |
| 15 | use SureTriggers\Traits\SingletonLoader; |
| 16 | |
| 17 | /** |
| 18 | * Class SureTrigger |
| 19 | * |
| 20 | * @package SureTriggers\Integrations\FluentCRM |
| 21 | */ |
| 22 | class FluentCRM extends Integrations { |
| 23 | |
| 24 | |
| 25 | use SingletonLoader; |
| 26 | |
| 27 | /** |
| 28 | * ID |
| 29 | * |
| 30 | * @var string |
| 31 | */ |
| 32 | protected $id = 'FluentCRM'; |
| 33 | |
| 34 | /** |
| 35 | * SureTrigger constructor. |
| 36 | */ |
| 37 | public function __construct() { |
| 38 | $this->name = __( 'FluentCRM', 'suretriggers' ); |
| 39 | $this->description = __( 'FluentCRM is a Self Hosted Email Marketing Automation Plugin for WordPress.', 'suretriggers' ); |
| 40 | $this->icon_url = SURE_TRIGGERS_URL . 'assets/icons/fluentCRM.svg'; |
| 41 | |
| 42 | parent::__construct(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Fetch tag data. |
| 47 | * |
| 48 | * @param int $tag_id tag id. |
| 49 | * @return mixed|array |
| 50 | */ |
| 51 | public function get_tag_data( $tag_id ) { |
| 52 | if ( ! class_exists( 'FluentCrm\App\Models\Tag' ) ) { |
| 53 | return []; |
| 54 | } |
| 55 | $tag = Tag::where( 'id', $tag_id )->get(); |
| 56 | return $tag; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Fetch list data. |
| 61 | * |
| 62 | * @param int $list_id list data. |
| 63 | * @return mixed |
| 64 | */ |
| 65 | public function get_list_data( $list_id ) { |
| 66 | if ( ! class_exists( 'FluentCrm\App\Models\Lists' ) ) { |
| 67 | return []; |
| 68 | } |
| 69 | $list = Lists::find( $list_id ); |
| 70 | return $list; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Is Plugin depended plugin is installed or not. |
| 75 | * |
| 76 | * @return bool |
| 77 | */ |
| 78 | public function is_plugin_installed() { |
| 79 | return defined( 'FLUENTCRM' ); |
| 80 | } |
| 81 | |
| 82 | } |
| 83 | |
| 84 | IntegrationsController::register( FluentCRM::class ); |
| 85 |