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/smart-sl.../Nextend/Framewor.../Misc/Base64
File: Encoder.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
namespace Nextend\Framework\Misc\Base64;
[3] Fix | Delete
[4] Fix | Delete
class Encoder {
[5] Fix | Delete
[6] Fix | Delete
public static function encode($data) {
[7] Fix | Delete
[8] Fix | Delete
if (function_exists('base64_encode')) {
[9] Fix | Delete
return base64_encode($data);
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
return self::encodeShim($data);
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
private static function encodeShim($data) {
[16] Fix | Delete
$b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
[17] Fix | Delete
$o1 = $o2 = $o3 = $h1 = $h2 = $h3 = $h4 = $bits = $i = 0;
[18] Fix | Delete
$ac = 0;
[19] Fix | Delete
$enc = '';
[20] Fix | Delete
$tmp_arr = array();
[21] Fix | Delete
if (!$data) {
[22] Fix | Delete
return $data;
[23] Fix | Delete
}
[24] Fix | Delete
do {
[25] Fix | Delete
// pack three octets into four hexets
[26] Fix | Delete
$o1 = self::charCodeAt($data, $i++);
[27] Fix | Delete
$o2 = self::charCodeAt($data, $i++);
[28] Fix | Delete
$o3 = self::charCodeAt($data, $i++);
[29] Fix | Delete
$bits = $o1 << 16 | $o2 << 8 | $o3;
[30] Fix | Delete
$h1 = $bits >> 18 & 0x3f;
[31] Fix | Delete
$h2 = $bits >> 12 & 0x3f;
[32] Fix | Delete
$h3 = $bits >> 6 & 0x3f;
[33] Fix | Delete
$h4 = $bits & 0x3f;
[34] Fix | Delete
// use hexets to index into b64, and append result to encoded string
[35] Fix | Delete
$tmp_arr[$ac++] = self::charAt($b64, $h1) . self::charAt($b64, $h2) . self::charAt($b64, $h3) . self::charAt($b64, $h4);
[36] Fix | Delete
} while ($i < strlen($data));
[37] Fix | Delete
$enc = implode('', $tmp_arr);
[38] Fix | Delete
$r = (strlen($data) % 3);
[39] Fix | Delete
[40] Fix | Delete
return ($r ? substr($enc, 0, ($r - 3)) . substr('===', $r) : $enc);
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
private static function charCodeAt($data, $char) {
[44] Fix | Delete
return ord(substr($data, $char, 1));
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
private static function charAt($data, $char) {
[48] Fix | Delete
return substr($data, $char, 1);
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function