Example #1
0
function topic_icons_label($label)
{
    global $topic;
    if (bb_is_front() || bb_is_forum() || bb_is_view() || bb_is_tag()) {
        $icon_set_name = topic_icons_get_active_icon_set();
        $icon_set_url = ICON_SET_URL_BASE . $icon_set_name;
        $status = get_active_status_interpreter()->getStatus(bb_get_location(), $topic);
        $renderer = get_active_status_renderer();
        $image = $renderer->renderStatus($status);
        $tooltip = $renderer->renderStatusTooltip($status);
        $exists = file_exists(dirname(__FILE__) . '/icon-sets/' . $icon_set_name . '/' . $image);
        if (!$exists) {
            return sprintf(__('<div class="topic-icon-image"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s" border="0"></a></div> %s'), get_topic_link($topic->topic_id), ICON_SET_URL_BASE . '/empty.png', ICON_WIDTH, ICON_HEIGHT, $tooltip, $label);
        } else {
            if (strlen($tooltip) > 0) {
                return sprintf(__('<div class="topic-icon-image"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s" border="0"><span>%s</span></a></div> %s'), get_topic_link($topic->topic_id), $icon_set_url . '/' . $image, ICON_WIDTH, ICON_HEIGHT, $tooltip, $tooltip, $label);
            } else {
                return sprintf(__('<div class="topic-icon-image"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s" border="0"></a></div> %s'), get_topic_link($topic->topic_id), $icon_set_url . '/' . $image, ICON_WIDTH, ICON_HEIGHT, $tooltip, $label);
            }
        }
    }
    return $label;
}
function get_sticky_topics($forum = false, $display = 1)
{
    if (1 != $display) {
        // Why is this even here?
        return false;
    }
    $q = array('forum_id' => $forum, 'sticky' => bb_is_front() ? 'super' : 'sticky');
    $query = new BB_Query('topic', $q, 'get_sticky_topics');
    return $query->results;
}
function is_front()
{
    bb_log_deprecated('function', __FUNCTION__, 'bb_is_front');
    return bb_is_front();
}
/**
 * bb_get_new_topic_link() - Get the link to the form for a new topic
 *
 * @since 1.0
 * @param mixed The arguments for this function.
 * @return string The link to the new topic form
 */
function bb_get_new_topic_link($args = null)
{
    $defaults = array('text' => __('Add New &raquo;'), 'forum' => 0, 'tag' => '');
    if ($args && is_string($args) && false === strpos($args, '=')) {
        $args = array('text' => $args);
    }
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    if ($forum && ($forum = bb_get_forum($forum))) {
        $url = get_forum_link($forum->forum_id) . '#postform';
    } elseif ($tag && ($tag = bb_get_tag($tag))) {
        $url = bb_get_tag_link($tag->tag) . '#postform';
    } elseif (bb_is_forum()) {
        global $forum;
        $url = get_forum_link($forum->forum_id) . '#postform';
    } elseif (bb_is_tag()) {
        global $tag;
        $url = bb_get_tag_link($tag) . '#postform';
    } elseif (bb_is_topic()) {
        $url = get_forum_link() . '#postform';
    } elseif (bb_is_front()) {
        $url = bb_get_uri(null, array('new' => 1));
    }
    if (!bb_is_user_logged_in()) {
        $url = bb_get_uri('bb-login.php', array('re' => $url), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS);
    } elseif (bb_is_forum() || bb_is_topic()) {
        if (!bb_current_user_can('write_topic', get_forum_id())) {
            return;
        }
    } else {
        if (!bb_current_user_can('write_topics')) {
            return;
        }
    }
    if ($url = esc_attr(apply_filters('new_topic_url', $url, $args))) {
        return '<a href="' . $url . '" class="new-topic">' . $text . '</a>' . "\n";
    }
}
Example #5
0
?>
		<textarea name="post_content" cols="50" rows="8" id="post_content" tabindex="3"></textarea>
	</label>
</p>
<p id="post-form-tags-container">
	<label for="tags-input"><?php 
printf(__('Tags (comma seperated)'), bb_get_tag_page_link());
?>
		<input id="tags-input" name="tags" type="text" size="50" maxlength="100" value="<?php 
bb_tag_name();
?>
" tabindex="4" />
	</label>
</p>
<?php 
if (bb_is_tag() || bb_is_front()) {
    ?>
<p id="post-form-forum-container">
	<label for="forum-id"><?php 
    _e('Forum');
    ?>
		<?php 
    bb_new_topic_forum_dropdown();
    ?>
	</label>
</p>
<?php 
}
?>
<p id="post-form-submit-container" class="submit">
  <input type="submit" id="postformsub" name="Submit" value="<?php 
function bb_sticky_label($label)
{
    global $topic;
    if (bb_is_front()) {
        if ('2' === $topic->topic_sticky) {
            return sprintf(__('[sticky] %s'), $label);
        }
    } else {
        if ('1' === $topic->topic_sticky || '2' === $topic->topic_sticky) {
            return sprintf(__('[sticky] %s'), $label);
        }
    }
    return $label;
}