function sp_do_sp_UnansweredPostsTag($args = '')
{
    #check if forum displayed
    if (sp_abort_display_forum()) {
        return;
    }
    $defs = array('tagId' => 'spUnansweredPostsTag', 'tagClass' => 'spListTag', 'listId' => 'spListItemTag%ID%', 'listClass' => 'spListItemTag', 'linkClass' => 'spLinkTag', 'textClass' => 'spTextTag', 'avatarClass' => 'spAvatarTag', 'listTags' => 1, 'forumIds' => '', 'limit' => 5, 'itemOrder' => 'FTUD', 'linkScope' => 'forum', 'beforeForum' => __('Forum: ', 'sp-ttags'), 'afterForum' => '<br />', 'beforeTopic' => __('Topic: ', 'sp-ttags'), 'afterTopic' => '<br />', 'beforeUser' => __('By: ', 'sp-ttags'), 'afterUser' => '', 'beforeDate' => '&nbsp;-', 'afterDate' => '', 'avatarSize' => 25, 'niceDate' => 1, 'postTip' => 1, 'truncate' => 0, 'echo' => 1);
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_UnansweredPostsTag_args', $a);
    extract($a, EXTR_SKIP);
    # sanitize before use
    $tagId = esc_attr($tagId);
    $tagClass = esc_attr($tagClass);
    $listClass = esc_attr($listClass);
    $listId = esc_attr($listId);
    $linkClass = esc_attr($linkClass);
    $textClass = esc_attr($textClass);
    $avatarClass = esc_attr($avatarClass);
    $listTags = (int) $listTags;
    $forumIds = esc_attr($forumIds);
    $limit = (int) $limit;
    $itemOrder = esc_attr($itemOrder);
    $linkScope = esc_attr($linkScope);
    $beforeForum = sp_filter_title_display($beforeForum);
    $afterForum = sp_filter_title_display($afterForum);
    $beforeTopic = sp_filter_title_display($beforeTopic);
    $afterTopic = sp_filter_title_display($afterTopic);
    $beforeUser = sp_filter_title_display($beforeUser);
    $afterUser = sp_filter_title_display($afterUser);
    $beforeDate = sp_filter_title_display($beforeDate);
    $afterDate = sp_filter_title_display($afterDate);
    $avatarSize = (int) $avatarSize;
    $niceDate = (int) $niceDate;
    $postTip = (int) $postTip;
    $truncate = (int) $truncate;
    $echo = (int) $echo;
    sp_forum_api_support();
    global $spPostList, $spThisPostList;
    $where = SFTOPICS . '.post_count=1';
    # do we have forum ids specified?
    $where .= !empty($forumIds) ? ' AND ' . SFPOSTS . '.forum_id IN (' . $forumIds . ')' : '';
    $spPostList = new spPostList($where, SFPOSTS . '.post_id DESC', $limit);
    if (empty($spPostList)) {
        return;
    }
    if (!empty($beforeForum)) {
        $beforeForum = trim($beforeForum) . ' ';
    }
    if (!empty($beforeTopic)) {
        $beforeTopic = trim($beforeTopic) . ' ';
    }
    if (!empty($beforeUser)) {
        $beforeUser = trim($beforeUser) . ' ';
    }
    if (!empty($beforeDate)) {
        $beforeDate = trim($beforeDate) . ' ';
    }
    if (!empty($afterForum)) {
        $afterForum = ' ' . trim($afterForum);
    }
    if (!empty($afterTopic)) {
        $afterTopic = ' ' . trim($afterTopic);
    }
    if (!empty($afterUser)) {
        $afterUser = '******' . trim($afterUser);
    }
    if (!empty($afterDate)) {
        $afterDate = ' ' . trim($afterDate);
    }
    $fLink = $tLink = $aLink = false;
    if ($linkScope == 'forum') {
        $fLink = $tLink = true;
    }
    if ($linkScope == 'all') {
        $aLink = true;
    }
    # Start building dislay
    $out = $listTags ? "<ul id='{$tagId}' class='{$tagClass}'>" : "<div id='{$tagId}' class='{$tagClass}'>";
    # start the loop
    if (sp_has_postlist()) {
        while (sp_loop_postlist()) {
            sp_the_postlist();
            $thisId = str_ireplace('%ID%', $spThisPostList->topic_id, $listId);
            $out .= $listTags ? "<li id='{$thisId}' class='{$listClass}'>" : "<div id='{$thisId}' class='{$listClass}'>";
            $title = $postTip ? "title='{$spThisPostList->post_tip}'" : '';
            if ($aLink) {
                $out .= "<a class='{$linkClass}' {$title} href='{$spThisPostList->post_permalink}'>";
            }
            for ($x = 0; $x < strlen($itemOrder); $x++) {
                switch (substr($itemOrder, $x, 1)) {
                    case 'F':
                        # Forum
                        $out .= $beforeForum;
                        if ($fLink) {
                            $out .= "<a class='{$linkClass}' href='{$spThisPostList->forum_permalink}'>";
                        }
                        $out .= sp_truncate($spThisPostList->forum_name, $truncate);
                        if ($fLink) {
                            $out .= '</a>';
                        }
                        $out .= $afterForum;
                        break;
                    case 'T':
                        # Topic
                        $out .= $beforeTopic;
                        if ($tLink) {
                            $out .= "<a class='{$linkClass}' {$title} href='{$spThisPostList->post_permalink}'>";
                        }
                        $out .= sp_truncate($spThisPostList->topic_name, $truncate);
                        if ($tLink) {
                            $out .= '</a>';
                        }
                        $out .= $afterTopic;
                        break;
                    case 'A':
                        # Avatar
                        $spx = $avatarSize + 10 . 'px';
                        $out .= sp_UserAvatar("tagClass={$avatarClass}&size={$avatarSize}&link=none&context=user&echo=0", $spThisPostList);
                        break;
                    case 'U':
                        # user
                        $out .= "<span class='{$textClass}'>{$spThisPostList->display_name}{$afterUser}</span>";
                        break;
                    case 'D':
                        # date
                        if ($niceDate) {
                            $out .= "<span class='{$textClass}'>" . $beforeDate . sp_nicedate($spThisPostList->post_date) . "{$afterDate}</span>\n";
                        } else {
                            $out .= "<span class='{$textClass}'>" . $beforeDate . sp_date('d', $spThisPostList->post_date) . "{$afterDate}</span>\n";
                        }
                        break;
                    default:
                        # Invalid code
                        $out .= '<br />' . __('Invalid Tag Code Found', 'sp-ttags') . '<br />';
                        break;
                }
            }
            if ($aLink) {
                $out .= '</a>';
            }
            $out .= $listTags ? '</li>' : '</div>';
        }
    }
    $out .= $listTags ? '</ul>' : '</div>';
    $out = apply_filters('sph_UnansweredPostsTag', $out);
    if ($echo) {
        echo $out;
    } else {
        return $out;
    }
}
Ejemplo n.º 2
0
#	Simple:Press Template
#	Theme		:	Default
#	Template	:	list search
#	Author		:	Simple:Press
#
#	The 'list search' template is used to display post content search results
#
# --------------------------------------------------------------------------------------
# Start the 'searchView' section
sp_SectionStart('tagClass=spListSection spPostSearchSection ', 'searchView');
sp_SearchListViewHead();
# Start the List Loop
# ----------------------------------------------------------------------
if (sp_has_postlist()) {
    while (sp_loop_postlist()) {
        sp_the_postlist();
        global $spThisPostList;
        if ($spDevice != 'mobile') {
            sp_SectionStart('tagClass=spPostSearchResultsSection spTextLeft', 'list');
            sp_SectionStart('tagClass=spPostSectionHeader', 'list-header');
            sp_SectionEnd('', 'list-header');
            sp_ColumnStart('tagClass=spColumnSection spPostSearchItemSection spLeft&width=70%&height=100%', 'list-content');
            sp_SearchListViewTopicHeader();
            sp_SearchListViewPostContent();
            sp_ColumnEnd('', 'search-content');
            sp_ColumnStart('tagClass=spColumnSection spPostInfoSection spRight&width=30%&height=100%', 'list-info');
            sp_UserAvatar('tagClass=spPostUserAvatar spLeft&size=40&context=user', $spThisPostList->user_id);
            sp_SearchListViewUserName('tagClass=spPostUserName');
            sp_SearchListViewUserDate('tagClass=spPostUserDate');
            sp_InsertBreak();
            sp_SearchListViewForumName('', __('Forum: ', 'sp-search'));