• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_pre_kses_less_than函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wpcf7_sanitize_query_var

function wpcf7_sanitize_query_var($text)
{
    $text = wp_unslash($text);
    $text = wp_check_invalid_utf8($text);
    if (false !== strpos($text, '<')) {
        $text = wp_pre_kses_less_than($text);
        $text = wp_strip_all_tags($text);
    }
    $text = preg_replace('/%[a-f0-9]{2}/i', '', $text);
    $text = preg_replace('/ +/', ' ', $text);
    $text = trim($text, ' ');
    return $text;
}
开发者ID:abcode619,项目名称:wpstuff,代码行数:13,代码来源:formatting.php


示例2: sanitize_multiline_text_field

/**
 * Filter a sanitized multi line text field string without removing linebreaks and tabs.
 *
 * @since 1.4.3
 *
 * @param string $filtered The sanitized string.
 * @param string $str      The string prior to being sanitized.
 */
function sanitize_multiline_text_field($str)
{
    $filtered = wp_check_invalid_utf8($str);
    if (strpos($filtered, '<') !== false) {
        $filtered = wp_pre_kses_less_than($filtered);
        // This will strip extra whitespace for us.
        $filtered = wp_strip_all_tags($filtered, true);
    }
    $found = false;
    while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
        $filtered = str_replace($match[0], '', $filtered);
        $found = true;
    }
    if ($found) {
        // Strip out the whitespace that may now exist after removing the octets.
        $filtered = trim(preg_replace('/ +/', ' ', $filtered));
    }
    return $filtered;
}
开发者ID:Jamesits,项目名称:wp-keybase-verification,代码行数:27,代码来源:write.php


示例3: sanitize_text_field

/**
 * Sanitize a string from user input or from the db
 *
 * check for invalid UTF-8,
 * Convert single < characters to entity,
 * strip all tags,
 * remove line breaks, tabs and extra white space,
 * strip octets.
 *
 * @since 2.9.0
 *
 * @param string $str
 * @return string
 */
function sanitize_text_field($str)
{
    $filtered = wp_check_invalid_utf8($str);
    if (strpos($filtered, '<') !== false) {
        $filtered = wp_pre_kses_less_than($filtered);
        // This will strip extra whitespace for us.
        $filtered = wp_strip_all_tags($filtered, true);
    } else {
        $filtered = trim(preg_replace('/[\\r\\n\\t ]+/', ' ', $filtered));
    }
    $found = false;
    while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
        $filtered = str_replace($match[0], '', $filtered);
        $found = true;
    }
    if ($found) {
        // Strip out the whitespace that may now exist after removing the octets.
        $filtered = trim(preg_replace('/ +/', ' ', $filtered));
    }
    /**
     * Filter a sanitized text field string.
     *
     * @since 2.9.0
     *
     * @param string $filtered The sanitized string.
     * @param string $str      The string prior to being sanitized.
     */
    return apply_filters('sanitize_text_field', $filtered, $str);
}
开发者ID:zhoujiangyou,项目名称:WordPress,代码行数:43,代码来源:formatting.php


示例4: sanitize_text_field

/**
 * Sanitize a string from user input or from the db
 *
 * check for invalid UTF-8,
 * Convert single < characters to entity,
 * strip all tags,
 * remove line breaks, tabs and extra whitre space,
 * strip octets.
 *
 * @since 2.9
 *
 * @param string $str
 * @return string
 */
function sanitize_text_field($str)
{
    $filtered = wp_check_invalid_utf8($str);
    if (strpos($filtered, '<') !== false) {
        $filtered = wp_pre_kses_less_than($filtered);
        $filtered = wp_strip_all_tags($filtered, true);
    } else {
        $filtered = trim(preg_replace('/\\s+/', ' ', $filtered));
    }
    $match = array();
    while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
        $filtered = str_replace($match[0], '', $filtered);
    }
    return apply_filters('sanitize_text_field', $filtered, $str);
}
开发者ID:bluedanbob,项目名称:wordpress,代码行数:29,代码来源:formatting.php


示例5: amt_metatag_highlighter

/**
 * Custom meta tag highlighter.
 *
 * Expects string.
 */
function amt_metatag_highlighter($metatags)
{
    // Convert special chars, but leave quotes.
    $metatags = htmlspecialchars($metatags, ENT_NOQUOTES);
    preg_match_all('#([^\\s]+="[^"]+?)"#i', $metatags, $matches);
    if (!$matches) {
        return $metatags;
    }
    //var_dump($matches[0]);
    foreach ($matches[0] as $match) {
        $highlighted = preg_replace('#^([^=]+)="(.+)"$#i', '<span style="font-weight:bold;color:black;">$1</span>="<span style="color:blue;">$2</span>"', $match);
        //var_dump($highlighted);
        $metatags = str_replace($match, $highlighted, $metatags);
    }
    // Highlight 'itemscope'
    $metatags = str_replace('itemscope', '<span style="font-weight: bold; color: #B90746;">itemscope</span>', $metatags);
    // Do some conversions
    $metatags = wp_pre_kses_less_than($metatags);
    // Done by wp_pre_kses_less_than()
    //$metatags = str_replace('<meta', '&lt;meta', $metatags);
    //$metatags = str_replace('/>', '/&gt;', $metatags);
    return $metatags;
}
开发者ID:RomualdKarbido,项目名称:Zeroom,代码行数:28,代码来源:amt-utils.php


