Edit File by line
/home/barbar84/public_h.../wp-inclu.../sodium_c.../lib
File: namespaced.php
<?php
[0] Fix | Delete
[1] Fix | Delete
require_once dirname(dirname(__FILE__)) . '/autoload.php';
[2] Fix | Delete
[3] Fix | Delete
if (PHP_VERSION_ID < 50300) {
[4] Fix | Delete
return;
[5] Fix | Delete
}
[6] Fix | Delete
[7] Fix | Delete
/*
[8] Fix | Delete
* This file is just for convenience, to allow developers to reduce verbosity when
[9] Fix | Delete
* they add this project to their libraries.
[10] Fix | Delete
*
[11] Fix | Delete
* Replace this:
[12] Fix | Delete
*
[13] Fix | Delete
* $x = ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_encrypt(...$args);
[14] Fix | Delete
*
[15] Fix | Delete
* with this:
[16] Fix | Delete
*
[17] Fix | Delete
* use ParagonIE\Sodium\Compat;
[18] Fix | Delete
*
[19] Fix | Delete
* $x = Compat::crypto_aead_xchacha20poly1305_encrypt(...$args);
[20] Fix | Delete
*/
[21] Fix | Delete
spl_autoload_register(function ($class) {
[22] Fix | Delete
if ($class[0] === '\\') {
[23] Fix | Delete
$class = substr($class, 1);
[24] Fix | Delete
}
[25] Fix | Delete
$namespace = 'ParagonIE\\Sodium';
[26] Fix | Delete
// Does the class use the namespace prefix?
[27] Fix | Delete
$len = strlen($namespace);
[28] Fix | Delete
if (strncmp($namespace, $class, $len) !== 0) {
[29] Fix | Delete
// no, move to the next registered autoloader
[30] Fix | Delete
return false;
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
// Get the relative class name
[34] Fix | Delete
$relative_class = substr($class, $len);
[35] Fix | Delete
[36] Fix | Delete
// Replace the namespace prefix with the base directory, replace namespace
[37] Fix | Delete
// separators with directory separators in the relative class name, append
[38] Fix | Delete
// with .php
[39] Fix | Delete
$file = dirname(dirname(__FILE__)) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
[40] Fix | Delete
// if the file exists, require it
[41] Fix | Delete
if (file_exists($file)) {
[42] Fix | Delete
require_once $file;
[43] Fix | Delete
return true;
[44] Fix | Delete
}
[45] Fix | Delete
return false;
[46] Fix | Delete
});
[47] Fix | Delete
[48] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function