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


PHP balanceTags函数代码示例

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


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

示例1: render

 /**
  * Group items
  *
  * @param type $element
  *
  * @return string
  */
 static function render($element)
 {
     $_element = $element;
     $label_item = isset($element['label_item']) ? $element['label_item'] : '';
     $sub_items = $_element['sub_items'];
     $overwrite_shortcode_data = isset($element['overwrite_shortcode_data']) ? $element['overwrite_shortcode_data'] : true;
     $sub_item_type = $element['sub_item_type'];
     $items_html = array();
     $shortcode_name = str_replace('WR_', '', $element['shortcode']);
     // get id of parameter to extract
     $extract_title = isset($element['extract_title']) ? $element['extract_title'] : '';
     $extra_params = array('drag_handle' => false);
     if ($sub_items) {
         foreach ($sub_items as $idx => $item) {
             $el = new $sub_item_type();
             $el->init_element();
             // check if $item['std'] is empty or not
             $shortcode_data = '';
             if (!$label_item) {
                 $content = __($shortcode_name, WR_PBL) . ' ' . __('Item', WR_PBL) . ' ' . ($idx + 1);
             } else {
                 $content = $label_item . ($idx + 1);
             }
             if (isset($_element['no_title'])) {
                 $content = $_element['no_title'];
             }
             if (!empty($item['std'])) {
                 // keep shortcode data as it is
                 $shortcode_data = $item['std'];
                 // reassign params for shortcode base on std string
                 $extract_params = WR_Pb_Helper_Shortcode::extract_params($item['std']);
                 $params = WR_Pb_Helper_Shortcode::generate_shortcode_params($el->items, NULL, $extract_params, TRUE, FALSE, $content);
                 $el->shortcode_data();
                 $params['extract_title'] = empty($params['extract_title']) ? __('(Untitled)', WR_PBL) : $params['extract_title'];
                 $content = $params['extract_title'];
                 if ($overwrite_shortcode_data) {
                     $shortcode_data = $el->config['shortcode_structure'];
                 }
             }
             $element_type = (array) $el->element_in_pgbldr($content, $shortcode_data, '', '', true, $extra_params);
             foreach ($element_type as $element_structure) {
                 $items_html[$shortcode_data] = $element_structure;
             }
         }
     }
     $style = isset($_element['style']) ? 'style="' . $_element['style'] . '"' : '';
     // Wrap item html to table
     $html = '';
     foreach ($items_html as $shortcode_data => $item_html) {
         if (!empty($extract_title)) {
             $attrs = shortcode_parse_atts($shortcode_data);
             $title = isset($attrs[$extract_title]) ? $attrs[$extract_title] : '';
             $html .= sprintf('<tr><td><b>%s</b></td><td>%s</td></tr>', $title, $item_html);
         }
     }
     $html = sprintf('<table class="%s" %s>%s</table>', 'table table-bordered', $style, balanceTags($html));
     $element_name = isset($_element['name']) ? $_element['name'] : __(ucwords(!$label_item ? $shortcode_name : $label_item), WR_PBL) . ' ' . __('Items', WR_PBL);
     $html_element = "<div id='{$_element['id']}' class='form-group control-group clearfix'><label class='control-label'>{$element_name}</label>\n\t\t\t\t<div class='item-container submodal_frame_2 controls group-table {$_element['class']}'>\n                    <div class='item-container-content jsn-items-list'>\n                    {$html}\n                    </div>\n                </div>\n                </div>";
     return $html_element;
 }
开发者ID:zulfnore,项目名称:WR-PageBuilder,代码行数:67,代码来源:group-table.php

示例2: widget

    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $advert_image = isset($instance['advert_image']) ? $instance['advert_image'] : '';
        $advert_link = isset($instance['advert_link']) ? $instance['advert_link'] : '';
        $advert_code = isset($instance['advert_code']) ? $instance['advert_code'] : '';
        /* Before widget (defined by themes). */
        echo balanceTags($before_widget);
        if ($title) {
            echo balanceTags($before_title . $title . $after_title);
        }
        ?>
			
		<div class="widget_advert_inner">
			<?php 
        if ($advert_image != '') {
            echo balanceTags(($advert_link != '' ? '<a href="' . $advert_link . '" class="image_wrapper">' : '') . '<img src="' . $advert_image . '" border="0" alt="' . $title . '" alt="" />' . ($advert_link != '' ? '</a>' : ''));
        }
        if ($advert_code != '') {
            echo substituteAll($advert_code);
        }
        ?>
		</div>
