本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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| )+</p>\\s?~', '', $content);
return $content;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}