本文整理汇总了PHP中wpex_sanitize_data函数的典型用法代码示例。如果您正苦于以下问题:PHP wpex_sanitize_data函数的具体用法?PHP wpex_sanitize_data怎么用?PHP wpex_sanitize_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpex_sanitize_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generates the CSS output
*
* @since 2.0.0
*/
public static function generate($output)
{
// Define main variables
$css = '';
/*-----------------------------------------------------------------------------------*/
/* - Logo Max Widths
/*-----------------------------------------------------------------------------------*/
// Desktop
if ($width = wpex_get_mod('logo_max_width')) {
$css .= '@media only screen and (min-width: 960px) {
#site-logo img {
max-width: ' . wpex_sanitize_data($width, 'px_pct') . ';
}
}';
}
// Tablet Portrait
if ($width = wpex_get_mod('logo_max_width_tablet_portrait')) {
$css .= '@media only screen and (min-width: 768px) and (max-width: 959px) {
#site-logo img {
max-width: ' . wpex_sanitize_data($width, 'px_pct') . ';
}
}';
}
// Phone
if ($width = wpex_get_mod('logo_max_width_phone')) {
$css .= '@media only screen and (max-width: 767px) {
#site-logo img {
max-width: ' . wpex_sanitize_data($width, 'px_pct') . ';
}
}';
}
/*-----------------------------------------------------------------------------------*/
/* - Other
/*-----------------------------------------------------------------------------------*/
// Fixes for full-width layout when custom background is added
if ('full-width' == wpex_global_obj('main_layout') && (wpex_get_mod('background_color') || wpex_get_mod('background_image'))) {
$css .= '.wpex-sticky-header-holder{background:none;}';
}
// Fix for Fonts In the Visual Composer
if (wpex_global_obj('vc_is_inline')) {
$css .= '.wpb_row .fa:before { box-sizing:content-box!important; -moz-box-sizing:content-box!important; -webkit-box-sizing:content-box!important; }';
}
// Remove header border if custom color is set
if (wpex_get_mod('header_background')) {
$css .= '.is-sticky #site-header{border-color:transparent;}';
}
// Overlay Header font size
if (wpex_global_obj('has_overlay_header') && ($font_size = get_post_meta(wpex_global_obj('post_id'), 'wpex_overlay_header_font_size', true))) {
$css .= '#site-navigation, #site-navigation .dropdown-menu a{font-size:' . intval($font_size) . 'px;}';
}
/*-----------------------------------------------------------------------------------*/
/* - Return CSS
/*-----------------------------------------------------------------------------------*/
if (!empty($css)) {
$output .= '/*ADVANCED STYLING CSS*/' . $css;
}
// Return output css
return $output;
}
示例2: loop_through_inline_css
/**
* Generates inline CSS for styling options
*
* @since 1.0.0
*/
public function loop_through_inline_css($return = 'css')
{
// Define vars
$add_css = '';
$elements_to_alter = '';
// Get customizer settings
$settings = wp_list_pluck($this->sections, 'settings');
// Return if there aren't any settings
if (empty($settings)) {
return;
}
// Loop through settings and find inline_css
foreach ($settings as $settings_array) {
foreach ($settings_array as $setting) {
// If setting shouldn't output css continue on to the next
if (!isset($setting['inline_css'])) {
continue;
}
// Get setting ID and if empty continue onto the next setting
$id = isset($setting['id']) ? $setting['id'] : '';
if (!$id) {
continue;
}
// Check if there is a default value
$default = isset($setting['default']) ? $setting['default'] : false;
// Get theme mod value and if empty continue onto the next setting
$theme_mod = get_theme_mod($id, $default);
// Return if theme mod is empty
if (!$theme_mod) {
continue;
}
// Extract vars
$inline_css = $setting['inline_css'];
// Make sure vars are defined
$sanitize = isset($inline_css['sanitize']) ? $inline_css['sanitize'] : '';
$target = isset($inline_css['target']) ? $inline_css['target'] : '';
$alter = isset($inline_css['alter']) ? $inline_css['alter'] : '';
$important = isset($inline_css['important']) ? '!important' : false;
// Target and alter vars are required, if they are empty continue onto the next setting
if (!$target && !$alter) {
continue;
}
// Sanitize data
if ($sanitize) {
$theme_mod = wpex_sanitize_data($theme_mod, $sanitize);
} else {
$theme_mod = $theme_mod;
}
// Save inline_css
if ($theme_mod) {
// Set to array if not
$target = is_array($target) ? $target : array($target);
// Loop through items
foreach ($target as $element) {
// Add to elements list if not already
if (!isset($elements_to_alter[$element])) {
$elements_to_alter[$element] = array('css' => '');
}
// Add css to element
if (is_array($alter)) {
foreach ($alter as $alter_val) {
$elements_to_alter[$element]['css'] .= $alter_val . ':' . $theme_mod . $important . ';';
}
} else {
$elements_to_alter[$element]['css'] .= $alter . ':' . $theme_mod . $important . ';';
}
}
}
// End theme_mod check
}
// End settings_array
}
// End settings loop
// No elements to alter so return null
if (!$elements_to_alter) {
return null;
}
// Loop through elements
foreach ($elements_to_alter as $element => $array) {
if (isset($array['css'])) {
$add_css .= $element . '{' . $array['css'] . '}';
}
}
// Return custom CSS
if ($add_css) {
return $add_css;
}
}
示例3: vcex_parse_lightbox_dims
// Parse lightbox dimensions
$lightbox_dimensions = vcex_parse_lightbox_dims($lightbox_dimensions);
// Set data attributes based on lightbox type
if ('iframe' == $lightbox_type) {
$button_classes[] = 'wpex-lightbox';
$data_attr[] = 'data-type="iframe"';
$data_attr[] = 'data-options="' . $lightbox_dimensions . '"';
} elseif ('image' == $lightbox_type) {
$button_classes[] = 'wpex-lightbox';
$data_attr[] = 'data-type="image"';
if ($lightbox_image) {
$url = wp_get_attachment_url($lightbox_image);
}
$inline_js[] = 'ilightbox';
} elseif ('video_embed' == $lightbox_type) {
$url = wpex_sanitize_data($url, 'embed_url');
$button_classes[] = 'wpex-lightbox';
$data_attr[] = 'data-type="iframe"';
$data_attr[] = 'data-options="' . $lightbox_dimensions . '"';
} elseif ('html5' == $lightbox_type) {
$lightbox_video_html5_webm = $lightbox_video_html5_webm ? $lightbox_video_html5_webm : $url;
$poster = wp_get_attachment_url($lightbox_poster_image);
$button_classes[] = 'wpex-lightbox';
$data_attr[] = 'data-type="video"';
$data_attr[] = 'data-options="' . $lightbox_dimensions . ', html5video: { webm: \'' . $lightbox_video_html5_webm . '\', poster: \'' . $poster . '\' }"';
} elseif ('quicktime' == $lightbox_type) {
$button_classes[] = 'wpex-lightbox';
$data_attr[] = 'data-type="video"';
$data_attr[] = 'data-options="' . $lightbox_dimensions . '"';
} else {
$button_classes[] = 'wpex-lightbox-autodetect';
示例4: array
}
$a_attrs = array();
// CUSTOM LIGHTBOX VIDEO - TOTAL SETTINGS
if (!empty($lightbox_video)) {
// Load lightbox skin
wpex_enqueue_ilightbox_skin();
// Esc lightbox video
$lightbox_video = esc_url($lightbox_video);
// Get lightbox dims
$lightbox_dimensions = vcex_parse_lightbox_dims($lightbox_dimensions);
if ($lightbox_iframe_type) {
// Add lightbox class
$a_attrs['class'] = 'wpex-lightbox';
if ('video_embed' == $lightbox_iframe_type) {
$a_attrs['class'] = 'wpex-lightbox';
$video_embed_url = wpex_sanitize_data($lightbox_video, 'embed_url');
$lightbox_video = $video_embed_url ? $video_embed_url : $lightbox_video;
$a_attrs['data-type'] = 'iframe';
$a_attrs['data-options'] = $lightbox_dimensions;
vcex_inline_js('ilightbox_single');
} elseif ('url' == $lightbox_iframe_type) {
$a_attrs['data-type'] = 'iframe';
$a_attrs['data-options'] = $lightbox_dimensions;
} elseif ('html5' == $lightbox_iframe_type) {
$poster = wp_get_attachment_image_src($img_id, 'full');
$poster = $poster[0];
$a_attrs['data-type'] = 'video';
$a_attrs['data-options'] = $lightbox_dimensions . ',html5video: { webm: \'' . $lightbox_video_html5_webm . '\', poster: \'' . $poster . '\' }';
} elseif ('quicktime' == $lightbox_iframe_type) {
$a_attrs['data-type'] = 'video';
$a_attrs['data-options'] = $lightbox_dimensions;
示例5: loop
/**
* Loop through settings
*
* @since 1.6.0
*/
public function loop($return = 'css')
{
// Define Vars
$css = '';
$fonts = array();
$elements = $this->elements();
$preview_styles = '';
// Loop through each elements that need typography styling applied to them
foreach ($elements as $element => $array) {
// Add empty css var
$add_css = '';
// Get target and current mod
$target = isset($array['target']) ? $array['target'] : '';
$get_mod = wpex_get_mod($element . '_typography');
// Attributes to loop through
if (!empty($array['attributes'])) {
$attributes = $array['attributes'];
} else {
$attributes = array('font-family', 'font-weight', 'font-style', 'font-size', 'color', 'line-height', 'letter-spacing', 'text-transform', 'margin');
}
// Loop through attributes
foreach ($attributes as $attribute) {
// Define val
$default = isset($array['defaults'][$attribute]) ? $array['defaults'][$attribute] : NULL;
$val = isset($get_mod[$attribute]) ? $get_mod[$attribute] : $default;
// If there is a value lets do something
if ($val) {
// Sanitize
$val = str_replace('"', '', $val);
// Sanitize data
$val = 'font-size' == $attribute ? wpex_sanitize_data($val, 'font_size') : $val;
$val = 'letter-spacing' == $attribute ? wpex_sanitize_data($val, 'px') : $val;
// Add quotes around font-family && font family to scripts array
if ('font-family' == $attribute) {
$fonts[] = $val;
$val = $val;
}
// Add to inline CSS
if ('css' == $return) {
$add_css .= $attribute . ':' . $val . ';';
} elseif ('preview_styles' == $return) {
$preview_styles['customizer-typography-' . $element . '-' . $attribute] = $target . '{' . $attribute . ':' . $val . ';}';
}
}
}
// Front-end inline CSS
if ($add_css && 'css' == $return) {
$css .= $target . '{' . $add_css . '}';
}
}
// Return CSS
if ('css' == $return && !empty($css)) {
$css = '/*TYPOGRAPHY*/' . $css;
return $css;
}
// Return styles
if ('preview_styles' == $return && !empty($preview_styles)) {
return $preview_styles;
}
// Return Fonts Array
if ('fonts' == $return && !empty($fonts)) {
return array_unique($fonts);
// Return only 1 of each font
}
}
示例6: create_admin_page
/**
* Settings page output
*
* @since 1.6.0
*/
public function create_admin_page()
{
?>
<div class="wrap wpex-theme-panel wpex-clr">
<h1><?php
esc_attr_e('Theme Panel', 'total');
?>
</h1>
<h2 class="nav-tab-wrapper">
<a href="#" class="nav-tab nav-tab-active"><?php
esc_attr_e('Features', 'total');
?>
</a>
<?php
// Customizer url
$customize_url = add_query_arg(array('return' => urlencode(wp_unslash($_SERVER['REQUEST_URI']))), 'customize.php');
?>
<a href="<?php
echo esc_url($customize_url);
?>
" class="nav-tab"><?php
esc_attr_e('Customize', 'total');
?>
</a>
</h2>
<div class="wpex-theme-panel-updated updated" style="border-color: #f0821e;display:none;">
<p>
<?php
echo wpex_sanitize_data(__('Don\'t forget to <a href="#">save your changes</a>', 'total'), 'html');
?>
</p>
</div>
<form id="wpex-theme-panel-form" method="post" action="options.php">
<?php
settings_fields('wpex_tweaks');
?>
<div class="manage-right">
<!-- Branding -->
<h4><?php
esc_attr_e('Theme Branding', 'total');
?>
</h4>
<?php
// Get theme branding value
$value = wpex_get_mod('theme_branding', 'Total');
$value = 'disabled' == $value || !$value ? '' : $value;
?>
<input type="text" name="wpex_tweaks[theme_branding]" value="<?php
echo esc_attr($value);
?>
" placeholder="<?php
esc_attr_e('Used in widgets and builder blocks...', 'total');
?>
">
<!-- View -->
<h4><?php
esc_attr_e('View', 'total');
?>
</h4>
<div class="button-group wpex-filter-active">
<button type="button" class="button active"><?php
esc_attr_e('All', 'total');
?>
</button>
<button type="button" class="button" data-filter-by="active"><?php
esc_attr_e('Active', 'total');
?>
</button>
<button type="button" class="button" data-filter-by="inactive"><?php
esc_attr_e('Inactive', 'total');
?>
</button>
</div>
<!-- Sort -->
<h4><?php
esc_attr_e('Sort', 'total');
?>
</h4>
<?php
// Categories
$categories = wp_list_pluck($this->theme_addons, 'category');
$categories = array_unique($categories);
asort($categories);
?>
<ul class="wpex-theme-panel-sort">
//.........这里部分代码省略.........
示例7: wpex_schema_markup
/**
* Outputs correct schema HTML for sections of the site
*
* @since 3.0.0
*/
function wpex_schema_markup($location)
{
echo wpex_sanitize_data(wpex_get_schema_markup($location), 'html');
}
示例8: intval
$wrap_attributes[] = 'data-height-animation-duration="' . intval($height_animation) . '"';
}
// Caption attributes
if ('true' == $caption) {
// Caption attributes
if ($caption_position) {
$caption_attributes[] = ' data-position="' . $caption_position . '"';
}
if ($caption_show_transition) {
$caption_attributes[] = ' data-show-transition="' . $caption_show_transition . '"';
}
if ($caption_hide_transition) {
$caption_attributes[] = ' data-hide-transition="' . $caption_hide_transition . '"';
}
if ($caption_width) {
$caption_attributes[] = ' data-width="' . wpex_sanitize_data($caption_width, 'px-pct') . '"';
}
if ($caption_horizontal) {
$caption_attributes[] = ' data-horizontal="' . intval($caption_horizontal) . '"';
}
if ($caption_vertical) {
$caption_attributes[] = ' data-vertical="' . intval($caption_vertical) . '"';
}
if ($caption_delay) {
$caption_attributes[] = ' data-show-delay="' . intval($caption_delay) . '"';
}
if (empty($caption_show_transition) && empty($caption_hide_transition)) {
$caption_attributes[] = ' data-sp-static="false"';
}
$caption_attributes = implode(' ', $caption_attributes);
// Caption classes
示例9: vcex_inline_style
?>
>
<?php
}
?>
<?php
// define inner output
$inner_output = '';
// Add icon if defined
if ($icon) {
// Icon classes
$icon_wrap_classes = 'vcex-icon-wrap';
// Icon inline style
$icon_style = vcex_inline_style(array('background' => $icon_background, 'width' => $icon_width, 'border_radius' => $icon_border_radius, 'height' => $icon_height, 'line_height' => wpex_sanitize_data($icon_height, 'px'), 'margin_right' => $margin_right, 'font_size' => $icon_size, 'color' => $color));
// Add icon to output
$inner_output .= '<div class="' . $icon_wrap_classes . '"' . $icon_style . '><span class="' . $icon . '"></span></div>';
}
// Add content to output
if ($content) {
$inner_output .= do_shortcode($content);
}
// Echo inner content (icon_content)
echo $inner_output;
// Close link tag
if ($url) {
echo '</a>';
}
?>
示例10: strip_tags
?>
">
<?php
echo strip_tags($author_name);
?>
</a>
</h4><!-- .author-bio-title -->
<?php
// Outputs the author description if one exists
if ($description) {
?>
<div class="author-bio-description clr">
<?php
echo wpautop(do_shortcode(wpex_sanitize_data($description, 'html')));
?>
</div><!-- author-bio-description -->
<?php
}
?>
<?php
// Display author social links if there are social links defined
if (wpex_author_has_social()) {
?>
<div class="author-bio-social clr">
<?php
// Display twitter url
示例11: extract
exit;
}
// Not needed in admin ever
if (is_admin()) {
return;
}
// Get and extract shortcode attributes
extract(vc_map_get_attributes($this->getShortcode(), $atts));
// Core class
$classes = 'vcex-spacing';
// Custom Class
if ($class) {
$classes .= $this->getExtraClass($class);
}
// Visiblity Class
if ($visibility) {
$classes .= ' ' . $visibility;
}
// Front-end composer class
if (vc_is_inline()) {
$classes .= ' vc-spacing-shortcode';
}
?>
<div class="<?php
echo $classes;
?>
" style="height:<?php
echo wpex_sanitize_data($size, 'px-pct');
?>
"></div>
示例12: vc_icon_element_fonts_enqueue
$wrap_classes[] = 'vcex-divider-custom-icon-width';
}
if ($icon_bg) {
$wrap_classes[] = 'vcex-divider-icon-has-bg';
}
if ('dotted' == $style & !$icon) {
$wrap_classes[] = 'repeat-bg';
}
// If icon exists
if ($icon) {
// Add special class to wrapper
$wrap_classes[] = 'vcex-divider-w-icon';
// Load icon font family
vc_icon_element_fonts_enqueue($icon_type);
// Icon style
$icon_style = vcex_inline_style(array('font_size' => $icon_size, 'border_radius' => $icon_border_radius, 'color' => $icon_color, 'background' => $icon_bg, 'padding' => $icon_padding, 'height' => $icon_height, 'line_height' => wpex_sanitize_data($icon_height, 'px'), 'width' => $icon_width));
// Border style
$vcex_inner_border_style = '';
if ('dotted' != $style) {
$border_top_width = 'double' == $style ? $height : '';
$top_margin = $height ? $height / 2 : '';
$top_margin = $height && 'double' == $style ? ($height * 2 + 4) / 2 : $top_margin;
$vcex_inner_border_style = vcex_inline_style(array('border_color' => $color, 'border_bottom_width' => $height, 'border_top_width' => $border_top_width, 'margin_top' => -$top_margin));
}
// Reset vars if icon is defined so styles aren't duplicated in main wrapper
$height = $color = '';
}
// Main style
$botttom_height = 'double' == $style ? $height : '';
$wrap_style = vcex_inline_style(array('height' => $dotted_height, 'width' => $width, 'margin_top' => $margin_top, 'margin_bottom' => $margin_bottom, 'border_top_width' => $height, 'border_bottom_width' => $botttom_height, 'border_color' => $color));
// Turn wrap classes into a string
示例13: update
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = isset($new_instance['title']) ? strip_tags($new_instance['title']) : '';
$instance['description'] = isset($new_instance['description']) ? wpex_sanitize_data($new_instance['description'], 'html') : '';
$instance['embed_code'] = isset($new_instance['embed_code']) ? $new_instance['embed_code'] : '';
$instance['height'] = !empty($new_instance['height']) ? intval($new_instance['height']) : '';
return $instance;
}
示例14: form
/**
* Back-end widget form.
*
* @see WP_Widget::form()
* @since 1.0.0
*
* @param array $instance Previously saved values from database.
*/
public function form($instance)
{
extract(wp_parse_args((array) $instance, array('title' => '', 'heading' => esc_html__('NEWSLETTER', 'total'), 'description' => '', 'form_action' => 'http://wpexplorer.us1.list-manage1.com/subscribe/post?u=9b7568b7c032f9a6738a9cf4d&id=7056c37ddf', 'placeholder_text' => esc_html__('Your email address', 'total'), 'button_text' => esc_html__('Subscribe', 'total'), 'name_placeholder_text' => esc_html__('First name', 'total'), 'name_field' => 0)));
?>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('title'));
?>
"><?php
esc_html_e('Title', 'total');
?>
:</label>
<input class="widefat" id="<?php
echo esc_attr($this->get_field_id('title'));
?>
" name="<?php
echo esc_attr($this->get_field_name('title'));
?>
" type="text" value="<?php
echo esc_attr($title);
?>
" />
</p>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('heading'));
?>
"><?php
esc_html_e('Heading', 'total');
?>
:</label>
<input class="widefat" id="<?php
echo esc_attr($this->get_field_id('heading'));
?>
" name="<?php
echo esc_attr($this->get_field_name('heading'));
?>
" type="text" value="<?php
echo esc_attr($heading);
?>
" />
</p>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('form_action'));
?>
"><?php
esc_html_e('Form Action', 'total');
?>
:</label>
<input class="widefat" id="<?php
echo esc_attr($this->get_field_id('form_action'));
?>
" name="<?php
echo esc_attr($this->get_field_name('form_action'));
?>
" type="text" value="<?php
echo esc_attr($form_action);
?>
" />
<span style="display:block;padding:5px 0" class="description">
<a href="//docs.shopify.com/support/configuration/store-customization/where-do-i-get-my-mailchimp-form-action?ref=wpexplorer" target="_blank"><?php
esc_html_e('Learn more', 'total');
?>
→</a>
</span>
</p>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('description'));
?>
"><?php
esc_html_e('Description:', 'total');
?>
</label>
<textarea class="widefat" rows="5" cols="20" id="<?php
echo esc_attr($this->get_field_id('description'));
?>
" name="<?php
echo esc_attr($this->get_field_name('description'));
?>
"><?php
echo wpex_sanitize_data($instance['description'], 'html');
?>
</textarea>
</p>
<p>
//.........这里部分代码省略.........
示例15: array
<?php
/**
* Returns the post title
*
* @package Total WordPress theme
* @subpackage Partials
* @version 3.3.0
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
// Define title args
$args = array();
// Single post markup
if (is_singular('post') && 'custom_text' == wpex_get_mod('blog_single_header', 'custom_text')) {
$args['html_tag'] = 'span';
$args['schema_markup'] = '';
} elseif (is_singular() && (!is_singular('page') && !is_singular('attachment'))) {
$args['html_tag'] = 'span';
$args['schema_markup'] = '';
}
// Apply filters
$args = apply_filters('wpex_page_header_title_args', $args);
// Parse args to prevent empty attributes and extract
extract(wp_parse_args($args, array('html_tag' => 'h1', 'string' => wpex_title(), 'schema_markup' => wpex_get_schema_markup('headline'))));
// Display title
if (!empty($string)) {
echo '<' . strip_tags($html_tag) . ' class="page-header-title wpex-clr"' . $schema_markup . '>' . wpex_sanitize_data($string, 'html') . '</' . strip_tags($html_tag) . '>';
}