<?php 
        /* After widget (defined by themes). */
        echo balanceTags($after_widget);
    }
开发者ID:riaface,项目名称:GrowBeyond,代码行数:32,代码来源:widget-advert.php

示例3: ot_type_user_select_ajax

 function ot_type_user_select_ajax($args = array())
 {
     $default = array('field_placeholder' => __('Search for a User', ST_TEXTDOMAIN));
     $args = wp_parse_args($args, $default);
     extract($args);
     $post_type = $field_post_type;
     /* verify a description */
     $has_desc = $field_desc ? true : false;
     /* format setting outer wrapper */
     echo '<div class="format-setting type-post_select_ajax ' . ($has_desc ? 'has-desc' : 'no-desc') . '">';
     /* description */
     echo balanceTags($has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : '');
     /* format setting inner wrapper */
     echo '<div class="format-setting-inner">';
     /* allow fields to be filtered */
     $post_select_ajax = apply_filters('ot_recognized_post_select_ajax_fields', $field_value, $field_id);
     $pl_name = '';
     $pl_desc = '';
     if ($field_value) {
         $user = get_userdata($field_value);
         if ($user) {
             $pl_name = $user->user_login . ' (#' . $user->ID . ' - ' . $user->user_email . ')';
             $pl_desc = "";
             //"ID: ".get_the_ID($field_value);
         }
     }
     echo '<div class="option-tree-ui-user_select_ajax-input-wrap">';
     echo "<input data-pl-name='{$pl_name}' data-pl-desc='{$pl_desc}' data-placeholder='{$field_placeholder}' value='{$field_value}' data-post-type='{$post_type}' type=hidden class='st_user_select_ajax' id='" . esc_attr($field_id) . "' name='" . esc_attr($field_name) . "'/>";
     echo '</div>';
     echo '</div>';
     echo '</div>';
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:32,代码来源:st-user-select-ajax.php

示例4: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $default = array('title' => 'recent tweet', 'number_tweet' => 5, 'user_id' => 'evanto');
     $instance = wp_parse_args($instance, $default);
     extract($instance);
     echo balanceTags($args['before_widget']);
     if (!empty($title)) {
         echo balanceTags($args['before_title'] . $title . $args['after_title']);
     }
     if ($user_id) {
         $credentials = array('consumer_key' => '18ihEuNsfOJokCLb8SAgA', 'consumer_secret' => '7vTYnLYYiP4BhXvkMWtD3bGnysgiGqYlsPFfwXhGk');
         $twitter_api = new Wp_Twitter_Api($credentials);
         $query = 'count=' . $number_tweet . '&include_entities=true&include_rts=true&screen_name=' . $user_id;
         $args = array('type' => 'statuses/user_timeline');
         $twitters = $twitter_api->query($query);
         $output = array();
         $output[] = '<div class="twitter">';
         $output[] = '<ul class="tweet-list list-unstyled">';
         if (!isset($twitters['errors']) && count($twitters) > 0 and is_array($twitters)) {
             foreach ($twitters as $twitter) {
                 $twitter = (array) $twitter;
                 $output[] = '<li class="tweet">';
                 $output[] = "<span class='tweet-text'><a href='http://twitter.com/" . $user_id . "/status/" . $twitter['id'] . "'>" . human_time_diff(strtotime($twitter['created_at'])) . ' ago</a></span>';
                 $output[] = "<span class='tweet-time'>" . $twitter['text'] . "</span>";
                 $output[] = '</li>';
             }
         }
         $output[] = '</ul>';
         $output[] = '</div>';
         echo implode("\n", $output);
     }
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:40,代码来源:twitter_widget.php

示例5: axiom_template_list_output

 function axiom_template_list_output($post_options, $post_data)
 {
     $parts = explode('_', $post_options['layout']);
     $layout = max(1, min(4, empty($parts[1]) ? $post_options['columns_count'] : (int) $parts[1]));
     if ($layout == 1) {
         $title = '<li class="post_item sc_blogger_item post_title sc_title sc_blogger_title list_style_' . esc_attr($layout) . '_item">' . '<div class="post_title sc_title sc_blogger_title">' . '<h5>' . (!isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '') . $post_data['post_title'] . (!isset($post_options['links']) || $post_options['links'] ? '</a>' : '') . '</h5>' . '<div class="post_info">' . '<span>by <a href="' . esc_url($post_data['post_author_url']) . '">' . $post_data['post_author'] . '</a></span>' . '<span>Views <span>' . esc_html($post_data['post_views']) . '</span></span>' . '</div>' . '</div>' . '</li>';
         echo $title;
     } else {
         if ($layout == 2) {
             $title = '<li class="post_item sc_blogger_item post_title sc_title sc_blogger_title list_style_' . esc_attr($layout) . '_item">' . '<div class="post_title sc_title sc_blogger_title">' . '<h4>' . (!isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '') . $post_data['post_title'] . (!isset($post_options['links']) || $post_options['links'] ? '</a>' : '') . '</h4>' . '<div class="post_descr">' . balanceTags($post_data['post_excerpt']) . '</div>' . '<div class="post_info">' . '<span>Posted on <span class="date">' . esc_html($post_data['post_date']) . '</span></span>' . '<span><span>' . balanceTags($post_data['post_terms'][$post_data['post_taxonomy']]->terms_links[0]) . '</span></span>' . '</div>' . '</div>' . '</li>';
             echo $title;
         } else {
             if ($layout == 3) {
                 $title = '<li class="post_item sc_blogger_item post_title sc_title sc_blogger_title list_style_' . esc_attr($layout) . '_item">';
                 echo $title;
                 if ($post_data['post_thumb']) {
                     require axiom_get_file_dir('templates/parts/post-featured.php');
                 }
                 $title = '';
                 $title .= '<div class="post_title sc_title sc_blogger_title">' . '<h5>' . (!isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '') . $post_data['post_title'] . (!isset($post_options['links']) || $post_options['links'] ? '</a>' : '') . '</h5>' . '<div class="post_descr">' . substr($post_data['post_excerpt'], 0, 100) . '...</div>' . '</div>' . '</li>';
                 echo $title;
             }
         }
     }
 }
开发者ID:pcuervo,项目名称:odc,代码行数:25,代码来源:list.php

示例6: attributes_page

 function attributes_page()
 {
     if (class_exists('STAttribute')) {
         $a = new STAttribute();
         echo balanceTags($a->content());
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:7,代码来源:class.admin.menus.php

示例7: sanitizeString

 /**
  * Sanitize the input string. HTML tags can be permitted.
  * The permitted tags can be supplied in an array.
  *
  * @TODO: Finish the code needed to support the $permittedTags array.
  *
  * @param string $string
  * @param bool $allowHTML [optional]
  * @param array $permittedTags [optional]
  * @return string
  */
 public function sanitizeString($string, $allowHTML = FALSE, $permittedTags = array())
 {
     // Strip all tags except the permitted.
     if (!$allowHTML) {
         // Ensure all tags are closed. Uses WordPress method balanceTags().
         $balancedText = balanceTags($string, TRUE);
         $strippedText = strip_tags($balancedText);
         // Strip all script and style tags.
         $strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $strippedText);
         // Escape text using the WordPress method and then strip slashes.
         $escapedText = stripslashes(esc_attr($strippedText));
         // Remove line breaks and trim white space.
         $escapedText = preg_replace('/[\\r\\n\\t ]+/', ' ', $escapedText);
         return trim($escapedText);
     } else {
         // Strip all script and style tags.
         $strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
         $strippedText = preg_replace('/&lt;(script|style).*?&gt;.*?&lt;\\/\\1&gt;/si', '', stripslashes($strippedText));
         /*
          * Use WordPress method make_clickable() to make links clickable and
          * use kses for filtering.
          *
          * http://ottopress.com/2010/wp-quickie-kses/
          */
         return wptexturize(wpautop(make_clickable(wp_kses_post($strippedText))));
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:38,代码来源:class.utility.php

示例8: get_fields

 public static function get_fields($key = '', $raw = false)
 {
     if (empty(self::$fields)) {
         self::init_fields();
     }
     if (!$key) {
         return '';
     }
     $html = '';
     if (is_array(self::$fields)) {
         foreach (self::$fields as $i => $field) {
             if ($field['id'] == $key) {
                 if ($raw == false) {
                     $html .= '<div class="form-group fieldset-' . esc_attr_e($key) . '">';
                     if ($field['label']) {
                         $html .= '<label class="' . esc_attr($field['parent_key_class']) . ' control-label" for="' . esc_attr_e($key) . '">' . balanceTags($field['label'] . ($field['required'] ? '' : ' <small>' . __('(optional)', DLN_CLF) . '</small>')) . '</label>';
                     }
                     $html .= '<div class="' . esc_attr($field['parent_value_class']) . '">';
                     $html .= DLN_Form_Functions::form_get_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field));
                     $html .= '</div>';
                     $html .= '</div>';
                 } else {
                     $html = DLN_Form_Functions::form_get_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field));
                 }
             }
         }
     }
     return $html;
 }
