|
- <?php
-
-
-
- namespace common\helpers;
-
- class Mailjet
- {
- public static function getApiKey($type = 'private')
- {
- $filename = '../../common/config/mailjet/api.key' ;
- if(file_exists($filename)) {
- $handle = fopen($filename, "r") ;
- $filesize = filesize($filename) ;
- if($handle && $filesize) {
- $apiKeys = fread($handle, $filesize);
- fclose($handle);
- $apiKeysArray = explode(':', $apiKeys) ;
- if(count($apiKeysArray) == 2) {
- if($type == 'private') {
- $key = $apiKeysArray[1] ;
- }
- else {
- $key = $apiKeysArray[0] ;
- }
- return trim($key) ;
- }
- }
- }
-
- return '' ;
- }
- }
|