Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0d2e1302
authored
2011-02-24 04:46:16 +0000
by
Kevin Burton
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added url_title function to HTML class
1 parent
4b05591d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
com/HTML/HTML.php
com/HTML/HTML.php
View file @
0d2e130
...
...
@@ -265,6 +265,48 @@ function form_linked_dropdown($name = '', $parent = '', $options = array(), $par
return
$form
;
}
if
(
!
function_exists
(
'url_title'
))
{
function
url_title
(
$str
,
$separator
=
'dash'
,
$lowercase
=
FALSE
)
{
if
(
$separator
==
'dash'
)
{
$search
=
'_'
;
$replace
=
'-'
;
}
else
{
$search
=
'-'
;
$replace
=
'_'
;
}
$trans
=
array
(
'&\#\d+?;'
=>
''
,
'&\S+?;'
=>
''
,
'\s+'
=>
$replace
,
'[^a-z0-9\-\._]'
=>
''
,
$replace
.
'+'
=>
$replace
,
$replace
.
'$'
=>
$replace
,
'^'
.
$replace
=>
$replace
,
'\.+$'
=>
''
);
$str
=
strip_tags
(
$str
);
foreach
(
$trans
as
$key
=>
$val
)
{
$str
=
preg_replace
(
"#"
.
$key
.
"#i"
,
$val
,
$str
);
}
if
(
$lowercase
===
TRUE
)
{
$str
=
strtolower
(
$str
);
}
return
trim
(
stripslashes
(
$str
));
}
}
class
Vars
{
public
static
$prefixes
=
Array
(
...
...
Please
register
or
sign in
to post a comment