templates
1 year ago
SendinblueAccount.php
1 year ago
SendinblueApiClient.php
1 year ago
function.wp_mail.php
8 years ago
http-build-url.php
1 year ago
index.php
8 years ago
mailin.php
3 years ago
push-admin.php
1 year ago
push-amp.php
1 year ago
push-api.php
1 year ago
push-httpclient.php
1 year ago
push-public.php
1 year ago
push-settings.php
1 year ago
push-utils.php
1 year ago
push-woocommerce.php
1 year ago
sendinblue.php
3 years ago
sib-api-manager.php
1 year ago
sib-form-preview.php
2 years ago
sib-sms-code.php
3 years ago
table-forms.php
1 year ago
SendinblueAccount.php
72 lines
| 1 | <?php |
| 2 | |
| 3 | class SendinblueAccount |
| 4 | { |
| 5 | private static $sendinblueAccountObj = null; |
| 6 | private $sendinblueAccountData; |
| 7 | private $lastResponseCode; |
| 8 | |
| 9 | /** |
| 10 | * SendinblueAccount private constructor. |
| 11 | */ |
| 12 | private function __construct() |
| 13 | { |
| 14 | |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Getter function for account data |
| 19 | */ |
| 20 | public function getSendinblueAccountData() |
| 21 | { |
| 22 | return $this->sendinblueAccountData; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Setter function for account data |
| 27 | */ |
| 28 | public function setSendinblueAccountData($sendinblueAccountData) |
| 29 | { |
| 30 | $this->sendinblueAccountData = $sendinblueAccountData; |
| 31 | |
| 32 | // update Marketing Automation API key. |
| 33 | if ( isset( $sendinblueAccountData['marketingAutomation']['enabled'] ) && true == $sendinblueAccountData['marketingAutomation']['enabled'] ) { |
| 34 | $ma_key = $sendinblueAccountData['marketingAutomation']['key']; |
| 35 | } else { |
| 36 | $ma_key = ''; |
| 37 | } |
| 38 | $general_settings = get_option( SIB_Manager::MAIN_OPTION_NAME, array() ); |
| 39 | $general_settings['ma_key'] = $ma_key; |
| 40 | update_option( SIB_Manager::MAIN_OPTION_NAME, $general_settings ); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Getter function for last response code |
| 45 | */ |
| 46 | public function getLastResponseCode() |
| 47 | { |
| 48 | return $this->lastResponseCode; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Setter function for last response code |
| 53 | */ |
| 54 | public function setLastResponseCode($lastResponseCode) |
| 55 | { |
| 56 | $this->lastResponseCode = $lastResponseCode; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Static function to create a new instance or return an existing instance. |
| 61 | */ |
| 62 | public static function getInstance() |
| 63 | { |
| 64 | if( null == self::$sendinblueAccountObj ) |
| 65 | { |
| 66 | self::$sendinblueAccountObj = new SendinblueAccount(); |
| 67 | } |
| 68 | |
| 69 | return self::$sendinblueAccountObj; |
| 70 | } |
| 71 | } |
| 72 |