本文整理汇总了PHP中sanitize_email函数的典型用法代码示例。如果您正苦于以下问题:PHP sanitize_email函数的具体用法?PHP sanitize_email怎么用?PHP sanitize_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sanitize_email函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: customer_note_added
public function customer_note_added($data)
{
global $wpdb;
$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE id = %d", $data['order_id']));
if ($post && $post->post_type == 'order_shipment') {
$parent_id = $post->post_parent;
$is_customer_note = intval(1);
if (isset($_SERVER['HTTP_HOST'])) {
$comment_author_email = sanitize_email(strtolower(__('WooCommerce', 'woocommerce')) . '@' . str_replace('www.', '', $_SERVER['HTTP_HOST']));
} else {
$comment_author_email = sanitize_email(strtolower(__('WooCommerce', 'woocommerce')) . '@noreply.com');
}
$comment_post_ID = $parent_id;
$comment_author = __('WooCommerce', 'woocommerce');
$comment_author_url = '';
$comment_content = $data['customer_note'];
$comment_agent = 'WooCommerce';
$comment_type = 'order_note';
$comment_parent = 0;
$comment_approved = 1;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_agent', 'comment_type', 'comment_parent', 'comment_approved');
$comment_id = wp_insert_comment($commentdata);
add_comment_meta($comment_id, 'is_customer_note', $is_customer_note);
}
}
示例2: gardenia_option_validate
function gardenia_option_validate($input)
{
$input['logo'] = esc_url_raw($input['logo']);
$input['favicon'] = esc_url_raw($input['favicon']);
$input['footertext'] = sanitize_text_field($input['footertext']);
$input['email'] = sanitize_email($input['email']);
$input['phone'] = wp_filter_nohtml_kses($input['phone']);
$input['home-title'] = sanitize_text_field($input['home-title']);
$input['home-content'] = sanitize_text_field($input['home-content']);
$input['post-title'] = sanitize_text_field($input['post-title']);
$input['post-content'] = sanitize_text_field($input['post-content']);
$input['twitter'] = esc_url_raw($input['twitter']);
$input['fburl'] = esc_url_raw($input['fburl']);
$input['pinterest'] = esc_url_raw($input['pinterest']);
$input['linkedin'] = esc_url_raw($input['linkedin']);
$input['gplus'] = esc_url_raw($input['gplus']);
$input['rss'] = esc_url_raw($input['rss']);
for ($gardenia_i = 1; $gardenia_i <= 5; $gardenia_i++) {
$input['slider-img-' . $gardenia_i] = esc_url_raw($input['slider-img-' . $gardenia_i]);
$input['slidelink-' . $gardenia_i] = esc_url_raw($input['slidelink-' . $gardenia_i]);
}
for ($gardenia_section_i = 1; $gardenia_section_i <= 4; $gardenia_section_i++) {
$input['home-icon-' . $gardenia_section_i] = esc_url_raw($input['home-icon-' . $gardenia_section_i]);
$input['section-title-' . $gardenia_section_i] = sanitize_text_field($input['section-title-' . $gardenia_section_i]);
$input['section-content-' . $gardenia_section_i] = sanitize_text_field($input['section-content-' . $gardenia_section_i]);
$input['section-link-' . $gardenia_section_i] = esc_url_raw($input['section-link-' . $gardenia_section_i]);
}
return $input;
}
示例3: optionsframework_options
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the 'id' fields, make sure to use all lowercase and no spaces.
*
* If you are making your theme translatable, you should replace 'skt-full-width'
* with the actual text domain for your theme. Read more:
* http://codex.wordpress.org/Function_Reference/load_theme_textdomain
*/
function optionsframework_options()
{
$options = array();
$imagepath = get_template_directory_uri() . '/images/';
//Basic Settings
$options[] = array('name' => __('Basic Settings', 'skt-full-width'), 'type' => 'heading');
$options[] = array('name' => __('Logo', 'skt-full-width'), 'desc' => __('Upload your logo here', 'skt-full-width'), 'id' => 'logo', 'class' => '', 'std' => '', 'type' => 'upload');
$options[] = array('name' => __('Copyright Text', 'skt-full-width'), 'desc' => __('Some Text regarding copyright of your site, you would like to display in the footer.', 'skt-full-width'), 'id' => 'footertext2', 'std' => 'Full Width 2014. All Rights Reserved', 'type' => 'text');
$options[] = array('name' => __('Featured image as background', 'skt-full-width'), 'desc' => __('Do not use featured image as background image.', 'skt-full-width'), 'id' => 'featured_as_background', 'type' => 'checkbox', 'std' => '');
$options[] = array('name' => __('Color Scheme', 'skt-full-width'), 'desc' => __('Select the color scheme for theme', 'skt-full-width'), 'id' => 'navigation_color', 'std' => '#7BB303', 'type' => 'color');
$options[] = array('name' => __('Navigation Icon', 'skt-full-width'), 'desc' => __('Upload icon for navigation<br />(max image size 9px X 9px)', 'skt-full-width'), 'id' => 'navigation_icon', 'class' => '', 'std' => get_template_directory_uri() . "/images/nav-icon-hover.png", 'type' => 'upload');
$options[] = array('name' => __('Pagination Gradient Color - Top', 'skt-full-width'), 'desc' => __('Select the top gradient color for pagination links', 'skt-full-width'), 'id' => 'pagin_grad_top_color', 'std' => '#89b219', 'type' => 'color');
$options[] = array('name' => __('Pagination Gradient Color - Bottom', 'skt-full-width'), 'desc' => __('Select the bottom gradient color for pagination links', 'skt-full-width'), 'id' => 'pagin_grad_bottom_color', 'std' => '#3f8d03', 'type' => 'color');
//Layout Settings
$options[] = array('name' => __('Layout Settings', 'skt-full-width'), 'type' => 'heading');
$options[] = array('name' => "Menu Layout", 'desc' => "Select Layout for Menu position. It applies on inner pages only.", 'id' => "sidebar-layout", 'std' => "left", 'type' => "images", 'options' => array('left' => $imagepath . '2cl.png', 'right' => $imagepath . '2cr.png'));
$options[] = array('name' => __('Custom CSS', 'skt-full-width'), 'desc' => __('Some Custom Styling for your site. Place any css codes here instead of the style.css file.', 'skt-full-width'), 'id' => 'style2', 'std' => '', 'type' => 'textarea');
//SLIDER SETTINGS
$options[] = array('name' => __('Homepage Slider', 'skt-full-width'), 'type' => 'heading');
$options[] = array('name' => __('Slider Effects', 'skt-full-width'), 'desc' => __('Add slider effects number eg: 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left.', 'skt-full-width'), 'id' => 'sliderefect', 'type' => 'text', 'std' => '1');
$options[] = array('name' => __('Slider Image 1', 'skt-full-width'), 'desc' => __('First Slide', 'skt-full-width'), 'id' => 'slide1', 'class' => '', 'std' => get_template_directory_uri() . "/images/banner_bg.jpg", 'type' => 'upload');
$options[] = array('desc' => __('Title', 'skt-full-width'), 'id' => 'slidetitle1', 'std' => 'Slider Image 1', 'type' => 'text');
$options[] = array('desc' => __('Description or Tagline', 'skt-full-width'), 'id' => 'slidedesc1', 'std' => 'Small description for slide 1', 'type' => 'textarea');
$options[] = array('desc' => __('Url', 'skt-full-width'), 'id' => 'slideurl1', 'std' => '#link1', 'type' => 'text', 'subtype' => 'url');
$options[] = array('name' => __('Slider Image 2', 'skt-full-width'), 'desc' => __('Second Slide', 'skt-full-width'), 'class' => '', 'id' => 'slide2', 'std' => get_template_directory_uri() . "/images/banner-welcome.jpg", 'type' => 'upload');
$options[] = array('desc' => __('Title', 'skt-full-width'), 'id' => 'slidetitle2', 'std' => 'Slider Image 2 ', 'type' => 'text');
$options[] = array('desc' => __('Description or Tagline', 'skt-full-width'), 'id' => 'slidedesc2', 'std' => 'Small description for slide 2', 'type' => 'textarea');
$options[] = array('desc' => __('Url', 'skt-full-width'), 'id' => 'slideurl2', 'std' => '#link2', 'type' => 'text', 'subtype' => 'url');
$options[] = array('name' => __('Slider Image 3', 'skt-full-width'), 'desc' => __('Third Slide', 'skt-full-width'), 'id' => 'slide3', 'class' => '', 'std' => '', 'type' => 'upload');
$options[] = array('desc' => __('Title', 'skt-full-width'), 'id' => 'slidetitle3', 'std' => '', 'type' => 'text');
$options[] = array('desc' => __('Description or Tagline', 'skt-full-width'), 'id' => 'slidedesc3', 'std' => '', 'type' => 'textarea');
$options[] = array('desc' => __('Url', 'skt-full-width'), 'id' => 'slideurl3', 'std' => '', 'type' => 'text', 'subtype' => 'url');
$options[] = array('name' => __('Slider Image 4', 'skt-full-width'), 'desc' => __('Fourth Slide', 'skt-full-width'), 'id' => 'slide4', 'class' => '', 'std' => '', 'type' => 'upload');
$options[] = array('desc' => __('Title', 'skt-full-width'), 'id' => 'slidetitle4', 'std' => '', 'type' => 'text');
$options[] = array('desc' => __('Description or Tagline', 'skt-full-width'), 'id' => 'slidedesc4', 'std' => '', 'type' => 'textarea');
$options[] = array('desc' => __('Url', 'skt-full-width'), 'id' => 'slideurl4', 'std' => '', 'type' => 'text', 'subtype' => 'url');
$options[] = array('name' => __('Slider Image 5', 'skt-full-width'), 'desc' => __('Fifth Slide', 'skt-full-width'), 'id' => 'slide5', 'class' => '', 'std' => '', 'type' => 'upload');
$options[] = array('desc' => __('Title', 'skt-full-width'), 'id' => 'slidetitle5', 'std' => '', 'type' => 'text');
$options[] = array('desc' => __('Description or Tagline', 'skt-full-width'), 'id' => 'slidedesc5', 'std' => '', 'type' => 'textarea');
$options[] = array('desc' => __('Url', 'skt-full-width'), 'id' => 'slideurl5', 'std' => '', 'type' => 'text', 'subtype' => 'url');
//Social Settings
$options[] = array('name' => __('Social Settings', 'skt-full-width'), 'type' => 'heading');
$options[] = array('desc' => __('Please set the value of following fields, as per the instructions given along. If you do not want to use an icon, just leave it blank. If some icons are showing up, even when no value is set then make sure they are completely blank, and just save the options once. They will not be shown anymore.', 'skt-full-width'), 'type' => 'info');
$options[] = array('name' => __('Facebook', 'skt-full-width'), 'desc' => __('Facebook Profile or Page URL i.e. http://facebook.com/username/ ', 'skt-full-width'), 'id' => 'facebook', 'std' => '#', 'class' => 'mini', 'type' => 'text', 'subtype' => 'url');
$options[] = array('name' => __('Twitter', 'skt-full-width'), 'desc' => __('Twitter Username', 'skt-full-width'), 'id' => 'twitter', 'std' => '#', 'class' => 'mini', 'type' => 'text');
$options[] = array('name' => __('Google Plus', 'skt-full-width'), 'desc' => __('Google Plus profile url, including "http://"', 'skt-full-width'), 'id' => 'google', 'std' => '#', 'class' => 'mini', 'type' => 'text', 'subtype' => 'url');
$options[] = array('name' => __('Linkedin', 'skt-full-width'), 'desc' => __('Linkedin URL', 'skt-full-width'), 'id' => 'linkedin', 'std' => '#', 'class' => 'mini', 'type' => 'text', 'subtype' => 'url');
// Contact Details
$options[] = array('name' => __('Contact Details for footer', 'skt-full-width'), 'type' => 'heading');
$options[] = array('desc' => __('Company Name', 'skt-full-width'), 'id' => 'contact1', 'std' => 'Full Width', 'type' => 'text');
$options[] = array('desc' => __('Address 1', 'skt-full-width'), 'id' => 'contact2', 'std' => '123 Some Street', 'type' => 'text');
$options[] = array('desc' => __('Address 2', 'skt-full-width'), 'id' => 'contact3', 'std' => 'California, USA', 'type' => 'text');
$options[] = array('desc' => __('Phone', 'skt-full-width'), 'id' => 'contact4', 'std' => '100 2000 300', 'type' => 'text');
$options[] = array('desc' => __('Email', 'skt-full-width'), 'id' => 'contact5', 'std' => sanitize_email('info@example.com'), 'type' => 'text', 'subtype' => 'email');
// Support
$options[] = array('name' => __('Our Themes', 'skt-full-width'), 'type' => 'heading');
$options[] = array('desc' => __('SKT Full Width WordPress theme has been Designed and Created by SKT Themes.', 'skt-full-width'), 'type' => 'info');
$options[] = array('desc' => '<a href="' . esc_url(SKT_THEME_URL) . '" target="_blank"><img src="' . get_template_directory_uri() . '/images/sktskill.jpg"></a><p><em><a target="_blank" href="' . esc_url(SKT_THEME_URL_DIRECT) . '">' . __('Buy PRO version for only $39 with more features.', 'skt-full-width') . '</a></em></p>', 'type' => 'info');
return $options;
}
示例4: kopa_validate_options
/**
* Validate/Sanitize options
*/
function kopa_validate_options($input)
{
$args = kopa_get_options_args();
foreach ($args as $index => $option) {
$id = $option['id'];
if (isset($input[$id])) {
switch ($option['type']) {
case 'text':
$input[$id] = sanitize_text_field($input[$id]);
break;
case 'url':
$input[$id] = esc_url($input[$id]);
break;
case 'email':
$input[$id] = sanitize_email($input[$id]);
break;
case 'number':
$input[$id] = kopa_sanitize_number($input[$id]);
break;
case 'abs_number':
$input[$id] = absint($input[$id]);
break;
case 'textarea':
$input[$id] = kopa_sanitize_textarea($input[$id]);
break;
case 'upload':
$input[$id] = kopa_sanitize_upload($input[$id]);
default:
break;
}
}
}
return $input;
}
示例5: fu_add_new_user
function fu_add_new_user($fu = false)
{
//echo "wtf?";
require_once '../../../wp-includes/registration.php';
global $blog_id;
$email = sanitize_email($fu['email']);
//$current_site = get_current_site();
$pass = $fu['password'];
$user_id = email_exists($email);
//echo "hi";
if (!$user_id) {
$password = $pass ? $pass : generate_random_password();
$user_id = wpmu_create_user($fu['username'], $password, $email);
if (false == $user_id) {
//echo "uh oh";
wp_die(__('There was an error creating the user'));
} else {
//echo "sending mail";
wp_new_user_notification($user_id, $password);
}
if (get_user_option('primary_blog', $user_id) == $blog_id) {
update_user_option($user_id, 'primary_blog', $blog_id, true);
}
}
$redirect = $fu['referer'] ? $fu['referer'] : get_bloginfo('url');
wp_redirect($redirect);
}
示例6: download_product
/**
* Check if we need to download a file and check validity.
*/
public static function download_product()
{
$product_id = absint($_GET['download_file']);
$product = wc_get_product($product_id);
$data_store = WC_Data_Store::load('customer-download');
if (!$product || !isset($_GET['key'], $_GET['order'])) {
self::download_error(__('Invalid download link.', 'woocommerce'));
}
$download_ids = $data_store->get_downloads(array('user_email' => sanitize_email(str_replace(' ', '+', $_GET['email'])), 'order_key' => wc_clean($_GET['order']), 'product_id' => $product_id, 'download_id' => wc_clean(preg_replace('/\\s+/', ' ', $_GET['key'])), 'orderby' => 'downloads_remaining', 'order' => 'DESC', 'limit' => 1, 'return' => 'ids'));
if (empty($download_ids)) {
self::download_error(__('Invalid download link.', 'woocommerce'));
}
$download = new WC_Customer_Download(current($download_ids));
self::check_order_is_valid($download);
self::check_downloads_remaining($download);
self::check_download_expiry($download);
self::check_download_login_required($download);
do_action('woocommerce_download_product', $download->get_user_email(), $download->get_order_key(), $download->get_product_id(), $download->get_user_id(), $download->get_download_id(), $download->get_order_id());
$count = $download->get_download_count();
$remaining = $download->get_downloads_remaining();
$download->set_download_count($count++);
$download->set_downloads_remaining($remaining--);
$download->save();
self::download($product->get_file_download_path($download->get_download_id()), $download->get_product_id());
}
示例7: edd_pup_sanitize_save
/**
* Sanitizes posted data from before saving an email
*
* @access public
* @param mixed $posted
* @return int email id of saved email
*/
function edd_pup_sanitize_save($data)
{
// Convert form data to array
if (isset($data['form'])) {
$form = $data['form'];
$data = array();
parse_str($form, $data);
}
// Sanitize our data
$data['message'] = wp_kses_post($data['message']);
$data['email-id'] = isset($data['email-id']) ? absint($data['email-id']) : 0;
$data['recipients'] = absint($data['recipients']);
$data['from_name'] = sanitize_text_field($data['from_name']);
$data['from_email'] = sanitize_email($data['from_email']);
$data['title'] = sanitize_text_field($data['title'], 'ID:' . $data['email-id'], 'save');
$data['subject'] = sanitize_text_field($data['subject']);
$data['bundle_1'] = sanitize_text_field($data['bundle_1']);
$data['bundle_2'] = isset($data['bundle_2']) ? 1 : 0;
// Sanitize products array and convert to ID => name format
if (isset($data['products'])) {
foreach ($data['products'] as $product) {
$prodid = absint($product);
$products[absint($prodid)] = get_the_title(absint($prodid));
}
$data['products'] = $products;
}
return edd_pup_save_email($data, $data['email-id']);
}
示例8: submit
/**
* Called via AJAX to submit the subscribe form.
*
* @since 1.5.2
* @return string The JSON encoded response.
*/
public function submit()
{
$name = isset($_POST['name']) ? sanitize_text_field($_POST['name']) : false;
$email = isset($_POST['email']) ? sanitize_email($_POST['email']) : false;
$node_id = isset($_POST['node_id']) ? sanitize_text_field($_POST['node_id']) : false;
$result = array('action' => false, 'error' => false, 'message' => false, 'url' => false);
if ($email && $node_id) {
$module = FLBuilderModel::get_module($node_id);
$settings = $module->settings;
// Subscribe.
$instance = FLBuilderServices::get_service_instance($settings->service);
$response = $instance->subscribe($settings, $email, $name);
// Check for an error from the service.
if ($response['error']) {
$result['error'] = $response['error'];
} else {
$result['action'] = $settings->success_action;
if ('message' == $settings->success_action) {
$result['message'] = $settings->success_message;
} else {
$result['url'] = $settings->success_url;
}
}
} else {
$result['error'] = __('There was an error subscribing. Please try again.', 'fl-builder');
}
echo json_encode($result);
die;
}
示例9: sanitize_option
function sanitize_option($option, $value) {
switch ($option) {
case 'admin_email':
$value = sanitize_email($value);
break;
case 'default_post_edit_rows':
case 'mailserver_port':
case 'comment_max_links':
$value = abs((int) $value);
break;
case 'posts_per_page':
case 'posts_per_rss':
$value = (int) $value;
if ( empty($value) ) $value = 1;
if ( $value < -1 ) $value = abs($value);
break;
case 'default_ping_status':
case 'default_comment_status':
// Options that if not there have 0 value but need to be something like "closed"
if ( $value == '0' || $value == '')
$value = 'closed';
break;
case 'blogdescription':
case 'blogname':
if (current_user_can('unfiltered_html') == false)
$value = wp_filter_post_kses( $value );
break;
case 'blog_charset':
$value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value);
break;
case 'date_format':
case 'time_format':
case 'mailserver_url':
case 'mailserver_login':
case 'mailserver_pass':
case 'ping_sites':
case 'upload_path':
$value = strip_tags($value);
$value = wp_filter_kses($value);
break;
case 'gmt_offset':
$value = preg_replace('/[^0-9:.-]/', '', $value);
break;
case 'siteurl':
case 'home':
$value = clean_url($value);
break;
}
return $value;
}
示例10: save_post
/**
* Hooks into WordPress' save_post function
*/
public function save_post($post_id)
{
if (!isset($_POST['advanced_options_nonce'])) {
return $post_id;
}
$nonce = $_POST['advanced_options_nonce'];
if (!wp_verify_nonce($nonce, 'advanced_options_data')) {
return $post_id;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
foreach ($this->fields as $field) {
if (isset($_POST[$field['id']])) {
switch ($field['type']) {
case 'email':
$_POST[$field['id']] = sanitize_email($_POST[$field['id']]);
break;
case 'text':
$_POST[$field['id']] = sanitize_text_field($_POST[$field['id']]);
break;
}
update_post_meta($post_id, 'advanced_options_' . $field['id'], $_POST[$field['id']]);
} else {
if ($field['type'] === 'checkbox') {
update_post_meta($post_id, 'advanced_options_' . $field['id'], '0');
}
}
}
}
示例11: ajax_register
/**
* AJAX Register.
*
* @since 1.0.0
*/
public function ajax_register()
{
// First check the nonce, if it fails the function will break
check_ajax_referer('vr-ajax-register-nonce', 'vr-secure-register');
// Nonce is checked, Get to work
$info = array();
$info['user_nicename'] = $info['nickname'] = $info['display_name'] = $info['first_name'] = $info['user_login'] = sanitize_user($_POST['register_username']);
$info['user_pass'] = sanitize_text_field($_POST['register_pwd']);
$info['user_email'] = sanitize_email($_POST['register_email']);
// Register the user
$user_register = wp_insert_user($info);
if (is_wp_error($user_register)) {
$error = $user_register->get_error_codes();
if (in_array('empty_user_login', $error)) {
echo json_encode(array('success' => false, 'message' => __($user_register->get_error_message('empty_user_login'))));
} elseif (in_array('existing_user_login', $error)) {
echo json_encode(array('success' => false, 'message' => __('This username already exists.', 'VRC')));
} elseif (in_array('existing_user_email', $error)) {
echo json_encode(array('success' => false, 'message' => __('This email is already registered.', 'VRC')));
}
} else {
/**
* Object: VR_Member class.
*
* @since 1.0.0
*/
$vr_member_object = new VR_Member();
$vr_member_object->ajax_user_authenticate($info['user_login'], $info['user_pass'], __('Registration', 'VRC'));
}
die;
}
示例12: lsx_sanitize_email
/**
* Sanitizes an email input
*
* @package lsx-theme
* @subpackage sanitize
*
* @param string $email
* @param obj $setting
* @return string $default
*/
function lsx_sanitize_email($email, $setting)
{
// Sanitize $input as a hex value without the hash prefix.
$email = sanitize_email($email);
// If $email is a valid email, return it; otherwise, return the default.
return !is_null($email) ? $email : $setting->default;
}
示例13: wc_downloadable_file_permission
/**
* Grant downloadable product access to the file identified by $download_id
*
* @access public
* @param string $download_id file identifier
* @param int $product_id product identifier
* @param WC_Order $order the order
* @return int|bool insert id or false on failure
*/
function wc_downloadable_file_permission($download_id, $product_id, $order)
{
global $wpdb;
if ($order->status == 'processing' && get_option('woocommerce_downloads_grant_access_after_payment') == 'no') {
return false;
}
$user_email = sanitize_email($order->billing_email);
$limit = trim(get_post_meta($product_id, '_download_limit', true));
$expiry = trim(get_post_meta($product_id, '_download_expiry', true));
$limit = empty($limit) ? '' : absint($limit);
// Default value is NULL in the table schema
$expiry = empty($expiry) ? null : absint($expiry);
if ($expiry) {
$order_completed_date = date_i18n("Y-m-d", strtotime($order->completed_date));
$expiry = date_i18n("Y-m-d", strtotime($order_completed_date . ' + ' . $expiry . ' DAY'));
}
$data = apply_filters('woocommerce_downloadable_file_permission_data', array('download_id' => $download_id, 'product_id' => $product_id, 'user_id' => absint($order->user_id), 'user_email' => $user_email, 'order_id' => $order->id, 'order_key' => $order->order_key, 'downloads_remaining' => $limit, 'access_granted' => current_time('mysql'), 'download_count' => 0));
$format = apply_filters('woocommerce_downloadable_file_permission_format', array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d'), $data);
if (!is_null($expiry)) {
$data['access_expires'] = $expiry;
$format[] = '%s';
}
// Downloadable product - give access to the customer
$result = $wpdb->insert($wpdb->prefix . 'woocommerce_downloadable_product_permissions', $data, $format);
do_action('woocommerce_grant_product_download_access', $data);
return $result ? $wpdb->insert_id : false;
}
示例14: koabase_get_socials_icon
function koabase_get_socials_icon()
{
$facebook_url = $twitter_url = $googleplus_url = $skype_link = $flickr_link = $youtube_url = $rss_link = $instagram_url = $pinterest_url = $email_link = '';
if ($facebook_url != '') {
$out .= '<a class="facebook" href="' . esc_url($facebook_url) . '" target="_blank"></a>';
}
if ($twitter_url != '') {
$out .= '<a class="twitter" href="' . esc_url($twitter_url) . '" target="_blank"></a>';
}
if ($googleplus_url != '') {
$out .= '<a class="googleplus" href="' . esc_url($googleplus_url) . '" target="_blank"></a>';
}
if ($skype_link != '') {
$out .= '<a class="skype" href="skype:' . esc_attr($skype_link) . '?call"></a>';
}
if ($flickr_link != '') {
$out .= '<a class="flickr" href="' . esc_url($flickr_link) . '" target="_blank"></a>';
}
if ($youtube_url != '') {
$out .= '<a class="youtube" href="' . esc_url($youtube_url) . '" target="_blank"></a>';
}
if ($rss_link != '') {
$out .= '<a class="rss" href="' . esc_url($rss_link) . '" target="_blank"></a>';
}
if ($instagram_url != '') {
$out .= '<a class="instagram" href="' . esc_url($instagram_url) . '" target="_blank"></a>';
}
if ($pinterest_url != '') {
$out .= '<a class="pinterest" href="' . esc_url($pinterest_url) . '" target="_blank"></a>';
}
if ($email_link != '') {
$out .= '<a class="email" href="mailto:' . sanitize_email($email_link) . '"></a>';
}
echo '<div class="social-icon">' . $out . '</div>';
}
示例15: hermes_contact_form_send_email
/**
* hermes_contact_form_send_email called by ajax from client-validation.js
* @return array the feedback array with the keys
* - status: error|success
* - message: string
*/
function hermes_contact_form_send_email()
{
$feedback = array('status' => 'error');
// check if the CSRF token is valid
if (!@isset($_POST['csrf_token']) || !wp_verify_nonce($_POST['csrf_token'], 'contact_form_token')) {
$feedback['message'] = 'Wrong CSRF token.';
die(json_encode($feedback));
}
if (!@isset($_POST['name']) || !@isset($_POST['email']) || !@isset($_POST['message'])) {
$feedback['message'] = 'The form is incomplete.';
die(json_encode($feedback));
}
// Sanitize
$name = sanitize_text_field($_POST['name']);
$email = sanitize_email($_POST['email']);
$message = sanitize_text_field($_POST['message']);
// Validations
hermes_contact_form_validate_form($name, $email, $message);
$headers = 'From: ' . $name . ' <' . $email . '>' . "\r\n";
$to = "florian.goussin@gmail.com";
$subject = 'EML foundation website message';
$message = '<p>' . $message . '</p><p>' . $name . '</p>';
// Send the email
if (wp_mail($to, $subject, $message, $headers)) {
$feedback['status'] = 'success';
$feedback['message'] = 'Message has been sent succesfully!';
} else {
$feedback['message'] = 'Impossible to send the message';
}
die(json_encode($feedback));
}