| 1 |
<?php |
| 2 |
|
| 3 |
namespace Pinova\Gateways; |
| 4 |
|
| 5 |
use Exception; |
| 6 |
|
| 7 |
class PWSMS extends BaseGateway { |
| 8 |
|
| 9 |
protected string $name = 'پیا� |
| 10 |
ک ووکا� |
| 11 |
رس'; |
| 12 |
|
| 13 |
protected string $url = 'persian woocommerce sms'; |
| 14 |
|
| 15 |
public string $video_url = 'https://www.aparat.com/v/azj395y'; |
| 16 |
|
| 17 |
public function send( string $mobile, string $message ): bool { |
| 18 |
|
| 19 |
$message = str_replace( 'pattern:', 'patterncode:', $message ); |
| 20 |
|
| 21 |
$data = [ |
| 22 |
'mobile' => $mobile, |
| 23 |
'message' => $message, |
| 24 |
]; |
| 25 |
|
| 26 |
$response = PWSMS()->send_sms( $data ); |
| 27 |
|
| 28 |
if ( $response === true ) { |
| 29 |
return true; |
| 30 |
} |
| 31 |
|
| 32 |
throw new Exception( $response ); |
| 33 |
} |
| 34 |
|
| 35 |
public function is_enable(): bool { |
| 36 |
return function_exists( 'PWSMS' ); |
| 37 |
} |
| 38 |
|
| 39 |
public function options(): array { |
| 40 |
|
| 41 |
if ( function_exists( 'PWSMS' ) ) { |
| 42 |
$description = sprintf( 'تنظی� |
| 43 |
ات سا� |
| 44 |
انه پیا� |
| 45 |
ک از � |
| 46 |
نو <a href="%s" target="_blank">ووکا� |
| 47 |
رس فارسی » پیا� |
| 48 |
ک ووکا� |
| 49 |
رس » وب سرویس</a> اع� |
| 50 |
ال � |
| 51 |
یشود.', admin_url( 'admin.php?page=persian-woocommerce-sms-pro&tab=main' ) ); |
| 52 |
} else { |
| 53 |
$description = sprintf( 'برای نصب و فعالسازی افزونه پیا� |
| 54 |
ک ووکا� |
| 55 |
رس از � |
| 56 |
خزن وردپرس، <a href="%s" target="_blank">اینجا</a> کلیک کنید.', admin_url( 'plugin-install.php?tab=plugin-information&plugin=persian-woocommerce-sms' ) ); |
| 57 |
} |
| 58 |
|
| 59 |
return [ |
| 60 |
[ |
| 61 |
'label' => 'راهن� |
| 62 |
ا', |
| 63 |
'key' => 'pwsms_help', |
| 64 |
'type' => 'html', |
| 65 |
'description' => $description, |
| 66 |
], |
| 67 |
]; |
| 68 |
} |
| 69 |
} |