JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added this_month() and this_year()
[wfpl.git] / basics.php
index 3a60248..4e1da44 100644 (file)
@@ -5,9 +5,24 @@ function read_whole_file($name) {
        if($fd === false) {
                die("Failed to read file: '$name'");
        }
-       $temp = fread($fd, filesize($name));
+       $file_data = fread($fd, filesize($name));
        fclose($fd);
-       return $temp;
+       return $file_data;
+}
+
+function unix_newlines($str) {
+       $str = str_replace("\r\n", "\n", $str);
+       return str_replace("\r", "\n", $str);
+}
+
+# return current year (all 4 digits)
+function this_year() {
+       return strftime('%Y');
+}
+
+# return the number of the current month (1..12)
+function this_month() {
+       return strftime('%m');
 }
 
 ?>