当前位置: 首页>>代码示例>>PHP>>正文


PHP sanitize_html_class函数代码示例

本文整理汇总了PHP中sanitize_html_class函数的典型用法代码示例。如果您正苦于以下问题:PHP sanitize_html_class函数的具体用法?PHP sanitize_html_class怎么用?PHP sanitize_html_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sanitize_html_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter_css_object

 function filter_css_object($css, $panels_data, $post_id)
 {
     foreach ($panels_data['grids'] as $gi => $grid) {
         $grid_id = !empty($grid['style']['id']) ? (string) sanitize_html_class($grid['style']['id']) : intval($gi);
         $top_padding = isset($grid['style']['top_padding']) ? $grid['style']['top_padding'] : null;
         $bottom_padding = isset($grid['style']['bottom_padding']) ? $grid['style']['bottom_padding'] : null;
         // Filter the bottom margin for this row with the arguments
         if ($top_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-top' => $top_padding), 1920);
         }
         if ($bottom_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-bottom' => $bottom_padding), 1920);
         }
         $top_padding = isset($grid['style']['tablet_top_padding']) ? $grid['style']['tablet_top_padding'] : null;
         $bottom_padding = isset($grid['style']['tablet_bottom_padding']) ? $grid['style']['tablet_bottom_padding'] : null;
         // Filter the bottom margin for this row with the arguments
         if ($top_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-top' => $top_padding), 960);
         }
         if ($bottom_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-bottom' => $bottom_padding), 960);
         }
         $top_padding = isset($grid['style']['mobile_top_padding']) ? $grid['style']['mobile_top_padding'] : null;
         $bottom_padding = isset($grid['style']['mobile_bottom_padding']) ? $grid['style']['mobile_bottom_padding'] : null;
         // Filter the bottom margin for this row with the arguments
         if ($top_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-top' => $top_padding), 478);
         }
         if ($bottom_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-bottom' => $bottom_padding), 478);
         }
     }
     return $css;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:34,代码来源:class-lsow-setup.php

示例2: wcasv_condition_description

/**
 * Descriptions.
 *
 * Display a description icon + tooltip on hover.
 *
 * @since 1.0.0
 *
 * @param  string  $condition  Current condition to display the description for.
 */
function wcasv_condition_description($condition)
{
    $descriptions = array('shipping_cost' => __('Shipping cost is based on the shipping package cost (taxes not counted)', 'woocommerce-advanced-shipping-validation'), 'state' => __('States must be installed in WC', 'woocommerce-advanced-shipping-validation'), 'zipcode' => __('Zipcodes can be separated by comma. Will match when user zipcode \'starts with\' any of the provided zipcodes.', 'woocommerce-advanced-shipping-validation'), 'city' => __('City can be separated by comma. Case incentive', 'woocommerce-advanced-shipping-validation'), 'weight' => __('Weight calculated on all the cart contents', 'woocommerce-advanced-shipping-validation'), 'length' => __('Compared to lengthiest product in cart', 'woocommerce-advanced-shipping-validation'), 'width' => __('Compared to widest product in cart', 'woocommerce-advanced-shipping-validation'), 'height' => __('Compared to highest product in cart', 'woocommerce-advanced-shipping-validation'), 'stock_status' => __('All products in cart must match stock status', 'woocommerce-advanced-shipping-validation'), 'contains_category' => __('Cart must contain least one product with the selected category', 'woocommerce-advanced-shipping-validation'), 'contains_product' => __('Cart must contain one of this product', 'woocommerce-advanced-shipping-validation'), 'contains_shipping_class' => __('Cart must contain at least one product with the selected shipping class', 'woocommerce-advanced-shipping-validation'));
    $descriptions = apply_filters('woocommerce_Advanced_Shipping_Validation_descriptions', $descriptions);
    // Display description
    if (!isset($descriptions[$condition])) {
        ?>
<span class='wcasv-description no-description'></span><?php 
        return;
    }
    ?>
<span class='wcasv-description <?php 
    echo sanitize_html_class($condition);
    ?>
-description'>

		<div class='description'>

			<img class='wcasv-tip' src='<?php 
    echo WC()->plugin_url();
    ?>
/assets/images/help.png' height='24' width='24' />

			<div class='wcasv-desc'><?php 
    echo wp_kses_post($descriptions[$condition]);
    ?>
</div>

		</div>

	</span><?php 
}
开发者ID:gelther,项目名称:advanced-shipping-validation-for-woocommerce,代码行数:41,代码来源:condition-descriptions.php

示例3: wpcf7_acceptance_shortcode_handler

function wpcf7_acceptance_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class($tag->type);
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
    }
    if ($tag->has_option('invert')) {
        $class .= ' wpcf7-invert';
    }
    $atts = array();
    $atts['class'] = $tag->get_class_option($class);
    $atts['id'] = $tag->get_id_option();
    $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
    if ($tag->has_option('default:on')) {
        $atts['checked'] = 'checked';
    }
    $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
    $atts['type'] = 'checkbox';
    $atts['name'] = $tag->name;
    $atts['value'] = '1';
    $atts = wpcf7_format_atts($atts);
    $html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
    return $html;
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:29,代码来源:acceptance.php

