X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=inline;f=format.php;h=1bac60910ffdebe9cd4fa37439365549a9bf6e77;hb=a679272cb862dd647da227cc720cd4d4853887c0;hp=fc04b1be56129e61d66d942d35dfff6f66c6aac6;hpb=20a465de812263ab74186f67ab3a3484665430e0;p=wfpl.git
diff --git a/format.php b/format.php
index fc04b1b..1bac609 100644
--- a/format.php
+++ b/format.php
@@ -4,20 +4,19 @@
#
# 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
@@ -27,6 +26,22 @@ function format_int($str) {
return ereg_replace('^0*([1-9])', '\1', $str);
}
+function format_zip($str) {
+ return ereg_replace('[^0-9]', '', $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);
@@ -118,24 +133,4 @@ function format_phone($str) {
return $output;
}
-
-#function ftest($val) {
-# printf("$val: '%s'
\n", format_phone($val, true));
-#}
-#
-#echo "FORMAT TESTS
";
-#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");
-
?>