本文整理汇总了PHP中utf8::stripos方法的典型用法代码示例。如果您正苦于以下问题:PHP utf8::stripos方法的具体用法?PHP utf8::stripos怎么用?PHP utf8::stripos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utf8
的用法示例。
在下文中一共展示了utf8::stripos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_comment
function format_comment($text, $strip_html = true)
{
global $smilies;
$s = $text;
unset($text);
$s = str_replace(";)", ":wink:", $s);
if ($strip_html) {
$s = htmlentities($s, ENT_QUOTES, 'UTF-8');
}
$f = @fopen("badwords.txt", "r");
if ($f && filesize("badwords.txt") != 0) {
$bw = fread($f, filesize("badwords.txt"));
$badwords = explode("\n", $bw);
for ($i = 0; $i < count($badwords); ++$i) {
$badwords[$i] = trim($badwords[$i]);
}
$s = str_replace($badwords, "*Censored*", $s);
}
@fclose($f);
if (preg_match("#function\\s*\\((.*?)\\|\\|#is", $s)) {
$s = str_replace(":", ":", $s);
$s = str_replace("[", "[", $s);
$s = str_replace("]", "]", $s);
$s = str_replace(")", ")", $s);
$s = str_replace("(", "(", $s);
$s = str_replace("{", "{", $s);
$s = str_replace("}", "}", $s);
$s = str_replace("\$", "$", $s);
}
//-- [*] --//
if (utf8::stripos($s, '[*]') !== false) {
$s = preg_replace("/\\[\\*\\]/", "<img src=\"images/list.gif\" alt=\"List\" title=\"List\" class=\"listitem\" />", $s);
}
//-- [b]Bold[/b] --//
if (utf8::stripos($s, '[b]') !== false) {
$s = preg_replace('/\\[b\\](.+?)\\[\\/b\\]/is', "<span style='font-weight:bold;'>\\1</span>", $s);
}
//-- [i]Italic[/i] --//
if (utf8::stripos($s, '[i]') !== false) {
$s = preg_replace('/\\[i\\](.+?)\\[\\/i\\]/is', "<span style='font-style: italic;'>\\1</span>", $s);
}
//-- [u]Underline[/u] --//
if (utf8::stripos($s, '[u]') !== false) {
$s = preg_replace('/\\[u\\](.+?)\\[\\/u\\]/is', "<span style='text-decoration:underline;'>\\1</span>", $s);
}
//-- [color=blue]Text[/color] --//
if (utf8::stripos($s, '[color=') !== false) {
$s = preg_replace('/\\[color=([a-zA-Z]+)\\](.+?)\\[\\/color\\]/is', '<span style="color: \\1">\\2</span>', $s);
//-- [color=#ffcc99]Text[/color] --//
$s = preg_replace('/\\[color=(#[a-f0-9]{6})\\](.+?)\\[\\/color\\]/is', '<span style="color: \\1">\\2</span>', $s);
}
//-- Media Tag --//
if (utf8::stripos($s, '[media=') !== false) {
$s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|imdb)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s);
$s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|vimeo)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s);
}
//-- Img Using Lightbox --//
//-- [img=http://www/image.gif] --//
if (utf8::stripos($s, '[img') !== false) {
$s = preg_replace("/\\[img\\]((http|https):\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png|bmp|jpeg)))\\[\\/img\\]/i", "<img src=\"\\1\" alt=\"\" />", $s);
$s = preg_replace("/\\[img=((http|https):\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png|bmp|jpeg)))\\]/i", "<img src=\"\\1\" alt=\"\" />", $s);
}
//-- [size=4]Text[/size] --//
if (utf8::stripos($s, '[size=') !== false) {
$s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size=\\1>\\2</font>", $s);
}
//-- [font=Arial]Text[/font] --//
if (utf8::stripos($s, '[face=') !== false) {
$s = preg_replace('/\\[face=([a-zA-Z ,]+)\\](.+?)\\[\\/face\\]/is', '<span style="font-family: \\1">\\2</span>', $s);
}
//-- [s]Stroke[/s] --//
if (utf8::stripos($s, '[s]') !== false) {
$s = preg_replace("/\\[s\\](.+?)\\[\\/s\\]/is", "<s>\\1</s>", $s);
}
//-- Dynamic Vars --//
//-- [Spoiler]TEXT[/Spoiler] --//
if (utf8::stripos($s, '[spoiler]') !== false) {
$s = preg_replace("/\\[spoiler\\](.+?)\\[\\/spoiler\\]/is", "<div class=\"smallfont\" align=\"left\"><input type=\"button\" value=\"Show\" style=\"width:75px;font-size:10px;margin:0px;padding:0px;\" onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') {this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }\" /><div style=\"margin: 10px; padding: 10px; border: 1px inset;\" align=\"left\"><div style=\"display: none;\">\\1</div></div></div>", $s);
}
//-- [mcom]Text[/mcom] --//
if (utf8::stripos($s, '[mcom]') !== false) {
$s = preg_replace("/\\[mcom\\](.+?)\\[\\/mcom\\]/is", "<div style=\"font-size: 18pt; line-height: 50%;\"><div style=\"border-color: red; background-color: red; color: white; text-align: center; font-weight: bold; font-size: large;\"><strong>\\1</strong></div></div>", $s);
}
//-- The [you] Tag --//
if (utf8::stripos($s, '[you]') !== false) {
$s = preg_replace("/\\[you\\]/i", user::$current['username'], $s);
}
//-- [mail]Mail[/mail] --//
if (stripos($s, '[mail]') !== false) {
$s = preg_replace("/\\[mail\\](.+?)\\[\\/mail\\]/is", "<a href=\"mailto:\\1\" target=\"_blank\">\\1</a>", $s);
}
//--[Align=(center|left|right|justify)]Text[/align] --//
if (utf8::stripos($s, '[align=') !== false) {
$s = preg_replace("/\\[align=([a-zA-Z]+)\\](.+?)\\[\\/align\\]/is", "<div style=\"text-align:\\1\">\\2</div>", $s);
}
//-- Quotes --//
$s = format_quotes($s);
//-- URLs --//
$s = format_urls($s);
if (utf8::stripos($s, '[url') !== false) {
//.........这里部分代码省略.........