示例4: widget

 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since  0.1.0
  * @access public
  * @param  array  $sidebar
  * @param  array  $instance
  * @return void
  */
 function widget($sidebar, $instance)
 {
     $instance = wp_parse_args($instance, $this->defaults);
     // Set up the arguments for get_users().
     $args = array('role' => $instance['role'], 'meta_key' => $instance['meta_key'], 'meta_value' => $instance['meta_value'], 'include' => !empty($instance['include']) ? explode(',', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? explode(',', $instance['exclude']) : '', 'search' => $instance['search'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'offset' => !empty($instance['offset']) ? intval($instance['offset']) : '', 'number' => !empty($instance['number']) ? intval($instance['number']) : '');
     // Output the theme's $before_widget wrapper.
     echo $sidebar['before_widget'];
     // If a title was input by the user, display it.
     if ($instance['title']) {
         echo $sidebar['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $sidebar['after_title'];
     }
     // Get users.
     $users = get_users($args);
     // If users were found.
     if (!empty($users)) {
         echo '<ul class="xoxo users">';
         // Loop through each available user, creating a list item with a link to the user's archive.
         foreach ($users as $user) {
             $class = sanitize_html_class("user-{$user->ID}");
             if (is_author($user->ID)) {
                 $class .= ' current-user';
             }
             printf('<li class="%s"><a href="%s">%s</a>', esc_attr($class), esc_url(get_author_posts_url($user->ID, $user->user_nicename)), esc_html($user->display_name));
         }
         echo '</ul>';
     }
     // Close the theme's widget wrapper.
     echo $sidebar['after_widget'];
 }
开发者ID:sciserver,项目名称:SciServer-WordPress-Website,代码行数:38,代码来源:class-widget-users.php

示例5: smashing_save_post_class_meta

 function smashing_save_post_class_meta($post_id, $post)
 {
     /* Verify the nonce before proceeding. */
     if (!isset($_POST['smashing_post_class_nonce']) || !wp_verify_nonce($_POST['smashing_post_class_nonce'], basename(__FILE__))) {
         return $post_id;
     }
     /* Get the post type object. */
     $post_type = get_post_type_object($post->post_type);
     /* Check if the current user has permission to edit the post. */
     if (!current_user_can($post_type->cap->edit_post, $post_id)) {
         return $post_id;
     }
     /* Get the posted data and sanitize it for use as an HTML class. */
     $new_meta_value = isset($_POST['smashing-post-class']) ? sanitize_html_class($_POST['smashing-post-class']) : '';
     /* Get the meta key. */
     $meta_key = 'smashing_post_class';
     /* Get the meta value of the custom field key. */
     $meta_value = get_post_meta($post_id, $meta_key, true);
     /* If a new meta value was added and there was no previous value, add it. */
     if ($new_meta_value && '' == $meta_value) {
         add_post_meta($post_id, $meta_key, $new_meta_value, true);
     } elseif ($new_meta_value && $new_meta_value != $meta_value) {
         update_post_meta($post_id, $meta_key, $new_meta_value);
     } elseif ('' == $new_meta_value && $meta_value) {
         delete_post_meta($post_id, $meta_key, $meta_value);
     }
 }
开发者ID:OoButt222,项目名称:Version-3,代码行数:27,代码来源:class-doifd-post-meta.php

示例6: display

    /**
     * Display meta in a formatted list
     *
     * @access public
     * @param bool $flat (default: false)
     * @param bool $return (default: false)
     * @param string $hideprefix (default: _)
     * @return string
     */
    public function display($flat = false, $return = false, $hideprefix = '_')
    {
        $output = '';
        $formatted_meta = $this->get_formatted($hideprefix);
        if (!empty($formatted_meta)) {
            $meta_list = array();
            foreach ($formatted_meta as $meta_key => $meta) {
                if ($flat) {
                    $meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']);
                } else {
                    $meta_list[] = '
							<dt class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post($meta['label']) . ':</dt>
							<dd class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post(wpautop($meta['value'])) . '</dd>
						';
                }
            }
            if (!empty($meta_list)) {
                if ($flat) {
                    $output .= implode(", \n", $meta_list);
                } else {
                    $output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>';
                }
            }
        }
        if ($return) {
            return $output;
        } else {
            echo $output;
        }
    }
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:39,代码来源:class-wc-order-item-meta.php

示例7: photoline_modified_post_gallery

function photoline_modified_post_gallery($output, $attr)
{
    global $post;
    static $instance = 0;
    $instance++;
    //disable all filter
    if (empty($attr['type']) || $attr['type'] != 'slider') {
        return;
    }
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => 'photoline-featured', 'include' => '', 'exclude' => ''), $attr));
    $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $include = preg_replace('/[^0-9,]+/', '', $include);
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $selector = "gallery-{$instance}";
    $size_class = sanitize_html_class($size);
    $gallery_div = "<div id='{$selector}' class='gallery galleryid-{$id} gallery-size-{$size_class} flexslider'>";
    $output = apply_filters('gallery_style', $gallery_div);
    $output .= '<ul class="slides">';
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $caption = !empty($attachment->post_excerpt) ? '<p class="flex-caption wp-caption-text gallery-caption">' . wptexturize($attachment->post_excerpt) . '</p>' : '';
        $image = wp_get_attachment_image($id, $size);
        $output .= '<li>';
        $output .= $image;
        $output .= $caption;
        $output .= '</li>';
    }
    $output .= "\r\n            </ul><!-- .slides -->\r\n        </div>\n";
    return $output;
}
开发者ID:AlexanderDolgan,项目名称:ojahuri,代码行数:60,代码来源:gallery-layout.php

