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


PHP wp_kses_no_null函数代码示例

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


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

示例1: ksesXML

 /**
  * Sanitises a fragment of XML code.
  *
  * @since 1.4
  *
  * @param string $xml
  * @return string
  */
 public static function ksesXML($xml)
 {
     $xml = wp_kses_no_null($xml);
     $xml = wp_kses_js_entities($xml);
     $xml = wp_kses_normalize_entities($xml);
     return preg_replace_callback('%(<[^>]*(>|$)|>)%', array('self', 'kses_split'), $xml);
 }
开发者ID:MarkSpencerTan,项目名称:webdev,代码行数:15,代码来源:sitetree-utilities.class.php

示例2: get_the_content

function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
{
    global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
    global $preview;
    global $pagenow;
    $output = '';
    if (!empty($post->post_password)) {
        // if there's a password
        if (stripslashes($_COOKIE['wp-postpass_' . COOKIEHASH]) != $post->post_password) {
            // and it doesn't match the cookie
            $output = get_the_password_form();
            return $output;
        }
    }
    if ($more_file != '') {
        $file = $more_file;
    } else {
        $file = $pagenow;
    }
    //$_SERVER['PHP_SELF'];
    if ($page > count($pages)) {
        // if the requested page doesn't exist
        $page = count($pages);
    }
    // give them the highest numbered page that DOES exist
    $content = $pages[$page - 1];
    if (preg_match('/<!--more(.+?)?-->/', $content, $matches)) {
        $content = explode($matches[0], $content, 2);
        if (!empty($matches[1]) && !empty($more_link_text)) {
            $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
        }
    } else {
        $content = array($content);
    }
    if (false !== strpos($post->post_content, '<!--noteaser-->') && (!$multipage || $page == 1)) {
        $stripteaser = 1;
    }
    $teaser = $content[0];
    if ($more && $stripteaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<a id="more-' . $id . '"></a>' . $content[1];
        } else {
            $output = balanceTags($output);
            if (!empty($more_link_text)) {
                $output .= ' <a href="' . get_permalink() . "#more-{$id}\" class=\"more-link\">{$more_link_text}</a>";
            }
        }
    }
    if ($preview) {
        // preview fix for javascript bug with foreign languages
        $output = preg_replace('/\\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);
    }
    return $output;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:58,代码来源:post-template.php

示例3: get_morelinktext_postmeta

 function get_morelinktext_postmeta($value, $key, $post)
 {
     if (!strlen($value)) {
         //Import any custom anchors from the post itself
         $content = $post->post_content;
         $matches = array();
         if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
             $content = explode($matches[0], $content, 2);
             if (!empty($matches[1])) {
                 return strip_tags(wp_kses_no_null(trim($matches[1])));
             }
         }
     }
     return $value;
 }
开发者ID:quinntron,项目名称:greendot,代码行数:15,代码来源:more-links.php

示例4: sanitize_posted_data

 private function sanitize_posted_data($value)
 {
     if (is_array($value)) {
         $value = array_map(array($this, 'sanitize_posted_data'), $value);
     } elseif (is_string($value)) {
         $value = wp_check_invalid_utf8($value);
         $value = wp_kses_no_null($value);
     }
     return $value;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:10,代码来源:submission.php

示例5: wp_kses_bad_protocol_once2

function wp_kses_bad_protocol_once2($string, $allowed_protocols)
###############################################################################
# This function processes URL protocols, checks to see if they're in the white-
# list or not, and returns different data depending on the answer.
###############################################################################
{
	$string2 = wp_kses_decode_entities($string);
	$string2 = preg_replace('/\s/', '', $string2);
	$string2 = wp_kses_no_null($string2);
	$string2 = preg_replace('/\xad+/', '', $string2);
	# deals with Opera "feature"
	$string2 = strtolower($string2);

	$allowed = false;
	foreach ($allowed_protocols as $one_protocol)
		if (strtolower($one_protocol) == $string2) {
			$allowed = true;
			break;
		}

	if ($allowed)
		return "$string2:";
	else
		return '';
} # function wp_kses_bad_protocol_once2
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:25,代码来源:kses.php

示例6: wp_kses_bad_protocol_once2

/**
 * Callback for wp_kses_bad_protocol_once() regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * white-list or not, and returns different data depending on the answer.
 *
 * @access private
 * @since 1.0.0
 *
 * @param mixed $matches string or preg_replace_callback() matches array to check for bad protocols
 * @return string Sanitized content
 */
function wp_kses_bad_protocol_once2($matches)
{
    global $_kses_allowed_protocols;
    if (is_array($matches)) {
        if (!isset($matches[1]) || empty($matches[1])) {
            return '';
        }
        $string = $matches[1];
    } else {
        $string = $matches;
    }
    $string2 = wp_kses_decode_entities($string);
    $string2 = preg_replace('/\\s/', '', $string2);
    $string2 = wp_kses_no_null($string2);
    $string2 = preg_replace('/\\xad+/', '', $string2);
    # deals with Opera "feature"
    $string2 = strtolower($string2);
    $allowed = false;
    foreach ((array) $_kses_allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) == $string2) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$string2}:";
    } else {
        return '';
    }
}
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:42,代码来源:kses.php

