-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmbbr_status_model.php
43 lines (37 loc) · 1.12 KB
/
mbbr_status_model.php
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
<?php
use CFPropertyList\CFPropertyList;
class Mbbr_status_model extends \Model
{
public function __construct($serial = '')
{
parent::__construct('id', 'mbbr_status'); //primary key, tablename
$this->rs['id'] = "";
$this->rs['serial_number'] = $serial;
$this->rs['entitlement_status'] = '';
$this->rs['machine_id'] = '';
$this->rs['install_token'] = '';
if ($serial) {
$this->retrieve_record($serial);
}
$this->serial = $serial;
}
public function process($data)
{
$parser = new CFPropertyList();
$parser->parse($data, CFPropertyList::FORMAT_XML);
$translate = array(
'Entitlement status' => 'entitlement_status',
'Machine ID' => 'machine_id',
'Installation token' => 'install_token'
);
$plist = $parser->toArray();
foreach ($translate as $search => $item) {
if (isset($plist[$search])) {
$this->$item = $plist[$search];
} else {
$this->$item = '';
}
}
$this->save();
}
}