function awpcp_listing_updated_user_message($listing, $messages) { $admin_email = awpcp_admin_recipient_email_address(); $payments_api = awpcp_payments_api(); $show_total_amount = $payments_api->payments_enabled(); $show_total_credits = $payments_api->credit_system_enabled(); $currency_code = awpcp_get_currency_code(); $blog_name = awpcp_get_blog_name(); if (!is_null($transaction)) { $transaction_totals = $transaction->get_totals(); $total_amount = $transaction_totals['money']; $total_credits = $transaction_totals['credits']; } else { $total_amount = 0; $total_credits = 0; } if (get_awpcp_option('requireuserregistration')) { $include_listing_access_key = false; $include_edit_listing_url = true; } else { $include_listing_access_key = get_awpcp_option('include-ad-access-key'); $include_edit_listing_url = false; } $params = compact('ad', 'admin_email', 'transaction', 'currency_code', 'show_total_amount', 'show_total_credits', 'include_listing_access_key', 'include_edit_listing_url', 'total_amount', 'total_credits', 'message', 'blog_name'); $email = new AWPCP_Email(); $email->to[] = "{$ad->ad_contact_name} <{$ad->ad_contact_email}>"; $email->subject = get_awpcp_option('listingaddedsubject'); $email->prepare(AWPCP_DIR . '/frontend/templates/email-place-ad-success-user.tpl.php', $params); return $email; }
function doadexpirations() { global $wpdb, $nameofsite; $notify_admin = get_awpcp_option('notifyofadexpired'); $notify_expiring = get_awpcp_option('notifyofadexpiring'); // disable the ads or delete the ads? // 1 = disable, 0 = delete $disable_ads = get_awpcp_option('autoexpiredisabledelete'); // allow users to use %s placeholder for the website name in the subject line $subject = get_awpcp_option('adexpiredsubjectline'); $subject = sprintf($subject, $nameofsite); $bodybase = get_awpcp_option('adexpiredbodymessage'); $admin_sender_email = awpcp_admin_sender_email_address(); $admin_recipient_email = awpcp_admin_recipient_email_address(); $ads = AWPCP_Ad::find("ad_enddate <= NOW() AND disabled != 1 AND payment_status != 'Unpaid' AND verified = 1"); foreach ($ads as $ad) { $ad->disable(); if ($notify_expiring == false && $notify_admin == false) { continue; } $adtitle = get_adtitle($ad->ad_id); $adstartdate = date("D M j Y G:i:s", strtotime(get_adstartdate($ad->ad_id))); $body = $bodybase; $body .= "\n\n"; $body .= __("Listing Details", "AWPCP"); $body .= "\n\n"; $body .= __("Ad Title:", "AWPCP"); $body .= " {$adtitle}"; $body .= "\n\n"; $body .= __("Posted:", "AWPCP"); $body .= " {$adstartdate}"; $body .= "\n\n"; $body .= __("Renew your ad by visiting:", "AWPCP"); $body .= " " . urldecode(awpcp_get_renew_ad_url($ad->ad_id)); $body .= "\n\n"; if ($notify_expiring) { $user_email = get_adposteremail($ad->ad_id); if (!empty($user_email)) { awpcp_process_mail($admin_sender_email, $user_email, $subject, $body, $nameofsite, $admin_recipient_email); } } if ($notify_admin) { awpcp_process_mail($admin_sender_email, $admin_recipient_email, $subject, $body, $nameofsite, $admin_recipient_email); } } }
protected function process_contact_form() { global $nameofsite; $ad = $this->get_ad(); $form = array_merge($this->get_posted_data(), array('ad_id' => $ad->ad_id)); $errors = array(); if (!$this->validate_posted_data($form, $errors)) { return $this->contact_form($form, $errors); } $ad_title = $ad->get_title(); $ad_url = url_showad($ad->ad_id); $sender_name = stripslashes($form['awpcp_sender_name']); $sender_email = stripslashes($form['awpcp_sender_email']); $message = awpcp_strip_html_tags(stripslashes($form['awpcp_contact_message'])); if (get_awpcp_option('usesenderemailinsteadofadmin')) { $sender = awpcp_strip_html_tags($sender_name); $from = $sender_email; } else { $sender = $nameofsite; $from = awpcp_admin_sender_email_address(); } /* send email to admin */ if (get_awpcp_option('notify-admin-about-contact-message')) { $subject = __('Notification about a response regarding Ad: %s', 'AWPCP'); $subject = sprintf($subject, $ad_title); ob_start(); include AWPCP_DIR . '/frontend/templates/email-reply-to-ad-admin.tpl.php'; $admin_body = ob_get_contents(); ob_end_clean(); $admin_email = awpcp_admin_recipient_email_address(); $result = awpcp_process_mail($from, $admin_email, $subject, $admin_body, $sender, $sender_email); } $subject = sprintf("%s %s: %s", get_awpcp_option('contactformsubjectline'), _x('regarding', 'reply email', 'AWPCP'), $ad_title); ob_start(); include AWPCP_DIR . '/frontend/templates/email-reply-to-ad-user.tpl.php'; $body = ob_get_contents(); ob_end_clean(); $sendtoemail = get_adposteremail($ad->ad_id); $result = awpcp_process_mail($from, $sendtoemail, trim($subject), $body, $sender, $sender_email); if ($result) { $message = __("Your message has been sent.", "AWPCP"); return $this->render('content', awpcp_print_message($message)); } else { $this->messages[] = __("There was a problem encountered during the attempt to send your message. Please try again and if the problem persists, please contact the system administrator.", "AWPCP"); return $this->contact_form($form, $errors); } }
/** * @since 3.0.2 */ function awpcp_ad_updated_user_email($ad, $message) { $admin_email = awpcp_admin_recipient_email_address(); $mail = new AWPCP_Email(); $mail->to[] = awpcp_format_email_address($ad->ad_contact_email, $ad->ad_contact_name); $mail->subject = sprintf(__('Your Ad "%s" has been successfully updated', 'AWPCP'), $ad->get_title()); $template = AWPCP_DIR . '/frontend/templates/email-ad-updated-user.tpl.php'; $mail->prepare($template, compact('ad', 'message', 'admin_email')); return $mail; }
<?php if (get_awpcp_option('include-ad-access-key')) { _e("Listing Edit Key", "AWPCP"); ?> : <?php echo $ad->get_access_key(); } ?> <?php _e("Listing End Date", "AWPCP"); ?> : <?php echo $ad->get_end_date(); ?> <?php $text = __("If you have questions about your listing, please contact %s.", 'AWPCP'); echo sprintf($text, awpcp_admin_recipient_email_address()); ?> <?php _e('Thank you for your business', 'AWPCP'); ?> <?php echo home_url();