mgd_get_createstr()
This small helper function is used to dynamically get object construction statements. It primarily encaspuletes the mgd_get_xxx - Things away.
Calling Syntax
string mgd_get_createstr (string $object_type)
Parameter Syntax
$object_type is the Class Name of the Class you require a create statement for. It looks for the "Midgard" in the class name and transforms it either into an "mgd_get_..." or an "new ..." String. This retured string can be used in eval's to dynamically construct objects.
Code
<?php
function mgd_get_createstr ($object_type) {
if (substr($object_type,0,7) == "Midgard")
return ("mgd_get_" . strtolower(substr($object_type,7)));
else
return ("new $object_type");
}
?>