示例6: amt_metatag_highlighter

/**
 * Custom meta tag highlighter.
 *
 * Expects string.
 */
function amt_metatag_highlighter($metatags)
{
    // Convert special chars, but leave quotes.
    // Required for pre box.
    $metatags = htmlspecialchars($metatags, ENT_NOQUOTES);
    if (!apply_filters('amt_metadata_review_mode_enable_highlighter', true)) {
        return $metatags;
    }
    // Find all property/value pairs
    preg_match_all('#([^\\s]+="[^"]+?)"#i', $metatags, $matches);
    if (!$matches) {
        return $metatags;
    }
    // Highlight properties and values.
    //var_dump($matches[0]);
    foreach ($matches[0] as $match) {
        $highlighted = preg_replace('#^([^=]+)="(.+)"$#i', '<span class="amt-ht-attribute">$1</span>="<span class="amt-ht-value">$2</span>"', $match);
        //var_dump($highlighted);
        $metatags = str_replace($match, $highlighted, $metatags);
    }
    // Highlight 'itemscope'
    $metatags = str_replace('itemscope', '<span class="amt-ht-itemscope">itemscope</span>', $metatags);
    // Highlight Schema.org object
    //$metatags = preg_replace('#: ([a-zA-Z0-9]+) --&gt;#', ': <span class="amt-ht-important">$1</span> --&gt;', $metatags);
    // Highlight HTML comments
    $metatags = str_replace('&lt;!--', '<span class="amt-ht-comment">&lt;!--', $metatags);
    $metatags = str_replace('--&gt;', '--&gt;</span>', $metatags);
    // Do some conversions
    $metatags = wp_pre_kses_less_than($metatags);
    // Done by wp_pre_kses_less_than()
    //$metatags = str_replace('<meta', '&lt;meta', $metatags);
    //$metatags = str_replace('/>', '/&gt;', $metatags);
    //$metatags = str_replace('<br />', '___', $metatags);
    //$metatags = str_replace('___', '<br />', $metatags);
    return $metatags;
}
开发者ID:ashenkar,项目名称:sanga,代码行数:41,代码来源:amt-utils.php


示例7: sanitize_permalink

 /**
  * Runs a simple sanitisation of the custom post type permalink structures
  * and adds an error if no post ID or post name present
  *
  * @param string $permalink The permalink structure
  *
  * @return string    Sanitised permalink structure
  */
 public function sanitize_permalink($permalink)
 {
     if (!empty($permalink) && !preg_match('/%(post_id|postname)%/', $permalink)) {
         add_settings_error('permalink_structure', 10, __('Permalink structures must contain at least the <code>%post_id%</code> or <code>%postname%</code>.'));
     }
     $filtered = wp_check_invalid_utf8($permalink);
     if (strpos($filtered, '<') !== false) {
         $filtered = wp_pre_kses_less_than($filtered);
         // This will strip extra whitespace for us.
         $filtered = wp_strip_all_tags($filtered, true);
     } else {
         $filtered = trim(preg_replace('/[\\r\\n\\t ]+/', ' ', $filtered));
     }
     return preg_replace('/[^a-zA-Z0-9\\/\\%_-]*/', '', $filtered);
 }
开发者ID:simonbbrown,项目名称:wp-permastructure,代码行数:23,代码来源:wp-permastructure.php


示例8: _sanitize_text_fields

/**
 * Internal helper function to sanitize a string from user input or from the db
 *
 * @since 4.7.0
 * @access private
 *
 * @param string $str String to sanitize.
 * @param bool $keep_newlines optional Whether to keep newlines. Default: false.
 * @return string Sanitized string.
 */
function _sanitize_text_fields($str, $keep_newlines = false)
{
    $filtered = wp_check_invalid_utf8($str);
    if (strpos($filtered, '<') !== false) {
        $filtered = wp_pre_kses_less_than($filtered);
        // This will strip extra whitespace for us.
        $filtered = wp_strip_all_tags($filtered, false);
        // Use html entities in a special case to make sure no later
        // newline stripping stage could lead to a functional tag
        $filtered = str_replace("<\n", "&lt;\n", $filtered);
    }
    if (!$keep_newlines) {
        $filtered = preg_replace('/[\\r\\n\\t ]+/', ' ', $filtered);
    }
    $filtered = trim($filtered);
    $found = false;
    while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
        $filtered = str_replace($match[0], '', $filtered);
        $found = true;
    }
    if ($found) {
        // Strip out the whitespace that may now exist after removing the octets.
        $filtered = trim(preg_replace('/ +/', ' ', $filtered));
    }
    return $filtered;
}
开发者ID:kucrut,项目名称:wordpress,代码行数:36,代码来源:formatting.php


示例9: social_sanitize_text

 function social_sanitize_text($input)
 {
     $filtered = wp_check_invalid_utf8($input);
     if (strpos($filtered, '<') !== false) {
         $filtered = wp_pre_kses_less_than($filtered);
         // This will strip extra whitespace.
         $filtered = wp_strip_all_tags($filtered, true);
     } else {
         $filtered = trim(preg_replace('/[\\r\\n\\t ]+/', ' ', $filtered));
     }
     return wp_kses_post(force_balance_tags($input));
 }
开发者ID:OanaRaluca,项目名称:Wordpress-theme-7,代码行数:12,代码来源:social-customizer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_prepare_attachment_for_js函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_post_revision_title_expanded函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap