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_latest_topics($args = null) { $defaults = array('forum' => false, 'page' => 1, 'exclude' => false, 'number' => false); if (is_numeric($args)) { $args = array('forum' => $args); } else { $args = wp_parse_args($args); } // Make sure it's an array if (1 < func_num_args()) { $args['page'] = func_get_arg(1); } if (2 < func_num_args()) { $args['exclude'] = func_get_arg(2); } $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); if ($exclude) { $exclude = '-' . str_replace(',', ',-', $exclude); $exclude = str_replace('--', '-', $exclude); if ($forum) { $forum = (string) $forum . ",{$exclude}"; } else { $forum = $exclude; } } $q = array('forum_id' => $forum, 'page' => $page, 'per_page' => $number, 'index_hint' => 'USE INDEX (`forum_time`)'); if (bb_is_front()) { $q['sticky'] = '-2'; } elseif (bb_is_forum() || bb_is_view()) { $q['sticky'] = 0; } // Last param makes filters back compat $query = new BB_Query('topic', $q, 'get_latest_topics'); return $query->results; }
function is_view() { bb_log_deprecated('function', __FUNCTION__, 'bb_is_view'); return bb_is_view(); }
function topic_class($class = '', $key = 'topic', $id = 0) { $topic = get_topic(get_topic_id($id)); $class = $class ? explode(' ', $class) : array(); if ('1' === $topic->topic_status && bb_current_user_can('browse_deleted')) { $class[] = 'deleted'; } elseif (1 < $topic->topic_status && bb_current_user_can('browse_deleted')) { $class[] = 'bozo'; } if ('0' === $topic->topic_open) { $class[] = 'closed'; } if (1 == $topic->topic_sticky && (bb_is_forum() || bb_is_view())) { $class[] = 'sticky'; } elseif (2 == $topic->topic_sticky && (bb_is_front() || bb_is_forum())) { $class[] = 'sticky super-sticky'; } $class = apply_filters('topic_class', $class, $topic->topic_id); $class = join(' ', $class); alt_class($key, $class); }