| 1 |
<?php |
| 2 |
if ( !defined( 'ABSPATH' ) ) exit; |
| 3 |
|
| 4 |
if ( !class_exists( 'ewduwpmSMSQueue' ) ) { |
| 5 |
/** |
| 6 |
* Class to queue/process emails that are sent using the wp_mail function |
| 7 |
* |
| 8 |
* @since 1.1.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
require_once( EWD_UWPM_PLUGIN_DIR . '/lib/wp-background-processing/wp-async-request.php' ); |
| 12 |
require_once( EWD_UWPM_PLUGIN_DIR . '/lib/wp-background-processing/wp-background-process.php' ); |
| 13 |
|
| 14 |
class ewduwpmSMSQueue extends EWD_WP_Background_Process { |
| 15 |
|
| 16 |
/** |
| 17 |
* @var string |
| 18 |
*/ |
| 19 |
protected $action = 'sms_queue_process'; |
| 20 |
|
| 21 |
/** |
| 22 |
* Task |
| 23 |
* |
| 24 |
* Perform any actions required on each queue item. Return the modified |
| 25 |
* item for further processing in the next pass through. Or, return false |
| 26 |
* to remove the item from the queue. |
| 27 |
* |
| 28 |
* @param mixed $item Queue item to iterate over |
| 29 |
* |
| 30 |
* @return mixed |
| 31 |
*/ |
| 32 |
protected function task( $item ) { |
| 33 |
global $ewd_uwpm_controller; |
| 34 |
|
| 35 |
$url = add_query_arg( |
| 36 |
array( |
| 37 |
'plugin' => 'uwpm', |
| 38 |
'license_key' => urlencode( get_option( 'uwpm-ultimate-license-key', 'no license key entered' ) ), |
| 39 |
'admin_email' => urlencode( $ewd_uwpm_controller->settings->get_setting( 'ultimate-purchase-email' ) ), |
| 40 |
'phone_number' => urlencode( $item['to'] ), |
| 41 |
'message' => urlencode( $item['message'] ), |
| 42 |
'country_code' => urlencode( $ewd_uwpm_controller->settings->get_setting( 'sms-country-code' ) ) |
| 43 |
), |
| 44 |
'http://www.etoilewebdesign.com/sms-handling/sms-client.php' |
| 45 |
); |
| 46 |
|
| 47 |
$opts = array( 'http' =>array( 'method' => "GET" ) ); |
| 48 |
$context = stream_context_create( $opts ); |
| 49 |
$return = json_decode( file_get_contents( $url, false, $context ) ); |
| 50 |
|
| 51 |
return false; |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
} |