-
Notifications
You must be signed in to change notification settings - Fork 8
/
sample_liff.php
75 lines (69 loc) · 1.9 KB
/
sample_liff.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
require_once __DIR__ . '/linebot.php';
$bot = new LineBotClass(false);
try {
// 削除
if (!empty($_GET['delete'])) {
$bot->delete_liff($_GET['delete']);
}
// 全て削除
if (!empty($_GET['all_delete'])) {
// 全てのliff情報を取得
$liff_list = $bot->get_liff_list();
foreach ($liff_list['apps'] as $key => $value) {
$bot->delete_liff($value['liffId']);
}
}
// 追加
if (!empty($_GET['liff_url'])) {
$reuslt = $bot->add_liff($_GET['liff_url'],$_GET['liff_type']);
}
// 全てのliff情報を取得
$liff_list = $bot->get_liff_list();
} catch (Exception $e) {
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
var error = "<?echo !empty($reuslt['message']) ? $reuslt['message'] : "";?>";
if (error != "") alert("error:" + error);
</script>
</head>
<body>
<form method="get">
<div style="margin-top: 50px;">
<div style="text-align : center ;">
url:<input type="text" name="liff_url" size="50" placeholder="追加するurl (httpsから始まるurl)">
type:<select name="liff_type">
<option value="full">full:100%</option>
<option value="tall">tall:80%</option>
<option value="compact">compact:50%</option>
</select>
<input type="submit" value="追加">
</div>
<table border="1" cellspacing="0" style="margin: 0 auto;">
<tr>
<th>liff_id</th>
<th>type</th>
<th>url</th>
<th>削除</th>
</tr>
<? foreach ($liff_list['apps'] as $key => $value) { ?>
<tr>
<td><? echo $value['liffId']; ?></td>
<td><? echo $value['view']['type']; ?></td>
<td><a href="<? echo $value['view']['url']; ?>"><? echo $value['view']['url']; ?></a></td>
<td><a href="?delete=<?echo $value['liffId'];?>">削除</a></td>
</tr>
<? } ?>
<tr>
<td colspan="4" align="center"><a href="?all_delete=true">全て削除</a></td>
</tr>
</table>
</div>
</form>
</body>
</html>