本文整理汇总了PHP中wp_kses_data函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_kses_data函数的具体用法?PHP wp_kses_data怎么用?PHP wp_kses_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_kses_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))));
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
示例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
}
示例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'));
}
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}