Website : phonehp.ir
backdoor
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Home
Console
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
nehpir
/
public_html
/
wp-content
/
plugins
/
woocommersa
/
includes
/
Services
/
Filename :
SMSService.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\Services; use WooCommersa\Core\Logger; if (!defined('ABSPATH')) exit; class SMSService { private $provider; private $settings; public function __construct($settings = null) { if ($settings === null) { $all_settings = get_option('woocommersa_settings', []); $this->settings = $all_settings['sms'] ?? []; } else { $this->settings = $settings; } $this->init_provider(); } private function init_provider() { $gateway = $this->settings['gateway'] ?? ''; switch ($gateway) { case 'ippanel': case 'farazsms': $this->provider = new SMS\Providers\IppanelProvider($this->settings); break; case 'kavehnegar': $this->provider = new SMS\Providers\KavehnegarProvider($this->settings); break; case 'smsir': $this->provider = new SMS\Providers\SmsirProvider($this->settings); break; case 'melipayamak': $this->provider = new SMS\Providers\MelipayamakProvider($this->settings); break; } } /** * Send order notification * * @param string $to Phone number * @param string $event order_placed, status_changed, tracking_added * @param array $params Variables for pattern * @return bool */ public function send_notification($to, $event, $params) { if (!$this->provider) return false; $pattern_id = $this->settings['patterns'][$event] ?? ''; if (!$pattern_id) return false; return $this->provider->send_pattern($to, $pattern_id, $params); } /** * Send custom pattern SMS */ public function send_custom_pattern($to, $pattern_id, $params) { if (!$this->provider) return false; return $this->provider->send_pattern($to, $pattern_id, $params); } /** * Send direct SMS message * * @param string $to Phone number * @param string $message Message content * @return bool */ public function send_direct($to, $message) { if (!$this->provider) return false; return $this->provider->send_message($to, $message); } /** * Test the current gateway connection * * @return array */ public function test_connection() { if (!$this->provider) { return [ 'success' => false, 'message' => 'هیچ درگاه پیامکی انتخاب نشده است.' ]; } $result = []; try { $balance = $this->provider->get_balance(); if ($balance !== false) { $result = [ 'success' => true, 'balance' => $balance, 'message' => 'اتصال با موفقیت برقرار شد. موجودی: ' . number_format($balance) . ' ریال' ]; } else { $result = [ 'success' => false, 'message' => 'خطا در برقراری ارتباط با درگاه. لطفاً تنظیمات، API Key و اتصال سرور خود را بررسی کنید. (لاگ سیستم را چک کنید)' ]; } } catch (\Exception $e) { $result = [ 'success' => false, 'message' => 'خطای استثنا: ' . $e->getMessage() ]; } Logger::log('نتیجه تست پیامک: ' . json_encode($result, JSON_UNESCAPED_UNICODE), $result['success'] ? 'info' : 'error', 'تست پیامک'); return $result; } /** * Test a specific pattern */ public function test_pattern($to, $pattern_id, $params) { if (!$this->provider) { return [ 'success' => false, 'message' => 'هیچ درگاه پیامکی انتخاب نشده است.' ]; } try { $success = $this->provider->send_pattern($to, $pattern_id, $params); if ($success) { return [ 'success' => true, 'message' => 'پیامک تست با موفقیت ارسال شد. لطفاً گوشی خود را بررسی کنید.' ]; } else { return [ 'success' => false, 'message' => 'ارسال پیامک تست با خطا مواجه شد. لطفاً تنظیمات و کد الگو را بررسی کنید.' ]; } } catch (\Exception $e) { return [ 'success' => false, 'message' => 'خطا: ' . $e->getMessage() ]; } } }