Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param  int     $uid       0 (= Root), 1(= anon), user id
  * @param  string  $encoding  encoding of the content
  * @param  array   $options
  */
 private function __construct($uid = 1, $encoding = 'utf-8', $options = array())
 {
     global $_CONF, $_PLUGINS, $_DPXY_CONF;
     if (count($options) === 0) {
         $options = $_DPXY_CONF;
     }
     if (empty($encoding)) {
         $encoding = COM_getCharset();
     }
     // Initializes settings
     self::$_uid = (int) $uid;
     self::$_encoding = $encoding;
     self::$_options = $options;
     $gl_version = preg_replace("/[^0-9.]/", '', VERSION);
     self::$isGL150 = version_compare($gl_version, '1.5.0') >= 0;
     self::$isGL170 = version_compare($gl_version, '1.7.0') >= 0;
     self::$isGL200 = version_compare($gl_version, '2.0.0') >= 0;
     // Loads drivers whose driver exists and plugin is enabled
     $base_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'drivers';
     $enabled_plugins = array_merge($_PLUGINS, array('article', 'comments', 'trackback'));
     foreach (self::$_supported_drivers as $driver) {
         $file = $driver;
         if ($file === 'article' and self::$isGL200) {
             $file = 'article2';
         }
         $path = $base_path . DIRECTORY_SEPARATOR . $file . '.class.php';
         if (is_file($path) and in_array($driver, $enabled_plugins)) {
             require_once $path;
             $class_name = 'dpxyDriver_' . ucfirst($driver);
             self::$_loaded_drivers[$driver] = new $class_name(self::$_options);
         }
     }
 }