| Server IP : 47.82.179.145 / Your IP : 216.73.217.129 Web Server : nginx/1.26.3 System : Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64 User : www ( 1001) PHP Version : 8.3.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/latepoint/lib/helpers/ |
Upload File : |
<?php
class OsSmsHelper {
/**
* @param $to
* @param $content
*
* @return array [
* 'status' => string,
* 'message' => string,
* 'to' => string,
* 'content' => string,
* 'processor_code' => string,
* 'processor_name' => string,
* 'processed_datetime' => string,
* 'extra_data' => array
* ]
*/
public static function send_sms($to, $content, $activity_data = []): array {
$result = [
'status' => LATEPOINT_STATUS_ERROR,
'message' => __('No SMS processor is selected.', 'latepoint'),
'to' => $to,
'content' => $content,
'processor_code' => '',
'processor_name' => '',
'processed_datetime' => '',
'extra_data' => [
'activity_data' => $activity_data
],
'errors' => []
];
if(OsSettingsHelper::is_sms_allowed() && OsNotificationsHelper::is_notification_type_enabled('sms')) {
/**
* Result of sending an SMS message to a recipient's phone number
*
* @param {array} $result The array of data describing the send operation
* @param {string} $to The recipient's phone number
* @param {string} $content The message to send to the recipient
*
* @since 4.7.0
* @hook latepoint_notifications_send_sms
* @returns {array} The array of descriptive data, possibly transformed by hooked SMS processor(s)
*/
$result = apply_filters( 'latepoint_notifications_send_sms', $result, $to, $content );
}else{
$result['message'] = __('SMS notifications are disabled', 'latepoint');
$result['errors'][] = __('SMS notifications are disabled', 'latepoint');
}
self::log_sms($result);
return $result;
}
/**
* @param $enabled_only
*
* @return array [
* 'code' => [
* 'code' => string,
* 'label' => string,
* 'image_url' => string
* ]
* ]
*/
public static function get_sms_processors( $enabled_only = false ) {
$sms_processors = [];
/**
* Get the list of SMS processors registered in the LatePoint ecosystem
*
* @since 1.2.3
* @hook latepoint_sms_processors
*
* @param {array} $sms_processors The list of SMS processors being filtered
* @param {bool} $enabled_only True when filtering only enabled SMS processors, false otherwise
* @returns {array} The filtered list of SMS processors
*/
return apply_filters('latepoint_sms_processors', $sms_processors, $enabled_only);
}
public static function is_sms_processor_enabled( string $sms_processor_code ): bool {
return (OsNotificationsHelper::get_selected_processor_code_by_type('sms') == $sms_processor_code);
}
/**
* @param array $result
*
* @return OsActivityModel
*/
public static function log_sms( array $result ) {
if ( empty( $result['processed_datetime'] ) ) {
$result['processed_datetime'] = OsTimeHelper::now_datetime_in_db_format();
}
$data = [
'code' => 'sms_sent',
'description' => wp_json_encode($result)
];
if(!empty($result['extra_data']['activity_data'])) $data = array_merge($data, $result['extra_data']['activity_data']);
$activity = OsActivitiesHelper::create_activity( $data );
return $activity;
}
}