This repository was archived by the owner on Nov 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcard.php
More file actions
60 lines (60 loc) · 1.28 KB
/
card.php
File metadata and controls
60 lines (60 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
class Card{
private $cardno;
private $name;
private $kana;
private $expansion;
private $side;
private $color;
private $level;
private $cost;
private $power;
private $soul;
private $triggers;
private $traits;
private $text;
private $flavor;
private $locale;
private $image;
function __construct($card)
{
foreach ($card as $key => $value) {
$this->{$key} = $value;
}
if(isset($this->traits))
$this->traits = unserialize($this->traits);
if(isset($this->triggers))
$this->triggers = unserialize($this->triggers);
$this->image = self::toimage($this->cardno).'.gif';
}
public static function tourl($cardno)
{
return strtolower(preg_replace('|[\/_]|', '-', $cardno));
}
public static function tocardno($cardno)
{
$cardno = preg_replace('|[-_]|', '/', $cardno, 1);
$cardno = preg_replace('|_|', '-', $cardno);
return strtoupper($cardno);
}
public static function toimage($cardno)
{
return strtolower(preg_replace('|[-\/]|', '_', $cardno));
}
public function getvars()
{
return get_object_vars($this);
}
public function getlocale()
{
return $this->locale;
}
public function getname()
{
return $this->name;
}
public function getcardno()
{
return $this->cardno;
}
}