From 1f6f877c81ef90cdeccf78bd3480051892345db7 Mon Sep 17 00:00:00 2001 From: Hakase Date: Tue, 3 Oct 2017 05:34:55 +0900 Subject: [PATCH] =?UTF-8?q?include=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 차후를 위해 spl_autoload_register 사용. 물론 사용 할 만한 클래스가 없지만 그래도... --- {include => class/osutournament}/check.php | 2 +- {include => class/osutournament}/index.php | 0 .../osutournament}/webparser.php | 2 +- include.php | 13 ++++------ include/db.php | 26 ------------------- test.php | 1 + 6 files changed, 8 insertions(+), 36 deletions(-) rename {include => class/osutournament}/check.php (99%) rename {include => class/osutournament}/index.php (100%) rename {include => class/osutournament}/webparser.php (98%) delete mode 100644 include/db.php diff --git a/include/check.php b/class/osutournament/check.php similarity index 99% rename from include/check.php rename to class/osutournament/check.php index c940757..79da622 100644 --- a/include/check.php +++ b/class/osutournament/check.php @@ -66,7 +66,7 @@ public function __construct() { - $this->Parser = new Parser(); + $this->Parser = new WEBParser(); } /** * SelectMode osu! mode diff --git a/include/index.php b/class/osutournament/index.php similarity index 100% rename from include/index.php rename to class/osutournament/index.php diff --git a/include/webparser.php b/class/osutournament/webparser.php similarity index 98% rename from include/webparser.php rename to class/osutournament/webparser.php index 10258b9..421dea6 100644 --- a/include/webparser.php +++ b/class/osutournament/webparser.php @@ -4,7 +4,7 @@ * @author Hakase (contact@hakase.kr) */ namespace OsuTournament; - class Parser + class WEBParser { private $httph = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'; public function splits($data, $first, $end, $num = 1) diff --git a/include.php b/include.php index 60b0384..91174c1 100644 --- a/include.php +++ b/include.php @@ -3,11 +3,8 @@ * @file include.php * @author Hakase (contact@hakase.kr) */ - require_once 'include/db.php'; - require_once 'include/webparser.php'; - require_once 'include/check.php'; - - /** - * In production DB. - */ - // $DB = new OsuTournament\DB('127.0.0.1', 'example', 'example', 'example'); + spl_autoload_register(function($classname) { + $file = __DIR__.'/class/'.strtolower(str_replace("\\", "/", $classname)).'.php'; + if(file_exists($file)) + require_once(__DIR__.'/class/'.strtolower(str_replace("\\", "/", $classname)).'.php'); + }); diff --git a/include/db.php b/include/db.php deleted file mode 100644 index ae5becf..0000000 --- a/include/db.php +++ /dev/null @@ -1,26 +0,0 @@ -mysql = new mysqli($ip, $dbid, $dbpw, $dbnm); - } - public function Query($query) - { - // ... - } - public function Insert($query) - { - // ... - } - } diff --git a/test.php b/test.php index ab7c79b..d0868ce 100644 --- a/test.php +++ b/test.php @@ -61,3 +61,4 @@ $Check->CheckUser('aergn8i39jf', 1, 1); GetDataTest(); +