Commit f727585399

f7275853993e4b01793bc9078f7a0a4865aaf334

parent: aa0739f782

Unsigned

cmc <hello@cleberg.net> · 2023-06-01 15:11 UTC

enhancement: add links to user profiles

Layout: unified · split

index.php +4 −2
@@ -138,11 +138,12 @@ function get_stories($api_url, $inline_title) {
138138 $sub_response_raw = file_get_contents($sub_url);
139139 $sub_response = json_decode($sub_response_raw, true);
140140
141 // TODO: Can this be converted to a heredoc string with variables?
141142 $html = '<div><a href="' . $sub_response['url'] . '">' . $sub_response['title'] . '</a>';
142143 $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '">';
143144 $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by <a';
144145 $html .= 'href="/user/'. $sub_response['by'] . '">';
145 $html .= $sub_response['by'] . ' | ' . $sub_response['score'];
146 $html .= $sub_response['by'] . '</a> | ' . $sub_response['score'];
146147 $html .= ' points</p></div>';
147148 $html_output .= $html;
148149 }
@@ -168,6 +169,7 @@ function get_user(string $api_url, string $inline_title) {
168169 $response = json_decode($response_raw, true);
169170 }
170171
172 // TODO: Can this be converted to a heredoc string with variables?
171173 $html_output = '<h1>' . $inline_title . '</h1>';
172174 $html_output .= '<p>About: ' . $response['about'] . '</p>';
173175 $html_output .= '<p>Karma: ' . $response['karma'] . '</p>';
@@ -186,7 +188,7 @@ function get_user(string $api_url, string $inline_title) {
186188 $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '">';
187189 $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by <a';
188190 $html .= 'href="/user/'. $sub_response['by'] . '">';
189 $html .= $sub_response['by'] . ' | ' . $sub_response['score'];
191 $html .= $sub_response['by'] . '</a> | ' . $sub_response['score'];
190192 $html .= ' points</p></div>';
191193 $html_output .= $html;
192194 }