function _hx_wiris_load($d, $pack = array()) { $h = opendir($d); while (false !== ($f = readdir($h))) { if ($f == '.' || $f == '..') { continue; } $p = $d . '/' . $f; if (is_file($p) && substr($f, -4) == '.php') { $bn = basename($f, '.php'); $name = false; if (substr($bn, -6) == '.class') { $bn = substr($bn, 0, -6); $t = '_hx_class'; } else { if (substr($bn, -5) == '.enum') { $bn = substr($bn, 0, -5); $t = '_hx_enum'; } else { if (substr($bn, -10) == '.interface') { $bn = substr($bn, 0, -10); $t = '_hx_interface'; } else { if (substr($bn, -7) == '.extern') { $bn = substr($bn, 0, -7); $t = '_hx_class'; $name = $bn; } else { continue; } } } } $qname = $bn == 'HList' && empty($pack) ? 'List' : join(array_merge($pack, array($bn)), '.'); $phpname = !empty($name) ? $name : join(array_merge($pack, array($bn)), '_'); _hx_register_type(new $t($phpname, $qname, $p)); } else { if (is_dir($p)) { _hx_wiris_load($p, array_merge($pack, array($f))); } } } }
if ($_hx_types_array[$i]['type'] == 1) { $t = new _hx_enum($_hx_types_array[$i]['phpname'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); $_hx_cache_content .= '_hx_enum'; } else { if ($_hx_types_array[$i]['type'] == 2) { $t = new _hx_interface($_hx_types_array[$i]['phpname'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); $_hx_cache_content .= '_hx_interface'; } else { if ($_hx_types_array[$i]['type'] == 3) { $t = new _hx_class($_hx_types_array[$i]['name'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); $_hx_cache_content .= '_hx_class'; } } } } _hx_register_type($t); $_hx_cache_content .= '(\'' . ($_hx_types_array[$i]['type'] == 3 ? $_hx_types_array[$i]['name'] : $_hx_types_array[$i]['phpname']) . '\', \'' . $_hx_types_array[$i]['qname'] . '\', \'' . $_hx_types_array[$i]['path'] . '\')); '; } try { file_put_contents($_hx_autload_cache_file, $_hx_cache_content); } catch (Exception $e) { } unset($_hx_types_array); unset($_hx_cache_content); } else { require $_hx_autload_cache_file; } function _hx_autoload($name) { if (!isset(php_Boot::$tpaths[$name])) {
static function loadLib($pathToLib) { $prefix = null; $_hx_types_array = array(); $_hx_cache_content = ''; //Calling this function will put all types present in the specified types in the $_hx_types_array _hx_build_paths($pathToLib, $_hx_types_array, array(), $prefix); for ($i = 0; $i < count($_hx_types_array); $i++) { //For every type that has been found, create its description $t = null; if ($_hx_types_array[$i]['type'] == 0) { $t = new _hx_class($_hx_types_array[$i]['phpname'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); } else { if ($_hx_types_array[$i]['type'] == 1) { $t = new _hx_enum($_hx_types_array[$i]['phpname'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); } else { if ($_hx_types_array[$i]['type'] == 2) { $t = new _hx_interface($_hx_types_array[$i]['phpname'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); } else { if ($_hx_types_array[$i]['type'] == 3) { $t = new _hx_class($_hx_types_array[$i]['name'], $_hx_types_array[$i]['qname'], $_hx_types_array[$i]['path']); } } } } //Register the type if (!array_key_exists($t->__qname__, php_Boot::$qtypes)) { _hx_register_type($t); } } }