/** * Returns an instance of a Auth_Yadis_XMLParser subclass based on * the availability of PHP extensions for XML parsing. If * Auth_Yadis_setDefaultParser has been called, the parser used in * that call will be returned instead. */ function &Auth_Yadis_getXMLParser() { global $__Auth_Yadis_defaultParser; if (isset($__Auth_Yadis_defaultParser)) { return $__Auth_Yadis_defaultParser; } $p = null; $classname = null; $extensions = Auth_Yadis_getSupportedExtensions(); // Return a wrapper for the resident implementation, if any. foreach ($extensions as $name => $params) { if (!extension_loaded($name)) { foreach ($params['libname'] as $libname) { if (@dl($libname)) { $classname = $params['classname']; } } } else { $classname = $params['classname']; } if (isset($classname)) { $p = new $classname(); return $p; } } if (!isset($p)) { trigger_error('No XML parser was found', E_USER_ERROR); } else { Auth_Yadis_setDefaultParser($p); } return $p; }
/** * Returns an instance of a Auth_Yadis_XMLParser subclass based on * the availability of PHP extensions for XML parsing. If * Auth_Yadis_setDefaultParser has been called, the parser used in * that call will be returned instead. */ function Auth_Yadis_getXMLParser() { global $__Auth_Yadis_defaultParser; if (isset($__Auth_Yadis_defaultParser)) { return $__Auth_Yadis_defaultParser; } foreach (Auth_Yadis_getSupportedExtensions() as $extension => $classname) { if (extension_loaded($extension)) { $p = new $classname(); Auth_Yadis_setDefaultParser($p); return $p; } } return false; }