3 # Copyright (C) 2006 Jason Woofenden
5 # This file is part of wfpl.
7 # wfpl is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU Lesser General Public License as published by the Free
9 # Software Foundation; either version 2.1 of the License, or (at your option)
12 # wfpl is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with wfpl; if not, write to the Free Software Foundation, Inc., 51
19 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 function unix_newlines($str) {
22 $str = str_replace("\r\n", "\n", $str);
23 return str_replace("\r", "\n", $str);
26 # return current year (all 4 digits)
27 function this_year() {
28 return strftime('%Y');
31 # return the number of the current month (1..12)
32 function this_month() {
33 return ereg_replace('^0', '', strftime('%m'));
37 # php4 is broken, in that you cannot set a default value for a parameter that
38 # is passed by reference. So, this is set up to use the following screwy
41 # function foo($bar = 0) {
51 class stupid_reference {
53 function stupid_reference(&$ref) {
58 return new stupid_reference($foo);