forked from gbishop/TarHeelGameplay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-gameplay.php
More file actions
35 lines (32 loc) · 785 Bytes
/
Copy pathsingle-gameplay.php
File metadata and controls
35 lines (32 loc) · 785 Bytes
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
<!--single-gameplay-->
<?php
if (have_posts()) {
the_post();
$id = $post->ID;
$json = get_post_meta($id, 'gamedata', true);
$accept = $_SERVER['HTTP_ACCEPT'];
if (strpos($accept, 'application/json') !== false ||
strpos($accept, 'text/javascript') !== false) {
$output = $json;
header('Content-Type: application/json');
header('Content-Size: ' . mb_strlen($output));
echo $output;
die();
}
get_header();
$script = "";
if($id) {
$script = "<script>window.game_init=$json; </script>";
}
}
?>
<body>
<?php echo $script; ?>
<div class="gameplay-page">
<div id="player"></div>
<div id="shade">
<table id="message"></table>
</div>
<?php
get_footer();
?>