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/clone/wp-conte.../plugins/wordfenc.../lib
File: wfHelperBin.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class wfHelperBin {
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* @param string $bin1
[5] Fix | Delete
* @param string $bin2
[6] Fix | Delete
* @return mixed
[7] Fix | Delete
*/
[8] Fix | Delete
public static function addbin2bin($bin1, $bin2) {
[9] Fix | Delete
if (strlen($bin1) % 4 != 0) {
[10] Fix | Delete
$bin1 = str_repeat("\0", 4 - (strlen($bin1) % 4)) . $bin1;
[11] Fix | Delete
}
[12] Fix | Delete
if (strlen($bin2) % 4 != 0) {
[13] Fix | Delete
$bin2 = str_repeat("\0", 4 - (strlen($bin2) % 4)) . $bin2;
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
$bin1_ints = array_reverse(array_values(unpack('N*', $bin1)));
[17] Fix | Delete
$bin2_ints = array_reverse(array_values(unpack('N*', $bin2)));
[18] Fix | Delete
$return = array();
[19] Fix | Delete
$carries = 0;
[20] Fix | Delete
for ($i=0; $i < max(count($bin1_ints), count($bin2_ints)); $i++) {
[21] Fix | Delete
$int1 = array_key_exists($i, $bin1_ints) ? $bin1_ints[$i] : 0;
[22] Fix | Delete
$int2 = array_key_exists($i, $bin2_ints) ? $bin2_ints[$i] : 0;
[23] Fix | Delete
$val = $int1 + $int2 + $carries;
[24] Fix | Delete
if ($carries > 0) {
[25] Fix | Delete
$carries = 0;
[26] Fix | Delete
}
[27] Fix | Delete
if ($val >= 0x100000000) {
[28] Fix | Delete
$val -= 0x100000000;
[29] Fix | Delete
$carries++;
[30] Fix | Delete
}
[31] Fix | Delete
$return[] = $val;
[32] Fix | Delete
}
[33] Fix | Delete
if ($carries) {
[34] Fix | Delete
$return[] += $carries;
[35] Fix | Delete
}
[36] Fix | Delete
$return = array_reverse($return);
[37] Fix | Delete
array_unshift($return, 'N*');
[38] Fix | Delete
$return = call_user_func_array('pack', $return);
[39] Fix | Delete
$return = ltrim($return, "\x00");
[40] Fix | Delete
return strlen($return) == 0 ? "\x00" : $return;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Convert binary string to the 10101's representation.
[45] Fix | Delete
*
[46] Fix | Delete
* @param string $string
[47] Fix | Delete
* @return string
[48] Fix | Delete
*/
[49] Fix | Delete
public static function bin2str($string) {
[50] Fix | Delete
$return = '';
[51] Fix | Delete
for ($i = 0; $i < strlen($string); $i++) {
[52] Fix | Delete
$return .= str_pad(decbin(ord($string[$i])), 8, '0', STR_PAD_LEFT);
[53] Fix | Delete
}
[54] Fix | Delete
$return = ltrim($return, '0');
[55] Fix | Delete
return strlen($return) == 0 ? '0' : $return;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
/**
[59] Fix | Delete
* Convert 10101's representation back to the binary data.
[60] Fix | Delete
*
[61] Fix | Delete
* @param string $string
[62] Fix | Delete
* @return string
[63] Fix | Delete
*/
[64] Fix | Delete
public static function str2bin($string) {
[65] Fix | Delete
if (strlen($string) % 32 > 0) {
[66] Fix | Delete
$string = str_repeat('0', 32 - (strlen($string) % 32)) . $string;
[67] Fix | Delete
}
[68] Fix | Delete
$ints = str_split($string, 32);
[69] Fix | Delete
$return = '';
[70] Fix | Delete
foreach ($ints as $int) {
[71] Fix | Delete
$return .= pack('N', bindec($int));
[72] Fix | Delete
}
[73] Fix | Delete
$return = ltrim($return, "\0");
[74] Fix | Delete
return strlen($return) == 0 ? "\0" : $return;
[75] Fix | Delete
}
[76] Fix | Delete
}
[77] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function