当前位置: 首页>>代码示例>>PHP>>正文


PHP dle_substr函数代码示例

本文整理汇总了PHP中dle_substr函数的典型用法代码示例。如果您正苦于以下问题:PHP dle_substr函数的具体用法?PHP dle_substr怎么用?PHP dle_substr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dle_substr函数的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;
 }
开发者ID:hiptc,项目名称:custom-users,代码行数:11,代码来源:custom.users.php

示例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;
 }
开发者ID:dle-modules,项目名称:DLE-Components,代码行数:22,代码来源:bpModifiers.php

示例3: str_replace

             $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']);
 }
 if ($config['allow_banner'] and count($banner_in_news) and !$view_template) {
     foreach ($banner_in_news as $name) {
开发者ID:Gordondalos,项目名称:union,代码行数:31,代码来源:show.full.php

示例4: 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("&nbsp;", " ", $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;
}
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:50,代码来源:functions.inc.php

示例5: echofooter

HTML;
    echofooter();
    die;
} elseif ($action == "doedit") {
    if ($_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash) {
        die("Hacking attempt! User not found");
    }
    $quotes = array("'", "\"", "`", "\t", "\n", "\r", '"');
    $cat_name = $db->safesql(htmlspecialchars(strip_tags(stripslashes($_POST['cat_name'])), ENT_QUOTES));
    $skin_name = trim(totranslit($_POST['skin_name'], false, false));
    $cat_icon = $db->safesql(htmlspecialchars(strip_tags(stripslashes($_POST['cat_icon'])), ENT_QUOTES));
    $alt_cat_name = totranslit(stripslashes($_POST['alt_cat_name']), true, false);
    $catid = intval($_POST['catid']);
    $parentid = intval($_POST['parentid']);
    $meta_title = $db->safesql(htmlspecialchars(strip_tags(stripslashes($_POST['meta_title']))));
    $description = $db->safesql(dle_substr(strip_tags(stripslashes($_POST['descr'])), 0, 200, $config['charset']));
    $keywords = $db->safesql(str_replace($quotes, " ", strip_tags(stripslashes($_POST['keywords']))));
    $short_tpl = totranslit(stripslashes(trim($_POST['short_tpl'])));
    $full_tpl = totranslit(stripslashes(trim($_POST['full_tpl'])));
    if (in_array($_POST['news_sort'], array("date", "rating", "news_read", "title"))) {
        $news_sort = $db->safesql($_POST['news_sort']);
    } else {
        $news_sort = "";
    }
    if (in_array($_POST['news_msort'], array("ASC", "DESC"))) {
        $news_msort = $db->safesql($_POST['news_msort']);
    } else {
        $news_msort = "";
    }
    if ($_POST['news_number'] > 0) {
        $news_number = intval($_POST['news_number']);
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:31,代码来源:categories.php

示例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'] ). '&hellip;';					
					if( !$this->config['wordcut'] && ($word_pos = dle_strrpos( $data, ' ', $this->dle_config['charset'] )) ) 
						$data = dle_substr( $data, 0, $word_pos, $this->dle_config['charset'] ). '&hellip;';

				}
			}
			return $data;
		}
开发者ID:n0wheremany,项目名称:Block.Pro.3,代码行数:23,代码来源:block.pro.3.php

示例7: values

        if ($old['autor'] != $row['name']) {
            $edit_articles++;
            $db->query("UPDATE " . PREFIX . "_post SET autor='{$row['name']}' WHERE id='{$id}'");
            $db->query("UPDATE " . PREFIX . "_post_extras SET user_id='{$row['user_id']}' WHERE news_id='{$id}'");
            $db->query("UPDATE " . PREFIX . "_images SET author='{$row['name']}' WHERE news_id='{$id}'");
            $db->query("UPDATE " . PREFIX . "_files SET author='{$row['name']}' WHERE news_id='{$id}'");
            $db->query("UPDATE " . USERPREFIX . "_users SET news_num=news_num+1 WHERE user_id='{$row['user_id']}'");
            $db->query("UPDATE " . USERPREFIX . "_users SET news_num=news_num-1 WHERE name='{$old['autor']}'");
        }
    }
    $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$_TIME}', '{$_IP}', '46', '')");
    clear_cache();
    msg("info", $lang['edit_selauthor_4'], $lang['edit_selauthor_4'] . " ({$edit_articles})", $_SESSION['admin_referrer']);
} elseif ($action == "do_mass_edit_symbol") {
    $edit_articles = 0;
    $catalog_url = $db->safesql(dle_substr(htmlspecialchars(strip_tags(stripslashes(trim($_POST['catalog_url'])))), 0, 3, $config['charset']));
    foreach ($selected_news as $id) {
        $edit_articles++;
        $id = intval($id);
        $db->query("UPDATE " . PREFIX . "_post SET symbol='{$catalog_url}' WHERE id='{$id}'");
    }
    $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$_TIME}', '{$_IP}', '46', '')");
    clear_cache();
    msg("info", $lang['mass_symbol_ok'], $lang['mass_symbol_ok'] . " ({$edit_articles})", $_SESSION['admin_referrer']);
} elseif ($action == "do_mass_edit_cloud") {
    $edit_articles = 0;
    if (@preg_match("/[\\||\\'|\\<|\\>|\"|\\!|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $_POST['tags'])) {
        $_POST['tags'] = "";
    } else {
        $_POST['tags'] = @$db->safesql(htmlspecialchars(strip_tags(stripslashes(trim($_POST['tags']))), ENT_QUOTES));
    }
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:31,代码来源:massactions.php

示例8: 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);
开发者ID:Zzepish,项目名称:IvanShikalovWebSIte,代码行数:31,代码来源:show.custom.php

示例9: 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'];
     }
 }