示例8: associate_style_body_class

/**
 * Filters the body classes to add the proper style-specific class.
 *
 */
function associate_style_body_class($classes)
{
    if ($style = genesis_get_option('style_selection')) {
        $classes[] = esc_attr(sanitize_html_class($style));
    }
    return $classes;
}
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:11,代码来源:style.php

示例9: __construct

 /**
  * Class constructor
  *
  * @since 2.0.5
  * @author jkudish
  * @param string $id the field id
  * @param array $field the field settings
  * @param null|mixed $value the field's current value
  * @return void
  */
 public function __construct($id, $field, $value = null)
 {
     // setup the defaults
     $this->defaults = array('type' => 'html', 'name' => $id, 'attributes' => array(), 'class' => null, 'label' => null, 'tooltip' => null, 'size' => 'medium', 'html' => null, 'error' => false, 'value' => $value, 'options' => null, 'conditional' => true, 'display_callback' => null, 'if_empty' => null, 'can_be_empty' => false, 'clear_after' => true);
     // a list of valid field types, to prevent screwy behaviour
     $this->valid_field_types = array('heading', 'html', 'text', 'textarea', 'wysiwyg', 'radio', 'checkbox_bool', 'checkbox_list', 'dropdown', 'dropdown_chosen', 'dropdown_select2', 'license_key');
     $this->valid_field_types = apply_filters('tribe_valid_field_types', $this->valid_field_types);
     // parse args with defaults and extract them
     $args = wp_parse_args($field, $this->defaults);
     extract($args);
     // sanitize the values just to be safe
     $id = esc_attr($id);
     $type = esc_attr($type);
     $name = esc_attr($name);
     $class = sanitize_html_class($class);
     $label = wp_kses($label, array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 'img' => array('title' => array(), 'src' => array(), 'alt' => array())));
     $tooltip = wp_kses($tooltip, array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 'img' => array('title' => array(), 'src' => array(), 'alt' => array()), 'code' => array('span' => array()), 'span' => array()));
     $size = esc_attr($size);
     $html = $html;
     $error = (bool) $error;
     $value = $value;
     $conditional = $conditional;
     $display_callback = $display_callback;
     $clear_after = (bool) $clear_after;
     // set the ID
     $this->id = apply_filters('tribe_field_id', $id);
     // set each instance variable and filter
     foreach ($this->defaults as $key => $value) {
         $this->{$key} = apply_filters('tribe_field_' . $key, ${$key}, $this->id);
     }
     // epicness
     $this->doField();
 }
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:43,代码来源:tribe-field.class.php

