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


PHP force_balance_tags函数代码示例

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


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

示例1: from_html

 public static function from_html($html, $title)
 {
     // give us soem breathing room
     ini_set('max_execution_time', 180);
     //$ohtml = $html;
     // pre-parse remote or url based assets
     try {
         $html = self::_pre_parse_remote_assets($html);
     } catch (Exception $e) {
         die('error');
         echo '<h1>Problem parsing html.</h1>';
         echo '<h2>' . force_balance_tags($e->getMessage()) . '</h2>';
         return;
     }
     // if we are debugging the pdf, then depending on the mode, dump the html contents onw
     if (QSOT_DEBUG_PDF & 2) {
         // || ( current_user_can( 'edit_posts' ) && isset( $_GET['as'] ) && 'html' == $_GET['as'] ) ) {
         echo '<pre>';
         echo htmlspecialchars($html);
         echo '</pre>';
         die;
     }
     // include the library
     require_once QSOT::plugin_dir() . 'libs/dompdf/dompdf_config.inc.php';
     // make and output the pdf
     $pdf = new DOMPDF();
     $pdf->load_html($html);
     $pdf->render();
     $pdf->stream(sanitize_title_with_dashes('ticket-' . $title) . '.pdf', array('Attachment' => 1));
     exit;
 }
开发者ID:Jayriq,项目名称:opentickets-community,代码行数:31,代码来源:pdf.class.php

示例2: dnp_social