开发者ID:Gordondalos,项目名称:union,代码行数:33,代码来源:social.class.php

示例10: 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("&nbsp;", " ", $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);
}
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:33,代码来源:functions.php

示例11: die

=====================================================
*/
if (!defined('DATALIFEENGINE')) {
    die("Hacking attempt!");
}
$row = $db->super_query("SELECT subj, text, user_from FROM " . USERPREFIX . "_pm WHERE user = '{$member_id['user_id']}' AND folder = 'inbox' ORDER BY pm_read ASC, date DESC LIMIT 0,1");
$lang['pm_alert'] = str_replace("{user}", $member_id['name'], str_replace("{num}", intval($member_id['pm_unread']), $lang['pm_alert']));
$row['subj'] = dle_substr(stripslashes($row['subj']), 0, 45, $config['charset']) . " ...";
if ($user_group[$member_id['user_group']]['allow_hide']) {
    $row['text'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['text']));
} else {
    $row['text'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "", $row['text']);
}
$row['text'] = str_replace("<br />", " ", $row['text']);
$row['text'] = str_replace("{", "&#123;", $row['text']);
$row['text'] = dle_substr(strip_tags(stripslashes($row['text'])), 0, 340, $config['charset']) . " ...";
$pm_alert = <<<HTML
<div id="newpm" title="{$lang['pm_atitle']}" style="display:none;" >{$lang['pm_alert']}
<br /><br />
{$lang['pm_asub']} <b>{$row['subj']}</b><br />
{$lang['pm_from']} <b>{$row['user_from']}</b><br /><br /><i>{$row['text']}</i></div>
HTML;
$onload_scripts[] = <<<HTML
\$('#newpm').dialog({
\tautoOpen: true,
\tshow: 'fade',
\thide: 'fade',
\twidth: 450,
\tresizable: false,
\tdialogClass: "dle-popup-newpm",
\tbuttons: {
开发者ID:Gordondalos,项目名称:union,代码行数:31,代码来源:pm_alert.php

示例12: 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']));
     }
开发者ID:Banych,项目名称:SiteCreate,代码行数:31,代码来源:search.php

示例13: str_replace

             $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);
 }
 $content['description'] = strip_tags($content['description'], "<br>");
 $content['description'] = str_replace("<br>", " ", str_replace("<br />", " ", $content['description']));
 $content['description'] = trim($content['description']);
 if ($value['dmax'] and dle_strlen($content['description'], $config['charset']) > $value['dmax']) {
     $content['description'] = dle_substr($content['description'], 0, $value['dmax'], $config['charset']);
     if ($temp_dmax = dle_strrpos($content['description'], ' ', $config['charset'])) {
         $content['description'] = dle_substr($content['description'], 0, $temp_dmax, $config['charset']);
     }
     $content['description'] .= " ...";
 }
 $content['link'] = htmlspecialchars($content['link'], ENT_QUOTES, $config['charset']);
 $tpl->set('{title}', $content['title']);
 $tpl->set('{news}', $content['description']);
 $tpl->set('[link]', "<a href=\"{$content['link']}\" target=\"_blank\">");
 $tpl->set('[/link]', "</a>");
 $tpl->set('{link}', $content['link']);
 $tpl->set('{category}', $content['category']);
 $tpl->set('{author}', $content['author']);
 $tpl->set('{date}', langdate($value['rss_date_format'], $content['date']));
 $news_date = $content['date'];
 $tpl->copy_template = preg_replace_callback("#\\{date=(.+?)\\}#i", "formdate", $tpl->copy_template);
 $tpl->compile('rss_info');
