本文整理汇总了PHP中vbstrlen函数的典型用法代码示例。如果您正苦于以下问题:PHP vbstrlen函数的具体用法?PHP vbstrlen怎么用?PHP vbstrlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vbstrlen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fetch_keywords_list
function fetch_keywords_list($threadinfo, $pagetext = '')
{
global $vbphrase, $vbulletin;
require_once DIR . '/includes/functions_search.php';
require_once DIR . '/includes/class_taggablecontent.php';
$keywords = vB_Taggable_Content_Item::filter_tag_list($threadinfo['taglist'], $errors, false);
if (!empty($threadinfo['prefixid'])) {
$prefix = $vbphrase["prefix_{$threadinfo['prefixid']}_title_plain"];
$keywords[] = trim($prefix);
}
if (!empty($pagetext)) {
// title has already been htmlspecialchar'd, pagetext has not
$words = fetch_postindex_text(unhtmlspecialchars($threadinfo['title']) . ' ' . $pagetext);
$wordarray = split_string($words);
$sorted_counts = array_count_values($wordarray);
arsort($sorted_counts);
require DIR . '/includes/searchwords.php';
// get the stop word list; allow multiple requires
$badwords = array_merge($badwords, preg_split('/\\s+/s', $vbulletin->options['badwords'], -1, PREG_SPLIT_NO_EMPTY));
foreach ($sorted_counts as $word => $count) {
$word = trim($word);
if (in_array(vbstrtolower($word), $badwords)) {
continue;
}
if (vbstrlen($word) <= $vbulletin->options['minsearchlength'] and !in_array(vbstrtolower($word), $goodwords)) {
continue;
}
$word = htmlspecialchars_uni($word);
if (!in_array($word, $keywords)) {
$keywords[] = $word;
}
if (sizeof($keywords) >= 50) {
break;
}
}
}
return implode(', ', $keywords);
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:38,代码来源:functions_newpost.php
示例2: verify_word_allowed
function verify_word_allowed(&$word)
{
global $vbulletin, $phrasequery;
$wordlower = strtolower($word);
// check if the word contains wildcards
if (strpos($wordlower, '*') !== false) {
// check if wildcards are allowed
if ($vbulletin->options['allowwildcards']) {
// check the length of the word with all * characters removed
// and make sure it's at least (minsearchlength - 1) characters long
// in order to prevent searches like *a**... which would be bad
if (vbstrlen(str_replace('*', '', $wordlower)) < $vbulletin->options['minsearchlength'] - 1) {
// word is too short
$word = htmlspecialchars_uni($word);
eval(standard_error(fetch_error('searchinvalidterm', $word, $vbulletin->options['minsearchlength'])));
} else {
// word is of valid length
return true;
}
} else {
// wildcards are not allowed - error
$word = htmlspecialchars_uni($word);
eval(standard_error(fetch_error('searchinvalidterm', $word, $vbulletin->options['minsearchlength'])));
}
} else {
if ($wordokay = is_index_word($word)) {
return true;
} else {
// word is a bad word (common, too long, or too short; don't search on it)
return false;
}
}
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:33,代码来源:functions_search.php
示例3: IF
/**
* Contructs a Post Tree
*
* @param string The template Name to use
* @param integer The Thread ID
* @param integer The "Root" post for which to work from
* @param integer The current "Depth" within the tree
*
* @return string The Generated Tree
*
*/
function &construct_post_tree($templatename, $threadid, $parentid = 0, $depth = 1)
{
global $vbulletin, $stylevar, $parentassoc, $show, $vbphrase, $threadedmode;
static $postcache;
if (!$threadedmode and $vbulletin->userinfo['postorder']) {
$postorder = 'DESC';
}
$depthnext = $depth + 2;
if (!$postcache) {
$posts = $vbulletin->db->query_read_slave("\n\t\t\tSELECT post.parentid, post.postid, post.userid, post.pagetext, post.dateline, IF(visible = 2, 1, 0) AS isdeleted,\n\t\t\t\tIF(user.username <> '', user.username, post.username) AS username\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = post.userid\n\t\t\tWHERE post.threadid = {$threadid}\n\t\t\tORDER BY dateline {$postorder}\n\t\t");
while ($post = $vbulletin->db->fetch_array($posts)) {
if (!$threadedmode) {
$post['parentid'] = 0;
}
$postcache[$post['parentid']][$post['postid']] = $post;
}
ksort($postcache);
}
$counter = 0;
$postbits = '';
if (is_array($postcache["{$parentid}"])) {
foreach ($postcache["{$parentid}"] as $post) {
$parentassoc[$post['postid']] = $post['parentid'];
if (($depth + 1) % 4 == 0) {
// alternate colors when switching depths; depth gets incremented by 2 each time
$post['backcolor'] = '{firstaltcolor}';
$post['bgclass'] = 'alt1';
} else {
$post['backcolor'] = '{secondaltcolor}';
$post['bgclass'] = 'alt2';
}
$post['postdate'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], true);
$post['posttime'] = vbdate($vbulletin->options['timeformat'], $post['dateline']);
// cut page text short if too long
if (vbstrlen($post['pagetext']) > 100) {
$spacepos = strpos($post['pagetext'], ' ', 100);
if ($spacepos != 0) {
$post['pagetext'] = substr($post['pagetext'], 0, $spacepos) . '...';
}
}
$post['pagetext'] = nl2br(htmlspecialchars_uni($post['pagetext']));
($hook = vBulletinHook::fetch_hook('threadmanage_construct_post_tree')) ? eval($hook) : false;
eval('$postbits .= "' . fetch_template($templatename) . '";');
$ret =& construct_post_tree($templatename, $threadid, $post['postid'], $depthnext);
$postbits .= $ret;
}
}
return $postbits;
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:60,代码来源:functions_threadmanage.php
示例4: verify_name
/**
* Verify that the name doesn't already exists
*
* @param string Group Name
*
* @return boolean
*/
function verify_name(&$name)
{
// replace html-encoded spaces with actual spaces
$name = preg_replace('/&#(0*32|x0*20);/', ' ', $name);
$name = trim($name);
if (!$this->condition or $name != $this->existing['name']) {
$dupegroup = $this->registry->db->query_first("\n\t\t\t\tSELECT *\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroup\n\t\t\t\tWHERE name = '" . $this->registry->db->escape_string($name) . "'\n\t\t\t\t\tAND groupid <> " . intval($this->fetch_field('groupid')));
if ($dupegroup) {
$this->error('group_already_exists_view_x', 'group.php?' . $this->registry->session->vars['sessionurl'] . 'do=view&groupid=' . $dupegroup['groupid']);
return false;
}
}
if (empty($name)) {
$this->error('must_enter_group_name');
return false;
}
if (vbstrlen($name, true) > $this->registry->options['sg_name_maxchars']) {
$this->error('name_too_long_max_x', vb_number_format($this->registry->options['sg_name_maxchars']));
return false;
}
return true;
}
开发者ID:holandacz,项目名称:nb4,代码行数:29,代码来源:class_dm_socialgroup.php
示例5: photoplog_hexdec
function photoplog_hexdec()
{
global $stylevar;
$photoplog_r = 255;
$photoplog_g = 255;
$photoplog_b = 255;
if ($stylevar['panel_bgcolor']) {
$photoplog_rgb = str_replace(array('#', ';'), '', $stylevar['panel_bgcolor']);
if (vbstrlen($photoplog_rgb) == 6) {
$photoplog_r = intval(hexdec(substr($photoplog_rgb, 0, 2)));
$photoplog_g = intval(hexdec(substr($photoplog_rgb, 2, 2)));
$photoplog_b = intval(hexdec(substr($photoplog_rgb, 4, 2)));
} else {
if (vbstrlen($photoplog_rgb) == 3) {
$photoplog_r = intval(hexdec(str_repeat(substr($photoplog_rgb, 0, 1), 2)));
$photoplog_g = intval(hexdec(str_repeat(substr($photoplog_rgb, 1, 1), 2)));
$photoplog_b = intval(hexdec(str_repeat(substr($photoplog_rgb, 2, 1), 2)));
}
}
}
return array($photoplog_r, $photoplog_g, $photoplog_b);
}
开发者ID:holandacz,项目名称:nb4,代码行数:22,代码来源:file.php
示例6: verify_pagetext
/**
* Verifies the page text is valid and sets it up for saving.
*
* @param string Page text
*
* @param bool Whether the text is valid
*/
function verify_pagetext(&$pagetext)
{
if (empty($this->info['is_automated'])) {
if ($this->registry->options['postmaxchars'] != 0 and ($postlength = vbstrlen($pagetext)) > $this->registry->options['postmaxchars']) {
$this->error('toolong', $postlength, $this->registry->options['postmaxchars']);
return false;
}
$this->registry->options['postminchars'] = intval($this->registry->options['postminchars']);
if ($this->registry->options['postminchars'] <= 0) {
$this->registry->options['postminchars'] = 1;
}
if (vbstrlen(strip_bbcode($pagetext, $this->registry->options['ignorequotechars'])) < $this->registry->options['postminchars']) {
$this->error('tooshort', $this->registry->options['postminchars']);
return false;
}
}
return parent::verify_pagetext($pagetext);
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:25,代码来源:class_dm_threadpost.php
示例7: fetch_no_shouting_text
/**
* Stops text being all UPPER CASE
*
* @param string The text to apply 'anti-shouting' to
*
* @return string The text with 'anti-shouting' applied
*
*/
function fetch_no_shouting_text($text)
{
global $vbulletin;
$effective_string = preg_replace('#[^a-z0-9\\s]#i', '\\2', strip_bbcode($text, true, false));
if ($vbulletin->options['stopshouting'] and vbstrlen($effective_string) >= $vbulletin->options['stopshouting'] and $effective_string == strtoupper($effective_string)) {
return fetch_sentence_case($text);
} else {
return $text;
}
}
开发者ID:holandacz,项目名称:nb4,代码行数:18,代码来源:functions_newpost.php
示例8: str_replace
}
if ($photoplog_wysiwyg) {
require_once DIR . '/includes/functions_wysiwyg.php';
$photoplog_file_description = str_replace($vbulletin->options['bburl'] . "/images/smilies/", "images/smilies/", $photoplog_file_description);
$photoplog_file_description = convert_wysiwyg_html_to_bbcode($photoplog_file_description, $do_html);
}
if (is_array($photoplog_userfile['name'])) {
$photoplog_userfile['name'] = $photoplog_userfile['name'][0];
$photoplog_userfile['type'] = $photoplog_userfile['type'][0];
$photoplog_userfile['tmp_name'] = $photoplog_userfile['tmp_name'][0];
$photoplog_userfile['error'] = $photoplog_userfile['error'][0];
$photoplog_userfile['size'] = $photoplog_userfile['size'][0];
}
$photoplog_urlflag = 0;
$photoplog_file_error = 1;
if (vbstrlen($photoplog_userlink) > 0) {
@ini_set('user_agent', 'PHP');
$photoplog_urlflag = 0;
$photoplog_file_error = 1;
$photoplog_urllink = str_replace(array(' ', '..'), array('+', ''), $photoplog_userlink);
if (eregi('^(http|ftp)s?://[^./]+\\.[^.]+.*/.+(\\.(gif|jpeg|jpg|png))$', $photoplog_urllink)) {
$photoplog_parse_url = @parse_url($photoplog_urllink);
$photoplog_file_check = @getimagesize($photoplog_urllink);
$photoplog_file_name = photoplog_strip_text(trim(basename($photoplog_parse_url['path'])));
if (!empty($photoplog_file_check) && is_array($photoplog_file_check) && !empty($photoplog_file_name) && eregi(".+\\.(gif|jpeg|jpg|png)\$", $photoplog_file_name)) {
if (!in_array($photoplog_file_check[2], array(1, 2, 3))) {
photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_file']);
}
$photoplog_file_type = htmlspecialchars_uni($photoplog_file_check['mime']);
$photoplog_file_tmp_name = '';
$photoplog_file_error = 1;
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:edit.php
示例9: verify_description
/**
* Verifies that the description is not too long
*
* @param string $description
* @return boolean
*/
function verify_description(&$description)
{
if (($currentlength = vbstrlen($description, true)) > $this->registry->options['sg_maxdescriptionchars']) {
$this->error('description_toolong_max_x', $currentlength, $this->registry->options['sg_maxdescriptionchars']);
return false;
}
return true;
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:14,代码来源:class_dm_socialgroup.php
示例10: is_tag_valid
protected static function is_tag_valid($tagtext, &$errors)
{
$options = vB::getDatastore()->getValue('options');
static $taggoodwords = null;
static $tagbadwords = null;
// construct stop words and exception lists (if not previously constructed)
if (is_null($taggoodwords) or is_null($tagbadwords)) {
// filter the stop words by adding custom stop words (tagbadwords) and allowing through exceptions (taggoodwords)
if (!is_array($tagbadwords)) {
$tagbadwords = preg_split('/\\s+/s', vbstrtolower($options['tagbadwords']), -1, PREG_SPLIT_NO_EMPTY);
}
if (!is_array($taggoodwords)) {
$taggoodwords = preg_split('/\\s+/s', vbstrtolower($options['taggoodwords']), -1, PREG_SPLIT_NO_EMPTY);
}
// get the stop word list
$badwords = vB_Api::instanceInternal("Search")->get_bad_words();
// merge hard-coded badwords and tag-specific badwords
$tagbadwords = array_merge($badwords, $tagbadwords);
}
if ($tagtext === '') {
return false;
}
if (in_array(vbstrtolower($tagtext), $taggoodwords)) {
return true;
}
$char_strlen = vbstrlen($tagtext, true);
if ($options['tagminlen'] and $char_strlen < $options['tagminlen']) {
$errors['min_length'] = array('tag_too_short_min_x', $options['tagminlen']);
return false;
}
if ($char_strlen > $options['tagmaxlen']) {
$errors['max_length'] = array('tag_too_long_max_x', $options['tagmaxlen']);
return false;
}
if (strlen($tagtext) > 100) {
// only have 100 bytes to store a tag
$errors['max_length'] = array('tag_too_long_max_x', $options['tagmaxlen']);
return false;
}
$censored = fetch_censored_text($tagtext);
if ($censored != $tagtext) {
// can't have tags with censored text
$errors['censor'] = 'tag_no_censored';
return false;
}
if (count(self::split_tag_list($tagtext)) > 1) {
// contains a delimiter character
$errors['comma'] = $evalerrors ? fetch_error('tag_no_comma') : 'tag_no_comma';
return false;
}
if (in_array(strtolower($tagtext), $tagbadwords)) {
$errors['common'] = array('tag_x_not_be_common_words', $tagtext);
return false;
}
return true;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:56,代码来源:class_taggablecontent.php
示例11: foreach
foreach ($scripts as $script) {
preg_match_all('#^[0-9].*|\\W#i', $script, $matches);
$check = trim(str_replace(' ', '#', implode('', $matches[0])));
if ($check) {
print_stop_message('invalid_script');
}
}
if (strlen($vbulletin->GPC['show']) > 30) {
print_stop_message('invalid_script');
}
preg_match_all('#^[0-9].*|\\W#i', $vbulletin->GPC['identity'], $matches);
$check = trim(str_replace(' ', '#', implode('', $matches[0])));
if ($check or strlen($vbulletin->GPC['identity']) > 20) {
print_stop_message('invalid_identity');
}
if (!$vbulletin->GPC['title'] or vbstrlen($vbulletin->GPC['title']) > 50) {
print_stop_message('invalid_title');
}
if ($vbulletin->GPC['type'] != 'menu' and (!$vbulletin->GPC['url'] or strlen($vbulletin->GPC['url']) > 500)) {
print_stop_message('invalid_url');
}
if ($vbulletin->GPC['type'] != 'tab' and !in_array($vbulletin->GPC['parent'], $vbulletin->GPC['type'] == 'link' ? array_keys($parents) : array_keys($tabs))) {
print_stop_message('invalid_parent');
}
if (!in_array($vbulletin->GPC['product'], array_keys($products))) {
print_stop_message('invalid_productid');
}
//-- end checks --//
$sqlset = $sqlfields = '';
($hook = vBulletinHook::fetch_hook('navigation_admin_doadd')) ? eval($hook) : false;
collapse_navigation_state($vbulletin->GPC);
开发者ID:0hyeah,项目名称:yurivn,代码行数:31,代码来源:navigation.php
示例12: prepare_output
/**
* Prepare any data needed for the output
*
* @param string The id of the block
* @param array Options specific to the block
*/
function prepare_output($id = '', $options = array())
{
global $show, $vbphrase;
$show['infractions'] = false;
($hook = vBulletinHook::fetch_hook('member_infraction_start')) ? eval($hook) : false;
$perpage = $options['perpage'];
$pagenumber = $options['pagenumber'];
$totalinfractions = $this->registry->db->query_first_slave("\n\t\t\tSELECT COUNT(*) AS count\n\t\t\tFROM " . TABLE_PREFIX . "infraction AS infraction\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (infraction.postid = post.postid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\tWHERE infraction.userid = " . $this->profile->userinfo['userid'] . "\n\t\t");
if ($totalinfractions['count']) {
if (!$pagenumber or $options['tab'] != $id) {
$pagenumber = 1;
}
// set defaults
sanitize_pageresults($totalinfractions['count'], $pagenumber, $perpage, 100, 5);
$limitlower = ($pagenumber - 1) * $perpage + 1;
$limitupper = $pagenumber * $perpage;
if ($limitupper > $totalinfractions['count']) {
$limitupper = $totalinfractions['count'];
if ($limitlower > $totalinfractions['count']) {
$limitlower = $totalinfractions['count'] - $perpage;
}
}
if ($limitlower <= 0) {
$limitlower = 1;
}
if ($this->profile->userinfo['userid'] != $this->registry->userinfo['userid'] and $this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canreverseinfraction']) {
$show['reverse'] = true;
}
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($this->registry, fetch_tag_list());
$infractions = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT infraction.*, thread.title, thread.threadid, user.username, thread.visible AS thread_visible, post.visible,\n\t\t\t\t\tforumid, postuserid, IF(ISNULL(post.postid) AND infraction.postid != 0, 1, 0) AS postdeleted\n\t\t\t\tFROM " . TABLE_PREFIX . "infraction AS infraction\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (infraction.postid = post.postid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (infraction.whoadded = user.userid)\n\t\t\t\tWHERE infraction.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\tORDER BY infraction.dateline DESC\n\t\t\t\tLIMIT " . ($limitlower - 1) . ", {$perpage}\n\t\t\t");
while ($infraction = $this->registry->db->fetch_array($infractions)) {
$show['expired'] = $show['reversed'] = $show['neverexpires'] = false;
$card = $infraction['points'] > 0 ? 'redcard' : 'yellowcard';
$infraction['timeline'] = vbdate($this->registry->options['timeformat'], $infraction['dateline']);
$infraction['dateline'] = vbdate($this->registry->options['dateformat'], $infraction['dateline']);
switch ($infraction['action']) {
case 0:
if ($infraction['expires'] != 0) {
$infraction['expires_timeline'] = vbdate($this->registry->options['timeformat'], $infraction['expires']);
$infraction['expires_dateline'] = vbdate($this->registry->options['dateformat'], $infraction['expires']);
$show['neverexpires'] = false;
} else {
$show['neverexpires'] = true;
}
break;
case 1:
$show['expired'] = true;
break;
case 2:
$show['reversed'] = true;
break;
}
$infraction['threadtitle'] = vbstrlen($infraction['title']) > 25 ? fetch_trimmed_title($infraction['title'], 24) : $infraction['title'];
$infraction['reason'] = !empty($vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title']) ? $vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title'] : ($infraction['customreason'] ? $infraction['customreason'] : $vbphrase['n_a']);
$show['threadtitle'] = true;
$show['postdeleted'] = false;
if ($infraction['postid'] != 0) {
if ($infraction['postdeleted']) {
$show['postdeleted'] = true;
} else {
if ((!$infraction['visible'] or !$infraction['thread_visible']) and !can_moderate($infraction['forumid'], 'canmoderateposts')) {
$show['threadtitle'] = false;
} else {
if (($infraction['visible'] == 2 or $infraction['thread_visible'] == 2) and !can_moderate($infraction['forumid'], 'candeleteposts')) {
$show['threadtitle'] = false;
} else {
$forumperms = fetch_permissions($infraction['forumid']);
if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canview'])) {
$show['threadtitle'] = false;
}
if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers']) and ($infraction['postuserid'] != $this->registry->userinfo['userid'] or $this->registry->userinfo['userid'] == 0)) {
$show['threadtitle'] = false;
}
}
}
}
}
($hook = vBulletinHook::fetch_hook('member_infractionbit')) ? eval($hook) : false;
$threadinfo = array('threadid' => $infraction['threadid'], 'title' => $infraction['title']);
$pageinfo = array('p' => $infraction['postid']);
$memberinfo = array('userid' => $infraction['whoadded'], 'username' => $infraction['username']);
$templater = vB_Template::create('memberinfo_infractionbit');
$templater->register('card', $card);
$templater->register('infraction', $infraction);
$templater->register('memberinfo', $memberinfo);
$templater->register('pageinfo', $pageinfo);
$templater->register('threadinfo', $threadinfo);
$infractionbits .= $templater->render();
}
unset($bbcode_parser);
$pageinfo_pagenav = array('tab' => $id);
if ($options['perpage']) {
$pageinfo_pagenav['pp'] = $options['perpage'];
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:class_profileblock.php
示例13: verify_pagetext
/**
* Verifies the page text is valid and sets it up for saving.
*
* @param string Page text
*
* @param bool Whether the text is valid
*/
function verify_pagetext(&$pagetext)
{
if (vbstrlen(strip_bbcode($pagetext, $this->registry->options['ignorequotechars'])) < 1) {
$this->error('tooshort', 1);
return false;
}
return parent::verify_pagetext($pagetext);
}
开发者ID:holandacz,项目名称:nb4,代码行数:15,代码来源:class_dm_pt_issuenote.php
示例14: verify_message
/**
* Verifies that the message field is valid
*
* @param string Message text
*
* @return boolean
*/
function verify_message(&$message)
{
if ($message == '') {
$this->error('nosubject');
return false;
}
// check message length
if (empty($this->info['is_automated']) and $this->registry->options['pmmaxchars'] > 0) {
$messagelength = vbstrlen($message);
if ($messagelength > $this->registry->options['pmmaxchars']) {
$this->error('toolong', $messagelength, $this->registry->options['pmmaxchars']);
return false;
}
}
$message = fetch_censored_text($message);
require_once DIR . '/includes/functions_video.php';
$message = parse_video_bbcode($message);
return true;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:26,代码来源:class_dm_pm.php
示例15: is_index_word
function is_index_word($word)
{
global $vbulletin, $badwords, $goodwords;
static $compiledlist;
if (!$compiledlist)
{
require(DIR . '/includes/searchwords.php'); // get the stop word list; allow multiple requires
$badwords = array_merge($badwords, preg_split('/\s+/s', $vbulletin->options['badwords'], -1, PREG_SPLIT_NO_EMPTY));
$compiledlist = true;
}
// is the word in the goodwords array?
if (in_array(strtolower($word), $goodwords))
{
return 1;
}
else
{
// is the word outside the min/max char lengths for indexing?
$wordlength = vbstrlen($word);
if ($wordlength < $vbulletin->options['minsearchlength'] OR $wordlength > $vbulletin->options['maxsearchlength'])
{
return 0;
}
// is the word a common/bad word?
else if (in_array(strtolower($word), $badwords))
{
return false;
}
// word is good
else
{
return 1;
}
}
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:38,代码来源:functions_databuild.php
示例16: verify_event
/**
* Verifies the page text is valid and sets it up for saving.
*
* @param string Page text
*
* @param bool Whether the text is valid
*/
function verify_event(&$pagetext)
{
if ($this->registry->options['postmaxchars'] != 0 and ($postlength = vbstrlen($pagetext)) > $this->registry->options['postmaxchars']) {
$this->error('toolong', $postlength, $this->registry->options['postmaxchars']);
return false;
}
return $this->verify_pagetext($pagetext);
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:15,代码来源:class_dm_event.php
示例17: validateURL
/**
* Validates the URL segment
*
* @param mixed $value - The value to validate
* @param mixed $error - The var to assign an error to
* @return mixed | bool - The filtered value or boolean false
*/
protected function validateURL($value, &$error)
{
if (!isset($this->set_fields['url']))
{
return $value;
}
$nodeid = $this->set_fields['nodeid'];
if (($length = vbstrlen($value)) > 256)
{
// too long
$error = new vB_Phrase('error', 'validation_toolong_x_y', $length, 256);
return false;
}
//First thing- let's make sure this URL is not already in use.
if ( $record = vB::$vbulletin->db->query_first($sql = "SELECT nodeid FROM " . TABLE_PREFIX .
"cms_node WHERE new != 1 AND lower(url) = '" . vB::$vbulletin->db->escape_string(strtolower($this->set_fields['url'])) .
(isset($this->set_fields['nodeid']) ? "' AND nodeid <> $nodeid;" : "' ") ))
{
//throw (new vB_Exception_Model($vbphrase['url_in_use'] ));
standard_error(fetch_error('url_in_use'));
return false;
}
return $value;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:35,代码来源:node.php
示例18: while
}
if ($vbulletin->GPC['parseurl'] and $foruminfo['allowbbcode']) {
require_once DIR . '/includes/functions_newpost.php';
$counter = 0;
while ($counter++ < $polloptions) {
// 0..Pollnum-1 we want, as arrays start with 0
$vbulletin->GPC['options']["{$counter}"] = convert_url_to_bbcode($vbulletin->GPC['options']["{$counter}"]);
}
}
// check question and if 2 options or more were given
$counter = 0;
$optioncount = 0;
$badoption = '';
while ($counter++ < $polloptions) {
// 0..Pollnum-1 we want, as arrays start with 0
if ($vbulletin->options['maxpolllength'] and vbstrlen($vbulletin->GPC['options']["{$counter}"]) > $vbulletin->options['maxpolllength']) {
$badoption .= iif($badoption, ', ') . $counter;
}
if (!empty($vbulletin->GPC['options']["{$counter}"])) {
$optioncount++;
}
}
if ($badoption) {
eval(standard_error(fetch_error('polloptionlength', $vbulletin->options['maxpolllength'], $badoption)));
}
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
if ($vbulletin->GPC['preview'] != '' or $vbulletin->GPC['updatenumber'] != '') {
if ($vbulletin->GPC['preview'] != '') {
$previewpost = 1;
$counter = 0;
$pollpreview = '';
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:poll.php
示例19: handle_bbcode_sigpic
/**
* Handles the parsing of a signature picture. Most of this is handled
* based on the $parse_userinfo member.
*
* @param string Description for the sig pic
*
* @return string HTML representation of the sig pic
*/
function handle_bbcode_sigpic($description)
{
// remove unnecessary line breaks and escaped quotes
$description = str_replace(array('<br>', '<br />', '\\"'), array('', '', '"'), $description);
if (empty($this->parse_userinfo['userid']) or empty($this->parse_userinfo['sigpic']) or is_array($this->parse_userinfo['permissions']) and !($this->parse_userinfo['permissions']['signaturepermissions'] & $this->registry->bf_ugp_signaturepermissions['cansigpic'])) {
// unknown user or no sigpic
return '';
}
if ($this->registry->options['usefileavatar']) {
$sigpic_url = $this->registry->options['sigpicurl'] . '/sigpic' . $this->parse_userinfo['userid'] . '_' . $this->parse_userinfo['sigpicrevision'] . '.gif';
} else {
$sigpic_url = 'image.php?' . $this->registry->session->vars['sessionurl'] . 'u=' . $this->parse_userinfo['userid'] . "&type=sigpic&dateline=" . $this->parse_userinfo['sigpicdateline'];
}
if (defined('VB_AREA') and VB_AREA != 'Forum') {
// in a sub directory, may need to move up a level
if ($sigpic_url[0] != '/' and !preg_match('#^[a-z0-9]+:#i', $sigpic_url)) {
$sigpic_url = '../' . $sigpic_url;
}
}
$description = str_replace(array('\\"', '"'), '', trim($description));
if ($this->registry->userinfo['userid'] == 0 or $this->registry->userinfo['showimages']) {
return "<img src=\"{$sigpic_url}\" alt=\"{$description}\" border=\"0\" />";
} else {
if (!$description) {
$description = $sigpic_url;
if (vbstrlen($description) > 55 and $this->is_wysiwyg() == false) {
$description = substr($description, 0, 36) . '...' . substr($description, -14);
}
}
return "<a href=\"{$sigpic_url}\">{$description}</a>";
}
}
开发者ID:holandacz,项目名称:nb4,代码行数:40,代码来源:class_bbcode.php
示例20: fetch_trimmed_title
/**
* Trims a string to the specified length while keeping whole words
*
* @param string String to be trimmed
* @param integer Number of characters to aim for in the trimmed string
* @param boolean Append "..." to shortened text
*
* @return string
*/
function fetch_trimmed_title($title, $chars = -1, $append = true)
{
global $vbulletin;
if ($chars == -1)
{
$chars = $vbulletin->options['lastthreadchars'];
}
if ($chars)
{
// limit to 10 lines (\n{240}1234567890 does weird things to the thread preview)
$titlearr = preg_split('#(\r\n|\n|\r)#', $title);
$title = '';
$i = 0;
foreach ($titlearr AS $key)
{
$title .= "$key \n";
$i++;
if ($i >= 10)
{
break;
}
}
$title = trim($title);
unset($titlearr);
if (vbstrlen($title) > $chars)
{
$title = vbchop($title, $chars);
if (($pos = strrpos($title, ' ')) !== false)
{
$title = substr($title, 0, $pos);
}
if ($append)
{
$title .= '...';
}
}
//$title = fetch_soft_break_string($title);
}
return $title;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:54,代码来源:functions.php
注:本文中的vbstrlen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论