getPoll($poll_id, $poll_token); } catch (NotFoundException $nfe) { die('Poll not found'); } catch (NotSupportedPollException $nspe) { die('Sorry, this poll has a not yet supported type: ' . $nspe->getMessage()); } catch (PollAccessRestrictedException $are) { $message = array_key_exists('polltoken', $_GET) ? 'Sorry, your poll token is invalid! Please enter a valid token: ' : ('Sorry, this poll is private! If you have found this poll on a post, ' . 'please enter a link to the post, the post ID or the access token for the poll: '); die( $message . '
' ); } jslog($poll); $user_avatar_url = $poll->user->getAvatarUrl(50); $username = '@' . $poll->user->username; $disabled = $poll->canVote() ? '' : 'disabled'; $user_name = $poll->user->name ?? ''; $created_at = $poll->created_at; $closed_at = $poll->closed_at; $user_votes = $poll->getMyVotes(); $votes_remaining = $poll->max_options - count($user_votes); $votes_remaining_plural = $votes_remaining === 1 ? '' : 's'; $votes_remaining_text = "$votes_remaining Vote$votes_remaining_plural remaining"; $votes_remaining_hidden = $poll->canVote() ? '' : ' hidden'; $data_can_vote = $poll->canVote() ? 'true' : 'false'; $disabled_button = ($poll->canVote() && count($user_votes) > 0) ? '' : 'disabled'; if (array_key_exists('success', $_GET) && $_GET['success'] == 1) { ?>