Edit File by line
/home/barbar84/www/wp-inclu...
File: formatting.php
if ( strlen( $short_url ) > $length ) {
[6000] Fix | Delete
$short_url = substr( $short_url, 0, $length - 3 ) . '…';
[6001] Fix | Delete
}
[6002] Fix | Delete
return $short_url;
[6003] Fix | Delete
}
[6004] Fix | Delete
[6005] Fix | Delete
/**
[6006] Fix | Delete
* Sanitizes a hex color.
[6007] Fix | Delete
*
[6008] Fix | Delete
* Returns either '', a 3 or 6 digit hex color (with #), or nothing.
[6009] Fix | Delete
* For sanitizing values without a #, see sanitize_hex_color_no_hash().
[6010] Fix | Delete
*
[6011] Fix | Delete
* @since 3.4.0
[6012] Fix | Delete
*
[6013] Fix | Delete
* @param string $color
[6014] Fix | Delete
* @return string|void
[6015] Fix | Delete
*/
[6016] Fix | Delete
function sanitize_hex_color( $color ) {
[6017] Fix | Delete
if ( '' === $color ) {
[6018] Fix | Delete
return '';
[6019] Fix | Delete
}
[6020] Fix | Delete
[6021] Fix | Delete
// 3 or 6 hex digits, or the empty string.
[6022] Fix | Delete
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
[6023] Fix | Delete
return $color;
[6024] Fix | Delete
}
[6025] Fix | Delete
}
[6026] Fix | Delete
[6027] Fix | Delete
/**
[6028] Fix | Delete
* Sanitizes a hex color without a hash. Use sanitize_hex_color() when possible.
[6029] Fix | Delete
*
[6030] Fix | Delete
* Saving hex colors without a hash puts the burden of adding the hash on the
[6031] Fix | Delete
* UI, which makes it difficult to use or upgrade to other color types such as
[6032] Fix | Delete
* rgba, hsl, rgb, and HTML color names.
[6033] Fix | Delete
*
[6034] Fix | Delete
* Returns either '', a 3 or 6 digit hex color (without a #), or null.
[6035] Fix | Delete
*
[6036] Fix | Delete
* @since 3.4.0
[6037] Fix | Delete
*
[6038] Fix | Delete
* @param string $color
[6039] Fix | Delete
* @return string|null
[6040] Fix | Delete
*/
[6041] Fix | Delete
function sanitize_hex_color_no_hash( $color ) {
[6042] Fix | Delete
$color = ltrim( $color, '#' );
[6043] Fix | Delete
[6044] Fix | Delete
if ( '' === $color ) {
[6045] Fix | Delete
return '';
[6046] Fix | Delete
}
[6047] Fix | Delete
[6048] Fix | Delete
return sanitize_hex_color( '#' . $color ) ? $color : null;
[6049] Fix | Delete
}
[6050] Fix | Delete
[6051] Fix | Delete
/**
[6052] Fix | Delete
* Ensures that any hex color is properly hashed.
[6053] Fix | Delete
* Otherwise, returns value untouched.
[6054] Fix | Delete
*
[6055] Fix | Delete
* This method should only be necessary if using sanitize_hex_color_no_hash().
[6056] Fix | Delete
*
[6057] Fix | Delete
* @since 3.4.0
[6058] Fix | Delete
*
[6059] Fix | Delete
* @param string $color
[6060] Fix | Delete
* @return string
[6061] Fix | Delete
*/
[6062] Fix | Delete
function maybe_hash_hex_color( $color ) {
[6063] Fix | Delete
$unhashed = sanitize_hex_color_no_hash( $color );
[6064] Fix | Delete
if ( $unhashed ) {
[6065] Fix | Delete
return '#' . $unhashed;
[6066] Fix | Delete
}
[6067] Fix | Delete
[6068] Fix | Delete
return $color;
[6069] Fix | Delete
}
[6070] Fix | Delete
[6071] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function