Source for file StaticMethods.class.php
Documentation is available at
StaticMethods.class.php
<?php
/**
* Class StaticMethods, contans only the simple methond for static use
*
* LICENSE: CREATIVE COMMONS PUBLIC LICENSE "Namensnennung — Nicht-kommerziell 2.0"
*
*
@copyright
2009 <SEDesign />
*
@license
http://creativecommons.org/licenses/by-nc/2.0/de/
*
@version
$3.0.6$
*
@link
http://www.sedesign.de/de_produkte_chat-v3.html
*
@since
File available since Alpha 1.0
*/
class
StaticMethods
{
/**
* Message filter, replaces smileys with images and "bad words"
*
*
@param
string
$str,
message text
*
@param
Array
$sml,
Smileys dataset
*
@return
String
*/
static
function
filtering
(
$str
,
$sml
)
{
//replace smileys
for
(
$a
=0
;
$a
<
count
(
$sml
)
;
$a
++
)
{
$img
=
getimagesize
(
"./"
.
$sml
[
$a
]
[
1
]
)
;
$str
=
str_replace
(
$sml
[
$a
]
[
0
]
,
"<img src=\""
.
$sml
[
$a
]
[
1
]
.
"\" "
.
$img
[
3
]
.
">"
,
$str
)
;
}
// create links from URIs
$str
=
eregi_replace
(
"(http://[^ )\r\n]+)"
,
"<a href=\"\\1\" target=\"_blank\">\\1</a>"
,
$str
)
;
// Bad Word Filter
if
(
file_exists
(
"./bad_words.txt"
))
{
$inhalt_des_bad_word_files
=
file
(
"./bad_words.txt"
)
;
foreach
(
$inhalt_des_bad_word_files
as
$bad_word_array
)
{
list
(
$bad_word
,
$good_word
)
=
explode
(
">"
,
$bad_word_array
)
;
$bad_word
=
chop
(
trim
(
$bad_word
))
;
$good_word
=
chop
(
trim
(
$good_word
))
;
$str
=
eregi_replace
(
$bad_word
,
$good_word
,
$str
)
;
}
}
return
$str
;
}
}
Documentation generated on Thu, 13 Aug 2009 08:22:02 +0200 by
phpDocumentor 1.4.1