开发者ID:Gordondalos,项目名称:union,代码行数:31,代码来源:rssinform.php

示例14: date

    $news_date = date('d-m-Y', $related['date']);
    if ($config['allow_alt_url'] == "yes") {
        if ($config['seo_type'] == 1 or $config['seo_type'] == 2) {
            if ($related['category'] and $config['seo_type'] == 2) {
                $full_link = $config['http_home_url'] . get_url($related['category']) . "/" . $related['id'] . "-" . $related['alt_name'] . ".html";
            } else {
                $full_link = $config['http_home_url'] . $related['id'] . "-" . $related['alt_name'] . ".html";
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', $related['date']) . $related['alt_name'] . ".html";
        }
    } else {
        $full_link = $config['http_home_url'] . "index.php?newsid=" . $related['id'];
    }
    if (dle_strlen($related['title'], $config['charset']) > 65) {
        $related['title'] = dle_substr($related['title'], 0, 65, $config['charset']) . " ...";
    }
    if ($user_group[$member_id['user_group']]['allow_all_edit']) {
        $d_link = "<a href=\"?mod=editnews&action=editnews&id={$related['id']}\" target=\"_blank\"><img style=\"vertical-align: middle;border:none;\" alt=\"{$lang['edit_rel']}\" src=\"engine/skins/images/notepad.png\" /></a>&nbsp;&nbsp;<a onclick=\"confirmDelete('?mod=editnews&action=doeditnews&ifdelete=yes&id={$related['id']}&user_hash={$dle_login_hash}', '{$related['id']}'); return false;\" href=\"?mod=editnews&action=doeditnews&ifdelete=yes&id={$related['id']}&user_hash={$dle_login_hash}\" target=\"_blank\"><img style=\"vertical-align: middle;border:none;\" alt=\"{$lang['edit_seldel']}\" src=\"engine/skins/images/delete.png\" /></a>&nbsp;&nbsp;";
    } else {
        $d_link = "";
    }
    $buffer .= "<div style=\"padding:2px;\">{$d_link}{$news_date} - <a href=\"" . $full_link . "\" target=\"_blank\">" . stripslashes($related['title']) . "</a></div>";
}
$db->close();
@header("Content-type: text/html; charset=" . $config['charset']);
if ($buffer) {
    echo "<div style=\"width:600px; background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">" . $buffer . "</div>";
} else {
    echo "<div style=\"width:542px;background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">" . $lang['related_not_found'] . "</div>";
}
开发者ID:Zzepish,项目名称:IvanShikalovWebSIte,代码行数:31,代码来源:find_relates.php

示例15: intval

     $tpl->set_block("'\\[yandex\\](.*?)\\[/yandex\\]'si", "");
     $tpl->set('{yandex_url}', '');
 }
 if (preg_match("#\\{text limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) {
     $count = intval($matches[1]);
     $stext = preg_replace("#<!--TBegin(.+?)<!--TEnd-->#is", "", $template);
     $stext = preg_replace("#<!--MBegin(.+?)<!--MEnd-->#is", "", $stext);
     $stext = preg_replace("'\\[attachment=(.*?)\\]'si", "", $stext);
     $stext = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "", $stext);
     $stext = str_replace("</p><p>", " ", $stext);
     $stext = strip_tags($stext, "<br>");
     $stext = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $stext)))));
     if ($count and dle_strlen($stext, $config['charset']) > $count) {
         $stext = dle_substr($stext, 0, $count, $config['charset']);
         if ($temp_dmax = dle_strrpos($stext, ' ', $config['charset'])) {
             $stext = dle_substr($stext, 0, $temp_dmax, $config['charset']);
         }
     }
     $tpl->set($matches[0], $stext);
 }
 if (stripos($tpl->copy_template, "{image-") !== false) {
     $images = array();
     preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $template, $media);
     $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "\$3", $media[0]);
     foreach ($data as $url) {
         $info = pathinfo($url);
         if (isset($info['extension'])) {
             if ($info['filename'] == "spoiler-plus" or $info['filename'] == "spoiler-plus") {
                 continue;
             }
             $info['extension'] = strtolower($info['extension']);
开发者ID:Gordondalos,项目名称:union,代码行数:31,代码来源:static.php


注:本文中的dle_substr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。