diff --git a/include/check.php b/include/check.php
index 4196da8..af71a51 100644
--- a/include/check.php
+++ b/include/check.php
@@ -14,13 +14,14 @@
*/
public $RealID, $OsuID;
/**
- * [$PlayCount User Playcount]
- * [$Performance User Performance]
- * [$Rank User Ranking]
+ * [$Playcount User playcount]
+ * [$Performance User performance]
+ * [$Rank User ranking]
* [$Occupation Check user occupation]
+ * [$Occupation_Set Setting user occupation data]
* @var [string]
*/
- private $PlayCount, $Performance, $Rank, $Occupation;
+ public $Playcount, $Performance, $Rank, $Occupation, $Occupation_Set;
/**
* [$mode osu! mode
* 0 = osu! standard (standard)
@@ -29,11 +30,10 @@
* 3 = osu!mania (mania)
* ]
* @var [int]
- * [$occu User Occupation Data]
- * @var [string]
*/
- private $mode, $occu;
+ private $mode;
/**
+ * Temp data
* [$data_profile description]
* [$data_userdata description]
* @var [string]
@@ -100,21 +100,30 @@
return false;
$this->Occupation = $this->Parser->splits($this->data_profile, '
');
+
+ $this->GetOccupation();
+ $this->GetUserData();
+
return $this->OsuID;
}
- public function CheckOccupation()
+ /**
+ * Not using this function.
+ */
+ /*
+ private function CheckOccupation()
{
if(empty($this->OsuID))
throw new \Exception('Please, CheckUser(OsuID) first!');
- if(empty($this->occu))
+ if(empty($this->Occupation_Set))
$this->GetOccupation();
- if ($this->occu === $this->Occupation)
+ if ($this->Occupation_Set === $this->Occupation)
return true;
else
return $this->Occupation;
}
- public function GetOccupation()
+ */
+ private function GetOccupation()
{
/**
* md5 = $RealID / $OsuID / date('Ymd') / $mode
@@ -122,9 +131,9 @@
*/
if(empty($this->OsuID))
throw new \Exception('Please, CheckUser(OsuID) first!');
- if(empty($this->occu))
- $this->occu = substr(md5($this->RealID . $this->OsuID . date('Ymd') . $this->mode), 0, 20);
- return $this->occu;
+ if(empty($this->Occupation_Set))
+ $this->Occupation_Set = substr(md5($this->RealID . $this->OsuID . date('Ymd') . $this->mode), 0, 20);
+ return $this->Occupation_Set;
}
private function GetUserData()
{
@@ -141,31 +150,13 @@
if (strpos($this->data_userdata, 'This user has not played enough, or has not played recently.') === false)
{
- $this->PlayCount = $this->Parser->splits($this->data_userdata, 'Play Count: ', '');
+ $this->Playcount = $this->Parser->splits($this->data_userdata, 'Play Count: ', '');
$this->Performance = str_replace(',', NULL, $this->Parser->splits($this->data_userdata, 'Performance: ', 'pp'));
$this->Rank = str_replace(',', NULL, $this->Parser->splits($this->data_userdata, 'pp (#', ')'));
}
else
return false;
}
- /**
- * [CheckPlayCount Get PlayCount]
- */
- public function CheckPlayCount()
- {
- $this->GetUserData();
- return $this->PlayCount;
- }
- public function CheckPerformance()
- {
- $this->GetUserData();
- return $this->Performance;
- }
- public function CheckRank()
- {
- $this->GetUserData();
- return $this->Rank;
- }
public function ResetObject()
{
foreach ($this as $key => $value)
diff --git a/test.php b/test.php
index 81426cb..fab941f 100644
--- a/test.php
+++ b/test.php
@@ -6,23 +6,20 @@
{
global $Check;
echo $Check->RealID . ' (' . $Check->OsuID . ')';
- $occu = $Check->CheckOccupation();
- if ($Check->CheckOccupation() === true)
+ if ($Check->Occupation_Set === $Check->Occupation)
echo '
You are applied!';
- elseif (empty($occu))
- echo '
Please change occupation to ' . $Check->GetOccupation() . '
Your Occupation is blank.';
+ elseif (empty($Check->Occupation))
+ echo '
Please change occupation to ' . $Check->Occupation_Set . '
Your Occupation is blank.';
else
- echo '
Please change occupation to ' . $Check->GetOccupation() . '
Your Occupation : ' . $occu;
+ echo '
Please change occupation to ' . $Check->Occupation_Set . '
Your Occupation : ' . $Check->Occupation;
echo '
';
- if (empty($Check->CheckPerformance()))
- echo 'Error
';
- echo 'Play Count : ' . $Check->CheckPlayCount();
+ echo 'Play Count : ' . $Check->Playcount;
echo '
';
- echo 'Performance : ' . $Check->CheckPerformance();
+ echo 'Performance : ' . $Check->Performance;
echo '
';
- echo 'Ranking : ' . $Check->CheckRank();
+ echo 'Ranking : ' . $Check->Rank;
echo '
';
}
$Check->CheckUser(2558286, 0);