开发者ID:httvncoder,项目名称:151722441,代码行数:29,代码来源:abstract-dln-form.php

示例9: ssquiz_crud_template

function ssquiz_crud_template()
{
    if (!current_user_can(SSQUIZ_CAP)) {
        return;
    }
    $subjects = json_decode(stripslashes($_REQUEST['subject']));
    $type = $_REQUEST['type'];
    $settings = get_option('ssquiz_settings');
    switch ($type) {
        case 'btn_report':
            $settings->pdf_template = balanceTags($subjects->pdf_template);
            break;
        case 'btn_teacher_email':
            $settings->teacher_email_address = wp_kses($subjects->teacher_email_address, array());
            $settings->teacher_email_subject = wp_kses($subjects->teacher_email_subject, array());
            $settings->teacher_email_template = balanceTags($subjects->teacher_email_template);
            $settings->teacher_will_receive = $subjects->teacher_will_receive;
            break;
        case 'btn_user_email':
            $settings->user_email_subject = wp_kses($subjects->user_email_subject, array());
            $settings->user_email_template = balanceTags($subjects->user_email_template);
            $settings->user_will_receive = $subjects->user_will_receive;
            break;
        case 'btn_finish':
            $settings->finish_template = balanceTags($subjects->finish_template);
            break;
        case 'btn_start':
            $settings->start_template = balanceTags($subjects->start_template);
            break;
    }
    update_option('ssquiz_settings', $settings);
}
开发者ID:benoitv80,项目名称:G4A.,代码行数:32,代码来源:admin-settings.php

