本文整理汇总了PHP中dle_strlen函数的典型用法代码示例。如果您正苦于以下问题:PHP dle_strlen函数的具体用法?PHP dle_strlen怎么用?PHP dle_strlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dle_strlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_title
function user_title($count, $title)
{
global $config;
if ($count and dle_strlen($title, $config['charset']) > $count) {
$title = dle_substr($title, 0, $count, $config['charset']);
if ($temp_dmax = dle_strrpos($title, ' ', $config['charset'])) {
$title = dle_substr($title, 0, $temp_dmax, $config['charset']);
}
}
return $title;
}
示例2: textLimit
/**
* @param $data - контент
* @param $limit
* @param string $etc - Окончание обрезанного текста
* @param bool $wordcut - жесткое ограничение символов
*
* @param string $charset
*
* @return string $data - обрезанный результат
*/
public static function textLimit($data, $limit, $etc = '…', $wordcut = false, $charset = 'utf-8')
{
$data = strip_tags($data, '<br>');
$data = trim(str_replace(['<br>', '<br />'], ' ', $data));
if ($limit && dle_strlen($data, $charset) > $limit) {
$data = dle_substr($data, 0, $limit, $charset) . $etc;
if (!$wordcut && ($word_pos = dle_strrpos($data, ' ', $charset))) {
$data = dle_substr($data, 0, $word_pos, $charset) . $etc;
}
}
return $data;
}
示例3: check_name
function check_name($name)
{
global $lang, $db, $banned_info, $relates_word, $config;
$stop = '';
$name = urldecode($name);
if (dle_strlen($name, $config['charset']) > 30 or dle_strlen(trim($name), $config['charset']) < 3) {
$stop .= $lang['reg_err_3'];
}
if (preg_match("/[\\||\\'|\\<|\\>|\\[|\\]|\"|\\!|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\{\\+]/", $name)) {
$stop .= $lang['reg_err_4'];
}
if (stripos(urlencode($name), "%AD") !== false) {
$stop .= $lang['reg_err_4'];
}
if (strpos(strtolower($name), '.php') !== false) {
$stop .= $lang['reg_err_4'];
}
if (count($banned_info['name'])) {
foreach ($banned_info['name'] as $banned) {
$banned['name'] = str_replace('\\*', '.*', preg_quote($banned['name'], "#"));
if ($banned['name'] and preg_match("#^{$banned['name']}\$#i", $name)) {
if ($banned['descr']) {
$lang['reg_err_21'] = str_replace("{descr}", $lang['reg_err_22'], $lang['reg_err_21']);
$lang['reg_err_21'] = str_replace("{descr}", $banned['descr'], $lang['reg_err_21']);
} else {
$lang['reg_err_21'] = str_replace("{descr}", "", $lang['reg_err_21']);
}
$stop .= $lang['reg_err_21'];
}
}
}
if (!$stop) {
if (function_exists('mb_strtolower')) {
$name = trim(mb_strtolower($name, $config['charset']));
} else {
$name = trim(strtolower($name));
}
$search_name = strtr($name, $relates_word);
$db->query("SELECT name FROM " . USERPREFIX . "_users WHERE LOWER(name) REGEXP '[[:<:]]{$search_name}[[:>:]]' OR name = '{$name}'");
if ($db->num_rows() > 0) {
$stop .= $lang['reg_err_20'];
}
}
if (!$stop) {
return false;
} else {
return $stop;
}
}
示例4: preg_replace
} else {
$tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
$tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template);
$tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
}
$xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
if ($config['allow_links'] and $value[3] == "textarea" and function_exists('replace_links')) {
$xfieldsdata[$value[0]] = replace_links($xfieldsdata[$value[0]], $replace_links['news']);
}
$tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
if (preg_match("#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches)) {
$count = intval($matches[1]);
$xfieldsdata[$value[0]] = str_replace("</p><p>", " ", $xfieldsdata[$value[0]]);
$xfieldsdata[$value[0]] = strip_tags($xfieldsdata[$value[0]], "<br>");
$xfieldsdata[$value[0]] = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $xfieldsdata[$value[0]])))));
if ($count and dle_strlen($xfieldsdata[$value[0]], $config['charset']) > $count) {
$xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $count, $config['charset']);
if ($temp_dmax = dle_strrpos($xfieldsdata[$value[0]], ' ', $config['charset'])) {
$xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset']);
}
}
$tpl->set($matches[0], $xfieldsdata[$value[0]]);
}
}
}
$category_id = $row['category'];
$tpl->compile('content');
if ($user_group[$member_id['user_group']]['allow_hide']) {
$tpl->result['content'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $tpl->result['content']));
} else {
$tpl->result['content'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $tpl->result['content']);
示例5: create_metatags
function create_metatags($story)
{
global $config, $db;
$keyword_count = 20;
$newarr = array();
$headers = array();
$quotes = array("\"", "`", "\t", '\\n', '\\r', "\n", "\r", '\\', ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "\$", "<", ">", "?", "!", '"');
$fastquotes = array("\"", "`", "\t", "\n", "\r", '"', '\\r', '\\n', "\$", "{", "}", "[", "]", "<", ">");
$story = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "", $story);
$story = preg_replace("'\\[attachment=(.*?)\\]'si", "", $story);
$story = preg_replace("'\\[page=(.*?)\\](.*?)\\[/page\\]'si", "", $story);
$story = str_replace("{PAGEBREAK}", "", $story);
$story = str_replace(" ", " ", $story);
$story = str_replace('<br />', ' ', $story);
$story = strip_tags($story);
$story = preg_replace("#&(.+?);#", "", $story);
$story = trim(str_replace(" ,", "", $story));
if (trim($_REQUEST['meta_title']) != "") {
$headers['title'] = trim(htmlspecialchars(strip_tags(stripslashes($_REQUEST['meta_title']))));
$headers['title'] = $db->safesql(str_replace($fastquotes, '', $headers['title']));
} else {
$headers['title'] = "";
}
if (trim($_REQUEST['descr']) != "") {
$headers['description'] = dle_substr(strip_tags(stripslashes($_REQUEST['descr'])), 0, 190, $config['charset']);
$headers['description'] = $db->safesql(str_replace($fastquotes, '', $headers['description']));
} else {
$story = str_replace($fastquotes, '', $story);
$headers['description'] = $db->safesql(dle_substr(stripslashes($story), 0, 190, $config['charset']));
}
if (trim($_REQUEST['keywords']) != "") {
$headers['keywords'] = $db->safesql(str_replace($fastquotes, " ", strip_tags(stripslashes($_REQUEST['keywords']))));
} else {
$story = str_replace($quotes, ' ', $story);
$arr = explode(" ", $story);
foreach ($arr as $word) {
if (dle_strlen($word, $config['charset']) > 4) {
$newarr[] = $word;
}
}
$arr = array_count_values($newarr);
arsort($arr);
$arr = array_keys($arr);
$total = count($arr);
$offset = 0;
$arr = array_slice($arr, $offset, $keyword_count);
$headers['keywords'] = $db->safesql(implode(", ", $arr));
}
return $headers;
}
示例6: textLimit
/**
* @param $data - контент
* @param $length - максимальный размер возвращаемого контента
*
* @return $data - обрезанный результат
*/
public function textLimit($data, $count)
{
if ($this->config['text_limit'] != '0')
{
$data = strip_tags($data, '<br>');
$data = trim(str_replace( array('<br>','<br />'), ' ', $data));
if($count && dle_strlen($data, $this->dle_config['charset'] ) > $count)
{
$data = dle_substr( $data, 0, $count, $this->dle_config['charset'] ). '…';
if( !$this->config['wordcut'] && ($word_pos = dle_strrpos( $data, ' ', $this->dle_config['charset'] )) )
$data = dle_substr( $data, 0, $word_pos, $this->dle_config['charset'] ). '…';
}
}
return $data;
}
示例7: stripslashes
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
}
$row['title'] = stripslashes($row['title']);
if (dle_strlen($row['title'], $config['charset']) > 43) {
$title = dle_substr($row['title'], 0, 43, $config['charset']) . " ...";
} else {
$title = $row['title'];
}
$row['short_story'] = trim(htmlspecialchars(strip_tags(stripslashes(str_replace(array("<br />", " "), " ", $row['short_story']))), ENT_QUOTES, $config['charset']));
if ($user_group[$member_id['user_group']]['allow_hide']) {
$row['short_story'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['short_story']));
} else {
$row['short_story'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "", $row['short_story']);
}
if (dle_strlen($row['short_story'], $config['charset']) > 150) {
$description = dle_substr($row['short_story'], 0, 150, $config['charset']) . " ...";
} else {
$description = $row['short_story'];
}
$description = str_replace('&', '&', $description);
$description = preg_replace("'\\[attachment=(.*?)\\]'si", "", $description);
$buffer .= "<a href=\"" . $full_link . "\"><span class=\"searchheading\">" . stripslashes($title) . "</span>";
$buffer .= "<span>" . $description . "</span></a>";
}
if (!$buffer) {
$buffer .= "<span class=\"notfound\">{$lang['related_not_found']}</span>";
}
$buffer .= '<span class="seperator"><a href="' . $config['http_home_url'] . '?do=search&mode=advanced&subaction=search&story=' . $query . '">' . $lang['s_ffullstart'] . '</a></span><br class="break" />';
@header("Content-type: text/html; charset=" . $config['charset']);
echo $buffer;
示例8: getuser
function getuser()
{
global $config, $lang;
if ($this->auth !== false) {
$user = $this->auth->get_user($this->social_config);
if (is_array($user) and $config['charset'] == "windows-1251") {
if (function_exists('mb_convert_encoding')) {
$user['name'] = mb_convert_encoding($user['name'], "windows-1251", "UTF-8");
$user['nickname'] = mb_convert_encoding($user['nickname'], "windows-1251", "UTF-8");
} elseif (function_exists('iconv')) {
$user['name'] = iconv("UTF-8", "windows-1251//IGNORE", $user['name']);
$user['nickname'] = iconv("UTF-8", "windows-1251//IGNORE", $user['nickname']);
}
}
if (is_array($user)) {
if (!$user['nickname']) {
$user['nickname'] = $user['name'];
}
$not_allow_symbol = array("\"", "`", "\t", '\\n', '\\r', "\n", "\r", '\\', ",", "/", "¬", "#", ";", ":", "~", "[", "]", "{", "}", ")", "(", "*", "^", "%", "\$", "<", ">", "?", "!", '"', "'", " ", "&");
$user['email'] = str_replace($not_allow_symbol, '', $user['email']);
$user['nickname'] = preg_replace("/[\\||\\'|\\<|\\>|\\[|\\]|\"|\\!|\\?|\$|\\@|\\#|\\/|\\\\|\\&\\~\\*\\{\\+]/", '', $user['nickname']);
$user['nickname'] = str_ireplace(".php", ".ppp", $user['nickname']);
$user['nickname'] = trim(htmlspecialchars($user['nickname'], ENT_QUOTES, $config['charset']));
$user['name'] = trim(htmlspecialchars($user['name'], ENT_QUOTES, $config['charset']));
if (dle_strlen($user['nickname'], $config['charset']) > 37) {
$user['nickname'] = dle_substr($user['nickname'], 37, $count, $config['charset']);
}
}
return $user;
} else {
return $lang['social_err_2'];
}
}
示例9: foreach
}
if (count($images)) {
$i = 0;
foreach ($images as $url) {
$i++;
$tpl->copy_template = str_replace('{image-' . $i . '}', $url, $tpl->copy_template);
$tpl->copy_template = str_replace('[image-' . $i . ']', "", $tpl->copy_template);
$tpl->copy_template = str_replace('[/image-' . $i . ']', "", $tpl->copy_template);
}
}
$tpl->copy_template = preg_replace("#\\[image-(.+?)\\](.+?)\\[/image-(.+?)\\]#is", "", $tpl->copy_template);
$tpl->copy_template = preg_replace("#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template);
}
$tpl->set('{short-story}', $row['short_story']);
if (preg_match("#\\{short-story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) {
$count = intval($matches[1]);
$row['short_story'] = str_replace("</p><p>", " ", $row['short_story']);
$row['short_story'] = strip_tags($row['short_story'], "<br>");
$row['short_story'] = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $row['short_story'])))));
if ($count and dle_strlen($row['short_story'], $config['charset']) > $count) {
$row['short_story'] = dle_substr($row['short_story'], 0, $count, $config['charset']);
if ($temp_dmax = dle_strrpos($row['short_story'], ' ', $config['charset'])) {
$row['short_story'] = dle_substr($row['short_story'], 0, $temp_dmax, $config['charset']);
}
}
$tpl->set($matches[0], $row['short_story']);
}
$tpl->compile('content');
}
$tpl->clear();
$db->free($sql_result);
示例10:
} else {
$send_mail_log = false;
}
if (intval($user_group[$member_id['user_group']]['max_info']) > 0 and dle_strlen($info, $config['charset']) > $user_group[$member_id['user_group']]['max_info']) {
$stop .= $lang['news_err_22'];
}
if (intval($user_group[$member_id['user_group']]['max_signature']) > 0 and dle_strlen($signature, $config['charset']) > $user_group[$member_id['user_group']]['max_signature']) {
$stop .= $lang['not_allowed_sig'];
}
if (dle_strlen($fullname, $config['charset']) > 100) {
$stop .= $lang['news_err_23'];
}
if (preg_match("/[\\||\\'|\\<|\\>|\"|\\!|\\]|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $fullname)) {
$stop .= $lang['news_err_35'];
}
if (dle_strlen($land, $config['charset']) > 100) {
$stop .= $lang['news_err_24'];
}
if (preg_match("/[\\||\\'|\\<|\\>|\"|\\!|\\]|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $land)) {
$stop .= $lang['news_err_36'];
}
if (strlen($icq) > 20) {
$stop .= $lang['news_err_25'];
}
if ($parse->not_allowed_tags) {
$stop .= $lang['news_err_34'];
}
if ($parse->not_allowed_text) {
$stop .= $lang['news_err_38'];
}
$db->query("SELECT name FROM " . USERPREFIX . "_users WHERE email = '{$email}' AND user_id != '{$id}'");
示例11: elseif
if ($config['allow_combine']) {
$row = $db->super_query("SELECT id, post_id, user_id, date, text, ip, is_register, approve, parent FROM " . PREFIX . "_comments WHERE post_id = '{$post_id}' ORDER BY id DESC LIMIT 0,1");
if ($row['id']) {
if ($row['user_id'] == $member_id['user_id'] and $row['is_register'] and $row['parent'] == $parent) {
$update_comments = true;
} elseif ($row['ip'] == $_IP and !$row['is_register'] and !$is_logged and $row['parent'] == $parent) {
$update_comments = true;
}
$row['date'] = strtotime($row['date']);
if (date("Y-m-d", $row['date']) != date("Y-m-d", $_TIME)) {
$update_comments = false;
}
if ($user_group[$member_id['user_group']]['edit_limit'] and $row['date'] + $user_group[$member_id['user_group']]['edit_limit'] * 60 < $_TIME) {
$update_comments = false;
}
if (dle_strlen($row['text'], $config['charset']) + dle_strlen($comments, $config['charset']) > $config['comments_maxlen'] and $update_comments) {
$update_comments = false;
$stop[] = $lang['news_err_3'];
$CN_HALT = TRUE;
msgbox($lang['all_err_1'], implode("<br />", $stop) . "<br /><br /><a href=\"javascript:history.go(-1)\">" . $lang['all_prev'] . "</a>");
}
}
}
if (!$CN_HALT) {
if ($config['allow_cmod'] and $user_group[$member_id['user_group']]['allow_modc']) {
if ($update_comments) {
if ($row['approve']) {
$update_comments = false;
}
}
$where_approve = 0;
示例12: cmplinks
function cmplinks($a, $b)
{
global $config;
return dle_strlen($b['word'], $config['charset']) - dle_strlen($a['word'], $config['charset']);
}
示例13: create_keywords
function create_keywords($story)
{
global $metatags, $config;
$keyword_count = 20;
$newarr = array();
$quotes = array("\"", "`", "\t", "\n", "\r", ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "\$", "<", ">", "?", "!", '"');
$fastquotes = array("\"", "`", "\t", "\n", "\r", '"', "\\", '\\r', '\\n', "/", "{", "}", "[", "]");
$story = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "", $story);
$story = preg_replace("'\\[attachment=(.*?)\\]'si", "", $story);
$story = preg_replace("'\\[page=(.*?)\\](.*?)\\[/page\\]'si", "", $story);
$story = str_replace("{PAGEBREAK}", "", $story);
$story = str_replace(" ", " ", $story);
$story = str_replace('<br />', ' ', $story);
$story = strip_tags($story);
$story = preg_replace("#&(.+?);#", "", $story);
$story = trim(str_replace(" ,", "", stripslashes($story)));
$story = str_replace($fastquotes, '', $story);
$metatags['description'] = dle_substr($story, 0, 190, $config['charset']);
$story = str_replace($quotes, ' ', $story);
$arr = explode(" ", $story);
foreach ($arr as $word) {
if (dle_strlen($word, $config['charset']) > 4) {
$newarr[] = $word;
}
}
$arr = array_count_values($newarr);
arsort($arr);
$arr = array_keys($arr);
$total = count($arr);
$offset = 0;
$arr = array_slice($arr, $offset, $keyword_count);
$metatags['keywords'] = implode(", ", $arr);
}
示例14: COUNT
}
$row = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_sendlog WHERE user = '{$check_user}' AND flag='2'");
if ($row['count'] >= $user_group[$member_id['user_group']]['max_mail_day']) {
$stop .= str_replace('{max}', $user_group[$member_id['user_group']]['max_mail_day'], $lang['feed_err_9']);
}
}
if (empty($name) or dle_strlen($name, $config['charset']) > 100) {
$stop .= $lang['feed_err_1'];
}
if (empty($email) or dle_strlen($email, $config['charset']) > 50 or @count(explode("@", $email)) != 2) {
$stop .= $lang['feed_err_2'];
}
if (empty($subject) or dle_strlen($subject, $config['charset']) > 200) {
$stop .= $lang['feed_err_4'];
}
if (empty($message) or dle_strlen($message, $config['charset']) > 20000) {
$stop .= $lang['feed_err_5'];
}
if ($user_group[$member_id['user_group']]['captcha_feedback']) {
if ($config['allow_recaptcha']) {
if ($_POST['recaptcha_response_field'] and $_POST['recaptcha_challenge_field']) {
require_once ENGINE_DIR . '/classes/recaptcha.php';
$resp = recaptcha_check_answer($config['recaptcha_private_key'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if ($resp->is_valid) {
$_POST['sec_code'] = 1;
$_SESSION['sec_code_session'] = 1;
} else {
$_SESSION['sec_code_session'] = false;
}
} else {
$_SESSION['sec_code_session'] = false;
示例15: preg_replace
}
$row['story'] = preg_replace("'\\[PAGE=(.*?)\\](.*?)\\[/PAGE\\]'si", $replacepage, $row['story']);
} else {
$row['story'] = preg_replace("'\\[PAGE=(.*?)\\](.*?)\\[/PAGE\\]'si", "", $row['story']);
}
$row['story'] = str_replace('{ACCEPT-DECLINE}', "", $row['story']);
$title = stripslashes(strip_tags($row['title']));
if ($row['allow_template']) {
$tpl->load_template('static.tpl');
if ($config['allow_alt_url'] == "yes") {
$static_descr = "<a title=\"" . $title . "\" href=\"" . $config['http_home_url'] . $row['static_name'] . ".html\" >" . $title . "</a>";
} else {
$static_descr = "<a title=\"" . $title . "\" href=\"{$PHP_SELF}?do=static&page=" . $row['static_name'] . "\" >" . $title . "</a>";
}
$tpl->set('{description}', $static_descr);
if (dle_strlen($row['story'], $config['charset']) > 2000) {
$row['story'] = dle_substr(strip_tags($row['story']), 0, 2000, $config['charset']) . " .... ";
if ($config['allow_alt_url'] == "yes") {
$row['story'] .= "( <a href=\"" . $config['http_home_url'] . $row['static_name'] . ".html\" >" . $lang['search_s_go'] . "</a> )";
} else {
$row['story'] .= "( <a href=\"{$PHP_SELF}?do=static&page=" . $row['static_name'] . "\" >" . $lang['search_s_go'] . "</a> )";
}
}
$tpl->set('{static}', $row['story']);
$tpl->set('{pages}', '');
if (@date("Ymd", $row['date']) == date("Ymd", $_TIME)) {
$tpl->set('{date}', $lang['time_heute'] . langdate(", H:i", $row['date']));
} elseif (@date("Ymd", $row['date']) == date("Ymd", $_TIME - 86400)) {
$tpl->set('{date}', $lang['time_gestern'] . langdate(", H:i", $row['date']));
} else {
$tpl->set('{date}', langdate($config['timestamp_active'], $row['date']));