function send_notification_email($to_email, $subject, $message, $reply_to = '', $reply_to_name = '', $plain_text = true, $attachments = array()) { $content_type = $plain_text ? 'text/plain' : 'text/html'; $reply_to_name = $reply_to_name == '' ? wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) : $reply_to_name; //senders name $reply_to = ($reply_to == '' or $reply_to == '[admin_email]') ? get_option('admin_email') : $reply_to; //senders e-mail address if ($to_email == '[admin_email]') { $to_email = get_option('admin_email'); } $recipient = $to_email; //recipient $header = "From: \"{$reply_to_name}\" <{$reply_to}>\r\n Reply-To: \"{$reply_to_name}\" <{$reply_to}>\r\n Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\r\n"; //optional headerfields $subject = wp_specialchars_decode(strip_tags(stripslashes($subject)), ENT_QUOTES); $message = do_shortcode($message); $message = wordwrap(stripslashes($message), 70, "\r\n"); //in case any lines are longer than 70 chars if ($plain_text) { $message = wp_specialchars_decode(strip_tags($message), ENT_QUOTES); } $header = apply_filters('frm_email_header', $header, compact('to_email', 'subject')); if (!wp_mail($recipient, $subject, $message, $header, $attachments)) { $header = "From: \"{$reply_to_name}\" <{$reply_to}>\r\n"; mail($recipient, $subject, $message, $header); } do_action('frm_notification', $recipient, $subject, $message); }
/** * Notify the blog admin of a new user, normally via email. * * @since 2.0 * * @param int $user_id User ID * @param string $plaintext_pass Optional. The user's plaintext password */ function wp_new_user_notification($user_id, $plaintext_pass = '') { global $LoginWithAjax; //Copied out of /wp-includes/pluggable.php $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if (empty($plaintext_pass)) { return; } //LWA Customizations if ($LoginWithAjax->data['notification_override'] == true) { //We can use our own logic here $LoginWithAjax->new_user_notification($user_login, $plaintext_pass, $user_email, $blogname); } else { //Copied out of /wp-includes/pluggable.php $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $message .= wp_login_url() . "\r\n"; wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); } }
/** * Email login credentials to a newly-registered user. * * A new user registration notification is also sent to admin email. * * @since 2.0.0 * @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`. * * @param int $user_id User ID. * @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty * string (admin only), or 'both' (admin and user). The empty string value was kept * for backward-compatibility purposes with the renamed parameter. Default empty. */ function wp_new_user_notification($user_id, $notify = '') { global $wpdb; $user = get_userdata($user_id); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if ('admin' === $notify || empty($notify)) { return; } // Generate something random for a password reset key. $key = wp_generate_password(20, false); /** This action is documented in wp-login.php */ do_action('retrieve_password_key', $user->user_login, $key); // Now insert the key, hashed, into the DB. if (empty($wp_hasher)) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash(8, true); } $hashed = time() . ':' . $wp_hasher->HashPassword($key); $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login)); $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; $message .= __('To set your password, visit the following address:') . "\r\n\r\n"; $message .= network_site_url("wp-login.php?action=rp&key={$key}&login="******"\r\n\r\n"; // $message .= wp_login_url() . "\r\n"; $message .= __('Make sure you click the RESET PASSWORD button to save your password.') . "\r\n\r\n"; wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message); }
function custom_new_user_notification($user_id, $deprecated = null, $notify = '', $password = null) { if ($deprecated !== null) { _deprecated_argument(__FUNCTION__, '4.3.1'); } global $wpdb, $wp_hasher; $user = get_userdata($user_id); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if ('admin' === $notify || empty($notify)) { return; } if ($password === null) { $password = wp_generate_password(12, false); } // change the URL below to actual page with [adverts_manage] shortcode. $manage_url = home_url() . "/adverts/manage/"; $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $password) . "\r\n"; $message .= 'To manage your Ads please use the following address ' . $manage_url . "\r\n"; wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); }
/** * Admin notification */ function edd_pre_approval_emails_send_admin_email($payment_id = 0, $payment_data = array()) { $payment_id = absint($payment_id); // get payment data from payment ID $payment_data = edd_get_payment_meta($payment_id); if (empty($payment_id)) { return; } if (!edd_get_payment_by('id', $payment_id)) { return; } $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); $from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data); $from_email = edd_get_option('from_email', get_bloginfo('admin_email')); $from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data); $subject = sprintf(__('New pledge - Order #%1$s', 'edd-pre-approval-emails'), $payment_id); $subject = wp_strip_all_tags($subject); $subject = edd_do_email_tags($subject, $payment_id); $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n"; $headers .= "Reply-To: " . $from_email . "\r\n"; $headers .= "Content-Type: text/html; charset=utf-8\r\n"; $headers = apply_filters('edd_admin_pledge_notification_headers', $headers, $payment_id, $payment_data); $attachments = apply_filters('edd_admin_pledge_notification_attachments', array(), $payment_id, $payment_data); $message = edd_pre_approval_emails_get_admin_email_body($payment_id, $payment_data); if (class_exists('EDD_Emails')) { $emails = EDD()->emails; $emails->__set('from_name', $from_name); $emails->__set('from_email', $from_email); $emails->__set('headers', $headers); $emails->__set('heading', __('New Pledge!', 'edd-pre-approval-emails')); $emails->send(edd_get_admin_notice_emails(), $subject, $message, $attachments); } }
/** * Helper Functions */ function wc_edd_email_purchase_receipt($payment_id, $download_id) { $payment_data = edd_get_payment_meta($payment_id); $download = get_post($download_id); $license = edd_software_licensing()->get_license_by_purchase($payment_id, $download_id); $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); $from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data); $from_email = edd_get_option('from_email', get_bloginfo('admin_email')); $from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data); $to_email = edd_get_payment_user_email($payment_id); $subject = edd_get_option('purchase_subject', __('New License Key', 'edd')); $subject = apply_filters('edd_purchase_subject', wp_strip_all_tags($subject), $payment_id); $subject = edd_do_email_tags($subject, $payment_id); $message = "Dear " . edd_email_tag_first_name($payment_id) . ",\n\n"; $message .= "As you have updated " . $download->post_title . ", please use following new license key to continue getting future updates: \n\n"; $message .= "License Key : " . edd_software_licensing()->get_license_key($license->ID) . "\n\n"; $message .= "Sorry for inconvenience."; $emails = EDD()->emails; $emails->__set('from_name', $from_name); $emails->__set('from_email', $from_email); $emails->__set('heading', __('Purchase Receipt', 'edd')); $headers = apply_filters('edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); $emails->__set('headers', $headers); $emails->send($to_email, $subject, $message, array()); if ($admin_notice && !edd_admin_notices_disabled($payment_id)) { do_action('edd_admin_sale_notice', $payment_id, $payment_data); } }
/** * Notify the blog admin of a new user, normally via email. * * @since 2.0 * * @param int $user_id User ID * @param string $plaintext_pass Optional. The user's plaintext password */ function wp_new_user_notification($user_id, $plaintext_pass = '', $flag='') { if(func_num_args() > 1 && $flag !== 1) return; $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if ( empty($plaintext_pass) ) return; // 你可以在此修改发送给用户的注册通知Email $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $message .= '登陆网址: ' . wp_login_url() . "\r\n"; // sprintf(__('[%s] Your username and password'), $blogname) 为邮件标题 wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); }
/** * Get the email from name * * @since 1.1.0 */ public function get_from_name() { if (!$this->from_name) { $this->from_name = get_bloginfo('name'); } return wp_specialchars_decode($this->from_name); }
/** * Returns the thousand separator used by WC. * * @return string */ public static function thousand_separator() { if (empty(self::$wc_thousand_separator)) { self::$wc_thousand_separator = wp_specialchars_decode(stripslashes(get_option('woocommerce_price_thousand_sep')), ENT_QUOTES); } return self::$wc_thousand_separator; }
function notification ($addressee,$address,$subject,$template="order.php",$receipt="receipt.php") { global $Ecart; global $is_IIS; if ($template == "order.php" && file_exists(ECART_TEMPLATES."/order.html")) $template = ECART_TEMPLATES."/order.html"; else $template = trailingslashit(ECART_TEMPLATES).$template; if (!file_exists($template)) return new EcartError(__('A purchase notification could not be sent because the template for it does not exist.','purchase_notification_template',ECART_ADMIN_ERR)); // Send the e-mail receipt $email = array(); $email['from'] = '"'.wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ).'"'; if ($Ecart->Settings->get('merchant_email')) $email['from'] .= ' <'.$Ecart->Settings->get('merchant_email').'>'; if($is_IIS) $email['to'] = $address; else $email['to'] = '"'.html_entity_decode($addressee,ENT_QUOTES).'" <'.$address.'>'; $email['subject'] = $subject; $email['receipt'] = $this->receipt($receipt); $email['url'] = get_bloginfo('siteurl'); $email['sitename'] = get_bloginfo('name'); $email['orderid'] = $this->id; $email = apply_filters('ecart_email_receipt_data',$email); if (ecart_email($template,$email)) { if (ECART_DEBUG) new EcartError('A purchase notification was sent to: '.$email['to'],false,ECART_DEBUG_ERR); return true; } if (ECART_DEBUG) new EcartError('A purchase notification FAILED to be sent to: '.$email['to'],false,ECART_DEBUG_ERR); return false; }
function wp_new_user_notification_original($user_id, $plaintext_pass = '', $include_fields = false, $activation_data = false, $welcome_email = '') { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); $admin_email = get_option('admin_email'); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); // Get the site domain and get rid of www. $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } $from_email = 'wordpress@' . $sitename; $headers = sprintf("From: %s <%s>\r\n\\", $blogname, $from_email); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; if ($include_fields) { $message .= cimy_uef_mail_fields($user, $activation_data); } @wp_mail($admin_email, sprintf(__('[%s] New User Registration'), $blogname), $message, $headers); if (empty($plaintext_pass)) { return; } $welcome_email = str_replace("USERNAME", $user_login, $welcome_email); $welcome_email = str_replace("PASSWORD", $plaintext_pass, $welcome_email); if ($include_fields) { $welcome_email .= cimy_uef_mail_fields($user, $activation_data); } $welcome_email = str_replace("LOGINLINK", wp_login_url(), $welcome_email); wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $welcome_email, $headers); }
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id) { global $bp; $friendship = new BP_Friends_Friendship($friendship_id, false, false); $friend_name = bp_core_get_user_displayname($friend_id); if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) { return false; } $ud = get_userdata($initiator_id); $friend_link = bp_core_get_user_domain($friend_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications'; // Set up and send the message $to = $ud->user_email; $sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name); $message = sprintf(__('%1$s accepted your friend request. To view %2$s\'s profile: %3$s --------------------- ', 'buddypress'), $friend_name, $friend_name, $friend_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('friends_notification_accepted_request_to', $to); $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name); $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link); wp_mail($to, $subject, $message); do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id); }
function localize_script() { global $woocommerce; $options = get_option('wcbulkorderform_variation_template'); $display_images = isset($options['display_images']) ? $options['display_images'] : ''; $send_to_cart_or_checkout = isset($options['send_to_cart_or_checkout']) ? $options['send_to_cart_or_checkout'] : ''; $noproductsfound = __('No Products Were Found', 'wcbulkorderform'); $variation_noproductsfound = __('No Variations', 'wcbulkorderform'); $selectaproduct = __('Please Select a Product', 'wcbulkorderform'); $enterquantity = __('Enter Quantity', 'wcbulkorderform'); $decimal_sep = wp_specialchars_decode(stripslashes(get_option('woocommerce_price_decimal_sep')), ENT_QUOTES); $thousands_sep = wp_specialchars_decode(stripslashes(get_option('woocommerce_price_thousand_sep')), ENT_QUOTES); $num_decimals = absint(get_option('woocommerce_price_num_decimals')); $minLength = 0; $Delay = 500; $single_buttons = $options['variation_display_format']; if ($send_to_cart_or_checkout == 'checkout') { $checkouttext = __('Checkout', 'woocommerce'); $checkouturl = $woocommerce->cart->get_checkout_url(); } else { $checkouttext = __('Cart', 'woocommerce'); $checkouturl = $woocommerce->cart->get_cart_url(); } wp_localize_script('wcbulkorder_acsearch', 'WCBulkOrder', array('url' => admin_url('admin-ajax.php'), 'search_products_nonce' => wp_create_nonce('wcbulkorder-search-products'), 'display_images' => $display_images, 'noproductsfound' => $noproductsfound, 'selectaproduct' => $selectaproduct, 'enterquantity' => $enterquantity, 'variation_noproductsfound' => $variation_noproductsfound, 'variation_noproductsfound' => $variation_noproductsfound, 'decimal_sep' => $decimal_sep, 'thousands_sep' => $thousands_sep, 'num_decimals' => $num_decimals, 'Delay' => $Delay, 'minLength' => $minLength, 'single_buttons' => $single_buttons, 'checkouttext' => $checkouttext, 'checkouturl' => $checkouturl)); }
function wp_new_user_notification_original($user_id, $plaintext_pass = '', $include_fields = false) { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; if ($include_fields) { $message .= cimy_uef_mail_fields($user); } @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if (empty($plaintext_pass)) { return; } $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; if ($include_fields) { $message .= cimy_uef_mail_fields($user); } $message .= wp_login_url() . "\r\n"; wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); }
/** * Replaces the default wp_new_user_notification function of the core. * * Email login credentials to a newly-registered user. * A new user registration notification is also sent to admin email. * * @since 1.0.0 * @access public * @return void */ function wp_new_user_notification($user_id, $plaintext_pass) { $user = get_userdata($user_id); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); // Send notification to admin if not disabled. if (!wpum_get_option('disable_admin_register_email')) { $message = sprintf(__('New user registration on your site %s:', 'wpum'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s', 'wpum'), $user->user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s', 'wpum'), $user->user_email) . "\r\n"; wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration', 'wpum'), $blogname), $message); } /* == Send notification to the user now == */ if (empty($plaintext_pass)) { return; } // Check if email exists first if (wpum_email_exists('register')) { // Retrieve the email from the database $register_email = wpum_get_email('register'); $message = wpautop($register_email['message']); $message = wpum_do_email_tags($message, $user_id, $plaintext_pass); WPUM()->emails->__set('heading', __('Your account', 'wpum')); WPUM()->emails->send($user->user_email, $register_email['subject'], $message); } }
function woo_ce_escape_csv_value( $string = '', $delimiter = ',', $format = 'all' ) { global $export; // Override the formatting for Debug Mode if( WOO_CD_DEBUG ) { $string = str_replace( '"', "'", $string ); $string = str_replace( PHP_EOL, "", $string ); } else { $string = str_replace( '"', '""', $string ); $string = str_replace( PHP_EOL, "\r\n", $string ); } $string = wp_specialchars_decode( $string ); $string = str_replace( "’", "'", $string ); // Override the escape formatting rule for XLS files if( $export->export_format == 'xls' ) $format = 'all'; switch( $format ) { case 'all': $string = '"' . $string . '"'; break; case 'excel': if( strpos( $string, '"' ) !== false or strpos( $string, ',' ) !== false or strpos( $string, "\r" ) !== false or strpos( $string, "\n" ) !== false ) $string = '"' . $string . '"'; break; } return $string; }
function x_shortcode_creative_cta($atts) { // 1 extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'padding' => '', 'text' => '', 'font_size' => '', 'icon' => '', 'icon_size' => '', 'image' => '', 'image_width' => '', 'animation' => '', 'link' => '', 'color' => '', 'bg_color' => '', 'bg_color_hover' => ''), $atts, 'x_creative_cta')); $id = $id != '' ? 'id="' . esc_attr($id) . '"' : ''; $class = $class != '' ? 'x-creative-cta ' . esc_attr($class) : 'x-creative-cta'; $style = $style != '' ? ' ' . $style : ''; $padding = $padding != '' ? $padding : '35px'; $text = $text != '' ? wp_specialchars_decode($text, ENT_QUOTES) : 'Place Your<br>Text Here'; $font_size = $font_size != '' ? $font_size : '36px'; $icon = $icon != '' ? $icon : ''; $icon_size = $icon_size != '' ? $icon_size : '36px'; $image = $image != '' ? $image : ''; $image_width = $image_width != '' ? $image_width : ''; $animation = $animation != '' ? ' ' . $animation : ''; $link = $link != '' ? $link : '#'; $color = $color != '' ? $color : '#ffffff'; $bg_color = $bg_color != '' ? $bg_color : '#ff2a13'; $bg_color_hover = $bg_color_hover != '' ? $bg_color_hover : '#d80f0f'; if ($animation != '') { if ($image != '') { $graphic = '<span class="graphic"><img style="margin: 0; width: ' . $image_width . ';" src="' . $image . '"></span>'; } else { if ($icon != '') { $graphic = '<span class="graphic"><i style="margin: 0; font-size: ' . $icon_size . ';" class="x-icon-' . $icon . '" data-x-icon="&#x' . fa_unicode($icon) . ';"></i></span>'; } } } else { $graphic = ''; } $js_params = array('animation' => $animation, 'bg_color' => $bg_color, 'bg_color_hover' => $bg_color_hover); $data = cs_generate_data_attributes('creative_cta', $js_params); $output = "<a {$id} class=\"{$class}{$animation}\" href=\"{$link}\" style=\"padding: {$padding}; color: {$color}; background-color: {$bg_color};{$style}\" {$data}>" . "<span class=\"text\" style=\"font-size: {$font_size};\">{$text}</span>" . $graphic . "</a>"; return $output; }
function wp_new_user_notification($user_id, $deprecated = null, $notify = '') { if ($deprecated !== null) { _deprecated_argument(__FUNCTION__, '4.3.1'); } // `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation. if ('admin' === $notify || empty($deprecated) && empty($notify)) { return; } global $wpdb, $wp_hasher; $user = get_userdata($user_id); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); // Generate something random for a password reset key. $key = wp_generate_password(20, false); /** This action is documented in wp-login.php */ do_action('retrieve_password_key', $user->user_login, $key); // Now insert the key, hashed, into the DB. if (empty($wp_hasher)) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash(8, true); } $hashed = time() . ':' . $wp_hasher->HashPassword($key); $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login)); $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; $message .= __('To set your password, visit the following address:') . "\r\n\r\n"; $message .= '<' . network_site_url("wp-login.php?action=rp&key={$key}&login="******">\r\n\r\n"; $message .= wp_login_url() . "\r\n"; wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message); }
function pmpro_send_html($phpmailer) { // Set the original plain text message $phpmailer->AltBody = wp_specialchars_decode($phpmailer->Body, ENT_QUOTES); // Clean < and > around text links in WP 3.1 $phpmailer->Body = preg_replace('#<(http://[^*]+)>#', '$1', $phpmailer->Body); // Convert line breaks & make links clickable $phpmailer->Body = make_clickable($phpmailer->Body); // Add header to message if found if (file_exists(get_stylesheet_directory() . "/email_header.html")) { $phpmailer->Body = file_get_contents(get_stylesheet_directory() . "/email_header.html") . "\n" . $phpmailer->Body; } elseif (file_exists(get_template_directory() . "/email_header.html")) { $phpmailer->Body = file_get_contents(get_template_directory() . "/email_header.html") . "\n" . $phpmailer->Body; } // Add footer to message if found if (file_exists(get_stylesheet_directory() . "/email_footer.html")) { $phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(get_stylesheet_directory() . "/email_footer.html"); } elseif (file_exists(get_template_directory() . "/email_footer.html")) { $phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(get_template_directory() . "/email_footer.html"); } // Replace variables in email global $current_user; $data = array("name" => $current_user->display_name, "sitename" => get_option("blogname"), "login_link" => pmpro_url("account"), "display_name" => $current_user->display_name, "user_email" => $current_user->user_email, "subject" => $phpmailer->Subject); foreach ($data as $key => $value) { $phpmailer->Body = str_replace("!!" . $key . "!!", $value, $phpmailer->Body); } do_action("pmpro_after_phpmailer_init", $phpmailer); do_action("pmpro_after_pmpmailer_init", $phpmailer); //typo left in for backwards compatibility }
function viradeco_new_user_notification($user_id, $plaintext_pass = '') { $user = get_userdata($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); $viraclub_id = get_user_meta($user_id, 'viraclub', 1); $viraclub_id = $viraclub_id ? $viraclub_id : ""; // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration in %s:', 'viradeco'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s', 'viradeco'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s', 'viradeco'), $user_email) . "\r\n"; $message .= sprintf(__('Vira Club ID : V%s', 'viradeco'), $viraclub_id) . "\r\n"; wp_mail(get_option('admin_email'), sprintf(__('New User Registration', 'viradeco'), $blogname), $message); if (empty($plaintext_pass)) { return; } $message = __('Your Information : ', 'viradeco') . "\r\n"; $message .= sprintf(__('Username: %s', 'viradeco'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s', 'viradeco'), $plaintext_pass) . "\r\n"; $message .= sprintf(__('Vira Club ID : V%s', 'viradeco'), $viraclub_id) . "\r\n"; $message .= get_the_permalink() . "\r\n"; wp_mail($user_email, sprintf(__('Welcome to Vira', 'viradeco'), $blogname), $message); }
/** * WooCommerce compatible function to get price decimal separator */ public static function get_price_decimal_separator() { if (self::is_wc_gte_23()) { return wc_get_price_decimal_separator(); } else { return wp_specialchars_decode(stripslashes(get_option('woocommerce_price_decimal_sep')), ENT_QUOTES); } }
function jp_customize_verification_email($message, $user_id) { $user_data = get_userdata($user_id); $url = edd_get_user_verification_url($user_id); $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); $message = sprintf(__("Howdy %s,\n\nYour account with %s needs to be verified before you can access your purchase history. <a href='%s'>Click here</a> to verify your account and get access to your purchases.", 'edd'), $user_data->display_name, $from_name, $url); return $message; }
/** * get_option( 'woocommerce_price_thousand_sep' ) cache. * * @return string */ function wc_cp_price_thousand_sep() { $wc_price_thousand_sep = WC_CP()->api->cache_get('wc_price_thousand_sep'); if (null === $wc_price_thousand_sep) { $wc_price_thousand_sep = wp_specialchars_decode(stripslashes(get_option('woocommerce_price_thousand_sep')), ENT_QUOTES); WC_CP()->api->cache_set('wc_price_thousand_sep', $wc_price_thousand_sep); } return $wc_price_thousand_sep; }
public function processRequest($request) { $db = new WPAM_Data_DataAccess(); $affiliateFields = $db->getAffiliateFieldRepository()->loadMultipleBy(array('enabled' => true), array('order' => 'asc')); if (isset($request['action']) && $request['action'] == 'submit') { $form_validated = false; $affiliateHelper = new WPAM_Util_AffiliateFormHelper(); $vr = $affiliateHelper->validateForm(new WPAM_Validation_Validator(), $request, $affiliateFields); if ($vr->getIsValid()) { $form_validated = true; } $output = apply_filters('wpam_validate_registration_form_submission', '', $request); if (!empty($output)) { $form_validated = false; } if ($form_validated) { $model = $affiliateHelper->getNewAffiliate(); $affiliateHelper->setModelFromForm($model, $affiliateFields, $request); //Fire the action hook do_action('wpam_front_end_registration_form_submitted', $model, $request); //Check if automatic affiliate approval option is enabled if (get_option(WPAM_PluginConfig::$AutoAffiliateApproveIsEnabledOption) == 1) { $userHandler = new WPAM_Util_UserHandler(); $userHandler->AutoapproveAffiliate($model); return new WPAM_Pages_TemplateResponse('aff_app_submitted_auto_approved'); } //Do the non auto approval process $db = new WPAM_Data_DataAccess(); $id = $db->getAffiliateRepository()->insert($model); if ($id == 0) { if (WPAM_DEBUG) { echo '<pre>', var_export($model, true), '</pre>'; } wp_die(__('Error submitting your details to the database. This is a bug, and your application was not submitted.', 'affiliates-manager')); } $mailer = new WPAM_Util_EmailHandler(); //Notify admin that affiliate has registered $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New affiliate registration on your site %s:', 'affiliates-manager'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Name: %s %s', 'affiliates-manager'), $request['_firstName'], $request['_lastName']) . "\r\n"; $message .= sprintf(__('Email: %s', 'affiliates-manager'), $request['_email']) . "\r\n"; $message .= sprintf(__('Company: %s', 'affiliates-manager'), $request['_companyName']) . "\r\n"; $message .= sprintf(__('Website: %s', 'affiliates-manager'), $request['_websiteUrl']) . "\r\n\r\n"; $message .= sprintf(__('View Application: %s', 'affiliates-manager'), admin_url('admin.php?page=wpam-affiliates&viewDetail=' . $id)) . "\r\n"; $mailer->mailAffiliate(get_option('admin_email'), __('New Affiliate Registration', 'affiliates-manager'), $message); //Notify affiliate of their application $affsubj = sprintf(__('Affiliate application for %s', 'affiliates-manager'), $blogname); $affmessage = WPAM_MessageHelper::GetMessage('affiliate_application_submitted_email'); $mailer->mailAffiliate($request['_email'], $affsubj, $affmessage); return new WPAM_Pages_TemplateResponse('affiliate_application_submitted'); } else { return $this->getForm($affiliateFields, $request, $vr); } } //else return $this->getForm($affiliateFields); }
public function Disallow_lost_password() { // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); login_header(__('Password reset disabled', c_bid_text_domain), '<p class="message">' . sprintf(__('%s uses Mozilla Persona to sign in and does not use passwords. Password reset is disabled.', c_bid_text_domain), $blogname) . "</p>"); login_footer('user_login'); exit; }
private function send_admin_email($user_id) { $user = get_userdata($user_id); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New confirmed app subscriber on your site %s: %s', 'pnfw'), $blogname, $user->user_email) . "\r\n\r\n"; wp_mail(get_option('admin_email'), sprintf(__('[%s] New Confirmed App Subscriber', 'pnfw'), $blogname), $message); }
private function callback_new_password() { global $wpdb; $form = wpsc_get_password_reminder_form_args(); $validation = wpsc_validate_form($form); do_action('lostpassword_post'); if (is_wp_error($validation)) { wpsc_set_validation_errors($validation); return; } extract($_POST, EXTR_SKIP); $username = $_POST['username']; $field = is_email($username) ? $field = 'email' : 'login'; $user_data = get_user_by($field, $username); if (!$user_data) { $this->message_collection->add(__('Invalid username or email.', 'wp-e-commerce'), 'error'); return; } $user_login = $user_data->user_login; $user_email = $user_data->user_email; do_action('retrieve_password', $user_login); $allow = apply_filters('allow_password_reset', true, $user_data->ID); if (!$allow) { wpsc_set_validation_errors(new WP_Error('username', __('Password reset is not allowed for this user', 'wp-e-commerce'))); } else { if (is_wp_error($allow)) { wpsc_set_validation_errors($allow); } } $key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM {$wpdb->users} WHERE user_login = %s", $user_login)); if (empty($key)) { // Generate something random for a key... $key = wp_generate_password(20, false); do_action('retrieve_password_key', $user_login, $key); // Now insert the new md5 key into the db $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login)); } $message = __('Someone requested that the password be reset for the following account:', 'wp-e-commerce') . "\r\n\r\n"; $message .= home_url('/') . "\r\n\r\n"; $message .= sprintf(__('Username: %s', 'wp-e-commerce'), $user_login) . "\r\n\r\n"; $message .= __('If this was a mistake, just ignore this email and nothing will happen.', 'wp-e-commerce') . "\r\n\r\n"; $message .= __('To reset your password, visit the following address:', 'wp-e-commerce') . "\r\n\r\n"; $message .= '<' . wpsc_get_password_reminder_url("reset/{$user_login}/{$key}") . ">\r\n"; if (is_multisite()) { $blogname = $GLOBALS['current_site']->site_name; } else { $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); } $title = sprintf(__('[%s] Password Reset', 'wp-e-commerce'), $blogname); $title = apply_filters('wpsc_retrieve_password_title', $title); $message = apply_filters('wpsc_retrieve_password_message', $message, $key); if ($message && !wp_mail($user_email, $title, $message)) { $this->message_collection->add(__("Sorry, but due to an unexpected technical issue, we couldn't send you the e-mail containing password reset directions. Most likely the web host we're using has disabled e-mail features. Please contact us and we'll help you fix this. Or you can simply try again later.", 'wp-e-commerce'), 'error'); // by "us", we mean the site owner. } $this->message_collection->add(__("We just sent you an e-mail containing directions to reset your password. If you don't receive it in a few minutes, check your Spam folder or simply try again.", 'wp-e-commerce'), 'success'); }
public function update_query() { global $wpdb; $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; $form_id = isset($_GET['form_id']) ? (int) $_GET['form_id'] : 0; $query = isset($_POST['query']) ? stripslashes(wp_specialchars_decode($_POST['query'])) : ""; $details = isset($_POST['details']) ? esc_html($_POST['details']) : ""; $save = $wpdb->update($wpdb->prefix . 'formmaker_query', array('form_id' => $form_id, 'query' => $query, 'details' => $details), array('id' => $id)); }
public function execute() { $post = $this->post; $args = $this->args; $filter_value = $args["filter_value"]; $pattern = preg_quote(wp_specialchars_decode(trim($filter_value))); $modifiers = ""; // after pattern PRCE modifiers if (empty($pattern)) { return $post; } // empty filter will always return true; not a good idea if (!isset($args["filter_match_case"]) || $args["filter_match_case"] == 0) { $modifiers = "i"; } // case insensitive and other preg_match modifiers $split_pattern = preg_split("/,/i", $pattern); // case insensitive match (rough) if (count($split_pattern) > 1) { $pattern = array(); // make it array foreach ($split_pattern as $item) { if (isset($args["filter_match_word"]) && $args["filter_match_word"] == 1) { $pattern[] = "/\\b{$item}\\b/{$modifiers}"; } else { $pattern[] = "/{$item}/{$modifiers}"; } } } else { if (isset($args["filter_match_word"]) && $args["filter_match_word"] == 1) { $pattern = "/\\b{$pattern}\\b/{$modifiers}"; } else { $pattern = "/{$pattern}/{$modifiers}"; } // rough and bad - needs updating for more algo's } // add all relevant fields to the content check. $content = $post["post_content"]; $excerpt = $post["post_excerpt"]; $title = $post["post_title"]; // check for multiple keywords. if (isset($args["filter_search_title"]) && $args["filter_search_title"] == 1) { $title = preg_replace($pattern, "", $title); } if (isset($args["filter_search_content"]) && $args["filter_search_content"] == 1) { $content = preg_replace($pattern, "", $content); } if (isset($args["filter_search_excerpt"]) && $args["filter_search_excerpt"] == 1) { $excerpt = preg_replace($pattern, "", $excerpt); } $post["post_content"] = $content; $post["post_excerpt"] = $excerpt; $post["post_title"] = $title; return $post; }
function new_reply_notification($reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0, $is_edit = false, $reply_to = 0) { $admin_email = get_option('admin_email'); $user_id = (int) $reply_author_id; $reply_id = bbp_get_reply_id($reply_id); $topic_id = bbp_get_topic_id($topic_id); $forum_id = bbp_get_forum_id($forum_id); $email_subject = get_option('bbpress_notify_newreply_email_subject'); $email_body = get_option('bbpress_notify_newreply_email_body'); $blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $topic_title = html_entity_decode(strip_tags(bbp_get_topic_title($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_content = html_entity_decode(strip_tags(bbp_get_topic_content($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_excerpt = html_entity_decode(strip_tags(bbp_get_topic_excerpt($topic_id, 100)), ENT_NOQUOTES, 'UTF-8'); $topic_author = bbp_get_topic_author($topic_id); $topic_url = bbp_get_topic_permalink($topic_id); $topic_reply = bbp_get_reply_url($topic_id); $reply_url = bbp_get_reply_url($reply_id); $reply_content = get_post_field('post_content', $reply_id, 'raw'); $reply_author = bbp_get_topic_author($user_id); $email_subject = $blog_name . " New Reply Alert: " . $topic_title; $email_body = $blog_name . ": {$topic_title}\n\r"; $email_body .= $reply_content; $email_body .= "\n\r--------------------------------\n\r"; $email_body .= "Reply Url: " . $reply_url . "\n\rAuthor: {$reply_author}" . "\n\rYou can reply at: {$reply_url}"; @wp_mail($admin_email, $email_subject, $email_body); }