本文整理汇总了PHP中sanitize_html_classes函数的典型用法代码示例。如果您正苦于以下问题:PHP sanitize_html_classes函数的具体用法?PHP sanitize_html_classes怎么用?PHP sanitize_html_classes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sanitize_html_classes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ts_import_notice
/**
* Print import notice
*/
function ts_import_notice()
{
$oArgs = ThemeArguments::getInstance('importer');
$ts_import_notice = $oArgs->get('ts_import_notice');
$ts_import_notice = $oArgs->get('ts_import_notice_type');
if (isset($_GET['imported_sample_data']) && $_GET['imported_sample_data'] == 1) {
?>
<div class="updated">
<p><?php
_e('Import completed', 'framework');
?>
</p>
</div>
<?php
} elseif (!empty($ts_import_notice)) {
?>
<div class="<?php
echo sanitize_html_classes($ts_import_notice_type);
?>
">
<p><?php
echo esc_html($ts_import_notice);
?>
</p>
</div>
<?php
}
}
示例2: ts_container_func
function ts_container_func($atts)
{
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_iteration' => '', 'content_box' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore libero autem tempora cumque officiis sapiente maxime sit facere assumenda quisquam amet consequatur ad delectus accusantium quia saepe quas repellendus optio distinctio nobis consequuntur culpa eligendi quibusdam nesciunt maiores alias ex.', 'style' => '1', 'icon' => '', 'icon_color' => ''), $atts));
$class_wrapper = null;
switch ($style) {
case '1':
$classes = 'content-block bottom-padding frame';
break;
case '2':
$classes = 'content-block bottom-padding frame border-radius';
break;
case '3':
$classes = 'content-block bottom-padding frame-shadow-lifted';
break;
case '4':
$classes = 'content-block bottom-padding frame frame-shadow-lifted';
break;
case '5':
$classes = 'content-block bottom-padding frame-shadow-lifted bg';
break;
case '6':
$classes = 'content-block bottom-padding frame-shadow-raised text-center';
break;
case '7':
$classes = 'content-block bottom-padding frame frame-shadow-curved';
break;
case '8':
$classes = 'content-block bottom-padding frame frame-shadow-lifted';
break;
case '9':
$classes = 'content-block bottom-padding frame frame-shadow-curved border-radius';
break;
case '10':
$classes = 'bottom-padding frame-shadow-lifted bg';
break;
case '11':
$class_wrapper = 'rotated-box';
$classes = 'content-block bottom-padding frame frame-shadow-lifted';
break;
case '12':
$class_wrapper = 'rotated-right-box';
$classes = 'content-block bottom-padding frame frame-shadow-curved border-radius';
break;
case '13':
$classes = 'content-block text-center frame-shadow bottom-padding';
break;
default:
$classes = 'bottom-padding frame-shadow-lifted bg';
break;
}
$icon_html = '';
if (!empty($icon)) {
$icon_html = '<span class="icon bg circle icon-60 pull-left"><i class="' . sanitize_html_class($icon) . '" ' . (!empty($icon_color) ? 'style="color: ' . esc_attr($icon_color) . '"' : '') . '></i></span>';
}
$output = "\n\t\t<div class='" . sanitize_html_classes($classes) . " " . ts_get_animation_class($animation) . "' " . ts_get_animation_data_class($animation_delay, $animation_iteration) . ">\n\t\t\t{$icon_html}\n\t\t\t<span class='lead'>{$content_box}</span>\n\t\t</div>";
if (!empty($class_wrapper)) {
return "<div class='" . sanitize_html_classes($class_wrapper) . "'>{$output}</div>";
}
return $output;
}
示例3: ts_button_outlined_func
function ts_button_outlined_func($atts, $content = null)
{
$oArgs = ThemeArguments::getInstance('ts_button_outlined_func');
$button_id = (int) $oArgs->get('button_id') + 1;
$oArgs->set('button_id', $button_id);
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_iteration' => '', "icon" => '', "color" => '', "hover_color" => '', "background_color" => '', "background_hover_color" => '', "size" => '', "url" => '', 'target' => '_self', 'align' => ''), $atts));
$button_class = 'button btn btn-border ' . $size;
if (empty($url)) {
$url = '#';
}
$button_styles = '';
$button_data = '';
if (!empty($color)) {
$button_styles .= "color:{$color}; border-color: {$color};";
$button_data .= 'data-color="' . esc_attr($color) . '"';
}
if (!empty($hover_color)) {
$button_data .= 'data-hover-color="' . esc_attr($hover_color) . '"';
}
if (!empty($background_color)) {
$button_styles .= "background-color:{$background_color};";
$button_data .= 'data-background-color="' . esc_attr($background_color) . '"';
}
if (!empty($background_hover_color)) {
$button_data .= 'data-background-hover-color="' . esc_attr($background_hover_color) . '"';
}
$icon_html = '';
if ($icon && $icon != 'no') {
$icon_html = '<i class="icons ' . esc_attr($icon) . '"></i>';
}
return '<div class="xbtn ' . sanitize_html_classes($align) . '"><a id="button-' . esc_attr($button_id) . '" ' . esc_attr($button_data) . ' class="' . esc_attr($button_class) . ' ' . ts_get_animation_class($animation) . '" ' . ts_get_animation_data_class($animation_delay, $animation_iteration) . ' href="' . esc_url($url) . '" target="' . esc_attr($target) . '" style="' . $button_styles . '">' . $icon_html . $content . '</a></div>';
}
示例4: ts_banner_carousel_func
function ts_banner_carousel_func($atts, $content = null)
{
global $post;
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_delay_item' => '', 'animation_iteration' => '', 'carousel_style' => '', 'full_width_lines' => '', 'category' => '', 'limit' => 10), $atts));
// Reset and setup variables
$output = '';
$temp_title = '';
$temp_link = '';
$carousel_classes = '';
if ($carousel_style == 'mini') {
$width = 127;
$height = 79;
$carousel_classes = 'banner-set-mini banner-set-no-pagination';
} else {
$width = 253;
$height = 158;
}
if ($full_width_lines == 'enabled') {
$carousel_classes .= ' banner-border-shop';
}
$output .= "<div class='banner-set load " . sanitize_html_classes($carousel_classes) . "'>\n <div class='container'>\n <div class='banners'>";
$args = array('post_type' => 'banner', 'posts_per_page' => $limit);
if (!empty($category)) {
$args['tax_query'] = array(array('taxonomy' => 'banner-cat', 'field' => 'id', 'terms' => $category));
}
$current_animation_delay = $animation_delay;
query_posts($args);
// the loop
if (have_posts()) {
while (have_posts()) {
the_post();
$temp_title = get_the_title($post->ID);
$url = xv_get_field('url');
$temp_link = '#';
if ($url) {
$temp_link = $url;
}
$excerpt = get_xv_excerpt(250);
// output all findings - CUSTOMIZE TO YOUR LIKING
$output .= "<a class='banner " . ts_get_animation_class($animation) . "' href='" . esc_url($temp_link) . "' " . ts_get_animation_data_class($current_animation_delay, $animation_iteration) . ">";
$thumb = get_xv_thumbnail($width, $height);
$output .= '<img src="' . esc_url($thumb) . '" alt="' . the_title_attribute('echo=0') . '" />';
$output .= "<h2 class='title'>{$temp_title}</h2>";
if ($carousel_style != 'mini') {
$output .= "<div class='description'>{$excerpt}</div>";
}
$output .= "</a>";
$current_animation_delay += $animation_delay_item;
}
}
wp_reset_query();
$output .= "</div>\n <div class='clearfix'></div>\n </div>\n <div class='nav-box " . ts_get_animation_class($animation) . "' " . ts_get_animation_data_class($current_animation_delay, $animation_iteration) . ">\n <div class='container'>\n <a class='prev' href='#'><span class='icon-left'></span></a>\n <div class='pagination switches'></div>\n <a class='next' href='#'><span class='icon-right'></span></a> \n </div>\n </div>\n </div>\n <div class='clearfix'></div>";
return $output;
}
示例5: ts_steps_func
/**
* Visual Composer Eelement: Steps
*
*/
function ts_steps_func($atts, $content = null)
{
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_iteration' => '', 'step' => '', 'style' => '', 'align' => ''), $atts));
$align_class = '';
return '
<div class="steps progress-steps ' . ts_get_animation_class($animation) . '" ' . ts_get_animation_data_class($animation_delay, $animation_iteration) . '>
<div class="step ' . sanitize_html_classes($style) . ' ' . sanitize_html_classes($align) . '">
<div class="step-wrapper">
<div class="number">' . $step . '</div>
' . do_shortcode($content) . '
</div>
</div>
</div>';
}
示例6: ts_hr_func
function ts_hr_func($atts, $content = null)
{
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_iteration' => '', 'color' => '', 'style' => ''), $atts));
$html = null;
$divider_style = array();
if (!empty($color)) {
$divider_style[] = 'border-color:' . esc_attr($color);
}
$divider_style_html = null;
if (is_array($divider_style)) {
$divider_style_html = 'style="' . implode(';', $divider_style) . '"';
}
$html .= '<hr class="divider ' . sanitize_html_classes($style) . ' ' . ts_get_animation_class($animation) . '" ' . ts_get_animation_data_class($animation_delay, $animation_iteration) . ' ' . $divider_style_html . ' >';
return $html;
}
示例7: ts_heading_func
/**
* Visual Composer Eelement: Heading
*
*/
function ts_heading_func($atts, $content = null)
{
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_iteration' => '', 'color' => '', 'type' => 1, 'align' => '', 'style' => '', 'id' => ''), $atts));
if (intval($type) < 1 || intval($type) > 6) {
$type = 1;
}
if (!empty($color)) {
$color = 'style="color:' . esc_attr($color) . '"';
}
$id_attr = '';
if (!empty($id)) {
$id_attr = 'id="' . esc_attr($id) . '"';
}
return "<div " . $id_attr . " class='" . sanitize_html_classes($style) . " " . sanitize_html_class($align) . " " . ts_get_animation_class($animation) . "' " . ts_get_animation_data_class($animation_delay, $animation_iteration) . "><h" . esc_attr($type) . " class='title' " . $color . ">" . do_shortcode($content) . "</h" . esc_attr($type) . "></div>";
}
示例8: capture
/**
* Captures helpmode message
*/
public function capture()
{
$out = '';
$helpmode_enabled = g1_get_theme_option('general', 'helpmode', 'none');
if (!current_user_can('administrator') || $helpmode_enabled === 'none') {
return $out;
}
$final_id = $this->get_id();
$final_class = array('g1-helpmode', 'g1-type-' . $this->get_type());
// Compose the template
$out = '<div id=%ID% class="%CLASS%">' . '<div class="g1-helpmode-title">
<span></span>%TITLE%
</div>' . '<div class="g1-helpmode-content">' . '%CONTENT%' . '</div>' . '</div>';
// Fill in the template
$out = str_replace(array('%ID%', '%CLASS%', '%TITLE%', '%CONTENT%'), array(esc_attr($final_id), sanitize_html_classes($final_class), esc_html($this->get_title()), $this->get_content()), $out);
return $out;
}
示例9: render
function render()
{
$class = !empty($this->field['class']) ? $this->field['class'] : '';
$base_id = $this->field['id'];
$base_name = $this->args['opt_name'] . '[' . $this->field['id'] . ']';
$inputs = array('tl' => __('Left-Top corner', Redux_TEXT_DOMAIN), 'tr' => __('Right-Top corner', Redux_TEXT_DOMAIN), 'br' => __('Right-Bottom corner', Redux_TEXT_DOMAIN), 'bl' => __('Left-Bottom corner', Redux_TEXT_DOMAIN));
$classes = array($class, 'g1-border-radius');
echo '<div class="' . sanitize_html_classes($classes) . '">';
echo '<div class="g1-configurator" data-g1-classes="g1-type-square,g1-type-squircle,g1-type-circle">';
echo '<div class="g1-border g1-tl" data-g1-corner="tl"></div>';
echo '<div class="g1-border g1-tr" data-g1-corner="tr"></div>';
echo '<div class="g1-border g1-bl" data-g1-corner="bl"></div>';
echo '<div class="g1-border g1-br" data-g1-corner="br"></div>';
echo '</div>';
foreach ($inputs as $name => $label) {
$value = !empty($this->value[$name]) ? $this->value[$name] : '';
$class = 'g1-border-radius-value-' . $name;
echo '<input type="hidden" id="' . esc_attr($base_id . '_' . $name) . '" name="' . esc_attr($base_name . '[' . $name . ']') . '" value="' . esc_attr($value) . '" class="' . sanitize_html_class($class) . '" />';
}
echo '</div>';
echo !empty($this->field['desc']) ? ' <span class="description">' . esc_html($this->field['desc']) . '</span>' : '';
}
示例10: ts_image_func
function ts_image_func($atts, $content = null)
{
extract(shortcode_atts(array('animation' => '', 'animation_delay' => '', 'animation_iteration' => '', 'img_url' => '', 'caption' => '', 'img_link' => '', 'style' => '', 'width' => '', 'height' => '', 'align' => '', 'output' => '', 'hover_border' => '', 'hover_opacity' => '', 'frame' => ''), $atts));
$attachment_id = $img_url;
$image_attributes = wp_get_attachment_image_src($attachment_id, 'full');
// returns an array
if (isset($image_attributes[0])) {
$img_url = $image_attributes[0];
}
//$output .= $img_url;
$img_url = get_xv_resizer($img_url, $width, $height);
if (!empty($img_link)) {
$output .= "<a class='frame-hover " . esc_attr($hover_border) . "' href='" . esc_url($img_link) . "' >";
}
$output .= "<div class='" . sanitize_html_classes($frame) . " " . esc_attr($style) . " " . esc_attr($align) . " " . esc_attr($hover_opacity) . "'>\n\t\t\t\t\t<img alt='" . esc_attr($caption) . "' src='" . esc_url($img_url) . "'>\n\t\t\t\t</div>";
if (!empty($img_link)) {
$output .= "</a>";
}
if (!empty($caption)) {
$output .= "<div class='caption'>{$caption}</div>";
}
return '<div ' . ts_get_animation_class($animation, true) . ' ' . ts_get_animation_data_class($animation_delay, $animation_iteration) . '>' . $output . '</div>';
}
示例11: do_shortcode
/**
* Shortcode callback function.
*
* @return string
*/
protected function do_shortcode()
{
extract($this->extract());
$content = preg_replace('#^<\\/p>|<p>$#', '', $content);
// Compose final HTML id attribute
$final_id = strlen($id) ? $id : 'g1-quote-' . $this->get_counter();
// Compose final HTML class attribute
$final_class = array('g1-quote', 'g1-quote--' . $style, 'g1-quote--' . $size);
$final_class = array_merge($final_class, explode(' ', $class));
$width = 40;
$height = 40;
if (strlen($author_image)) {
$author_image = sprintf('<img src="%s" width="%d" height="%d" alt="%s"/>', esc_url($author_image), $width, $height, esc_attr('Author\'s image'));
} else {
$author_image = '<span class="g1-quote__image"></span>';
}
if (strlen($author_name)) {
$author_name = '<strong>' . esc_html($author_name) . '</strong>';
}
if (strlen($author_description)) {
$author_description = '<span>' . esc_html($author_description) . '</span>';
}
$figcaption = '';
if ($author_image || $author_name || $author_description) {
$figcaption = '<figcaption class="g1-meta">' . $author_image . $author_name . $author_description . '</figcaption>';
}
// Compose the template
$out = '<figure %id%%class%>' . '<div class="g1-inner">' . '%content%' . '</div>' . '%figcaption%' . '</figure>';
// Fill in the template
$out = str_replace(array('%id%', '%class%', '%content%', '%figcaption%'), array(strlen($final_id) ? 'id="' . esc_attr($final_id) . '" ' : '', count($final_class) ? 'class="' . sanitize_html_classes($final_class) . '" ' : '', do_shortcode($content), $figcaption), $out);
return $out;
}
示例12: capture
/**
* Returns a simple slider markup
*
* @param string $id The id attribute
* @param integer $width Slider width
* @param integer $height Slider height
* @param array $config Slider configuration
* @param array $slides
* @return string
*/
public function capture($slides, $config, $args)
{
static $counter = 0;
$counter++;
$out = '';
if (!count($slides)) {
return '';
}
// clean arguments
$args['id'] = !empty($args['id']) ? $args['id'] : 'g1-slider-counter-' . $counter;
$args['class'] = !empty($args['class']) ? $args['class'] : '';
$args['width'] = absint($args['width']);
$args['height'] = absint($args['height']);
// clean options
$config['layout'] = $this->sanitize_string_var($config['layout']);
$config['width'] = $this->sanitize_string_var($config['width']);
$config['height'] = 320;
if (is_numeric($config['height'])) {
$config['height'] = absint($config['height']);
}
$config['animation'] = $this->sanitize_string_var($config['animation']);
$config['animation'] = str_replace('-', '_', $config['animation']);
$config['animationDuration'] = absint($config['animationDuration']);
$config['slideshowSpeed'] = absint($config['slideshowSpeed']);
$config['autoplay'] = $this->sanitize_string_var($config['autoplay']);
$config['fullscreen'] = $this->sanitize_string_var($config['fullscreen']);
$config['coinNavigation'] = $this->sanitize_string_var($config['coinNavigation']);
$config['directionNavigation'] = $this->sanitize_string_var($config['directionNavigation']);
$config['progressBar'] = $this->sanitize_string_var($config['progressBar']);
$config['width_in_px'] = G1_Simple_Sliders_Module::get_slider_width_in_pixels($config['width']);
switch ($config['width']) {
case '':
break;
}
// set defaults if needed
$config_defaults = $this->get_default_config();
foreach ($config as $key => $value) {
if (empty($value)) {
$config[$key] = $config_defaults[$key];
}
}
$final_class = array('g1-simple-slider', 'g1-slider-not-ready', 'g1-simple-slider-' . $config['layout']);
$final_class = array_merge($final_class, explode(' ', $args['class']));
// Remove empty strings
$final_class = array_filter($final_class);
$final_class[] = 'g1-width-' . str_replace('g1_simple_slider_', '', $config['width']);
$final_class[] = 'g1-nav-direction-' . $config['directionNavigation'];
$final_class[] = 'g1-nav-coin-' . $config['coinNavigation'];
$final_class[] = 'g1-fullscreen-' . $config['fullscreen'];
$final_class[] = 'g1-progress-' . $config['progressBar'];
// Install Simple Slider. Not every page needs to load additional javascrips
add_action('wp_footer', 'g1_simple_slider_wp_footer');
$out .= '<div id="' . esc_attr($args['id']) . '" class="' . sanitize_html_classes($final_class) . '" data-config="' . g1_data_capture($config) . '">';
$out .= '<div class="g1-inner">';
$out .= '<ol class="g1-slides">' . "\n";
foreach ($slides as $i => $slide) {
// Default slide configuration
$x = array('layout' => 'default', 'width' => $args['width'], 'height' => $args['height']);
// Cascade configuration
$x = array_merge($x, $slide);
// Check for an empty link
$x['linking'] = strlen($x['link']) ? $x['linking'] : 'none';
$media = '<img src="' . esc_url($x['src']) . '" ' . 'width="' . absint($x['width']) . '" ' . 'height="' . absint($x['height']) . '" ' . 'alt="' . esc_url($x['src']) . '" ' . '/>';
switch ($x['linking']) {
case 'none':
break;
case 'new_window':
case 'new-window':
$media = '<a href="' . esc_url($x['link']) . '" class="g1-new-window">' . do_shortcode('[indicator type="new-window"]') . $media . '</a>';
break;
case 'lightbox':
$media = '<a href="' . esc_url($x['link']) . '">' . do_shortcode('[indicator type="zoom"]') . $media . '</a>';
break;
default:
$media = '<a href="' . esc_url($x['link']) . '">' . do_shortcode('[indicator type="document"]') . $media . '</a>';
break;
}
$media = '<div>' . $media . '</div>';
$desc = '';
if (strlen($x['title'] || strlen($x['content']))) {
$desc .= '<figcaption>' . "\n" . '<div class="g1-slide__title">' . '<div class="g1-h1">' . $x['title'] . '</div>' . '<div class="g1-background"></div>' . '</div>' . '<div class="g1-slide__description">' . '<div class="g1-h3">' . do_shortcode($x['content']) . '</div>' . '<div class="g1-background"></div>' . '</div>' . '</figcaption>' . "\n";
}
$final_class = array('g1-slide');
if (0 == $i) {
$final_class[] = 'g1-selected';
}
$out .= '<li class="' . sanitize_html_classes($final_class) . '" data-g1-linking="' . esc_attr($x['linking']) . '">' . "\n" . '<figure>' . "\n" . $media . $desc . '</figure>' . "\n" . '</li>' . "\n";
}
$out .= '</ol>' . "\n";
if ('none' !== $config['coinNavigation']) {
//.........这里部分代码省略.........
示例13: format_row
protected static function format_row($row, $post_url, $index)
{
$out = '';
$row = strip_tags(trim($row));
if (self::author_specified($row)) {
$row_parts = explode(self::$separator, trim($row), 2);
$author = self::sanitize_author($row_parts[0]);
$text = self::sanitize_text($row_parts[1]);
$row_id = 'g1-chat-row-' . ($index + 1);
$row_class = array('g1-chat-row', 'g1-chat-author-' . self::get_author_id($author));
$author_class = array('g1-chat-author', strtolower('g1-chat-author-' . $author));
$index = ++self::$row_counter;
$out = '<li id ="' . esc_attr($row_id) . '" class="' . sanitize_html_classes($row_class) . '">';
$out .= '<div class="' . sanitize_html_classes($author_class) . '">';
$out .= '<a href="' . esc_url($post_url) . '#' . esc_attr($row_id) . '">#</a>';
$out .= '<strong>' . esc_html($author) . '</strong>';
$out .= '</div>';
$out .= '<div class="g1-chat-text">';
$out .= esc_html($text);
$out .= '</div>';
$out .= '</li>';
} else {
if (!empty($row)) {
$text = self::sanitize_text($row);
$out = '<div class="g1-chat-row">';
$out .= '<div class="g1-chat-text">' . esc_html($text) . '</div>';
$out .= '</div>';
}
}
return $out;
}
示例14: ts_get_opt
$button_style = 'btn-border-w';
}
$header_button_target = ts_get_opt('header-button-target') ? ts_get_opt('header-button-target') : '_blank';
?>
<li>
<a class="header-button" href="<?php
echo esc_url(ts_get_opt('header-button-link'));
?>
" target="<?php
echo esc_attr($header_button_target);
?>
"><span class="btn btn-mod btn-circle <?php
echo sanitize_html_classes($button_style);
?>
"><?php
echo ts_get_opt('header-button-icon') ? '<i class="' . sanitize_html_classes(ts_get_opt('header-button-icon')) . '"></i> ' : '';
echo esc_html(ts_get_opt('header-button-text'));
?>
</span></a>
<?php
?>
</li>
<?php
}
?>
</ul>
</div>
<!-- End Main Menu -->
</div>
</nav>
示例15: g1_part_get_data
$g1_data = g1_part_get_data();
$g1_query = $g1_data['query'];
$g1_query = $g1_query ? $g1_query : $wp_query;
$g1_collection = $g1_data['collection'];
$g1_elems = $g1_data['elems'];
$g1_options = !empty($g1_data['options']) ? $g1_data['options'] : array();
$g1_counter = 0;
?>
<?php
do_action('g1_collection_before', $g1_collection, $g1_query);
?>
<!-- BEGIN: .g1-collection -->
<div class="<?php
echo sanitize_html_classes($g1_collection->get_classes());
?>
">
<ul>
<?php
while ($g1_query->have_posts()) {
$g1_query->the_post();
?>
<li class="g1-collection__item">
<?php
// Our tricky way to pass variables to a template part
g1_part_set_data(array('collection' => $g1_collection, 'elems' => $g1_elems, 'options' => $g1_options));
get_template_part('template-parts/g1_content_list_item');
?>
</li>
<?php