コード例 #1
0
ファイル: YouTube.php プロジェクト: rettoph/42Porter
 private function SetConfigAndMySQLi()
 {
     if (is_null(self::$config)) {
         self::$config = json_decode(file_get_contents(self::$CONFIG_LOCATION), true);
     }
     if (is_null(self::$sql)) {
         //check if the class exists, if not import it
         if (!class_exists("EnhancedMySQLi")) {
             require_once "EnhancedMySQLi/EnhancedMySQLi.php";
         }
         //temp save the config settings in this object (for readability)
         $MySQLiSettings = self::$config["MySQLi"];
         //create the EnhancedMySQLi object. It is static and will be shared between all instances of YouTube
         self::$sql = new EnhancedMySQLi($MySQLiSettings["Host"], $MySQLiSettings["User"], $MySQLiSettings["Password"], $MySQLiSettings["Database"]);
     }
 }