static function get_instance()
 {
     if (self::$instance == null) {
         self::$instance = new AE_Mailing();
     }
     return self::$instance;
 }
Exemple #2
0
 function __construct(AE_Users $user)
 {
     $this->user = $user;
     $this->mail = AE_Mailing::get_instance();
     // $this->add_action('init', 'confirm');
     $this->add_action('ae_insert_user', 'after_register');
     $this->add_action('ae_user_forgot', 'user_forgot', 10, 2);
     $this->add_action('ae_user_inbox', 'user_inbox', 10, 2);
     $this->add_action('ae_upload_image', 'change_avatar', 10, 2);
     $this->add_action('save_post', 'update_user_profile_id');
     //$this->add_ajax('ae_send_contact', 'ae_send_contact');
     $this->add_ajax('ae-send-invite', 'ae_send_invite');
 }
function ae_member_process_order($user_id, $order)
{
    $mail = AE_Mailing::get_instance();
    $mail->send_receipt($user_id, $order);
}
 function update_user_mobile()
 {
     $user_mobile = trim($_POST['mobile']);
     $user_id = get_current_user_id();
     update_user_meta($user_id, 'phone', $user_mobile);
     $mail = AE_Mailing::get_instance();
     $mail->confirmed_phone($user_id);
     echo "success";
 }
 /**
  * callback for ajax ae-sync-user action
  */
 function sync()
 {
     global $user_ID;
     $request = $_REQUEST;
     /**
      * sync user base on method and do param
      */
     $result = $this->user->sync($request);
     // check the result and send json to client
     if ($result && !is_wp_error($result)) {
         $response = array('success' => true, 'data' => $result, 'msg' => is_object($result) && isset($result->msg) ? $result->msg : $result['msg']);
         // user sync and try to request confirm email
         if (isset($request['do']) && $request['do'] == 'confirm_mail' && $user_ID == $request['ID']) {
             if (ae_is_send_activation_code()) {
                 $mailing = AE_Mailing::get_instance();
                 $send_mail = $mailing->request_confirm_mail($user_ID);
                 if ($send_mail) {
                     $response['msg'] = __('New confirm email already send to your email account.', ET_DOMAIN);
                     $secure = 'https' === parse_url(site_url(), PHP_URL_SCHEME) && 'https' === parse_url(home_url(), PHP_URL_SCHEME);
                     setcookie('ae_sent_activation_code', 1, time() + 300, COOKIEPATH, COOKIE_DOMAIN, $secure);
                     if (SITECOOKIEPATH != COOKIEPATH) {
                         setcookie('ae_sent_activation_code', 1, time() + 300, SITECOOKIEPATH, COOKIE_DOMAIN, $secure);
                     }
                 } else {
                     $response['msg'] = __('An unknown error has occurred. Please try again later.', ET_DOMAIN);
                     $response['success'] = false;
                 }
             } else {
                 $response = array('success' => false, 'msg' => __('Please wait 5 minutes to resend an activation code!', ET_DOMAIN));
             }
         }
     } else {
         $response = array('success' => false, 'msg' => $result->get_error_message());
     }
     wp_send_json($response);
 }
 /**
  * send notify to admin 
  * @param Object $post Post data 
  * @since 1.1
  * @author Dakachi
  */
 function notify_admin($payment_return, $data)
 {
     if (!isset($data['ad_id'])) {
         return false;
     }
     if (!$payment_return['ACK']) {
         return;
     }
     $this->mail = AE_Mailing::get_instance();
     $this->mail->new_post_alert($data['ad_id']);
 }