Skip to content

Commit 8f41c04

Browse files
Fix possible error, when function mg_api_get_region does not exist (#200)
1 parent 1a9349d commit 8f41c04

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

mailgun.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class Mailgun
6666
*/
6767
protected $assetsDir;
6868

69+
/**
70+
* @var string
71+
*/
72+
private $api_endpoint;
73+
6974
/**
7075
* Setup shared functionality for Admin and Front End.
7176
*
@@ -186,7 +191,7 @@ public function phpmailer_init(&$phpmailer)
186191
* Deactivate this plugin and die.
187192
* Deactivate the plugin when files critical to it's operation cannot be loaded
188193
*
189-
* @param $file Files critical to plugin functionality
194+
* @param string $file files critical to plugin functionality
190195
*
191196
* @return void
192197
*/
@@ -219,6 +224,9 @@ public function api_call($uri, $params = [], $method = 'POST'): string
219224
$apiKey = (defined('MAILGUN_APIKEY') && MAILGUN_APIKEY) ? MAILGUN_APIKEY : $options[ 'apiKey' ];
220225
$domain = (defined('MAILGUN_DOMAIN') && MAILGUN_DOMAIN) ? MAILGUN_DOMAIN : $options[ 'domain' ];
221226

227+
if (!function_exists('mg_api_get_region')) {
228+
include __DIR__ . '/includes/mg-filter.php';
229+
}
222230
$region = mg_api_get_region($getRegion);
223231
$this->api_endpoint = ($region) ?: 'https://api.mailgun.net/v3/';
224232

0 commit comments

Comments
 (0)