Ejemplo n.º 1
0
 /**
  * Set default options for libxml loader
  *
  * @param int $options Default options for libxml loader
  */
 public static function setLibXmlLoaderOptions($options = null)
 {
     if (is_null($options) && defined(LIBXML_DTDLOAD)) {
         $options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
     }
     if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
         @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
     }
     self::$libXmlLoaderOptions = $options;
 }
Ejemplo n.º 2
0
 /**
  * Get defined options for libxml loader.
  * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
  *
  * @return int Default options for libxml loader
  */
 public static function getLibXmlLoaderOptions()
 {
     if (is_null(self::$libXmlLoaderOptions) && defined('LIBXML_DTDLOAD')) {
         self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
     } elseif (is_null(self::$libXmlLoaderOptions)) {
         self::$libXmlLoaderOptions = true;
     }
     if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
         @libxml_disable_entity_loader((bool) self::$libXmlLoaderOptions);
     }
     return self::$libXmlLoaderOptions;
 }