function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $bbcode = 0, $html = 0) { global $_G; $string = trim($string); $sppos = strpos($string, chr(0) . chr(0) . chr(0)); if ($sppos !== false) { $string = substr($string, 0, $sppos); } if ($in_slashes) { $string = dstripslashes($string); } $string = preg_replace("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", '', $string); if ($html < 0) { $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string); } elseif ($html == 0) { $string = dhtmlspecialchars($string); } if ($length) { $string = cutstr($string, $length); } if ($bbcode) { require_once DISCUZ_ROOT . './source/class/class_bbcode.php'; $bb =& bbcode::instance(); $string = $bb->bbcode2html($string, $bbcode); } if ($out_slashes) { $string = daddslashes($string); } return trim($string); }
public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new bbcode(); } return self::$instance; }
function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $censor = 0, $bbcode = 0, $html = 0) { global $_G; $string = trim($string); if ($in_slashes) { $string = dstripslashes($string); } if ($html < 0) { $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string); } elseif ($html == 0) { $string = dhtmlspecialchars($string); } if ($censor) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } $censor = discuz_censor::instance(); $censor->check($string); if ($censor->modbanned() || $censor->modmoderated()) { showmessage('word_banned'); } } if ($length) { $string = cutstr($string, $length); } if ($bbcode) { require_once DISCUZ_ROOT . './source/class/class_bbcode.php'; $bb =& bbcode::instance(); $string = $bb->bbcode2html($string, $bbcode); } if ($out_slashes) { $string = daddslashes($string); } return trim($string); }
$page = 1; } $start = ($page - 1) * $perpage; ckstart($start, $perpage); if ($albumid > 0) { $count = $picid ? 1 : $album['picnum']; } else { $count = C::t('home_pic')->fetch_all_by_albumid($albumid, 0, 0, $picid, 0, 0, $_G['uid'], true); } $list = array(); if ($count) { if ($page > 1 && $start >= $count) { $page--; $start = ($page - 1) * $perpage; } $bbcode =& bbcode::instance(); $query = C::t('home_pic')->fetch_all_by_albumid($albumid, $start, $perpage, $picid, 0, 1, $albumid > 0 ? 0 : $_G['uid']); foreach ($query as $value) { if ($picid) { $value['checked'] = ' checked'; } $value['title'] = $bbcode->html2bbcode($value['title']); $value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']); $value['bigpic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0); $list[] = $value; } } $multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=album&op=editpic&albumid={$albumid}"); $albumlist = getalbums($album['uid']); } elseif ($_GET['op'] == 'setpic') { album_update_pic($albumid, $picid);
function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $bbcode = 0, $html = 0) { global $_G; $string = trim($string); if ($in_slashes) { $string = dstripslashes($string); } if ($html < 0) { $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", " ", $string); } else { if ($html == 0) { $string = dhtmlspecialchars($string); } } if ($length) { $string = cutstr($string, $length); } if ($bbcode) { require_once DISCUZ_ROOT . "./source/class/class_bbcode.php"; $bb =& bbcode::instance(); $string = $bb->bbcode2html($string, $bbcode); } if ($out_slashes) { $string = daddslashes($string); } return trim($string); }