/**
* Social Shorcodes
*/
function dnp_social($params, $content = null)
{
    extract(shortcode_atts(array('type' => 'facebook', 'link' => '#'), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '<a class="social ' . $type . '" href="' . $link . '"><i class="icon-' . ($type !== 'gplus' ? $type : 'google-plus') . '"></i></a>';
    return force_balance_tags($result);
}
开发者ID:samuel657677,项目名称:www.mertex.de,代码行数:10,代码来源:dnp_social.php

示例3: bs_buttons

function bs_buttons($params, $content = null)
{
    extract(shortcode_atts(array('size' => 'default', 'type' => 'default', 'value' => 'button', 'href' => "#"), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '<a class="btn btn-' . $size . ' btn-' . $type . '" href="' . $href . '">' . $value . '</a>';
    return force_balance_tags($result);
}
开发者ID:t3patterson,项目名称:bootstrap_to_wp,代码行数:7,代码来源:bs_buttons.php

示例4: xprofile_sanitize_data_value_before_save

/**
 * xprofile_sanitize_data_value_before_save ( $field_value, $field_id )
 *
 * Safely runs profile field data through kses and force_balance_tags.
 *
 * @param string $field_value
 * @param int $field_id
 * @return string
 */
function xprofile_sanitize_data_value_before_save ( $field_value, $field_id ) {

	// Return if empty
	if ( empty( $field_value ) )
		return;

	// Value might be serialized
	$field_value = maybe_unserialize( $field_value );

	// Filter single value
	if ( !is_array( $field_value ) ) {
		$kses_field_value     = wp_filter_kses( $field_value );
		$filtered_field_value = force_balance_tags( $kses_field_value );

	// Filter each array item independently
	} else {
		foreach ( (array)$field_value as $value ) {
			$kses_field_value       = wp_filter_kses( $value );
			$filtered_values[] = force_balance_tags( $kses_field_value );
		}

		$filtered_field_value = serialize( $filtered_values );
	}

	return $filtered_field_value;
}
开发者ID:n-sane,项目名称:zaroka,代码行数:35,代码来源:bp-xprofile-filters.php

示例5: dnp_contact

function dnp_contact($params, $content = null)
{
    extract(shortcode_atts(array(), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '';
    $result .= '<form class="comment_form" id="commentform" method="post" action="' . admin_url('admin-ajax.php?action=contact') . '">
						<div class="row-fluid">
							<div class="span6">
								<input type="email" placeholder="' . __('Email', '') . '" required name="email" id="email">
							</div>
							<div class="span6">
								<input type="text" placeholder="' . __('Name', '') . '" required name="name" id="name">
							</div>
						</div>
						<div class="row-fluid">
							<div class="span8">
								<textarea rows="10" cols="30" placeholder="' . __('Message', '') . '" name="message"></textarea>
							</div>
							<div class="span4">
								<button type="submit" class="btn "><i class="li_paperplane"></i>' . __('Send message', 'argo') . '</button>
							</div>
						</div>
					</form>';
    return force_balance_tags($result);
}
开发者ID:samuel657677,项目名称:www.mertex.de,代码行数:25,代码来源:dnp_contact.php

示例6: dws_icons

/**
 * Button
 */
function dws_icons($params, $content = null)
{
    extract(shortcode_atts(array('name' => 'default'), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '<i class="' . $name . '"></i>';
    return force_balance_tags($result);
}
开发者ID:rinodung,项目名称:live-theme,代码行数:10,代码来源:dws_icons.php

示例7: erh_trim_excerpt

 function erh_trim_excerpt($text)
 {
     $raw_excerpt = $text;
     if ('' == $text) {
         $text = get_the_content('');
         $text = strip_shortcodes($text);
         $text = apply_filters('the_content', $text);
         // $text = str_replace(']]>', ']]>', $text);
         //  $text = strip_tags($text, '<em><strong><p>');
         // Set the excerpt length
         $excerpt_length = apply_filters('excerpt_length', 150);
         // Set what appears at the end of the excerpt
         $excerpt_more = apply_filters('excerpt_more', ' ' . '...');
         $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
         if (count($words) > $excerpt_length) {
             array_pop($words);
             $text = implode(' ', $words);
             $text = $text . $excerpt_more;
             $text = force_balance_tags($text);
         } else {
             $text = implode(' ', $words);
         }
     }
     return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
 }
开发者ID:ehermanson,项目名称:wp-starter-bootstrap,代码行数:25,代码来源:posts.php

示例8: removeEmptyPTag

 /**
  * Removes empty p-tags
  * @param  string $content Text
  * @return string       Markup
  */
 public function removeEmptyPTag($content)
 {
     $content = force_balance_tags($content);
     $content = preg_replace('#<p>\\s*+(<br\\s*/*>)?\\s*</p>#i', '', $content);
     $content = preg_replace('~\\s?<p>(\\s|&nbsp;)+</p>\\s?~', '', $content);
     return $content;
 }
开发者ID:helsingborg-stad,项目名称:Municipio,代码行数:12,代码来源:General.php

示例9: els_heading

function els_heading($params, $content = null)
{
    extract(shortcode_atts(array('size' => 'h2', 'text' => 'Heading 2 Custom'), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = sprintf('<%1$s class="els-heading"><span class="sr">%2$s</span></%1$s>', $size, $text);
    return force_balance_tags($result);
}
开发者ID:anup04sust,项目名称:GarnetMachine,代码行数:7,代码来源:els_heading.php

示例10: els_labels

function els_labels($params, $content = null)
{
    extract(shortcode_atts(array('type' => 'default'), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '<span class="label label-' . $type . '">' . $content . '</span>';
    return force_balance_tags($result);
}
开发者ID:anup04sust,项目名称:GarnetMachine,代码行数:7,代码来源:els_labels.php

示例11: dnp_code_inline

function dnp_code_inline($params, $content = null)
{
    extract(shortcode_atts(array('type' => '', 'value' => ''), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '<code>' . do_shortcode($content) . '</code>';
    return force_balance_tags($result);
}
开发者ID:samuel657677,项目名称:www.mertex.de,代码行数:7,代码来源:dnp_code.php

示例12: dnp_buttons_toolbar

function dnp_buttons_toolbar($params, $content = null)
{
    extract(shortcode_atts(array(), $params));
    $content = preg_replace('/<br class="nc".\\/>/', '', $content);
    $result = '<div class="btn-toolbar">' . do_shortcode($content) . '</div>';
    return force_balance_tags($result);
}
开发者ID:samuel657677,项目名称:www.mertex.de,代码行数:7,代码来源:dnp_buttons.php

示例13: my_shortcode_panel

function my_shortcode_panel($atts, $content = null)
{
    // extract and set defaults
    extract(shortcode_atts(array('type' => 'keyline'), $atts));
    $output_string = '<article class="island panel ' . $type . '">' . $content . '</article>';
    return force_balance_tags($output_string);
}
开发者ID:xeyefex,项目名称:Mixd-WordPress-Framework,代码行数:7,代码来源:shortcodes.php

示例14: xprofile_sanitize_data_value_before_save

/**
 * xprofile_sanitize_data_value_before_save ( $field_value, $field_id )
 *
 * Safely runs profile field data through kses and force_balance_tags.
 *
 * @param string $field_value
 * @param int $field_id
 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true
 * @return string
 */
function xprofile_sanitize_data_value_before_save($field_value, $field_id, $reserialize = true)
{
    // Return if empty
    if (empty($field_value)) {
        return;
    }
    // Value might be serialized
    $field_value = maybe_unserialize($field_value);
    // Filter single value
    if (!is_array($field_value)) {
        $kses_field_value = xprofile_filter_kses($field_value);
        $filtered_field_value = nxt_rel_nofollow(force_balance_tags($kses_field_value));
        $filtered_field_value = apply_filters('xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value);
        // Filter each array item independently
    } else {
        $filtered_values = array();
        foreach ((array) $field_value as $value) {
            $kses_field_value = xprofile_filter_kses($value);
            $filtered_value = nxt_rel_nofollow(force_balance_tags($kses_field_value));
            $filtered_values[] = apply_filters('xprofile_filtered_data_value_before_save', $filtered_value, $value);
        }
        if ($reserialize) {
            $filtered_field_value = serialize($filtered_values);
        } else {
            $filtered_field_value = $filtered_values;
        }
    }
    return $filtered_field_value;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:39,代码来源:bp-xprofile-filters.php

示例15: the_excerpt_rereloaded

function the_excerpt_rereloaded($words = 40, $link_text = 'Leia Mais', $allowed_tags = '', $container = 'p', $smileys = 'no' )
{
	global $post;
        
    if ( $allowed_tags == 'all' ) $allowed_tags = '<h3>,<br>,<p>,<i>,<em>,<b>,<strong>,<ul>,<ol>,<li>,<span>,<blockquote>,<img>';
    
    $text = preg_replace('/\[.*\]/', '', strip_tags($post->post_content, $allowed_tags));

    $text = explode(' ', $text);
    $tot = count($text);
    
    for ( $i=0; $i<$words; $i++ ) : $output .= $text[$i] . ' '; endfor;
    
    if ( $smileys == "yes" ) $output = convert_smilies($output);
 
    ?><p><?php echo force_balance_tags($output) ?><?php if ( $i < $tot ) : ?> ...<?php else : ?></p><?php endif; ?>
    <?php if ( $i < $tot ) : 
        if ( $container == 'p' || $container == 'div' ) : ?></p><?php endif; 
            if ( $container != 'plain' ) : ?><<?php echo $container; ?> class="more"><?php if ( $container == 'div' ) : ?><p><?php endif; endif; ?>
            
    <a href="<?php the_permalink(); ?>" title="<?php echo $link_text; ?>"><?php echo $link_text; ?></a><?php
    
            if ( $container == 'div' ) : ?></p><?php endif; if ( $container != 'plain' ) : ?></<?php echo $container; ?>><?php endif;
        if ( $container == 'plain' || $container == 'span' ) : ?></p><?php endif; 
        endif;
        
}
开发者ID:rodolfospalenza,项目名称:blogrs,代码行数:27,代码来源:the_excerpt_rereloaded.php


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