示例10: widget

    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $flickr_username = isset($instance['flickr_username']) ? $instance['flickr_username'] : '';
        $flickr_count = isset($instance['flickr_count']) ? $instance['flickr_count'] : '';
        /* Before widget (defined by themes). */
        echo balanceTags($before_widget);
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo balanceTags($before_title . $title . $after_title);
        }
        //here will be displayed widget content for Footer 1st column
        ?>
		<div class="flickr_images">
			<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=<?php 
        echo $flickr_count;
        ?>
&amp;flickr_display=random&amp;size=s&amp;layout=x&amp;source=user&amp;user=<?php 
        echo $flickr_username;
        ?>
"></script>
		</div>

		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
开发者ID:riaface,项目名称:GrowBeyond,代码行数:32,代码来源:widget-flickr.php

示例11: ts_essentials_escape

function ts_essentials_escape($str = '', $type = '', $context = '')
{
    if (trim($str)) {
        if ($type == 'strip') {
            if ($context == 'widget_before_after') {
                return strip_tags($str, '<div><ul><li>');
            } elseif ($context == 'widget_title_before_after') {
                return strip_tags($str, '<div><ul><li><h3><h4><h5><h6><strong><em><i><b><span>');
            } elseif (substr($context, 0, 1) == '<') {
                return strip_tags($str, $context);
            } else {
                return strip_tags($str);
            }
        } elseif ($type == 'bal' || $type == 'balance') {
            return balanceTags($str);
        } elseif ($type == 'attr') {
            return esc_attr($str);
        } elseif ($type == 'html') {
            return esc_html($str);
        } elseif ($type == 'url') {
            return esc_url($str);
        } elseif ($type == 'js') {
            return esc_js($str);
        } elseif ($type == 'textarea') {
            return esc_textarea($str);
        } elseif ($type == 'sql') {
            return esc_sql($str);
        } elseif ($type == 'post') {
            return wp_kses_post($str);
        }
    }
    return $str;
}
开发者ID:estvmachine,项目名称:nicowp,代码行数:33,代码来源:functions.php

