Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
wfpl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8d6b4ad
)
format_varname prepends _ instead of deleting numeric prefix, add format_slug
author
Jason Woofenden
<jason@jasonwoof.com>
Fri, 6 Feb 2015 15:57:50 +0000
(10:57 -0500)
committer
Jason Woofenden
<jason@jasonwoof.com>
Fri, 6 Feb 2015 15:57:50 +0000
(10:57 -0500)
format.php
patch
|
blob
|
history
diff --git
a/format.php
b/format.php
index
e0818fd
..
28c555d
100644
(file)
--- a/
format.php
+++ b/
format.php
@@
-163,11
+163,18
@@
function format_image_w_h_thumb_w_h($str) {
return "$filename $width $height $thumb_filename $thumb_width $thumb_height";
}
return "$filename $width $height $thumb_filename $thumb_width $thumb_height";
}
+function format_slug($str) {
+ $str = strtolower($str);
+ $str = str_replace("'", '', $str);
+ $str = preg_replace('/[^a-z0-9-]+/', '-', $str);
+ return trim($str, '-');
+}
+
function format_varname($str) {
$str = preg_replace("/([a-z])([A-Z])/", "\\1_\\2", $str); # split words on camelCase
$str = strtolower($str);
function format_varname($str) {
$str = preg_replace("/([a-z])([A-Z])/", "\\1_\\2", $str); # split words on camelCase
$str = strtolower($str);
- $str = ereg_replace('[^a-z0-9_]', '_', $str);
- return ereg_replace('^[0-9]*', '', $str);
+ $str = preg_replace('/[^a-z0-9_]+/', '_', $str);
+ return preg_replace('/^([^a-z_])/', "_\\1", $str);
}
function format_oneline($str) {
}
function format_oneline($str) {