';
+ print htmlentities($buffer);
+ print '
';
+}
- $line = str_replace(">", ">", $line);
- $line = str_replace("<", "<", $line);
- return $line;
- }
+/**
+ * version of fwrite which checks for failure
+ * @param resource $fp
+ * @param string $string
+ * @return number of written bytes. false on failure
+ * @since 1.4.3
+ */
+function sq_fwrite($fp, $string) {
+ // write to file
+ $count = @fwrite($fp,$string);
+ // the number of bytes written should be the length of the string
+ if($count != strlen($string)) {
+ return FALSE;
+ }
- /** Returns an array of email addresses **/
- function parseAddrs($text) {
- if (trim($text) == "") {
- return;
- }
- $text = str_replace(" ", "", $text);
- $text = ereg_replace( '"[^"]*"', "", $text);
- $text = str_replace(",", ";", $text);
- $array = explode(";", $text);
- for ($i = 0; $i < count ($array); $i++) {
- $array[$i] = eregi_replace ("^.*[<]", "", $array[$i]);
- $array[$i] = eregi_replace ("[>].*$", "", $array[$i]);
- }
- return $array;
- }
+ return $count;
+}
- /** Returns a line of comma separated email addresses from an array **/
- function getLineOfAddrs($array) {
- if (is_array($array)) {
- $to_line = implode(", ", $array);
- $to_line = trim(ereg_replace(",,+", ",", $to_line));
- } else {
- $to_line = "";
- }
- return $to_line;
- }
+/**
+ * sq_get_html_translation_table
+ *
+ * Returns the translation table used by sq_htmlentities()
+ *
+ * @param integer $table html translation table. Possible values (without quotes):
+ *