示例10: shortcode

 public function shortcode($args = array(), $content = '')
 {
     $original_arguments = $args;
     $codec = new Eab_Codec_ArgumentsCodec();
     $args = $codec->parse_arguments($args, array('format' => 'H:i T l', 'class' => '', 'add' => 0, 'expired' => __('Closed', Eab_EventsHub::TEXT_DOMAIN), 'legacy' => false, 'category' => false, 'categories' => false));
     if (!empty($args['legacy'])) {
         return $this->_legacy_shortcode($original_arguments);
     }
     $class = !empty($args['class']) ? 'class="' . sanitize_html_class($args['class']) . '"' : '';
     $format = "<div {$class}>%s</div>";
     $output = '';
     $additional = 0;
     if (!empty($args['add']) && (int) $args['add']) {
         $additional = (int) $args['add'] * 60;
     }
     $query = $codec->get_query_args($args);
     $now = eab_current_time() + $additional;
     $events = Eab_CollectionFactory::get_upcoming_events($now, $query);
     $ret = array();
     foreach ($events as $event) {
         $ts = $event->get_start_timestamp();
         if ($ts < $now) {
             continue;
         }
         $ret[$ts] = $event;
     }
     ksort($ret);
     $next = reset($ret);
     if ($next) {
         $output = date_i18n($args['format'], $next->get_start_timestamp());
     } else {
         $output = !empty($args['expired']) ? esc_html($args['expired']) : $content;
     }
     return sprintf($format, $output);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:35,代码来源:eab-events-next-event-shortcode.php

示例11: __construct

 public function __construct($args)
 {
     if (!is_array($args)) {
         return;
     }
     $this->post_id = null === $args['post_id'] ? null : (int) $args['post_id'];
     $this->size = isset($args['size']) ? sanitize_key($args['size']) : false;
     $this->crop = isset($args['crop']) ? wp_validate_boolean($args['crop']) : (bool) 0;
     $this->img_class = isset($args['img_class']) ? sanitize_html_class($args['img_class']) : '';
     $this->img_default = isset($args['default']) ? esc_url_raw($args['default']) : '';
     $this->img_src = isset($args['src']) && '' != $args['src'] ? esc_url_raw($args['src']) : '';
     $this->img_src = isset($args['full_src']) ? esc_url_raw($args['full_src']) : $this->img_src;
     $this->direct_src_external = '' != $this->img_src ? $this->img_src : '';
     $this->post = get_post($this->post_id);
     $this->attachment_id = intval(get_post_thumbnail_id($this->post_id));
     if (!is_admin()) {
         $image = $this->thumbnail_meta_data();
         if (0 == $this->attachment_id) {
             $this->attachment_id = $image['attachment_id'];
             if (!is_admin()) {
                 $this->img_src = $image['src'];
             }
             if (-1 == $this->attachment_id) {
                 $this->img_src_ext = $image['src'];
             }
         }
     }
     $this->attachment = get_post($this->attachment_id);
     add_filter('icon_dir', array($this, 'filter_icon_dir'));
 }
开发者ID:Jevuska,项目名称:extended-related-posts,代码行数:30,代码来源:class-extrp-thumbnail.php

示例12: shortcode_handler

 /**
  * @todo Should probably be checking publicly_queryable instead of public.
  */
 public function shortcode_handler($atts, $content = null, $tag = '')
 {
     $post_types = get_post_types(['public' => true]);
     $r = [];
     foreach ($post_types as $post_type) {
         // Skip attachments.
         if (in_array($post_type, ['attachment'])) {
             continue;
         }
         $object = get_post_type_object($post_type);
         $args = ['order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => $post_type, 'posts_per_page' => 20];
         $query = new WP_Query($args);
         if ($query->have_posts()) {
             $type = str_replace('_', '-', $post_type);
             $classes = ['hestia-wrap', 'hestia-sitemap', sprintf('post-type-%s', sanitize_html_class($type))];
             $r[] = sprintf('<div class="%s">', implode(' ', $classes));
             $r[] = sprintf('<h2>Recent %s</h2>', $object->labels->name);
             $r[] = '<ul>';
             while ($query->have_posts()) {
                 $query->the_post();
                 $r[] = sprintf('<li><a href="%s">%s</a></li>', esc_url(get_permalink()), esc_html(get_the_title()));
             }
             $r[] = '</ul>';
             $r[] = '</div>';
         }
         wp_reset_postdata();
     }
     return implode("\n", $r);
 }
开发者ID:ssnepenthe,项目名称:hestia,代码行数:32,代码来源:Sitemap.php

示例13: bfg_nav_menu_markup_filter

function bfg_nav_menu_markup_filter($html, $args)
{
    // only add additional Bootstrap markup to
    // primary and secondary nav locations
    if ('primary' !== $args->theme_location && 'secondary' !== $args->theme_location) {
        return $html;
    }
    $data_target = "nav-collapse" . sanitize_html_class('-' . $args->theme_location);
    $output = <<<EOT
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#{$data_target}">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
EOT;
    // only include blog name and description in the nav
    // if it is the primary nav location
    if ('primary' === $args->theme_location) {
        $output .= apply_filters('bfg_navbar_brand', bfg_navbar_brand_markup());
    }
    $output .= '</div>';
    // .navbar-header
    $output .= "<div class=\"collapse navbar-collapse\" id=\"{$data_target}\">";
    $output .= $html;
    if (get_theme_mod('navextra', false)) {
        $output .= apply_filters('bfg_navbar_content', bfg_navbar_content_markup());
    }
    $output .= '</div>';
    // .collapse .navbar-collapse
    return $output;
}
开发者ID:WayneStratton,项目名称:Bootstrap-for-Genesis,代码行数:34,代码来源:nav.php

示例14: useragent

 /**
  * sanitize useragent list
  *
  * @since 1.1
  *
  */
 public function useragent($array)
 {
     global $wp_filter;
     $localhost = false;
     $array = wp_unslash($array);
     if (!is_array($array)) {
         $array = array($array);
     }
     if (isset($array['localhost']) && 's' == sanitize_html_class($array['localhost']) && isset($wp_filter['stt2extat_allow_localhost'])) {
         $localhost = true;
     }
     $array_unique = array_unique(array_map('trim', array_keys($array)));
     $new_array = array();
     foreach ($array_unique as $k) {
         $v = $array[$k];
         if (isset($array[$k]) && '' != $v) {
             $k = stt2extat_parse_url(sanitize_text_field($k));
             $v = sanitize_html_class($v);
             if ('' != $k && '' != $v) {
                 $new_array[$k['host']] = $v;
             }
         }
     }
     if ($localhost) {
         $new_array = wp_parse_args(array('localhost' => 's'), $new_array);
     }
     $new_array = array_filter(array_map('trim', $new_array));
     uksort($new_array, 'strcasecmp');
     return $new_array;
 }
开发者ID:Jevuska,项目名称:stt2-extension-add-terms,代码行数:36,代码来源:class-stt2extat-sanitize.php

示例15: set_markup

 /**
  * Custom markup for the ouput of tabs.
  *
  * @since  0.1
  * @access public
  * @param  array   $whistles
  * @return string
  */
 public function set_markup($whistles)
 {
     /* Set up an empty string to return. */
     $output = '';
     /* If we have whistles, let's roll! */
     if (!empty($whistles)) {
         /* Generate random ID. */
         $rand = mt_rand();
         /* Inject the choosen style from the shortcode popup window as CSS class. */
         $style = isset($this->args['style']) ? ' ' . sanitize_html_class($this->args['style']) : '';
         /* Open tabs wrapper. */
         $output .= '<div class="whistles whistles-tabs' . $style . '">';
         /* Open tabs nav. */
         $output .= '<ul class="whistles-tabs-nav">';
         /* Loop through each whistle title and format it into a list item. */
         foreach ($whistles as $whistle) {
             $id = sanitize_html_class('whistle-' . $this->args['group'] . '-' . $whistle['id'] . '-' . $rand);
             $output .= '<li class="whistle-title"><a href="#' . $id . '">' . $whistle['title'] . '</a></li>';
         }
         /* Close tabs nav. */
         $output .= '</ul><!-- whistles-tabs-nav -->';
         /* Open tabs content wrapper. */
         $output .= '<div class="whistles-tabs-wrap">';
         /* Loop through each whistle and format its content into a tab content block. */
         foreach ($whistles as $whistle) {
             $id = sanitize_html_class('whistle-' . $this->args['group'] . '-' . $whistle['id'] . '-' . $rand);
             $output .= '<div id="' . $id . '" class="whistle-content">' . $whistle['content'] . '</div>';
         }
         /* Close tabs and tabs content wrappers. */
         $output .= '</div><!-- .whistles-tabs-wrap -->';
         $output .= '</div><!-- .whistles-tabs -->';
     }
     /* Return the formatted output. */
     return $output;
 }
开发者ID:seowebbureau,项目名称:whistles-styles,代码行数:43,代码来源:class-whistles-styles-tabs.php


注:本文中的sanitize_html_class函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。