本文整理汇总了PHP中balanceTags函数的典型用法代码示例。如果您正苦于以下问题:PHP balanceTags函数的具体用法?PHP balanceTags怎么用?PHP balanceTags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了balanceTags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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('/<(script|style).*?>.*?<\\/\\1>/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;
?>
&flickr_display=random&size=s&layout=x&source=user&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
示例16: fpf_run_main
function fpf_run_main($post_id)
{
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
//Don't process REVISIONS (would result in 2 fetches per save)
if (wp_is_post_revision($post_id)) {
return $post_id;
}
// Check the user's permissions.
if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
} else {
if (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
}
/* OK, it's safe for us to save the data now. */
// Make sure that it is set.
if (!isset($_POST['post_content'])) {
return $post_id;
}
$parsed_content = '';
$parsed_content = fpf_find_shortcode($_POST['post_content']);
// back compatibility for old "magic tags"
if (!$parsed_content) {
$parsed_content = fpf_find_tags($_POST['post_content']);
if (isset($parsed_content['aid'])) {
$parsed_content['id'] = $parsed_content['aid'];
}
}
// return early if nothing doing
if (empty($parsed_content) || !isset($parsed_content['id'])) {
return $post_id;
}
//Connect to Facebook and generate the album content
$album_content = fpf_fetch_album_content($parsed_content['id'], $parsed_content);
//Update the post we're about to save
$album = $parsed_content['before'] . $parsed_content['startTag'] . $album_content['content'] . $parsed_content['endTag'] . $parsed_content['after'];
$album = balanceTags($album);
// @todo add more sanitization
update_post_meta($post_id, '_fpf_album_html', $album);
//Set postmeta with the album's size and cover photo (can be optionally referenced by the user)
update_post_meta($post_id, '_fpf_album_size', $album_content['count']);
if (isset($album_content['cover'])) {
update_post_meta($post_id, '_fpf_album_cover', $album_content['cover']);
} else {
delete_post_meta($post_id, '_fpf_album_cover');
}
//Done!
return $post_id;
}
开发者ID:helgatheviking,项目名称:facebook-photo-fetcher,代码行数:55,代码来源:_output_gallery.php
示例17: wp_splash_page_show_preview
function wp_splash_page_show_preview()
{
check_admin_referer(WP_SPLASH_PAGE_PREVIEW_NONCE, 'nonce');
$options = get_option('wp_splash_page_options');
$preview = array('template' => strip_tags($_REQUEST['template']), 'page_title' => empty($_REQUEST['page_title']) ? get_bloginfo('name') : strip_tags(stripslashes($options['page_title'])), 'title' => balanceTags(stripslashes($_REQUEST['title'])), 'text' => balanceTags(stripslashes($_REQUEST['text'])), 'title_color' => !empty($_REQUEST['title_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['title_color'])) ? str_replace('#', '', $_REQUEST['title_color']) : $options['title_color'], 'text_color' => !empty($_REQUEST['text_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['text_color'])) ? str_replace('#', '', $_REQUEST['text_color']) : $options['text_color'], 'background_color' => !empty($_REQUEST['background_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['background_color'])) ? str_replace('#', '', $_REQUEST['background_color']) : $options['background_color'], 'continue_button_bg_color' => !empty($_REQUEST['continue_button_bg_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['continue_button_bg_color'])) ? str_replace('#', '', $_REQUEST['continue_button_bg_color']) : $options['continue_button_bg_color'], 'continue_button_text_color' => !empty($_REQUEST['continue_button_text_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['continue_button_text_color'])) ? str_replace('#', '', $_REQUEST['continue_button_text_color']) : $options['continue_button_text_color'], 'image_url' => esc_url_raw($_REQUEST['image_url']), 'repeat_image' => strip_tags($_REQUEST['repeat_image']), 'center_image' => strip_tags($_REQUEST['center_image']), 'youtube_id' => strip_tags($_REQUEST['youtube_id']), 'video_autoplay' => $_REQUEST['video_autoplay'] == 'true' ? 1 : 0, 'video_width' => $_REQUEST['video_width'] >= 1 && $_REQUEST['video_width'] <= 9999 && ctype_digit($_REQUEST['video_width']) ? intval($_REQUEST['video_width']) : $options['video_width'], 'video_height' => $_REQUEST['video_height'] >= 1 && $_REQUEST['video_height'] <= 9999 && ctype_digit($_REQUEST['video_height']) ? intval($_REQUEST['video_height']) : $options['video_height'], 'continue_button_text' => empty($_REQUEST['continue_button_text']) ? strip_tags('Continue to Web Site') : strip_tags(stripslashes($options['continue_button_text'])), 'enable_age_confirmation' => $_REQUEST['enable_age_confirmation'] == 'true' ? 1 : 0, 'reject_text' => strip_tags(stripslashes($_REQUEST['reject_text'])), 'enable_opt_in' => $_REQUEST['enable_opt_in'] == 'true' ? 1 : 0, 'opt_in_reject_text' => strip_tags(stripslashes($_REQUEST['opt_in_reject_text'])), 'opt_in_text' => balanceTags(stripslashes($_REQUEST['opt_in_text'])));
update_option('wp_splash_page_options_preview', $preview);
$result = array('homeURL' => home_url());
header('content-type: application/json; charset=utf-8');
echo json_encode($result);
die;
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:11,代码来源:preview-ajax.php
示例18: render_error
public function render_error($message)
{
?>
<div class="wrap">
<div class="error" id="error">
<p><strong><?php
echo balanceTags($message);
?>
</strong></p>
</div></div>
<?php
}
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:12,代码来源:ajaxplaylistController.php
示例19: widget
/**
* How to display the widget on the screen.
*/
function widget($args, $instance)
{
extract($args);
global $wp_query, $post;
global $THEMEREX_CURRENT_SIDEBAR;
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
$number = isset($instance['number']) ? (int) $instance['number'] : '';
$show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
$show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
$show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
$show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
$category = isset($instance['category']) ? (int) $instance['category'] : 0;
$show_counters = $show_counters ? get_theme_option("blog_counters") : '';
$output = '';
if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
$output .= '<div class="columnsWrap"><div class="columns1_2">';
}
$args = array('numberposts' => $number, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'ignore_sticky_posts' => 1, 'suppress_filters' => true);
if ($category > 0) {
$args['category'] = $category;
}
$ex = get_theme_option('exclude_cats');
if (!empty($ex)) {
$args['category__not_in'] = explode(',', $ex);
}
$recent_posts = wp_get_recent_posts($args, OBJECT);
$post_number = 0;
foreach ($recent_posts as $post) {
$post_number++;
require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
if ($THEMEREX_CURRENT_SIDEBAR == 'top' && $post_number == round($number / 2)) {
$output .= '
</div><div class="columns1_2">
';
}
if ($post_number >= $number) {
break;
}
}
if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
$output .= '</div></div>';
}
if (!empty($output)) {
/* Before widget (defined by themes). */
echo balanceTags($before_widget);
/* Display the widget title if one was input (before and after defined by themes). */
echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title);
echo balanceTags($output);
/* After widget (defined by themes). */
echo balanceTags($after_widget);
}
}
开发者ID:WestBayResidential,项目名称:wbrsorg,代码行数:56,代码来源:widget-recent-posts.php
示例20: widget_action
public function widget_action()
{
include_once ABSPATH . 'wp-admin/includes/widgets.php';
wp_enqueue_style('wr-megamenu_modal', WR_MEGAMENU_ROOT_URL . '/assets/css/modal.css');
@session_start();
global $wp_widget_factory;
$widgets = $wp_widget_factory->widgets;
$widget_id = $_GET['widget_id'];
$menu = isset($_REQUEST['menu']) ? $_REQUEST['menu'] : '';
$location = isset($_REQUEST['location']) ? $_REQUEST['location'] : '';
if (!$widget_id) {
exit(__('No widget ID'));
}
if (!$widgets[$widget_id]) {
exit(__('Can not find this widget'));
}
$instance = array();
$options = array();
if (isset($_REQUEST['status']) && $_REQUEST['status'] == 'edit') {
$options = $_SESSION['wr_megamenu_widget_options_' . $widget_id];
$options = (array) json_decode($options);
} else {
unset($_SESSION['wr_megamenu_widget_options_' . $widget_id]);
}
$wg = new $widget_id();
$wg->number = 0;
//Get the base ID of widget.
$widget_id_base = $wg->id_base;
if (isset($options) && count($options)) {
// Process field name prefix
$sample_name = $wg->get_field_name('');
$_patern = '#([^\\[\\]\\r\\n\\s\\t]+)\\[#';
preg_match_all($_patern, $sample_name, $matches, PREG_SET_ORDER);
if ($matches) {
$options_index = $matches[0][1];
}
$instance = (array) $options[$options_index][0];
}
ob_start();
echo '<div class="jsn-bootstrap3" id="widget-options-container">
<form id="widget-options" class="form-horizontal form-inline" onsubmit="javascript:void(0)" autocomplete="false">
<input type="hidden" name="wr_megamenu_menu" id="wr_megamenu_menu" value="' . $menu . '">
<input type="hidden" name="wr_megamenu_location" id="wr_megamenu_location" value="' . $location . '">
<input type="hidden" name="wr_megamenu_widget_id" id="wr_megamenu_widget_id" value="' . $widget_id_base . '">
<input type="hidden" name="wr_megamenu_widget_title_id" id="wr_megamenu_widget_title_id" value="' . $wg->get_field_id('title') . '">
';
$wg->form($instance);
echo '</form></div>';
echo balanceTags(ob_get_clean());
}
开发者ID:webprese,项目名称:dev.mgeonline,代码行数:50,代码来源:widget.php
注:本文中的balanceTags函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论