Fix autoloading of 'html' class and improve autoloader performance

pull/5241/head
Aleksander Machniak 8 years ago
parent 5d08d57005
commit 0eece8222b

@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail
- Fix message list multi-select/deselect issue (#5219)
- Fix bug where getting HTML editor content could steal focus from other form controls (#5223)
- Fix bug where contact search menu fields where always unchecked in Larry skin
- Fix autoloading of 'html' class
RELEASE 1.2-rc
--------------

@ -428,27 +428,25 @@ if (!function_exists('idn_to_ascii'))
*/
function rcube_autoload($classname)
{
$filename = preg_replace(
array(
'/Mail_(.+)/',
'/Net_(.+)/',
'/Auth_(.+)/',
'/^html_.+/',
'/^rcube(.*)/'
),
array(
'Mail/\\1',
'Net/\\1',
'Auth/\\1',
'Roundcube/html',
'Roundcube/rcube\\1'
),
$classname
);
if (strpos($classname, 'rcube') === 0) {
$classname = 'Roundcube/' . $classname;
}
else if (strpos($classname, 'html_') === 0 || $classname === 'html') {
$classname = 'Roundcube/html';
}
else if (strpos($classname, 'Mail_') === 0) {
$classname = 'Mail/' . substr($classname, 5);
}
else if (strpos($classname, 'Net_') === 0) {
$classname = 'Net/' . substr($classname, 4);
}
else if (strpos($classname, 'Auth_') === 0) {
$classname = 'Auth/' . substr($classname, 5);
}
if ($fp = @fopen("$filename.php", 'r', true)) {
if ($fp = @fopen("$classname.php", 'r', true)) {
fclose($fp);
include_once "$filename.php";
include_once "$classname.php";
return true;
}

Loading…
Cancel
Save