#
# This file is part of wfpl.
#
-# wfpl is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
+# wfpl is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
-# wfpl is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
+# wfpl is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
#
-# You should have received a copy of the GNU General Public License
-# along with wfpl; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
+# You should have received a copy of the GNU Lesser General Public License
+# along with wfpl; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# This file contains basic encodings
+function format_int($str) {
+ $str = ereg_replace('[^0-9]', '', $str);
+ return ereg_replace('^0*([1-9])', '\1', $str);
+}
+
+function format_filename($str) {
+ $str = strtolower($str);
+ $str = ereg_replace('[^a-z0-9_.-]', '_', $str);
+ return ereg_replace('^[0-9.-]*', '', $str);
+}
+
+function format_varname($str) {
+ $str = strtolower($str);
+ $str = ereg_replace('[^a-z0-9_]', '_', $str);
+ return ereg_replace('^[0-9]*', '', $str);
+}
+
function format_oneline($str) {
$str = str_replace("\r", '', $str);
return str_replace("\n", '', $str);
return $output;
}
-
-#function ftest($val) {
-# printf("$val: '%s'<br />\n", format_phone($val, true));
-#}
-#
-#echo "FORMAT TESTS<br><br>";
-#ftest("$3");
-#ftest("3.99");
-#ftest("3.5");
-#ftest("891234");
-#ftest("8221234");
-#ftest("82212334");
-#ftest("122313234");
-#ftest("1158221234");
-#ftest("1558221234");
-#ftest("12235513234");
-#ftest("122355123334");
-#ftest("1585552212334");
-#ftest("15855522123334");
-
?>