summaryrefslogtreecommitdiff
path: root/src/Util.php
blob: c11263ea1b05aa0623abb6463848049fe34e24ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

function throw_if_null($arg) {
  if ($arg === null) throw new Exception('argument is null');
}

function build_message_id($postId, $editId, $time, $forumHost) {
  return "<$time.$postId.$editId.bridge@$forumHost>";
}

function is_ascii($string) {
  return !preg_match('/[^[:ascii:]]/', $str);
}

function utf8_quote($string) {
  return '=?UTF-8?B?' . base64_encode($string) . '?=';
}

?>