コード例 #1
0
ファイル: spListViewMobile.php プロジェクト: bself/nuimage-wp
#	Theme		:	Barebones
#	Template	:	list (simplified topic listing)
#	Author		:	Simple:Press
#	Version		:	1.0
#
#	The 'list' template is used to display a simplified Topic Listing
#
# --------------------------------------------------------------------------------------
# Start the 'listView' section
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spListSection spListViewSection', 'listView');
sp_ListViewHead();
# Start the List Loop
# ----------------------------------------------------------------------
if (sp_has_list()) {
    while (sp_loop_list()) {
        sp_the_list();
        # Start the 'list' section
        # ----------------------------------------------------------------------
        sp_ListViewBodyStart();
        sp_SectionStart('tagClass=spTopicListSection spTextLeft', 'list');
        sp_ListForumName('', __sp('Browse topics in %NAME%'), __sp('New and Unread Posts'));
        sp_InsertBreak();
        sp_ColumnStart('tagClass=spColumnSection spLeft&width=auto&height=auto');
        sp_ListTopicName('tagClass=spLeft', __sp('Browse the thread %NAME%'));
        sp_InsertBreak('');
        sp_ListLastPost('tagClass=spLeft&height=0px&break=0&icon=', __sp(''));
        sp_ColumnEnd();
        sp_ListViewBodyEnd();
        sp_InsertBreak();
        sp_SectionEnd('', 'list');
コード例 #2
0
function sp_do_sp_RecentPostsTag($args = '')
{
    #check if forum displayed
    if (sp_abort_display_forum()) {
        return;
    }
    $defs = array('tagId' => 'spRecentPostsTag', 'tagClass' => 'spListTag', 'listId' => 'spListItemTag%ID%', 'listClass' => 'spListItemTag', 'linkClass' => 'spLinkTag', 'textClass' => 'spTextTag', 'avatarClass' => 'spAvatarTag', 'listTags' => 1, 'forumIds' => 0, 'topicIds' => 0, 'orderByGroup' => 0, '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_RecentPostsTag_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);
    $topicIds = esc_attr($topicIds);
    $orderByGroup = (int) $orderByGroup;
    $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 $spListView, $spThisListTopic;
    # do we have forum ids specified?
    if ($forumIds ? $forumIds = explode(',', $forumIds) : ($forumIds = '')) {
    }
    # do we have topic ids specified?
    if ($topicIds ? $topicIds = explode(',', $topicIds) : ($topicIds = '')) {
    }
    $spListView = new spTopicList($topicIds, $limit, $orderByGroup, $forumIds);
    if (empty($spListView)) {
        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
    if ($listTags ? $out = "<ul id='{$tagId}' class='{$tagClass}'>" : ($out = "<div id='{$tagId}' class='{$tagClass}'>")) {
    }
    # start the loop
    if (sp_has_list()) {
        while (sp_loop_list()) {
            sp_the_list();
            $thisId = str_ireplace('%ID%', $spThisListTopic->topic_id, $listId);
            $out .= $listTags ? "<li id='{$thisId}' class='{$listClass}'>" : "<div id='{$thisId}' class='{$listClass}'>";
            $title = $postTip ? "title='{$spThisListTopic->post_tip}'" : '';
            if ($aLink) {
                $out .= "<a class='{$linkClass}' {$title} href='{$spThisListTopic->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='{$spThisListTopic->forum_permalink}'>";
                        }
                        $out .= sp_truncate($spThisListTopic->forum_name, $truncate);
                        if ($fLink) {
                            $out .= '</a>';
                        }
                        $out .= $afterForum;
                        break;
                    case 'T':
                        # Topic
                        $out .= $beforeTopic;
                        if ($tLink) {
                            $out .= "<a class='{$linkClass}' {$title} href='{$spThisListTopic->post_permalink}'>";
                        }
                        $out .= sp_truncate($spThisListTopic->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", $spThisListTopic->user_id);
                        break;
                    case 'U':
                        # user
                        $out .= "<span class='{$textClass}'>{$beforeUser}{$spThisListTopic->display_name}{$afterUser}</span>";
                        break;
                    case 'D':
                        # date
                        if ($niceDate) {
                            $out .= "<span class='{$textClass}'>" . $beforeDate . sp_nicedate($spThisListTopic->post_date) . "{$afterDate}</span>\n";
                        } else {
                            $out .= "<span class='{$textClass}'>" . $beforeDate . sp_date('d', $spThisListTopic->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_RecentPostsTag', $out);
    if ($echo) {
        echo $out;
    } else {
        return $out;
    }
}