28
Quote:
ghia wrote:
What I don't understand about that piece of code (in the light of the wrong class check with d3downloads) is how it could go wrong, since all formelement classes of the various types seems to me checked twice!
Once by including /class/xoopsformloader.php (which actually does not result in the loading of the checked xoopsformloader class), and then again in the following list, where every type of the form element classes are rechecked and loaded individually if needed, eg xoopsformelement, etc.
Or did I miss something in my interpretation?
I supose you mean that if we include class/xoopsformloader.php and then use xoops_load('xoopsformelement'); xoopsformelement class would be included twice?
$type = empty($type) ? 'core' : $type;
//first check
if (isset($loaded[$type][$name])) {
return $loaded[$type][$name];
}
//second check
if (class_exists($name)) {
$loaded[$type][$name] = true;// added this line in the propose
return true;
}
Time line:
include class/xoopsformloader.php -> nothing happens in xoopsload but all form elements class are loaded.
xoop_load('formelement')-> class already exists(2 check), it is added to list of loaded and return without including any file.
xoops_load('formelement')-> class already in list of loaded classes(1 check) and return without loading any file.
----
In the other post you mention that xoopsformelement and xoopsformdhtmltextarea are both loaded initially, where?