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
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../classes/utilitie...
File: class-wpml-encoding.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class WPML_Encoding {
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* @param string $string The string to decode.
[5] Fix | Delete
* @param string $encodings A comma separated list of encodings in the order that the data was encoded
[6] Fix | Delete
*
[7] Fix | Delete
* @return mixed
[8] Fix | Delete
*/
[9] Fix | Delete
public static function decode( $string, $encodings ) {
[10] Fix | Delete
$decoded_data = $string;
[11] Fix | Delete
[12] Fix | Delete
// NOTE: We decode in the reverse order of the encodings given
[13] Fix | Delete
foreach ( array_reverse( explode( ',', $encodings ) ) as $encoding ) {
[14] Fix | Delete
switch ( $encoding ) {
[15] Fix | Delete
case 'json':
[16] Fix | Delete
$decoded_data = json_decode( $decoded_data, true );
[17] Fix | Delete
break;
[18] Fix | Delete
[19] Fix | Delete
case 'base64':
[20] Fix | Delete
$decoded_data = base64_decode( $decoded_data );
[21] Fix | Delete
break;
[22] Fix | Delete
[23] Fix | Delete
case 'urlencode':
[24] Fix | Delete
$decoded_data = urldecode( $decoded_data );
[25] Fix | Delete
break;
[26] Fix | Delete
}
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* @since 4.1.0
[31] Fix | Delete
*/
[32] Fix | Delete
return apply_filters( 'wpml_decode_string', $decoded_data, $string, $encodings );
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* @param mixed $data The data to encode.
[37] Fix | Delete
* @param string $encodings A comma separated list of encodings in the order that the data was encoded
[38] Fix | Delete
*
[39] Fix | Delete
* @return string
[40] Fix | Delete
*/
[41] Fix | Delete
public static function encode( $data, $encodings ) {
[42] Fix | Delete
$encoded_data = $data;
[43] Fix | Delete
[44] Fix | Delete
foreach ( explode( ',', $encodings ) as $encoding ) {
[45] Fix | Delete
switch ( $encoding ) {
[46] Fix | Delete
case 'json':
[47] Fix | Delete
$encoded_data = wp_json_encode( $encoded_data );
[48] Fix | Delete
break;
[49] Fix | Delete
[50] Fix | Delete
case 'base64':
[51] Fix | Delete
$encoded_data = base64_encode( $encoded_data );
[52] Fix | Delete
break;
[53] Fix | Delete
[54] Fix | Delete
case 'urlencode':
[55] Fix | Delete
$encoded_data = urlencode( $encoded_data );
[56] Fix | Delete
break;
[57] Fix | Delete
}
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* @since 4.1.0
[62] Fix | Delete
*/
[63] Fix | Delete
return apply_filters( 'wpml_encode_string', $encoded_data, $data, $encodings );
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
[68] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function