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


PHP TextHelper::substr_html方法代码示例

本文整理汇总了PHP中TextHelper::substr_html方法的典型用法代码示例。如果您正苦于以下问题:PHP TextHelper::substr_html方法的具体用法?PHP TextHelper::substr_html怎么用?PHP TextHelper::substr_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextHelper的用法示例。


在下文中一共展示了TextHelper::substr_html方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_menu_content

 public function get_menu_content()
 {
     //Create file template
     $tpl = new FileTemplate('guestbook/GuestbookModuleMiniMenu.tpl');
     //Assign the lang file to the tpl
     $tpl->add_lang(LangLoader::get('common', 'guestbook'));
     $tpl->put('U_GUESTBOOK', GuestbookUrlBuilder::home()->rel());
     $guestbook_cache = GuestbookMessagesCache::load();
     $random_message = $guestbook_cache->get_message(array_rand($guestbook_cache->get_messages()));
     if ($random_message !== null) {
         $user_group_color = User::get_group_color($random_message['groups'], $random_message['level']);
         $tpl->put_all(array('C_ANY_MESSAGE_GUESTBOOK' => true, 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_MORE_CONTENTS' => strlen($random_message['contents']) >= 200, 'C_VISITOR' => empty($random_message['user_id']), 'CONTENTS' => $random_message['contents'], 'SHORT_CONTENTS' => nl2br(TextHelper::substr_html($random_message['contents'], 0, 200)), 'USER_PSEUDO' => $random_message['login'], 'USER_LEVEL_CLASS' => UserService::get_level_class($random_message['level']), 'USER_GROUP_COLOR' => $user_group_color, 'U_MESSAGE' => GuestbookUrlBuilder::home($random_message['page'], $random_message['id'])->rel(), 'U_PROFILE' => UserUrlBuilder::profile($random_message['user_id'])->rel()));
     }
     return $tpl->render();
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:15,代码来源:GuestbookModuleMiniMenu.class.php

示例2: ceil

            }
            if (!in_array($row['cid'], $is_sub_forum)) {
                if ($row['nbr_msg'] !== '0') {
                    //Si le dernier message lu est présent on redirige vers lui, sinon on redirige vers le dernier posté.
                    if (!empty($row['last_view_id'])) {
                        $last_msg_id = $row['last_view_id'];
                        $last_page = 'idm=' . $row['last_view_id'] . '&';
                        $last_page_rewrite = '-0-' . $row['last_view_id'];
                    } else {
                        $last_msg_id = $row['last_msg_id'];
                        $last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page());
                        $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
                        $last_page = $last_page > 1 ? 'pt=' . $last_page . '&' : '';
                    }
                    $last_topic_title = ($config->is_message_before_topic_title_displayed() && $row['display_msg'] ? $config->get_message_before_topic_title() : '') . ' ' . $row['title'];
                    $last_topic_title = stripslashes(strlen(TextHelper::html_entity_decode($last_topic_title)) > 20 ? TextHelper::substr_html($last_topic_title, 0, 20) . '...' : $last_topic_title);
                    $group_color = User::get_group_color($row['groups'], $row['user_level']);
                    $last = '<a href="topic' . url('.php?id=' . $row['tid'], '-' . $row['tid'] . '+' . Url::encode_rewrite($row['title']) . '.php') . '" class="small">' . $last_topic_title . '</a><br />
					<a href="topic' . url('.php?' . $last_page . 'id=' . $row['tid'], '-' . $row['tid'] . $last_page_rewrite . '+' . Url::encode_rewrite($row['title']) . '.php') . '#m' . $last_msg_id . '" title=""><i class="fa fa-hand-o-right"></i></a> ' . $LANG['on'] . ' ' . Date::to_format($row['last_timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />
					' . $LANG['by'] . (!empty($row['display_name']) ? ' <a href="' . UserUrlBuilder::profile($row['last_user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['user_level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . TextHelper::wordwrap_html($row['display_name'], 13) . '</a>' : ' ' . $LANG['guest']);
                } else {
                    $row['last_timestamp'] = '';
                    $last = '<br />' . $LANG['no_message'] . '<br /><br />';
                }
                //Vérirication de l'existance de sous forums.
                $subforums = '';
                $children = ForumService::get_categories_manager()->get_categories_cache()->get_childrens($row['cid']);
                if ($children) {
                    foreach ($children as $id => $child) {
                        if ($child->get_id_parent() == $row['cid'] && ForumAuthorizationsService::check_authorizations($child->get_id())->read()) {
                            $is_sub_forum[] = $child->get_id();
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:forum.php

示例3: AND

     $nbr_msg_not_read = 0;
     $result = PersistenceContext::get_querier()->select("SELECT t.id AS tid, t.title, t.last_timestamp, t.last_user_id, t.last_msg_id, t.nbr_msg AS t_nbr_msg, t.display_msg, m.user_id, m.display_name as login, m.level as user_level, m.groups, v.last_view_id\n\t\tFROM " . PREFIX . "forum_topics t\n\t\tLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat\n\t\tLEFT JOIN " . PREFIX . "forum_view v ON v.idtopic = t.id AND v.user_id = '" . AppContext::get_current_user()->get_id() . "'\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = t.last_user_id\n\t\tWHERE t.last_timestamp >= '" . $max_time_msg . "' AND (v.last_view_id != t.last_msg_id OR v.last_view_id IS NULL) AND c.id IN :authorized_categories\n\t\tORDER BY t.last_timestamp DESC", array('authorized_categories' => $authorized_categories));
     while ($row = $result->fetch()) {
         //Si le dernier message lu est présent on redirige vers lui, sinon on redirige vers le dernier posté.
         if (!empty($row['last_view_id'])) {
             $last_msg_id = $row['last_view_id'];
             $last_page = 'idm=' . $row['last_view_id'] . '&amp;';
             $last_page_rewrite = '-0-' . $row['last_view_id'];
         } else {
             $last_msg_id = $row['last_msg_id'];
             $last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page());
             $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
             $last_page = $last_page > 1 ? 'pt=' . $last_page . '&amp;' : '';
         }
         $last_topic_title = ($config->is_message_before_topic_title_displayed() && $row['display_msg'] ? $config->get_message_before_topic_title() : '') . ' ' . $row['title'];
         $last_topic_title = strlen(TextHelper::html_entity_decode($last_topic_title)) > 25 ? TextHelper::substr_html($last_topic_title, 0, 25) . '...' : $last_topic_title;
         $last_topic_title = addslashes($last_topic_title);
         $row['login'] = !empty($row['login']) ? $row['login'] : $LANG['guest'];
         $group_color = User::get_group_color($row['groups'], $row['user_level']);
         $contents .= '<tr><td class="forum-notread" style="width:100%"><a href="topic' . url('.php?' . $last_page . 'id=' . $row['tid'], '-' . $row['tid'] . $last_page_rewrite . '+' . addslashes(Url::encode_rewrite($row['title'])) . '.php') . '#m' . $last_msg_id . '"><i class="fa fa-hand-o-right"></i></a> <a href="topic' . url('.php?id=' . $row['tid'], '-' . $row['tid'] . '+' . addslashes(Url::encode_rewrite($row['title'])) . '.php') . '" class="small">' . $last_topic_title . '</a></td><td class="forum-notread" style="white-space:nowrap">' . ($row['last_user_id'] != '-1' ? '<a href="' . UserUrlBuilder::profile($row['last_user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['user_level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . addslashes($row['login']) . '</a>' : '<em>' . addslashes($LANG['guest']) . '</em>') . '</td><td class="forum-notread" style="white-space:nowrap">' . Date::to_format($row['last_timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '</td></tr>';
         $nbr_msg_not_read++;
     }
     $result->dispose();
     $max_visible_topics = 10;
     $height_visible_topics = $nbr_msg_not_read < $max_visible_topics ? 23 * $nbr_msg_not_read : 23 * $max_visible_topics;
     echo "array_unread_topics[0] = '" . $nbr_msg_not_read . "';\n";
     echo "array_unread_topics[1] = '" . '<a class="small" href="' . PATH_TO_ROOT . '/forum/unread.php" title="' . addslashes($LANG['show_not_reads']) . '">' . addslashes($LANG['show_not_reads']) . (AppContext::get_current_user()->get_id() !== -1 ? ' (' . $nbr_msg_not_read . ')' : '') . '</a>' . "';\n";
     echo "array_unread_topics[2] = '" . '<div style="width:438px;height:' . max($height_visible_topics, 65) . 'px;overflow:auto;padding:0px;" onmouseover="forum_hide_block(\\\'forum_unread\\\', 1);" onmouseout="forum_hide_block(\\\'forum_unread\\\', 0);"><table class="module-table" style="margin:2px;width:99%">' . $contents . "</table></div>';";
 } else {
     echo '';
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:xmlhttprequest.php

示例4: build_view

    private function build_view()
    {
        global $LANG, $config, $nbr_msg_not_read, $tpl_top, $tpl_bottom;
        $id_get = retrieve(GET, 'id', 0);
        try {
            $this->category = ForumService::get_categories_manager()->get_categories_cache()->get_category($id_get);
        } catch (CategoryNotFoundException $e) {
        }
        require_once PATH_TO_ROOT . '/forum/forum_begin.php';
        require_once PATH_TO_ROOT . '/forum/forum_tools.php';
        $this->view = new FileTemplate('forum/forum_index.tpl');
        //Affichage des sous-catégories de la catégorie.
        $display_cat = !empty($id_get);
        //Vérification des autorisations.
        $authorized_categories = ForumService::get_authorized_categories($id_get);
        //Calcul du temps de péremption, ou de dernière vue des messages par à rapport à la configuration.
        $max_time_msg = forum_limit_time_msg();
        $is_guest = AppContext::get_current_user()->get_id() == -1;
        $total_topic = 0;
        $total_msg = 0;
        $i = 0;
        //On liste les catégories et sous-catégories.
        $result = PersistenceContext::get_querier()->select('SELECT @id_cat:= c.id, c.id AS cid, c.id_parent, c.name, c.rewrited_name, c.description as subname, c.url, c.last_topic_id, t.id AS tid, t.idcat, t.title, t.last_timestamp, t.last_user_id, t.last_msg_id, t.nbr_msg AS t_nbr_msg, t.display_msg, t.status, m.user_id, m.display_name as login, m.level as user_level, m.groups, v.last_view_id,
		(SELECT COUNT(*) FROM ' . ForumSetup::$forum_topics_table . '
			WHERE idcat IN (
				@id_cat,
				(SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . ForumSetup::$forum_cats_table . ' WHERE id_parent = @id_cat), 
				(SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . ForumSetup::$forum_cats_table . ' parents
				INNER JOIN ' . ForumSetup::$forum_cats_table . ' childs ON parents.id = childs.id_parent
				WHERE parents.id_parent = @id_cat)
			)
		) AS nbr_topic,
		(SELECT COUNT(*) FROM ' . ForumSetup::$forum_message_table . '
			WHERE idtopic IN (
				(SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . ForumSetup::$forum_topics_table . ' WHERE idcat = @id_cat), 
				(SELECT GROUP_CONCAT(t.id SEPARATOR \',\') FROM ' . ForumSetup::$forum_topics_table . ' t LEFT JOIN ' . ForumSetup::$forum_cats_table . ' c ON t.idcat = c.id WHERE id_parent = @id_cat)
			)
		) AS nbr_msg
		FROM ' . ForumSetup::$forum_cats_table . ' c
		LEFT JOIN ' . ForumSetup::$forum_topics_table . ' t ON t.id = c.last_topic_id
		LEFT JOIN ' . ForumSetup::$forum_view_table . ' v ON v.user_id = :user_id AND v.idtopic = t.id
		LEFT JOIN ' . DB_TABLE_MEMBER . ' m ON m.user_id = t.last_user_id
		WHERE ' . ($display_cat ? 'c.id_parent = :id_cat AND ' : '') . 'c.id IN :authorized_categories
		ORDER BY c.id, c.id_parent, c.c_order', array('id_cat' => $id_get, 'user_id' => AppContext::get_current_user()->get_id(), 'authorized_categories' => $authorized_categories));
        $categories = array();
        while ($row = $result->fetch()) {
            $categories[] = $row;
        }
        $result->dispose();
        $display_sub_cats = false;
        $is_sub_forum = array();
        foreach ($categories as $row) {
            $this->view->assign_block_vars('forums_list', array());
            if ($row['id_parent'] == Category::ROOT_CATEGORY && $i > 0 && $display_sub_cats) {
                $this->view->assign_block_vars('forums_list.endcats', array());
            }
            $i++;
            if ($row['id_parent'] == Category::ROOT_CATEGORY) {
                $this->view->assign_block_vars('forums_list.cats', array('IDCAT' => $row['cid'], 'NAME' => $row['name'], 'U_FORUM_VARS' => ForumUrlBuilder::display_category($row['cid'], $row['rewrited_name'])->rel()));
                $display_sub_cats = true;
            } else {
                if (in_array($row['id_parent'], $is_sub_forum)) {
                    $is_sub_forum[] = $row['cid'];
                }
                if (($display_sub_cats || !empty($id_get)) && !in_array($row['cid'], $is_sub_forum)) {
                    if ($display_cat) {
                        $this->view->assign_block_vars('forums_list.cats', array('IDCAT' => $this->category->get_id(), 'NAME' => $this->category->get_name(), 'U_FORUM_VARS' => PATH_TO_ROOT . '/forum/' . url('index.php?id=' . $this->category->get_id(), 'cat-' . $this->category->get_id() . '+' . $this->category->get_rewrited_name() . '.php')));
                        $display_cat = false;
                    }
                    $subforums = '';
                    $this->view->put_all(array('C_FORUM_ROOT_CAT' => false, 'C_FORUM_CHILD_CAT' => true, 'C_END_S_CATS' => false));
                    $children = ForumService::get_categories_manager()->get_categories_cache()->get_childrens($row['cid']);
                    if ($children) {
                        foreach ($children as $id => $child) {
                            if ($child->get_id_parent() == $row['cid'] && ForumAuthorizationsService::check_authorizations($child->get_id())->read()) {
                                $is_sub_forum[] = $child->get_id();
                                $link = $child->get_url() ? '<a href="' . $child->get_url() . '" class="small">' : '<a href="forum' . url('.php?id=' . $child->get_id(), '-' . $child->get_id() . '+' . $child->get_rewrited_name() . '.php') . '" class="small">';
                                $subforums .= !empty($subforums) ? ', ' . $link . $child->get_name() . '</a>' : $link . $child->get_name() . '</a>';
                            }
                        }
                        $subforums = '<strong>' . $LANG['subforum_s'] . '</strong>: ' . $subforums;
                    }
                    if (!empty($row['last_topic_id'])) {
                        //Si le dernier message lu est présent on redirige vers lui, sinon on redirige vers le dernier posté.
                        if (!empty($row['last_view_id'])) {
                            $last_msg_id = $row['last_view_id'];
                            $last_page = 'idm=' . $row['last_view_id'] . '&amp;';
                            $last_page_rewrite = '-0-' . $row['last_view_id'];
                        } else {
                            $last_msg_id = $row['last_msg_id'];
                            $last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page());
                            $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
                            $last_page = $last_page > 1 ? 'pt=' . $last_page . '&amp;' : '';
                        }
                        $last_topic_title = ($config->is_message_before_topic_title_displayed() && $row['display_msg'] ? $config->get_message_before_topic_title() : '') . ' ' . $row['title'];
                        $last_topic_title = stripslashes(strlen(TextHelper::html_entity_decode($last_topic_title)) > 20 ? TextHelper::substr_html($last_topic_title, 0, 20) . '...' : $last_topic_title);
                        $row['login'] = !empty($row['login']) ? $row['login'] : $LANG['guest'];
                        $group_color = User::get_group_color($row['groups'], $row['user_level']);
                        $last = '<a href="' . PATH_TO_ROOT . '/forum/topic' . url('.php?id=' . $row['tid'], '-' . $row['tid'] . '+' . Url::encode_rewrite($row['title']) . '.php') . '" class="small">' . $last_topic_title . '</a><br />
						<a href="' . PATH_TO_ROOT . '/forum/topic' . url('.php?' . $last_page . 'id=' . $row['tid'], '-' . $row['tid'] . $last_page_rewrite . '+' . Url::encode_rewrite($row['title']) . '.php') . '#m' . $last_msg_id . '"><i class="fa fa-hand-o-right"></i></a> ' . $LANG['on'] . ' ' . Date::to_format($row['last_timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />' . $LANG['by'] . ' ' . ($row['last_user_id'] != '-1' ? '<a href="' . UserUrlBuilder::profile($row['last_user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['user_level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['login'] . '</a>' : '<em>' . $LANG['guest'] . '</em>');
//.........这里部分代码省略.........
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:101,代码来源:ForumHomeController.class.php


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