本文整理汇总了PHP中wp_kses_data函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_kses_data函数的具体用法?PHP wp_kses_data怎么用?PHP wp_kses_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_kses_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_attachment
public function get_attachment()
{
if ('POST' != $_SERVER['REQUEST_METHOD']) {
die(json_encode(array('success' => false, 'message' => __('Error: only post method allowed.', APP_TD))));
}
$required = array('ID', 'url', 'title');
foreach ($required as $key) {
if (!isset($_POST[$key])) {
die(json_encode(array('success' => false, 'message' => __('Error: missing required post data.', APP_TD))));
}
}
$post_id = absint($_POST['ID']);
$url = appthemes_clean($_POST['url']);
$title = wp_kses_data($_POST['title']);
$attachment = $this->_get_attachment($post_id, $url);
if (!$attachment) {
$attachment = $this->alt_attachment($url, $post_id, $title);
}
if ($attachment) {
$attachment->thumbnail_html = $this->display_attachment_thumbnail($attachment);
$attachment->upload_date = appthemes_display_date($attachment->post_date, 'date');
$attachment->dimensions = $this->display_attachment_dimensions($attachment);
die(json_encode($attachment));
}
die(json_encode(array('success' => false, 'message' => __('Error: attachment not found.', APP_TD))));
}
开发者ID:kalushta,项目名称:darom,代码行数:26,代码来源:class-attachments-metabox.php
示例2: update
/**
* update function.
*
* @see WP_Widget->update
* @access public
* @param array $new_instance
* @param array $old_instance
* @return array
*/
function update($new_instance, $old_instance)
{
$instance = $old_instance;
if (!$this->settings) {
return $instance;
}
foreach ($this->settings as $key => $setting) {
switch ($setting['type']) {
case 'textarea':
if (current_user_can('unfiltered_html')) {
$instance[$key] = $new_instance[$key];
} else {
$instance[$key] = wp_kses_data($new_instance[$key]);
}
break;
case 'multicheck':
$instance[$key] = maybe_serialize($new_instance[$key]);
break;
case 'text':
case 'checkbox':
case 'select':
case 'number':
case 'colorpicker':
$instance[$key] = sanitize_text_field($new_instance[$key]);
break;
default:
$instance[$key] = apply_filters('listify_widget_update_type_' . $setting['type'], $new_instance[$key], $key, $setting);
break;
}
}
$this->flush_widget_cache();
return $instance;
}
开发者ID:GaryJones,项目名称:dockerfiles,代码行数:42,代码来源:class-widget.php
示例3: polefitness_cart_link
function polefitness_cart_link()
{
?>
<a class="cart-contents" href="<?php
echo esc_url(WC()->cart->get_cart_url());
?>
" title="<?php
_e('Visa varukorgen', 'polefitness');
?>
">
<img src="<?php
echo get_template_directory_uri();
?>
/images/cart.svg" height="16" width="16">
<span class="count">
<?php
$product = wp_kses_data(sprintf('%d', WC()->cart->get_cart_contents_count()));
if ($product == 1) {
echo $product . ' <span class="product">vara</span>';
} else {
echo $product . ' <span class="product">varor</span>';
}
?>
</span>
<span class="amount">
(<?php
echo wp_kses_data(WC()->cart->get_cart_subtotal());
?>
)
</span>
</a>
<?php
}
开发者ID:NoviumDesign,项目名称:polefitness,代码行数:33,代码来源:template-tags.php
示例4: get_post
function get_post($validate = false, $ticket_id = 0, $attendee_index = 0)
{
$this->field_values = array();
foreach ($this->form_fields as $field) {
$fieldid = $field['fieldid'];
$value = '';
$request = $_REQUEST;
if (isset($_REQUEST['em_attendee_fields'][$ticket_id][$fieldid][$attendee_index]) && $_REQUEST['em_attendee_fields'][$ticket_id][$fieldid][$attendee_index] != '') {
if (!is_array($_REQUEST['em_attendee_fields'][$ticket_id][$fieldid][$attendee_index])) {
$this->field_values[$fieldid] = wp_kses_data(stripslashes($_REQUEST['em_attendee_fields'][$ticket_id][$fieldid][$attendee_index]));
} elseif (is_array($_REQUEST['em_attendee_fields'][$ticket_id][$fieldid][$attendee_index])) {
$this->field_values[$fieldid] = $_REQUEST['em_attendee_fields'][$ticket_id][$fieldid][$attendee_index];
}
}
//dates and time are special
if (in_array($field['type'], array('date', 'time'))) {
if (!empty($_REQUEST['em_attendee_fields'][$ticket_id][$fieldid]['start'][$attendee_index])) {
$this->field_values[$fieldid] = $_REQUEST['em_attendee_fields'][$ticket_id][$fieldid]['start'][$attendee_index];
}
if ($field['options_' . $field['type'] . '_range'] && !empty($_REQUEST['em_attendee_fields'][$ticket_id][$fieldid]['end'][$attendee_index])) {
$this->field_values[$fieldid] .= ',' . $_REQUEST['em_attendee_fields'][$ticket_id][$fieldid]['end'][$attendee_index];
}
}
}
if ($validate) {
return $this->validate();
}
return true;
}
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:29,代码来源:attendee-form.php
示例5: videotube_author_header
function videotube_author_header()
{
global $videotube, $wp_query;
//print_r( $wp_query );
$header = null;
$user_id = isset($wp_query->query_vars['author']) ? $wp_query->query_vars['author'] : null;
$user_data = get_user_by('id', $user_id);
if ($videotube['enable_channelpage'] == 0 || !isset($videotube['enable_channelpage'])) {
$header .= '<h3>' . $user_data->display_name . '</h3>';
} else {
$header .= '
<div class="channel-header">
<div class="channel-image">' . get_avatar($user_id) . '</div>
<div class="channel-info">
<h3>' . $user_data->display_name . '</h3>
<span class="channel-item"><strong>' . __('Videos:', 'mars') . '</strong> ' . mars_get_user_postcount($user_id) . '</span>
<span class="channel-item"><strong>' . __('Likes:', 'mars') . '</strong> ' . mars_get_user_metacount($user_id, 'like_key') . '</span>
<span class="channel-item"><strong>' . __('Views:', 'mars') . '</strong> ' . mars_get_user_metacount($user_id, 'count_viewed') . '</span>
';
if ($user_data->user_url) {
$header .= '<span class="channel-item"><a ref="nofollow" href="' . $user_data->user_url . '"><i class="fa fa-home"></i></a></span>';
}
$header .= '
</div>
<div class="channel-description">' . wp_kses_data(nl2br($user_data->description)) . '</div>
</div>
<h3>Videos by: ' . $user_data->display_name . '</h3>
';
}
return $header;
}
开发者ID:chypriote,项目名称:wp-video,代码行数:35,代码来源:Mars_Author_Page.php
示例6: odin_cart_link
/**
* Cart Link
* Displayed a link to the cart including the number of items present and the cart total
*
* @since 2.2.6
*
* @param array $settings Settings
*
* @return array Settings
*/
function odin_cart_link()
{
if (is_cart()) {
$class = 'current-menu-item active';
} else {
$class = '';
}
?>
<li class="<?php
echo esc_attr($class);
?>
">
<a class="cart-contents" href="<?php
echo esc_url(WC()->cart->get_cart_url());
?>
" title="<?php
_e('View your shopping cart', 'odin');
?>
">
<?php
echo wp_kses_data(WC()->cart->get_cart_total());
?>
<span class="count"><?php
echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'odin'), WC()->cart->get_cart_contents_count()));
?>
</span>
</a>
</li>
<?php
}
开发者ID:KhallebRibeiro,项目名称:odin,代码行数:40,代码来源:template-tags.php
示例7: save_settings
function save_settings()
{
if (!empty($_POST) && isset($_POST['nb-submit'])) {
if (!isset($_POST['nb_settings_nonce_field']) || !wp_verify_nonce($_POST['nb_settings_nonce_field'], 'nb_settings_action')) {
} else {
global $notice_bar_themes;
$settings['status'] = esc_attr($_POST[NB_SETTINGS_NAME]['status']);
$settings['theme'] = esc_attr($_POST[NB_SETTINGS_NAME]['theme']);
$theme_settings_name = 'theme_' . $settings['theme'] . '_settings';
$settings[$theme_settings_name]['message'] = wp_kses_data($_POST[NB_SETTINGS_NAME][$theme_settings_name]['message']);
$settings[$theme_settings_name]['position'] = esc_attr($_POST[NB_SETTINGS_NAME][$theme_settings_name]['position']);
$settings[$theme_settings_name]['button_label'] = sanitize_text_field($_POST[NB_SETTINGS_NAME][$theme_settings_name]['button_label']);
$settings[$theme_settings_name]['button_link'] = esc_url_raw($_POST[NB_SETTINGS_NAME][$theme_settings_name]['button_link']);
$settings[$theme_settings_name]['button_target'] = esc_attr($_POST[NB_SETTINGS_NAME][$theme_settings_name]['button_target']);
$settings[$theme_settings_name]['background_color'] = sanitize_text_field($_POST[NB_SETTINGS_NAME][$theme_settings_name]['background_color']);
$settings[$theme_settings_name]['font_color'] = sanitize_text_field($_POST[NB_SETTINGS_NAME][$theme_settings_name]['font_color']);
$settings[$theme_settings_name]['font_size'] = absint($_POST[NB_SETTINGS_NAME][$theme_settings_name]['font_size']);
$settings[$theme_settings_name]['bar_control'] = esc_attr($_POST[NB_SETTINGS_NAME][$theme_settings_name]['bar_control']);
$theme_settings = $notice_bar_themes->theme_settings($settings['theme']);
if ('' === $settings[$theme_settings_name]['message']) {
$settings[$theme_settings_name]['message'] = $theme_settings['message'];
}
if ($settings[$theme_settings_name]['font_size'] < 1) {
$settings[$theme_settings_name]['font_size'] = $theme_settings['font_size'];
}
update_option(NB_SETTINGS_NAME, $settings);
// set_transient( 'notice_bar_success_message', __( 'Settings saved.', 'notice-bar' ), 0 );
wp_redirect(admin_url('admin.php?page=notice-bar&success=true'));
}
}
}
开发者ID:wensolutions,项目名称:notice-bar,代码行数:31,代码来源:settings.php
示例8: update
/**
* update function.
*
* @see WP_Widget->update
* @access public
* @param array $new_instance
* @param array $old_instance
* @return array
*/
function update($new_instance, $old_instance)
{
$instance = $old_instance;
if (!$this->settings) {
return $instance;
}
foreach ($this->settings as $key => $setting) {
switch ($setting['type']) {
case 'textarea':
if (current_user_can('unfiltered_html')) {
$instance[$key] = $new_instance[$key];
} else {
$instance[$key] = wp_kses_data($new_instance[$key]);
}
break;
case 'number':
$instance[$key] = absint($new_instance[$key]);
break;
default:
$instance[$key] = sanitize_text_field($new_instance[$key]);
break;
}
}
$this->flush_widget_cache();
return $instance;
}
开发者ID:evinw,项目名称:project_3dBP,代码行数:35,代码来源:class-widget.php
示例9: get_shortcode_date_format
public function get_shortcode_date_format()
{
if (get_option('mdnooz_shortcode_date_format')) {
return wp_kses_data(strip_tags(get_option('mdnooz_shortcode_date_format')));
} else {
return $this->get_default_date_format();
}
}
开发者ID:WildCodeSchool,项目名称:projet-maison_ados_dreux,代码行数:8,代码来源:NoozCore.php
示例10: rbs_ajax_create_article
function rbs_ajax_create_article()
{
if (isset($_POST['galleryid']) && (int) $_POST['galleryid'] && isset($_POST['categoryid']) && (int) $_POST['categoryid']) {
$galleryid = intval($_POST['galleryid']);
$categoryid = intval($_POST['categoryid']);
$post_info = get_post($galleryid);
if (gettype($post_info) != 'object') {
echo '<p><strong>' . __('Post not created. Error: ', 'rbs_gallery') . '</strong><br><p>empty gallery id</p>';
die;
}
$Poster = new PostController();
$title = $post_info->post_title;
if (isset($_POST['articletitle']) && $_POST['articletitle']) {
$title = wp_kses_data($_POST['articletitle']);
}
$slug = 'post_' . $post_info->post_name;
if (isset($_POST['articleslug']) && $_POST['articleslug']) {
$slug = wp_kses_data($_POST['articleslug']);
}
$Poster->set_title($title);
$Poster->add_category(array($categoryid));
$Poster->set_type("post");
$Poster->set_content('[robo-gallery id="' . $galleryid . '"]');
$Poster->set_author_id(get_current_user_id());
$Poster->set_post_slug($slug);
$Poster->set_post_state("publish");
$Poster->create();
$posts_id = get_post_meta($galleryid, 'rbs_gallery_id', true);
if (!$posts_id) {
$posts_id = array();
} else {
$posts_id = json_decode($posts_id, true);
}
$postId = $Poster->PC_current_post_id;
$posts_id[] = $postId;
update_post_meta($galleryid, 'rbs_gallery_id', json_encode($posts_id, JSON_FORCE_OBJECT));
if (isset($Poster->errors) && count($Poster->errors)) {
echo '<p><strong>' . __('Post not created. Error: ', 'rbs_gallery') . '</strong><br>';
for ($i = 0; $i < count($Poster->errors); $i++) {
$error = $Poster->errors[$i];
echo ' - ' . $error . '<br>';
}
echo '</p>';
} else {
echo '<h3>' . __('Post ', 'rbs_gallery') . '"' . $title . '"' . __(' created', 'rbs_gallery') . '</h3>';
echo '<p>
<a href="' . esc_url(get_edit_post_link($postId)) . '" class="button button-small" target="_blank">
' . __('Edit', 'rbs_gallery') . '</a>
<a href="' . esc_url(get_permalink($postId)) . '" class="button button-small" target="_blank">
' . __('Preview', 'rbs_gallery') . '</a>
</p>';
}
} else {
echo '<p><strong>' . __('Error: input value', 'rbs_gallery') . '</strong></p>';
}
die;
}
开发者ID:mossavage,项目名称:robo-gallery,代码行数:57,代码来源:rbs_create_post_ajax.php
示例11: sanitize
/**
* Sanitize the field value.
*
* @param mixed $value
* @return mixed
*/
public function sanitize($value)
{
switch ($this->type) {
default:
if (!current_user_can('unfiltered_html')) {
$value = wp_kses_data($value);
}
}
return $value;
}
开发者ID:Bonus3,项目名称:ib-educator-theme,代码行数:16,代码来源:user-meta.php
示例12: sanitize_admin_options
/**
* Sanitize options.
*
* @param array $input
* @return array
*/
public function sanitize_admin_options($input)
{
foreach ($input as $option_name => $value) {
switch ($option_name) {
case 'description':
$input[$option_name] = wp_kses_data($value);
break;
}
}
return $input;
}
开发者ID:Bonus3,项目名称:ibeducator,代码行数:17,代码来源:Check.php
示例13: update
function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = sprintf('%s', strip_tags(stripslashes($new_instance['title'])));
$instance['description'] = sprintf('%s', wp_kses_data($new_instance['description']));
$instance['rss_text'] = sprintf('%s', strip_tags(stripslashes($new_instance['rss_text'])));
$instance['email'] = sprintf('%s', wp_kses_data($new_instance['email']));
if (get_option('thesis_widget_subscriptions')) {
delete_option('thesis_widget_subscriptions');
}
return $instance;
}
开发者ID:iaakash,项目名称:chriskeef,代码行数:12,代码来源:widgets.php
示例14: render_sections
public function render_sections()
{
$out = '<ul class="tf_properties_list">';
foreach ($this->properties() as $property => $attribute) {
$out .= sprintf('<li id="%s_control" class="tf_properties_list_expanded tf_styling_property_%s">
<strong class="tf_property_title %s"%s>%s</strong>
<div class="tf_property_wrap"></div>
</li>', esc_attr($attribute['name']), $property, 'customcss' === $property ? 'tf_expand_section' : 'tf_toggle_property_section', 'customcss' === $property ? 'data-expand="customcss"' : '', wp_kses_data($attribute['label']));
$this->initialize_helpers($attribute);
$this->js_controls[$attribute['name']]['name'] = $attribute['name'];
$this->js_controls[$attribute['name']]['type'] = $attribute['type'];
}
$out .= '</ul>';
// Pass data for templates
$this->js_data = array('core' => array('background_control' => array('labels' => array('image' => __('Background Image', 'themify-flow'), 'repeatAll' => __('Repeat All', 'themify-flow'), 'repeatHorizontal' => __('Repeat Horizontal', 'themify-flow'), 'repeatVertical' => __('Repeat Vertical', 'themify-flow'), 'noRepeat' => __('No Repeat', 'themify-flow'), 'fullcover' => __('Fullcover', 'themify-flow'), 'leftTop' => __('Left Top', 'themify-flow'), 'leftCenter' => __('Left Center', 'themify-flow'), 'leftBottom' => __('Left Bottom', 'themify-flow'), 'rightTop' => __('Right Top', 'themify-flow'), 'rightCenter' => __('Right Center', 'themify-flow'), 'rightBottom' => __('Right Bottom', 'themify-flow'), 'centerTop' => __('Center Top', 'themify-flow'), 'centerCenter' => __('Center Center', 'themify-flow'), 'centerBottom' => __('Center Bottom', 'themify-flow'), 'noBackgroundImage' => __('No Background Image', 'themify-flow'), 'backgroundColor' => __('Background Color', 'themify-flow'), 'transparent' => __('Transparent', 'themify-flow'))), 'padding_control' => array('labels' => array('padding' => __('Padding', 'themify-flow'), 'paddingTop' => __('Padding Top', 'themify-flow'), 'paddingRight' => __('Padding Right', 'themify-flow'), 'paddingBottom' => __('Padding Bottom', 'themify-flow'), 'paddingLeft' => __('Padding Left', 'themify-flow'), 'applyToAll' => __('Apply to all padding.', 'themify-flow'))), 'margin_control' => array('labels' => array('margin' => __('Margin', 'themify-flow'), 'marginTop' => __('Margin Top', 'themify-flow'), 'marginRight' => __('Margin Right', 'themify-flow'), 'marginBottom' => __('Margin Bottom', 'themify-flow'), 'marginLeft' => __('Margin Left', 'themify-flow'), 'auto' => __('Auto', 'themify-flow'), 'applyToAll' => __('Apply to all margin.', 'themify-flow'))), 'width_control' => array('labels' => array('width' => __('Width', 'themify-flow'), 'auto' => __('Auto', 'themify-flow'))), 'height_control' => array('labels' => array('height' => __('Height', 'themify-flow'), 'auto' => __('Auto', 'themify-flow'))), 'min-width_control' => array('labels' => array('min-width' => __('Minimum Width', 'themify-flow'))), 'max-width_control' => array('labels' => array('max-width' => __('Maximum Width', 'themify-flow'))), 'min-height_control' => array('labels' => array('min-height' => __('Minimum Height', 'themify-flow'))), 'position_control' => array('labels' => array('position' => __('Position', 'themify-flow'), 'absolute' => __('Absolute', 'themify-flow'), 'relative' => __('Relative', 'themify-flow'), 'fixed' => __('Fixed', 'themify-flow'), 'static' => __('Static', 'themify-flow'), 'top' => __('Top', 'themify-flow'), 'right' => __('Right', 'themify-flow'), 'bottom' => __('Bottom', 'themify-flow'), 'left' => __('Left', 'themify-flow'), 'auto' => __('Auto', 'themify-flow'))), 'float_control' => array('labels' => array('float' => __('Float', 'themify-flow'), 'left' => __('Left', 'themify-flow'), 'right' => __('Right', 'themify-flow'), 'none' => __('None', 'themify-flow'))), 'opacity_control' => array('labels' => array()), 'z-index_control' => array('labels' => array()), 'customcss_control' => array('labels' => array())), 'controls' => $this->js_controls);
wp_localize_script('tf-view-styling-control-js', '_tf_styling', $this->js_data);
return $out;
}
开发者ID:jhostetter,项目名称:wp_intern_themes,代码行数:18,代码来源:class-tf-styling-control.php
示例15: render_content
/**
* Render action.
*
* @since 1.0.0
*/
public function render_content()
{
?>
<label>
<span class="customize-control-title">
<?php
esc_html_e('Site Icon');
// We use the Wordpress context for this.
?>
</span>
<span class="description customize-control-description">
<?php
echo wp_kses_data(__('Please manage your site icon through <a href="themes.php?page=site_icon_pro_options">Appearance -> Site Icon Pro</a>.', 'site-icon-pro'));
?>
</span>
</label>
<?php
}
开发者ID:BlissfulPlugins,项目名称:site-icon-pro,代码行数:23,代码来源:class-customize-control.php
示例16: sanitize
public function sanitize($value)
{
$allow_html = $this->getSetting('allow_html');
// Sanitize
if ('limited' == $allow_html) {
$value = wp_kses_data($value);
// Only some inline tags
} elseif ('raw' == $allow_html) {
$value = $value;
// Any HTML tags and attr, even 'script'. RAW
} elseif ($allow_html === false) {
$value = strip_tags($value);
// No tags allowed at all
} else {
$value = wp_kses_post($value);
// Default. Can use only the tags that are allowed in posts.
}
return $value;
}
开发者ID:ZeroWP,项目名称:AdminPage,代码行数:19,代码来源:field.class.php
示例17: storefront_cart_link
function storefront_cart_link()
{
?>
<a class="cart-contents" href="<?php
echo esc_url(WC()->cart->get_cart_url());
?>
" title="<?php
_e('View your shopping cart', 'storefront');
?>
">
<?php
echo wp_kses_data(WC()->cart->get_cart_subtotal());
?>
<span class="count"><?php
echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront'), WC()->cart->get_cart_contents_count()));
?>
</span>
</a>
<?php
}
开发者ID:karyband,项目名称:Rettner-Website,代码行数:20,代码来源:template-tagsnew.php
示例18: recent_reviews
/**
* Recent reviews widget
*/
public function recent_reviews()
{
global $wpdb;
$comments = $wpdb->get_results("SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt\n\t\tFROM {$wpdb->comments}\n\t\tLEFT JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID)\n\t\tWHERE comment_approved = '1'\n\t\tAND comment_type = ''\n\t\tAND post_password = ''\n\t\tAND post_type = 'product'\n\t\tORDER BY comment_date_gmt DESC\n\t\tLIMIT 8");
if ($comments) {
echo '<ul>';
foreach ($comments as $comment) {
echo '<li>';
echo get_avatar($comment->comment_author, '32');
$rating = intval(get_comment_meta($comment->comment_ID, 'rating', true));
echo '<div class="star-rating" title="' . esc_attr($rating) . '">
<span style="width:' . $rating * 20 . '%">' . $rating . ' ' . __('out of 5', 'woocommerce') . '</span></div>';
echo '<h4 class="meta"><a href="' . get_permalink($comment->ID) . '#comment-' . absint($comment->comment_ID) . '">' . esc_html__(apply_filters('woocommerce_admin_dashboard_recent_reviews', $comment->post_title, $comment)) . '</a> ' . __('reviewed by', 'woocommerce') . ' ' . esc_html($comment->comment_author) . '</h4>';
echo '<blockquote>' . wp_kses_data($comment->comment_excerpt) . ' [...]</blockquote></li>';
}
echo '</ul>';
} else {
echo '<p>' . __('There are no product reviews yet.', 'woocommerce') . '</p>';
}
}
开发者ID:vkolova,项目名称:bgscena,代码行数:23,代码来源:class-wc-admin-dashboard.php
示例19: e_commerce_cart_link
function e_commerce_cart_link()
{
if (is_woocommerce_activated()) {
?>
<div class="cart-contents cart_totals">
<a href="<?php
echo esc_url(WC()->cart->get_cart_url());
?>
" title="<?php
_e('View cart', 'e-commerce');
?>
">
<span class="cart-icon"></span><span class="subtotal"><?php
echo wp_kses_data(WC()->cart->get_cart_subtotal());
?>
</span> <span class="count"><?php
echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'e-commerce'), WC()->cart->get_cart_contents_count()));
?>
</span>
</a>
</div>
<?php
}
}
开发者ID:kuem2405,项目名称:backend,代码行数:24,代码来源:woocommerce.php
示例20: em_booking_add_registration
/**
* Decides whether to register a user based on a certain booking that is to be added
* @param EM_Booking $EM_Booking
*/
function em_booking_add_registration($EM_Booking)
{
global $EM_Notices;
//Does this user need to be registered first?
$registration = true;
if ((!is_user_logged_in() && get_option('dbem_bookings_anonymous') || EM_Bookings::is_registration_forced()) && !get_option('dbem_bookings_registration_disable')) {
//find random username - less options for user, less things go wrong
$username_root = explode('@', wp_kses_data($_REQUEST['user_email']));
$username_root = $username_rand = sanitize_user($username_root[0], true);
while (username_exists($username_rand)) {
$username_rand = $username_root . rand(1, 1000);
}
$_REQUEST['dbem_phone'] = !empty($_REQUEST['dbem_phone']) ? wp_kses_data($_REQUEST['dbem_phone']) : '';
//fix to prevent warnings
$_REQUEST['user_name'] = !empty($_REQUEST['user_name']) ? wp_kses_data($_REQUEST['user_name']) : '';
//fix to prevent warnings
$user_data = array('user_login' => $username_rand, 'user_email' => $_REQUEST['user_email'], 'user_name' => $_REQUEST['user_name'], 'dbem_phone' => $_REQUEST['dbem_phone']);
$id = em_register_new_user($user_data);
if (is_numeric($id)) {
$EM_Person = new EM_Person($id);
$EM_Booking->person_id = $id;
$feedback = get_option('dbem_booking_feedback_new_user');
$EM_Notices->add_confirm($feedback);
add_action('em_bookings_added', 'em_new_user_notification');
} else {
$registration = false;
if (is_object($id) && get_class($id) == 'WP_Error') {
/* @var $id WP_Error */
if ($id->get_error_code() == 'email_exists') {
$EM_Notices->add_error(get_option('dbem_booking_feedback_email_exists'));
} else {
$EM_Notices->add_error($id->get_error_messages());
}
} else {
$EM_Notices->add_error(get_option('dbem_booking_feedback_reg_error'));
}
}
} elseif ((!is_user_logged_in() || EM_Bookings::is_registration_forced()) && get_option('dbem_bookings_registration_disable')) {
//Validate name, phone and email
if ($EM_Booking->get_person_post()) {
//Save default person to booking
$EM_Booking->person_id = get_option('dbem_bookings_registration_user');
} else {
$registration = false;
}
} elseif (!is_user_logged_in()) {
$registration = false;
$EM_Notices->add_error(get_option('dbem_booking_feedback_log_in'));
} elseif (empty($EM_Booking->person_id)) {
//user must be logged in, so we make this person the current user id
$EM_Booking->person_id = get_current_user_id();
}
return apply_filters('em_booking_add_registration_result', $registration, $EM_Booking, $EM_Notices);
}
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:58,代码来源:em-functions.php
注:本文中的wp_kses_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论