<?php
/**
* Main WordPress Formatting API.
*
* Handles many functions for formatting output.
*
* @package WordPress
*/
/**
* Replaces common plain text characters with formatted entities.
*
* Returns given text with transformations of quotes into smart quotes, apostrophes,
* dashes, ellipses, the trademark symbol, and the multiplication symbol.
*
* As an example,
*
* 'cause today's effort makes it worth tomorrow's "holiday" ...
*
* Becomes:
*
* ’cause today’s effort makes it worth tomorrow’s “holiday” …
*
* Code within certain HTML blocks are skipped.
*
* Do not use this function before the {@see 'init'} action hook; everything will break.
*
* @since 0.71
*
* @global array $wp_cockneyreplace Array of formatted entities for certain common phrases.
* @global array $shortcode_tags
*
* @param string $text The text to be formatted.
* @param bool $reset Set to true for unit testing. Translated patterns will reset.
* @return string The string replaced with HTML entities.
*/
function wptexturize( $text, $reset = false ) {
global $wp_cockneyreplace, $shortcode_tags;
static $static_characters = null,
$static_replacements = null,
$dynamic_characters = null,
$dynamic_replacements = null,
$default_no_texturize_tags = null,
$default_no_texturize_shortcodes = null,
$run_texturize = true,
$apos = null,
$prime = null,
$double_prime = null,
$opening_quote = null,
$closing_quote = null,
$opening_single_quote = null,
$closing_single_quote = null,
$open_q_flag = '<!--oq-->',
$open_sq_flag = '<!--osq-->',
$apos_flag = '<!--apos-->';
// If there's nothing to do, just stop.
if ( empty( $text ) || false === $run_texturize ) {
return $text;
}
// Set up static variables. Run once only.
if ( $reset || ! isset( $static_characters ) ) {
/**
* Filters whether to skip running wptexturize().
*
* Returning false from the filter will effectively short-circuit wptexturize()
* and return the original text passed to the function instead.
*
* The filter runs only once, the first time wptexturize() is called.
*
* @since 4.0.0
*
* @see wptexturize()
*
* @param bool $run_texturize Whether to short-circuit wptexturize().
*/
$run_texturize = apply_filters( 'run_wptexturize', $run_texturize );
if ( false === $run_texturize ) {
return $text;
}
/* translators: Opening curly double quote. */
$opening_quote = _x( '“', 'opening curly double quote' );
/* translators: Closing curly double quote. */
$closing_quote = _x( '”', 'closing curly double quote' );
/* translators: Apostrophe, for example in 'cause or can't. */
$apos = _x( '’', 'apostrophe' );
/* translators: Prime, for example in 9' (nine feet). */
$prime = _x( '′', 'prime' );
/* translators: Double prime, for example in 9" (nine inches). */
$double_prime = _x( '″', 'double prime' );
/* translators: Opening curly single quote. */
$opening_single_quote = _x( '‘', 'opening curly single quote' );
/* translators: Closing curly single quote. */
$closing_single_quote = _x( '’', 'closing curly single quote' );
/* translators: En dash. */
$en_dash = _x( '–', 'en dash' );
/* translators: Em dash. */
$em_dash = _x( '—', 'em dash' );
$default_no_texturize_tags = array( 'pre', 'code', 'kbd', 'style', 'script', 'tt' );
$default_no_texturize_shortcodes = array( 'code' );
// If a plugin has provided an autocorrect array, use it.
if ( isset( $wp_cockneyreplace ) ) {
$cockney = array_keys( $wp_cockneyreplace );
$cockneyreplace = array_values( $wp_cockneyreplace );
} else {
/*
* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
* for example... 'We do not have enough words yet'... is a typical quoted phrase. But when we write
* lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
*/
$cockney = explode(
',',
_x(
"'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
'Comma-separated list of words to texturize in your language'
)
);
$cockneyreplace = explode(
',',
_x(
'’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em',
'Comma-separated list of replacement words in your language'
)
);
}
$static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
$static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace );
// Pattern-based replacements of characters.
// Sort the remaining patterns into several arrays for performance tuning.
$dynamic_characters = array(
'apos' => array(),
'quote' => array(),
'dash' => array(),
);
$dynamic_replacements = array(
'apos' => array(),
'quote' => array(),
'dash' => array(),
);
$dynamic = array();
$spaces = wp_spaces_regexp();
// '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation.
if ( "'" !== $apos || "'" !== $closing_single_quote ) {
$dynamic[ '/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_single_quote;
}
if ( "'" !== $apos || '"' !== $closing_quote ) {
$dynamic[ '/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_quote;
}
// '99 '99s '99's (apostrophe) But never '9 or '99% or '999 or '99.0.
if ( "'" !== $apos ) {
$dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag;
}
// Quoted numbers like '0.42'.
if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $open_sq_flag . '$1' . $closing_single_quote;
}
// Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
if ( "'" !== $opening_single_quote ) {
$dynamic[ '/(?<=\A|[([{"\-]|<|' . $spaces . ')\'/' ] = $open_sq_flag;
}
// Apostrophe in a word. No spaces, double apostrophes, or other punctuation.
if ( "'" !== $apos ) {
$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos_flag;
}
$dynamic_characters['apos'] = array_keys( $dynamic );
$dynamic_replacements['apos'] = array_values( $dynamic );
$dynamic = array();
// Quoted numbers like "42".
if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
$dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $open_q_flag . '$1' . $closing_quote;
}
// Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces.
if ( '"' !== $opening_quote ) {
$dynamic[ '/(?<=\A|[([{\-]|<|' . $spaces . ')"(?!' . $spaces . ')/' ] = $open_q_flag;
}
$dynamic_characters['quote'] = array_keys( $dynamic );
$dynamic_replacements['quote'] = array_values( $dynamic );
$dynamic = array();
// Dashes and spaces.
$dynamic['/---/'] = $em_dash;
$dynamic[ '/(?<=^|' . $spaces . ')--(?=$|' . $spaces . ')/' ] = $em_dash;
$dynamic['/(?<!xn)--/'] = $en_dash;
$dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ] = $en_dash;
$dynamic_characters['dash'] = array_keys( $dynamic );
$dynamic_replacements['dash'] = array_values( $dynamic );
}
// Must do this every time in case plugins use these filters in a context sensitive manner.
/**
* Filters the list of HTML elements not to texturize.
*
* @since 2.8.
没有合适的资源?快使用搜索试试~ 我知道了~
资源共享网整站源码WordPress CorePress 主题丨带会员充值插件
共2000个文件
php:1899个
css:630个
js:545个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 142 浏览量
2022-02-02
14:38:30
上传
评论
收藏 18.92MB ZIP 举报
温馨提示
WordPress高颜值,高性能CorePress主题,极致优化,专为极客,主题体积小于2m,代码精,功能全,颜值高,兼容好。响应式设计开启用户中心,接管WordPress自带登录页面,注册页面,找回密码页面,同时自定义个人中心设置页面,支持修改昵称,签名,修改密码,绑定账号。 环境要求: PHP版本5.6以上,WordPress 5.0+ 推荐使用宝塔建站 安装教程: 1.源码上传服务器根目录 2.修改 http://你的域名/wp-config.php 数据库信息 3.访问安装 http://你的域名/wp-admin/install.php 4.登录后台 http://你的域名/wp-admin 5.在后台 - 外观 - 点击 - CorePress 启用
资源推荐
资源详情
资源评论
收起资源包目录
资源共享网整站源码WordPress CorePress 主题丨带会员充值插件 (2000个子文件)
page-user.php.bak 2KB
twig.c 35KB
CHANGELOG 44KB
ca-bundle.crt 229KB
style.css 451KB
index.css 227KB
style.css 147KB
style-rtl.css 147KB
style.min.css 124KB
style-rtl.min.css 124KB
style.css 115KB
style-rtl.css 115KB
all.min.css 105KB
fontawesome.css 100KB
style-rtl.min.css 100KB
style.min.css 100KB
style.css 91KB
style-rtl.css 90KB
style.min.css 79KB
style-rtl.min.css 78KB
common-rtl.css 72KB
common.css 72KB
epd-front.css 71KB
customize-controls-rtl.css 68KB
customize-controls.css 68KB
editor.css 65KB
editor-rtl.css 65KB
dashicons.css 61KB
dashicons.min.css 58KB
media-views-rtl.css 57KB
media-views.css 57KB
customize-controls-rtl.min.css 57KB
customize-controls.min.css 57KB
editor-rtl.min.css 55KB
editor.min.css 55KB
common-rtl.min.css 54KB
common.min.css 54KB
style.css 53KB
style-rtl.css 53KB
media-views-rtl.min.css 46KB
media-views.min.css 46KB
style-rtl.min.css 44KB
style.min.css 44KB
skin.min.css 43KB
themes-rtl.css 40KB
themes.css 40KB
list-tables-rtl.css 39KB
list-tables.css 39KB
edit-rtl.css 36KB
edit.css 36KB
forms-rtl.css 32KB
forms.css 32KB
editor-rtl.css 32KB
editor.css 32KB
list-tables-rtl.min.css 32KB
list-tables.min.css 32KB
themes-rtl.min.css 32KB
themes.min.css 32KB
main.css 30KB
main11.css 30KB
edit-rtl.min.css 29KB
edit.min.css 29KB
erphpdown.css 28KB
style.css 27KB
style-rtl.css 27KB
editor-rtl.min.css 27KB
editor.min.css 27KB
about-rtl.css 26KB
about.css 26KB
forms-rtl.min.css 25KB
media-rtl.css 25KB
forms.min.css 25KB
media.css 25KB
dashboard-rtl.css 24KB
dashboard.css 24KB
admin-bar-rtl.css 24KB
admin-bar.css 24KB
style-rtl.css 23KB
style.css 23KB
erphpdown.css 22KB
style-rtl.min.css 22KB
style.min.css 22KB
customize-nav-menus-rtl.css 22KB
customize-nav-menus.css 21KB
media-rtl.min.css 20KB
media.min.css 20KB
colors-rtl.css 20KB
colors.css 20KB
colors-rtl.css 20KB
colors-rtl.css 20KB
colors-rtl.css 20KB
colors.css 20KB
colors.css 20KB
colors.css 20KB
colors-rtl.css 20KB
colors.css 20KB
colors-rtl.css 20KB
colors.css 20KB
about-rtl.min.css 20KB
about.min.css 20KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
希希分享
- 粉丝: 6875
- 资源: 3811
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 金山PDF教育版编辑器
- 基于springboot+element的校园服务平台源代码项目包含全套技术资料.zip
- 自动化应用驱动的容器弹性管理平台解决方案
- 各种排序算法 Python 实现的源代码
- BlurAdmin 是一款使用 AngularJs + Bootstrap实现的单页管理端模版,视觉冲击极强的管理后台,各种动画效果
- 基于JSP+Servlet的网上书店系统源代码项目包含全套技术资料.zip
- GGJGJGJGGDGGDGG
- 基于SpringBoot的毕业设计选题系统源代码项目包含全套技术资料.zip
- Springboot + mybatis-plus + layui 实现的博客系统源代码全套技术资料.zip
- 智慧农场小程序源代码全套技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功