示例7: get_the_content

/**
 * Retrieve the post content.
 *
 * @since 0.71
 *
 * @param string $more_link_text Optional. Content for when there is more text.
 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
 * @return string
 */
function get_the_content($more_link_text = null, $stripteaser = false)
{
    global $post, $more, $page, $pages, $multipage, $preview;
    if (null === $more_link_text) {
        $more_link_text = __('(more...)');
    }
    $output = '';
    $hasTeaser = false;
    // If post password required and it doesn't match the cookie.
    if (post_password_required($post)) {
        return get_the_password_form();
    }
    if ($page > count($pages)) {
        // if the requested page doesn't exist
        $page = count($pages);
    }
    // give them the highest numbered page that DOES exist
    $content = $pages[$page - 1];
    if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
        $content = explode($matches[0], $content, 2);
        if (!empty($matches[1]) && !empty($more_link_text)) {
            $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
        }
        $hasTeaser = true;
    } else {
        $content = array($content);
    }
    if (false !== strpos($post->post_content, '<!--noteaser-->') && (!$multipage || $page == 1)) {
        $stripteaser = true;
    }
    $teaser = $content[0];
    if ($more && $stripteaser && $hasTeaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
        } else {
            if (!empty($more_link_text)) {
                $output .= apply_filters('the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">{$more_link_text}</a>", $more_link_text);
            }
            $output = force_balance_tags($output);
        }
    }
    if ($preview) {
        // preview fix for javascript bug with foreign languages
        $output = preg_replace_callback('/\\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
    }
    return $output;
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:60,代码来源:post-template.php

示例8: wp_sanitize_redirect

    /**
     * Sanitizes a URL for use in a redirect.
     *
     * @since 2.3.0
     *
     * @return string redirect-sanitized URL
     **/
    function wp_sanitize_redirect($location)
    {
        $regex = '/
		(
			(?: [\\xC2-\\xDF][\\x80-\\xBF]        # double-byte sequences   110xxxxx 10xxxxxx
			|   \\xE0[\\xA0-\\xBF][\\x80-\\xBF]    # triple-byte sequences   1110xxxx 10xxxxxx * 2
			|   [\\xE1-\\xEC][\\x80-\\xBF]{2}
			|   \\xED[\\x80-\\x9F][\\x80-\\xBF]
			|   [\\xEE-\\xEF][\\x80-\\xBF]{2}
			|   \\xF0[\\x90-\\xBF][\\x80-\\xBF]{2} # four-byte sequences   11110xxx 10xxxxxx * 3
			|   [\\xF1-\\xF3][\\x80-\\xBF]{3}
			|   \\xF4[\\x80-\\x8F][\\x80-\\xBF]{2}
		){1,50}                              # ...one or more times
		)/x';
        $location = preg_replace_callback($regex, '_wp_sanitize_utf8_in_redirect', $location);
        $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!*\\[\\]()]|i', '', $location);
        $location = wp_kses_no_null($location);
        // remove %0d and %0a from location
        $strip = array('%0d', '%0a', '%0D', '%0A');
        $location = _deep_replace($strip, $location);
        return $location;
    }
开发者ID:cybKIRA,项目名称:roverlink-updated,代码行数:29,代码来源:pluggable.php

示例9: sanitize_entry_value

 /**
  * Override this method to implement the appropriate sanitization specific to the field type before the value is saved.
  *
  * This base method provides a generic sanitization similar to wp_kses but values are not encoded.
  * Scripts are stripped out leaving allowed tags if HTMl is allowed.
  *
  * @param string $value The field value to be processed.
  * @param int $form_id The ID of the form currently being processed.
  *
  * @return string
  */
 public function sanitize_entry_value($value, $form_id)
 {
     if (is_array($value)) {
         return '';
     }
     //allow HTML for certain field types
     $allow_html = $this->allow_html();
     $allowable_tags = gf_apply_filters(array('gform_allowable_tags', $form_id), $allow_html, $this, $form_id);
     if ($allowable_tags !== true) {
         $value = strip_tags($value, $allowable_tags);
     }
     $allowed_protocols = wp_allowed_protocols();
     $value = wp_kses_no_null($value, array('slash_zero' => 'keep'));
     $value = wp_kses_hook($value, 'post', $allowed_protocols);
     $value = wp_kses_split($value, 'post', $allowed_protocols);
     return $value;
 }
开发者ID:timk85,项目名称:DIT,代码行数:28,代码来源:class-gf-field.php

示例10: get_the_content

/**
 * Retrieve the post content.
 *
 * @since 0.71
 *
 * @param string $more_link_text Optional. Content for when there is more text.
 * @param string $stripteaser Optional. Teaser content before the more text.
 * @param string $more_file Optional. Not used.
 * @return string
 */
function get_the_content($more_link_text = null, $stripteaser = 0, $more_file = '')
{
    global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;
    if (null === $more_link_text) {
        $more_link_text = __('(more...)');
    }
    $output = '';
    // If post password required and it doesn't match the cookie.
    if (post_password_required($post)) {
        $output = get_the_password_form();
        return $output;
    }
    if ($more_file != '') {
        $file = $more_file;
    } else {
        $file = $pagenow;
    }
    //$_SERVER['PHP_SELF'];
    if ($page > count($pages)) {
        // if the requested page doesn't exist
        $page = count($pages);
    }
    // give them the highest numbered page that DOES exist
    $content = $pages[$page - 1];
    if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
        $content = explode($matches[0], $content, 2);
        if (!empty($matches[1]) && !empty($more_link_text)) {
            $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
        }
    } else {
        $content = array($content);
    }
    if (false !== strpos($post->post_content, '<!--noteaser-->') && (!$multipage || $page == 1)) {
        $stripteaser = 1;
    }
    $teaser = $content[0];
    if ($more && $stripteaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<span id="more-' . $id . '"></span>' . $content[1];
        } else {
            $output = balanceTags($output);
            if (!empty($more_link_text)) {
                $output .= ' <a href="' . get_permalink() . "#more-{$id}\" class=\"more-link\">{$more_link_text}</a>";
            }
        }
    }
    if ($preview) {
        // preview fix for javascript bug with foreign languages
        $output = preg_replace_callback('/\\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output);
    }
    return $output;
}
开发者ID:blowery,项目名称:wordpress,代码行数:66,代码来源:post-template.php

示例11: raindrops_add_more

 function raindrops_add_more($id, $content, $more_link_text = null)
 {
     global $multipage, $page;
     $pre = apply_filters('raindrops_add_more_before', '');
     $after = apply_filters('raindrops_add_more_after', '');
     $html = ' <div class="raindrops-more-wrapper">' . $pre . '<a href="%1$s%2$s" class="poster-more-link">%3$s</a>' . $after . '</div>';
     if (empty($more_link_text)) {
         $raindrops_aria_hidden = raindrops_doctype_elements('', 'aria-hidden="true"', false);
         $more_link_text = esc_html__('Continue&nbsp;reading ', 'raindrops') . '<span class="meta-nav" ' . $raindrops_aria_hidden . '>&rarr;</span><span class="more-link-post-unique">' . esc_html__('&nbsp;Post ID&nbsp;', 'raindrops') . $id . '</span>';
     }
     $output = '';
     $strip_teaser = false;
     $more = false;
     if (preg_match('/<!--noteaser-->/', $content, $matches)) {
         $fragment_identifier = '';
     } else {
         $fragment_identifier = '#more-' . $id;
     }
     if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
         $content = explode($matches[0], $content, 2);
         if (!empty($matches[1])) {
             $more_link_text = esc_html($matches[1]);
         }
         if (!empty($matches[1]) && !empty($more_link_text)) {
             $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
         }
         $more = true;
     }
     if (is_array($content)) {
         $content = $content[0];
         $content .= apply_filters('the_content_more_link', sprintf($html, get_permalink($id), $fragment_identifier, $more_link_text), $more_link_text);
         $content = force_balance_tags($content);
         return apply_filters('raindrops_add_more', $content, $more);
     } else {
         return apply_filters('raindrops_add_more', $content, $more);
     }
 }