示例12: st_sc_custom_meta

 function st_sc_custom_meta($attr, $content = false)
 {
     $data = shortcode_atts(array('key' => ''), $attr, 'st_custom_meta');
     extract($data);
     if (!empty($key)) {
         $data = get_post_meta(get_the_ID(), $key, true);
         return balanceTags($data);
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:9,代码来源:base_shortcodes.php

示例13: widget

    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        $args['before_title'] = '<h5 class="stm_subscribe_title">';
        $args['after_title'] = '</h5>';
        echo $args['before_widget'];
        if (!empty($title)) {
            echo $args['before_title'] . esc_html($title) . $args['after_title'];
        }
        $html = '';
        $mailchimp_key = stm_option('mailchimp_api_key');
        $mailchimp_list = stm_option('mailchimp_list_id');
        if ($mailchimp_key and $mailchimp_list) {
            $html .= '<form action="/" class="stm_subscribe_' . time() . '">';
            $html .= '<div class="stm_mailchimp_unit">';
            $html .= '<div class="form-group">';
            $html .= '<input type="email" name="email" class="form-control stm_subscribe_email" required/>';
            $html .= '</div>';
            $html .= '<button class="button"><span class="h5">' . __('Subscribe', 'stm_domain') . '</span></button>';
            $html .= '<div class="stm_subscribe_preloader">Please wait...</div>';
            $html .= '</div>';
            $html .= '</form>';
            $html .= '
			<script type="text/javascript">
				jQuery(document).ready( function($){
					$(".stm_subscribe_' . time() . '").on(\'submit\', function (e) {
						e.preventDefault;
					    var $this = $(this);
						$(".stm_subscribe_preloader").addClass("loading");
				        $.ajax({
				            type: \'POST\',
				            data: \'action=stm_subscribe&email=\' + $($this).find(".stm_subscribe_email").val(),
				            dataType: \'json\',
				            url: ajaxurl,
				            success: function (json) {
				                if (json[\'success\']) {
				                    $($this).replaceWith(\'<div class="success_message">\' + json[\'success\'] + \'</div>\');
				                }
				                if (json[\'error\']) {
				                    alert(json[\'error\']);
				                }
				                $(".stm_subscribe_preloader").removeClass("loading");
				            }
				        });

				        return false;
				    });
				})
			</script>
		';
        } else {
            $html .= __('Error API', 'stm_domain');
        }
        echo balanceTags($html, true);
        echo $args['after_widget'];
    }
开发者ID:rinodung,项目名称:master-study-wordpress,代码行数:64,代码来源:mailchimp.php

示例14: filter_text

 protected static function filter_text($text)
 {
     $text = trim($text);
     //$text = self::code_trick($text); // A better parser than Markdown's for: backticks -> CODE
     $allowed = array('a' => array('href' => array(), 'title' => array(), 'rel' => array()), 'blockquote' => array('cite' => array()), 'br' => array(), 'p' => array(), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h3' => array(), 'h4' => array());
     $text = balanceTags($text);
     $text = wp_kses($text, $allowed);
     $text = trim($text);
     return $text;
 }
开发者ID:rmccue,项目名称:WordPress-Readme-Parser,代码行数:10,代码来源:compat.php

示例15: wyde_footer_content

function wyde_footer_content()
{
    global $wyde_options;
    if (!empty($wyde_options['footer_script'])) {
        /**
         *Echo extra HTML/JavaScript/Stylesheet from theme options > advanced - body content
         */
        echo balanceTags($wyde_options['footer_script'], true);
    }
}
开发者ID:de190909,项目名称:WPTest,代码行数:10,代码来源:custom-functions.php


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