Edit File by line
/home/barbar84/public_h.../wp-inclu.../sodium_c...
File: autoload.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (PHP_VERSION_ID < 70000) {
[2] Fix | Delete
if (!is_callable('sodiumCompatAutoloader')) {
[3] Fix | Delete
/**
[4] Fix | Delete
* Sodium_Compat autoloader.
[5] Fix | Delete
*
[6] Fix | Delete
* @param string $class Class name to be autoloaded.
[7] Fix | Delete
*
[8] Fix | Delete
* @return bool Stop autoloading?
[9] Fix | Delete
*/
[10] Fix | Delete
function sodiumCompatAutoloader($class)
[11] Fix | Delete
{
[12] Fix | Delete
$namespace = 'ParagonIE_Sodium_';
[13] Fix | Delete
// Does the class use the namespace prefix?
[14] Fix | Delete
$len = strlen($namespace);
[15] Fix | Delete
if (strncmp($namespace, $class, $len) !== 0) {
[16] Fix | Delete
// no, move to the next registered autoloader
[17] Fix | Delete
return false;
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
// Get the relative class name
[21] Fix | Delete
$relative_class = substr($class, $len);
[22] Fix | Delete
[23] Fix | Delete
// Replace the namespace prefix with the base directory, replace namespace
[24] Fix | Delete
// separators with directory separators in the relative class name, append
[25] Fix | Delete
// with .php
[26] Fix | Delete
$file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php';
[27] Fix | Delete
// if the file exists, require it
[28] Fix | Delete
if (file_exists($file)) {
[29] Fix | Delete
require_once $file;
[30] Fix | Delete
return true;
[31] Fix | Delete
}
[32] Fix | Delete
return false;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
// Now that we have an autoloader, let's register it!
[36] Fix | Delete
spl_autoload_register('sodiumCompatAutoloader');
[37] Fix | Delete
}
[38] Fix | Delete
} else {
[39] Fix | Delete
require_once dirname(__FILE__) . '/autoload-php7.php';
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/* Explicitly, always load the Compat class: */
[43] Fix | Delete
require_once dirname(__FILE__) . '/src/Compat.php';
[44] Fix | Delete
[45] Fix | Delete
if (!class_exists('SodiumException', false)) {
[46] Fix | Delete
require_once dirname(__FILE__) . '/src/SodiumException.php';
[47] Fix | Delete
}
[48] Fix | Delete
if (PHP_VERSION_ID >= 50300) {
[49] Fix | Delete
// Namespaces didn't exist before 5.3.0, so don't even try to use this
[50] Fix | Delete
// unless PHP >= 5.3.0
[51] Fix | Delete
require_once dirname(__FILE__) . '/lib/namespaced.php';
[52] Fix | Delete
require_once dirname(__FILE__) . '/lib/sodium_compat.php';
[53] Fix | Delete
} else {
[54] Fix | Delete
require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php';
[55] Fix | Delete
}
[56] Fix | Delete
if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) {
[57] Fix | Delete
if (PHP_VERSION_ID >= 50300 && !defined('SODIUM_CRYPTO_SCALARMULT_BYTES')) {
[58] Fix | Delete
require_once dirname(__FILE__) . '/lib/php72compat_const.php';
[59] Fix | Delete
}
[60] Fix | Delete
if (PHP_VERSION_ID >= 70000) {
[61] Fix | Delete
assert(class_exists('ParagonIE_Sodium_Compat'), 'Possible filesystem/autoloader bug?');
[62] Fix | Delete
} else {
[63] Fix | Delete
assert(class_exists('ParagonIE_Sodium_Compat'));
[64] Fix | Delete
}
[65] Fix | Delete
require_once(dirname(__FILE__) . '/lib/php72compat.php');
[66] Fix | Delete
} elseif (!function_exists('sodium_crypto_stream_xchacha20_xor')) {
[67] Fix | Delete
// Older versions of {PHP, ext/sodium} will not define these
[68] Fix | Delete
require_once(dirname(__FILE__) . '/lib/php72compat.php');
[69] Fix | Delete
}
[70] Fix | Delete
require_once(dirname(__FILE__) . '/lib/ristretto255.php');
[71] Fix | Delete
[72] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function