Fix autoloading of 'html' class and improve autoloader performance
| | |
| | | - 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 |
| | | -------------- |
| | |
| | | */ |
| | | 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; |
| | | } |
| | | |