Commit f727585399
Unsigned
Layout: unified · split
index.php +4 −2
| @@ -138,11 +138,12 @@ function get_stories($api_url, $inline_title) { | ||
| 138 | 138 | $sub_response_raw = file_get_contents($sub_url); |
| 139 | 139 | $sub_response = json_decode($sub_response_raw, true); |
| 140 | 140 | |
| 141 | // TODO: Can this be converted to a heredoc string with variables? | |
| 141 | 142 | $html = '<div><a href="' . $sub_response['url'] . '">' . $sub_response['title'] . '</a>'; |
| 142 | 143 | $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '">'; |
| 143 | 144 | $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by <a'; |
| 144 | 145 | $html .= 'href="/user/'. $sub_response['by'] . '">'; |
| 145 | $html .= $sub_response['by'] . ' | ' . $sub_response['score']; | |
| 146 | $html .= $sub_response['by'] . '</a> | ' . $sub_response['score']; | |
| 146 | 147 | $html .= ' points</p></div>'; |
| 147 | 148 | $html_output .= $html; |
| 148 | 149 | } |
| @@ -168,6 +169,7 @@ function get_user(string $api_url, string $inline_title) { | ||
| 168 | 169 | $response = json_decode($response_raw, true); |
| 169 | 170 | } |
| 170 | 171 | |
| 172 | // TODO: Can this be converted to a heredoc string with variables? | |
| 171 | 173 | $html_output = '<h1>' . $inline_title . '</h1>'; |
| 172 | 174 | $html_output .= '<p>About: ' . $response['about'] . '</p>'; |
| 173 | 175 | $html_output .= '<p>Karma: ' . $response['karma'] . '</p>'; |
| @@ -186,7 +188,7 @@ function get_user(string $api_url, string $inline_title) { | ||
| 186 | 188 | $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '">'; |
| 187 | 189 | $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by <a'; |
| 188 | 190 | $html .= 'href="/user/'. $sub_response['by'] . '">'; |
| 189 | $html .= $sub_response['by'] . ' | ' . $sub_response['score']; | |
| 191 | $html .= $sub_response['by'] . '</a> | ' . $sub_response['score']; | |
| 190 | 192 | $html .= ' points</p></div>'; |
| 191 | 193 | $html_output .= $html; |
| 192 | 194 | } |