开发者ID:TheRojam,项目名称:raindrops,代码行数:37,代码来源:functions.php

示例12: biznex_content

function biznex_content($q = null, $more_link_text = null, $strip_teaser = false)
{
    global $page, $more, $preview, $pages, $multipage;
    $post = get_post($q);
    if (null === $more_link_text) {
        $more_link_text = __('(more&hellip;)');
    }
    $output = '';
    $has_teaser = false;
    if (post_password_required($post)) {
        return get_the_password_form($post);
    }
    if ($page > count($pages)) {
        $page = count($pages);
    }
    $content = $pages[$page - 1];
    if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
        $content = explode($matches[0], $content, 2);
        if (!empty($matches[1]) && !empty($more_link_text)) {
            $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
        }
        $has_teaser = true;
    } else {
        $content = array($content);
    }
    if (false !== strpos($post->post_content, '<!--noteaser-->') && (!$multipage || $page == 1)) {
        $strip_teaser = true;
    }
    $teaser = $content[0];
    if ($more && $strip_teaser && $has_teaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
        } else {
            if (!empty($more_link_text)) {
                $output .= apply_filters('the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">{$more_link_text}</a>", $more_link_text);
            }
            $output = force_balance_tags($output);
        }
    }
    if ($preview) {
        $output = preg_replace_callback('/\\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
    }
    return $output;
}
开发者ID:sissisnothere,项目名称:testWeb,代码行数:48,代码来源:functions.php

示例13: wp_redirect

function wp_redirect($location, $status = 302) {
	global $is_IIS;

	$location = apply_filters('wp_redirect', $location, $status);

	if ( !$location ) // allows the wp_redirect filter to cancel a redirect
		return false; 

	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
	$location = wp_kses_no_null($location);

	$strip = array('%0d', '%0a');
	$location = str_replace($strip, '', $location);

	if ( $is_IIS ) {
		header("Refresh: 0;url=$location");
	} else {
		if ( php_sapi_name() != 'cgi-fcgi' )
			status_header($status); // This causes problems on IIS and some FastCGI setups
		header("Location: $location");
	}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:22,代码来源:pluggable.php

示例14: wp_kses_bad_protocol_once2

 static function wp_kses_bad_protocol_once2($string, $allowed_protocols)
 {
     $string2 = wp_kses_decode_entities($string);
     $string2 = preg_replace('/\\s/', '', $string2);
     $string2 = wp_kses_no_null($string2);
     $string2 = strtolower($string2);
     $allowed = false;
     foreach ((array) $allowed_protocols as $one_protocol) {
         if (strtolower($one_protocol) == $string2) {
             $allowed = true;
             break;
         }
     }
     if ($allowed) {
         return "{$string2}:";
     } else {
         return '';
     }
 }
开发者ID:roblarsen,项目名称:jquery-wp-content,代码行数:19,代码来源:class.vaultpress-hotfixes.php

示例15: get_the_post_thumbnail

        echo get_the_post_thumbnail($item->ID, 'hotdaily-thumb');
        ?>
</div>
<h2><?php 
        echo $item->post_title;
        ?>
</h2>
<p class="txt"><?php 
        // split content if too long
        $post_content = $item->post_content;
        $output = '';
        $has_teaser = false;
        if (preg_match('/<!--more(.*?)?-->/', $post_content, $matches)) {
            $post_content = explode($matches[0], $post_content, 2);
            if (!empty($matches[1]) && !empty($more_link_text)) {
                $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
            }
            $has_teaser = true;
        } else {
            $post_content = array($post_content);
        }
        $teaser = $post_content[0];
        $output .= $teaser;
        $output = force_balance_tags($output);
        echo $output;
        ?>
</p>
<footer>
<span class="date">(<?php 
        echo date("Y/m/d", strtotime($item->post_date));
        ?>
开发者ID:nil-vn,项目名称:beautysite,代码行数:31,代码来源:content.php


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