Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: formatting.php
/**
[5500] Fix | Delete
* Properly strips all HTML tags including script and style
[5501] Fix | Delete
*
[5502] Fix | Delete
* This differs from strip_tags() because it removes the contents of
[5503] Fix | Delete
* the `<script>` and `<style>` tags. E.g. `strip_tags( '<script>something</script>' )`
[5504] Fix | Delete
* will return 'something'. wp_strip_all_tags will return ''
[5505] Fix | Delete
*
[5506] Fix | Delete
* @since 2.9.0
[5507] Fix | Delete
*
[5508] Fix | Delete
* @param string $text String containing HTML tags
[5509] Fix | Delete
* @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars
[5510] Fix | Delete
* @return string The processed string.
[5511] Fix | Delete
*/
[5512] Fix | Delete
function wp_strip_all_tags( $text, $remove_breaks = false ) {
[5513] Fix | Delete
if ( is_null( $text ) ) {
[5514] Fix | Delete
return '';
[5515] Fix | Delete
}
[5516] Fix | Delete
[5517] Fix | Delete
if ( ! is_scalar( $text ) ) {
[5518] Fix | Delete
/*
[5519] Fix | Delete
* To maintain consistency with pre-PHP 8 error levels,
[5520] Fix | Delete
* wp_trigger_error() is used to trigger an E_USER_WARNING,
[5521] Fix | Delete
* rather than _doing_it_wrong(), which triggers an E_USER_NOTICE.
[5522] Fix | Delete
*/
[5523] Fix | Delete
wp_trigger_error(
[5524] Fix | Delete
'',
[5525] Fix | Delete
sprintf(
[5526] Fix | Delete
/* translators: 1: The function name, 2: The argument number, 3: The argument name, 4: The expected type, 5: The provided type. */
[5527] Fix | Delete
__( 'Warning: %1$s expects parameter %2$s (%3$s) to be a %4$s, %5$s given.' ),
[5528] Fix | Delete
__FUNCTION__,
[5529] Fix | Delete
'#1',
[5530] Fix | Delete
'$text',
[5531] Fix | Delete
'string',
[5532] Fix | Delete
gettype( $text )
[5533] Fix | Delete
),
[5534] Fix | Delete
E_USER_WARNING
[5535] Fix | Delete
);
[5536] Fix | Delete
[5537] Fix | Delete
return '';
[5538] Fix | Delete
}
[5539] Fix | Delete
[5540] Fix | Delete
$text = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $text );
[5541] Fix | Delete
$text = strip_tags( $text );
[5542] Fix | Delete
[5543] Fix | Delete
if ( $remove_breaks ) {
[5544] Fix | Delete
$text = preg_replace( '/[\r\n\t ]+/', ' ', $text );
[5545] Fix | Delete
}
[5546] Fix | Delete
[5547] Fix | Delete
return trim( $text );
[5548] Fix | Delete
}
[5549] Fix | Delete
[5550] Fix | Delete
/**
[5551] Fix | Delete
* Sanitizes a string from user input or from the database.
[5552] Fix | Delete
*
[5553] Fix | Delete
* - Checks for invalid UTF-8,
[5554] Fix | Delete
* - Converts single `<` characters to entities
[5555] Fix | Delete
* - Strips all tags
[5556] Fix | Delete
* - Removes line breaks, tabs, and extra whitespace
[5557] Fix | Delete
* - Strips percent-encoded characters
[5558] Fix | Delete
*
[5559] Fix | Delete
* @since 2.9.0
[5560] Fix | Delete
*
[5561] Fix | Delete
* @see sanitize_textarea_field()
[5562] Fix | Delete
* @see wp_check_invalid_utf8()
[5563] Fix | Delete
* @see wp_strip_all_tags()
[5564] Fix | Delete
*
[5565] Fix | Delete
* @param string $str String to sanitize.
[5566] Fix | Delete
* @return string Sanitized string.
[5567] Fix | Delete
*/
[5568] Fix | Delete
function sanitize_text_field( $str ) {
[5569] Fix | Delete
$filtered = _sanitize_text_fields( $str, false );
[5570] Fix | Delete
[5571] Fix | Delete
/**
[5572] Fix | Delete
* Filters a sanitized text field string.
[5573] Fix | Delete
*
[5574] Fix | Delete
* @since 2.9.0
[5575] Fix | Delete
*
[5576] Fix | Delete
* @param string $filtered The sanitized string.
[5577] Fix | Delete
* @param string $str The string prior to being sanitized.
[5578] Fix | Delete
*/
[5579] Fix | Delete
return apply_filters( 'sanitize_text_field', $filtered, $str );
[5580] Fix | Delete
}
[5581] Fix | Delete
[5582] Fix | Delete
/**
[5583] Fix | Delete
* Sanitizes a multiline string from user input or from the database.
[5584] Fix | Delete
*
[5585] Fix | Delete
* The function is like sanitize_text_field(), but preserves
[5586] Fix | Delete
* new lines (\n) and other whitespace, which are legitimate
[5587] Fix | Delete
* input in textarea elements.
[5588] Fix | Delete
*
[5589] Fix | Delete
* @see sanitize_text_field()
[5590] Fix | Delete
*
[5591] Fix | Delete
* @since 4.7.0
[5592] Fix | Delete
*
[5593] Fix | Delete
* @param string $str String to sanitize.
[5594] Fix | Delete
* @return string Sanitized string.
[5595] Fix | Delete
*/
[5596] Fix | Delete
function sanitize_textarea_field( $str ) {
[5597] Fix | Delete
$filtered = _sanitize_text_fields( $str, true );
[5598] Fix | Delete
[5599] Fix | Delete
/**
[5600] Fix | Delete
* Filters a sanitized textarea field string.
[5601] Fix | Delete
*
[5602] Fix | Delete
* @since 4.7.0
[5603] Fix | Delete
*
[5604] Fix | Delete
* @param string $filtered The sanitized string.
[5605] Fix | Delete
* @param string $str The string prior to being sanitized.
[5606] Fix | Delete
*/
[5607] Fix | Delete
return apply_filters( 'sanitize_textarea_field', $filtered, $str );
[5608] Fix | Delete
}
[5609] Fix | Delete
[5610] Fix | Delete
/**
[5611] Fix | Delete
* Internal helper function to sanitize a string from user input or from the database.
[5612] Fix | Delete
*
[5613] Fix | Delete
* @since 4.7.0
[5614] Fix | Delete
* @access private
[5615] Fix | Delete
*
[5616] Fix | Delete
* @param string $str String to sanitize.
[5617] Fix | Delete
* @param bool $keep_newlines Optional. Whether to keep newlines. Default: false.
[5618] Fix | Delete
* @return string Sanitized string.
[5619] Fix | Delete
*/
[5620] Fix | Delete
function _sanitize_text_fields( $str, $keep_newlines = false ) {
[5621] Fix | Delete
if ( is_object( $str ) || is_array( $str ) ) {
[5622] Fix | Delete
return '';
[5623] Fix | Delete
}
[5624] Fix | Delete
[5625] Fix | Delete
$str = (string) $str;
[5626] Fix | Delete
[5627] Fix | Delete
$filtered = wp_check_invalid_utf8( $str );
[5628] Fix | Delete
[5629] Fix | Delete
if ( str_contains( $filtered, '<' ) ) {
[5630] Fix | Delete
$filtered = wp_pre_kses_less_than( $filtered );
[5631] Fix | Delete
// This will strip extra whitespace for us.
[5632] Fix | Delete
$filtered = wp_strip_all_tags( $filtered, false );
[5633] Fix | Delete
[5634] Fix | Delete
/*
[5635] Fix | Delete
* Use HTML entities in a special case to make sure that
[5636] Fix | Delete
* later newline stripping stages cannot lead to a functional tag.
[5637] Fix | Delete
*/
[5638] Fix | Delete
$filtered = str_replace( "<\n", "&lt;\n", $filtered );
[5639] Fix | Delete
}
[5640] Fix | Delete
[5641] Fix | Delete
if ( ! $keep_newlines ) {
[5642] Fix | Delete
$filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
[5643] Fix | Delete
}
[5644] Fix | Delete
$filtered = trim( $filtered );
[5645] Fix | Delete
[5646] Fix | Delete
// Remove percent-encoded characters.
[5647] Fix | Delete
$found = false;
[5648] Fix | Delete
while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) {
[5649] Fix | Delete
$filtered = str_replace( $match[0], '', $filtered );
[5650] Fix | Delete
$found = true;
[5651] Fix | Delete
}
[5652] Fix | Delete
[5653] Fix | Delete
if ( $found ) {
[5654] Fix | Delete
// Strip out the whitespace that may now exist after removing percent-encoded characters.
[5655] Fix | Delete
$filtered = trim( preg_replace( '/ +/', ' ', $filtered ) );
[5656] Fix | Delete
}
[5657] Fix | Delete
[5658] Fix | Delete
return $filtered;
[5659] Fix | Delete
}
[5660] Fix | Delete
[5661] Fix | Delete
/**
[5662] Fix | Delete
* i18n-friendly version of basename().
[5663] Fix | Delete
*
[5664] Fix | Delete
* @since 3.1.0
[5665] Fix | Delete
*
[5666] Fix | Delete
* @param string $path A path.
[5667] Fix | Delete
* @param string $suffix If the filename ends in suffix this will also be cut off.
[5668] Fix | Delete
* @return string
[5669] Fix | Delete
*/
[5670] Fix | Delete
function wp_basename( $path, $suffix = '' ) {
[5671] Fix | Delete
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
[5672] Fix | Delete
}
[5673] Fix | Delete
[5674] Fix | Delete
// phpcs:disable WordPress.WP.CapitalPDangit.MisspelledInComment,WordPress.WP.CapitalPDangit.MisspelledInText,WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- 8-)
[5675] Fix | Delete
/**
[5676] Fix | Delete
* Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence).
[5677] Fix | Delete
*
[5678] Fix | Delete
* Violating our coding standards for a good function name.
[5679] Fix | Delete
*
[5680] Fix | Delete
* @since 3.0.0
[5681] Fix | Delete
*
[5682] Fix | Delete
* @param string $text The text to be modified.
[5683] Fix | Delete
* @return string The modified text.
[5684] Fix | Delete
*/
[5685] Fix | Delete
function capital_P_dangit( $text ) {
[5686] Fix | Delete
// Simple replacement for titles.
[5687] Fix | Delete
$current_filter = current_filter();
[5688] Fix | Delete
if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) {
[5689] Fix | Delete
return str_replace( 'Wordpress', 'WordPress', $text );
[5690] Fix | Delete
}
[5691] Fix | Delete
// Still here? Use the more judicious replacement.
[5692] Fix | Delete
static $dblq = false;
[5693] Fix | Delete
if ( false === $dblq ) {
[5694] Fix | Delete
$dblq = _x( '&#8220;', 'opening curly double quote' );
[5695] Fix | Delete
}
[5696] Fix | Delete
return str_replace(
[5697] Fix | Delete
array( ' Wordpress', '&#8216;Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
[5698] Fix | Delete
array( ' WordPress', '&#8216;WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
[5699] Fix | Delete
$text
[5700] Fix | Delete
);
[5701] Fix | Delete
}
[5702] Fix | Delete
// phpcs:enable
[5703] Fix | Delete
[5704] Fix | Delete
/**
[5705] Fix | Delete
* Sanitizes a mime type
[5706] Fix | Delete
*
[5707] Fix | Delete
* @since 3.1.3
[5708] Fix | Delete
*
[5709] Fix | Delete
* @param string $mime_type Mime type.
[5710] Fix | Delete
* @return string Sanitized mime type.
[5711] Fix | Delete
*/
[5712] Fix | Delete
function sanitize_mime_type( $mime_type ) {
[5713] Fix | Delete
$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
[5714] Fix | Delete
/**
[5715] Fix | Delete
* Filters a mime type following sanitization.
[5716] Fix | Delete
*
[5717] Fix | Delete
* @since 3.1.3
[5718] Fix | Delete
*
[5719] Fix | Delete
* @param string $sani_mime_type The sanitized mime type.
[5720] Fix | Delete
* @param string $mime_type The mime type prior to sanitization.
[5721] Fix | Delete
*/
[5722] Fix | Delete
return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
[5723] Fix | Delete
}
[5724] Fix | Delete
[5725] Fix | Delete
/**
[5726] Fix | Delete
* Sanitizes space or carriage return separated URLs that are used to send trackbacks.
[5727] Fix | Delete
*
[5728] Fix | Delete
* @since 3.4.0
[5729] Fix | Delete
*
[5730] Fix | Delete
* @param string $to_ping Space or carriage return separated URLs
[5731] Fix | Delete
* @return string URLs starting with the http or https protocol, separated by a carriage return.
[5732] Fix | Delete
*/
[5733] Fix | Delete
function sanitize_trackback_urls( $to_ping ) {
[5734] Fix | Delete
$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
[5735] Fix | Delete
foreach ( $urls_to_ping as $k => $url ) {
[5736] Fix | Delete
if ( ! preg_match( '#^https?://.#i', $url ) ) {
[5737] Fix | Delete
unset( $urls_to_ping[ $k ] );
[5738] Fix | Delete
}
[5739] Fix | Delete
}
[5740] Fix | Delete
$urls_to_ping = array_map( 'sanitize_url', $urls_to_ping );
[5741] Fix | Delete
$urls_to_ping = implode( "\n", $urls_to_ping );
[5742] Fix | Delete
/**
[5743] Fix | Delete
* Filters a list of trackback URLs following sanitization.
[5744] Fix | Delete
*
[5745] Fix | Delete
* The string returned here consists of a space or carriage return-delimited list
[5746] Fix | Delete
* of trackback URLs.
[5747] Fix | Delete
*
[5748] Fix | Delete
* @since 3.4.0
[5749] Fix | Delete
*
[5750] Fix | Delete
* @param string $urls_to_ping Sanitized space or carriage return separated URLs.
[5751] Fix | Delete
* @param string $to_ping Space or carriage return separated URLs before sanitization.
[5752] Fix | Delete
*/
[5753] Fix | Delete
return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
[5754] Fix | Delete
}
[5755] Fix | Delete
[5756] Fix | Delete
/**
[5757] Fix | Delete
* Adds slashes to a string or recursively adds slashes to strings within an array.
[5758] Fix | Delete
*
[5759] Fix | Delete
* This should be used when preparing data for core API that expects slashed data.
[5760] Fix | Delete
* This should not be used to escape data going directly into an SQL query.
[5761] Fix | Delete
*
[5762] Fix | Delete
* @since 3.6.0
[5763] Fix | Delete
* @since 5.5.0 Non-string values are left untouched.
[5764] Fix | Delete
*
[5765] Fix | Delete
* @param string|array $value String or array of data to slash.
[5766] Fix | Delete
* @return string|array Slashed `$value`, in the same type as supplied.
[5767] Fix | Delete
*/
[5768] Fix | Delete
function wp_slash( $value ) {
[5769] Fix | Delete
if ( is_array( $value ) ) {
[5770] Fix | Delete
$value = array_map( 'wp_slash', $value );
[5771] Fix | Delete
}
[5772] Fix | Delete
[5773] Fix | Delete
if ( is_string( $value ) ) {
[5774] Fix | Delete
return addslashes( $value );
[5775] Fix | Delete
}
[5776] Fix | Delete
[5777] Fix | Delete
return $value;
[5778] Fix | Delete
}
[5779] Fix | Delete
[5780] Fix | Delete
/**
[5781] Fix | Delete
* Removes slashes from a string or recursively removes slashes from strings within an array.
[5782] Fix | Delete
*
[5783] Fix | Delete
* This should be used to remove slashes from data passed to core API that
[5784] Fix | Delete
* expects data to be unslashed.
[5785] Fix | Delete
*
[5786] Fix | Delete
* @since 3.6.0
[5787] Fix | Delete
*
[5788] Fix | Delete
* @param string|array $value String or array of data to unslash.
[5789] Fix | Delete
* @return string|array Unslashed `$value`, in the same type as supplied.
[5790] Fix | Delete
*/
[5791] Fix | Delete
function wp_unslash( $value ) {
[5792] Fix | Delete
return stripslashes_deep( $value );
[5793] Fix | Delete
}
[5794] Fix | Delete
[5795] Fix | Delete
/**
[5796] Fix | Delete
* Extracts and returns the first URL from passed content.
[5797] Fix | Delete
*
[5798] Fix | Delete
* @since 3.6.0
[5799] Fix | Delete
*
[5800] Fix | Delete
* @param string $content A string which might contain a URL.
[5801] Fix | Delete
* @return string|false The found URL.
[5802] Fix | Delete
*/
[5803] Fix | Delete
function get_url_in_content( $content ) {
[5804] Fix | Delete
if ( empty( $content ) ) {
[5805] Fix | Delete
return false;
[5806] Fix | Delete
}
[5807] Fix | Delete
[5808] Fix | Delete
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
[5809] Fix | Delete
return sanitize_url( $matches[2] );
[5810] Fix | Delete
}
[5811] Fix | Delete
[5812] Fix | Delete
return false;
[5813] Fix | Delete
}
[5814] Fix | Delete
[5815] Fix | Delete
/**
[5816] Fix | Delete
* Returns the regexp for common whitespace characters.
[5817] Fix | Delete
*
[5818] Fix | Delete
* By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp.
[5819] Fix | Delete
* This is designed to replace the PCRE \s sequence. In ticket #22692, that
[5820] Fix | Delete
* sequence was found to be unreliable due to random inclusion of the A0 byte.
[5821] Fix | Delete
*
[5822] Fix | Delete
* @since 4.0.0
[5823] Fix | Delete
*
[5824] Fix | Delete
* @return string The spaces regexp.
[5825] Fix | Delete
*/
[5826] Fix | Delete
function wp_spaces_regexp() {
[5827] Fix | Delete
static $spaces = '';
[5828] Fix | Delete
[5829] Fix | Delete
if ( empty( $spaces ) ) {
[5830] Fix | Delete
/**
[5831] Fix | Delete
* Filters the regexp for common whitespace characters.
[5832] Fix | Delete
*
[5833] Fix | Delete
* This string is substituted for the \s sequence as needed in regular
[5834] Fix | Delete
* expressions. For websites not written in English, different characters
[5835] Fix | Delete
* may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
[5836] Fix | Delete
* sequence may not be in use.
[5837] Fix | Delete
*
[5838] Fix | Delete
* @since 4.0.0
[5839] Fix | Delete
*
[5840] Fix | Delete
* @param string $spaces Regexp pattern for matching common whitespace characters.
[5841] Fix | Delete
*/
[5842] Fix | Delete
$spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;' );
[5843] Fix | Delete
}
[5844] Fix | Delete
[5845] Fix | Delete
return $spaces;
[5846] Fix | Delete
}
[5847] Fix | Delete
[5848] Fix | Delete
/**
[5849] Fix | Delete
* Enqueues the important emoji-related styles.
[5850] Fix | Delete
*
[5851] Fix | Delete
* @since 6.4.0
[5852] Fix | Delete
*/
[5853] Fix | Delete
function wp_enqueue_emoji_styles() {
[5854] Fix | Delete
// Back-compat for plugins that disable functionality by unhooking this action.
[5855] Fix | Delete
$action = is_admin() ? 'admin_print_styles' : 'wp_print_styles';
[5856] Fix | Delete
if ( ! has_action( $action, 'print_emoji_styles' ) ) {
[5857] Fix | Delete
return;
[5858] Fix | Delete
}
[5859] Fix | Delete
remove_action( $action, 'print_emoji_styles' );
[5860] Fix | Delete
[5861] Fix | Delete
$emoji_styles = '
[5862] Fix | Delete
img.wp-smiley, img.emoji {
[5863] Fix | Delete
display: inline !important;
[5864] Fix | Delete
border: none !important;
[5865] Fix | Delete
box-shadow: none !important;
[5866] Fix | Delete
height: 1em !important;
[5867] Fix | Delete
width: 1em !important;
[5868] Fix | Delete
margin: 0 0.07em !important;
[5869] Fix | Delete
vertical-align: -0.1em !important;
[5870] Fix | Delete
background: none !important;
[5871] Fix | Delete
padding: 0 !important;
[5872] Fix | Delete
}';
[5873] Fix | Delete
$handle = 'wp-emoji-styles';
[5874] Fix | Delete
wp_register_style( $handle, false );
[5875] Fix | Delete
wp_add_inline_style( $handle, $emoji_styles );
[5876] Fix | Delete
wp_enqueue_style( $handle );
[5877] Fix | Delete
}
[5878] Fix | Delete
[5879] Fix | Delete
/**
[5880] Fix | Delete
* Prints the inline Emoji detection script if it is not already printed.
[5881] Fix | Delete
*
[5882] Fix | Delete
* @since 4.2.0
[5883] Fix | Delete
*/
[5884] Fix | Delete
function print_emoji_detection_script() {
[5885] Fix | Delete
static $printed = false;
[5886] Fix | Delete
[5887] Fix | Delete
if ( $printed ) {
[5888] Fix | Delete
return;
[5889] Fix | Delete
}
[5890] Fix | Delete
[5891] Fix | Delete
$printed = true;
[5892] Fix | Delete
[5893] Fix | Delete
_print_emoji_detection_script();
[5894] Fix | Delete
}
[5895] Fix | Delete
[5896] Fix | Delete
/**
[5897] Fix | Delete
* Prints inline Emoji detection script.
[5898] Fix | Delete
*
[5899] Fix | Delete
* @ignore
[5900] Fix | Delete
* @since 4.6.0
[5901] Fix | Delete
* @access private
[5902] Fix | Delete
*/
[5903] Fix | Delete
function _print_emoji_detection_script() {
[5904] Fix | Delete
$settings = array(
[5905] Fix | Delete
/**
[5906] Fix | Delete
* Filters the URL where emoji png images are hosted.
[5907] Fix | Delete
*
[5908] Fix | Delete
* @since 4.2.0
[5909] Fix | Delete
*
[5910] Fix | Delete
* @param string $url The emoji base URL for png images.
[5911] Fix | Delete
*/
[5912] Fix | Delete
'baseUrl' => apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/15.0.3/72x72/' ),
[5913] Fix | Delete
[5914] Fix | Delete
/**
[5915] Fix | Delete
* Filters the extension of the emoji png files.
[5916] Fix | Delete
*
[5917] Fix | Delete
* @since 4.2.0
[5918] Fix | Delete
*
[5919] Fix | Delete
* @param string $extension The emoji extension for png files. Default .png.
[5920] Fix | Delete
*/
[5921] Fix | Delete
'ext' => apply_filters( 'emoji_ext', '.png' ),
[5922] Fix | Delete
[5923] Fix | Delete
/**
[5924] Fix | Delete
* Filters the URL where emoji SVG images are hosted.
[5925] Fix | Delete
*
[5926] Fix | Delete
* @since 4.6.0
[5927] Fix | Delete
*
[5928] Fix | Delete
* @param string $url The emoji base URL for svg images.
[5929] Fix | Delete
*/
[5930] Fix | Delete
'svgUrl' => apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/15.0.3/svg/' ),
[5931] Fix | Delete
[5932] Fix | Delete
/**
[5933] Fix | Delete
* Filters the extension of the emoji SVG files.
[5934] Fix | Delete
*
[5935] Fix | Delete
* @since 4.6.0
[5936] Fix | Delete
*
[5937] Fix | Delete
* @param string $extension The emoji extension for svg files. Default .svg.
[5938] Fix | Delete
*/
[5939] Fix | Delete
'svgExt' => apply_filters( 'emoji_svg_ext', '.svg' ),
[5940] Fix | Delete
);
[5941] Fix | Delete
[5942] Fix | Delete
$version = 'ver=' . get_bloginfo( 'version' );
[5943] Fix | Delete
[5944] Fix | Delete
if ( SCRIPT_DEBUG ) {
[5945] Fix | Delete
$settings['source'] = array(
[5946] Fix | Delete
/** This filter is documented in wp-includes/class-wp-scripts.php */
[5947] Fix | Delete
'wpemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji.js?$version" ), 'wpemoji' ),
[5948] Fix | Delete
/** This filter is documented in wp-includes/class-wp-scripts.php */
[5949] Fix | Delete
'twemoji' => apply_filters( 'script_loader_src', includes_url( "js/twemoji.js?$version" ), 'twemoji' ),
[5950] Fix | Delete
);
[5951] Fix | Delete
} else {
[5952] Fix | Delete
$settings['source'] = array(
[5953] Fix | Delete
/** This filter is documented in wp-includes/class-wp-scripts.php */
[5954] Fix | Delete
'concatemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji-release.min.js?$version" ), 'concatemoji' ),
[5955] Fix | Delete
);
[5956] Fix | Delete
}
[5957] Fix | Delete
[5958] Fix | Delete
wp_print_inline_script_tag(
[5959] Fix | Delete
sprintf( 'window._wpemojiSettings = %s;', wp_json_encode( $settings ) ) . "\n" .
[5960] Fix | Delete
file_get_contents( ABSPATH . WPINC . '/js/wp-emoji-loader' . wp_scripts_get_suffix() . '.js' )
[5961] Fix | Delete
);
[5962] Fix | Delete
}
[5963] Fix | Delete
[5964] Fix | Delete
/**
[5965] Fix | Delete
* Converts emoji characters to their equivalent HTML entity.
[5966] Fix | Delete
*
[5967] Fix | Delete
* This allows us to store emoji in a DB using the utf8 character set.
[5968] Fix | Delete
*
[5969] Fix | Delete
* @since 4.2.0
[5970] Fix | Delete
*
[5971] Fix | Delete
* @param string $content The content to encode.
[5972] Fix | Delete
* @return string The encoded content.
[5973] Fix | Delete
*/
[5974] Fix | Delete
function wp_encode_emoji( $content ) {
[5975] Fix | Delete
$emoji = _wp_emoji_list( 'partials' );
[5976] Fix | Delete
[5977] Fix | Delete
foreach ( $emoji as $emojum ) {
[5978] Fix | Delete
$emoji_char = html_entity_decode( $emojum );
[5979] Fix | Delete
if ( str_contains( $content, $emoji_char ) ) {
[5980] Fix | Delete
$content = preg_replace( "/$emoji_char/", $emojum, $content );
[5981] Fix | Delete
}
[5982] Fix | Delete
}
[5983] Fix | Delete
[5984] Fix | Delete
return $content;
[5985] Fix | Delete
}
[5986] Fix | Delete
[5987] Fix | Delete
/**
[5988] Fix | Delete
* Converts emoji to a static img element.
[5989] Fix | Delete
*
[5990] Fix | Delete
* @since 4.2.0
[5991] Fix | Delete
*
[5992] Fix | Delete
* @param string $text The content to encode.
[5993] Fix | Delete
* @return string The encoded content.
[5994] Fix | Delete
*/
[5995] Fix | Delete
function wp_staticize_emoji( $text ) {
[5996] Fix | Delete
if ( ! str_contains( $text, '&#x' ) ) {
[5997] Fix | Delete
if ( ( function_exists( 'mb_check_encoding' ) && mb_check_encoding( $text, 'ASCII' ) ) || ! preg_match( '/[^\x00-\x7F]/', $text ) ) {
[5998] Fix | Delete
// The text doesn't contain anything that might be emoji, so we can return early.
[5999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function