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


PHP bbp_is_topic_sticky函数代码示例

本文整理汇总了PHP中bbp_is_topic_sticky函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_topic_sticky函数的具体用法?PHP bbp_is_topic_sticky怎么用?PHP bbp_is_topic_sticky使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: firmasite_social_bbp_get_topic_class

function firmasite_social_bbp_get_topic_class($classes, $topic_id)
{
    $bbp = bbpress();
    $count = isset($bbp->topic_query->current_post) ? $bbp->topic_query->current_post : 1;
    if (bbp_is_topic_sticky($topic_id, false)) {
        $classes[] = 'alert alert-warning panel-body';
    } else {
        if (bbp_is_topic_super_sticky($topic_id)) {
            $classes[] = 'alert alert-danger panel-body';
        } else {
            $classes[] = (int) $count % 2 ? 'panel-footer' : 'panel-body';
        }
    }
    $classes[] = "clearfix";
    return $classes;
}
开发者ID:jason-herndon,项目名称:bas-intranet,代码行数:16,代码来源:bbpress.php

示例2: stachestack_bbp_get_form_topic_type_dropdown

/**
 * Returns topic type select box (normal/sticky/super sticky)
 *
 * @since bbPress (r5059)
 *
 * @param $args This function supports these arguments:
 *  - select_id: Select id. Defaults to bbp_stick_topic
 *  - tab: Tabindex
 *  - topic_id: Topic id
 *  - selected: Override the selected option
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_single_topic() To check if we're viewing a single topic
 * @uses bbp_is_topic_edit() To check if it is the topic edit page
 * @uses bbp_is_topic_super_sticky() To check if the topic is a super sticky
 * @uses bbp_is_topic_sticky() To check if the topic is a sticky
 */
function stachestack_bbp_get_form_topic_type_dropdown($args = '')
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('select_id' => 'bbp_stick_topic', 'tab' => bbp_get_tab_index(), 'topic_id' => 0, 'selected' => false), 'topic_type_select');
    // No specific selected value passed
    if (empty($r['selected'])) {
        // Post value is passed
        if (bbp_is_post_request() && isset($_POST[$r['select_id']])) {
            $r['selected'] = $_POST[$r['select_id']];
            // No Post value passed
        } else {
            // Edit topic
            if (bbp_is_single_topic() || bbp_is_topic_edit()) {
                // Get current topic id
                $topic_id = bbp_get_topic_id($r['topic_id']);
                // Topic is super sticky
                if (bbp_is_topic_super_sticky($topic_id)) {
                    $r['selected'] = 'super';
                    // Topic is sticky or normal
                } else {
                    $r['selected'] = bbp_is_topic_sticky($topic_id, false) ? 'stick' : 'unstick';
                }
            }
        }
    }
    // Used variables
    $tab = !empty($r['tab']) ? ' tabindex="' . (int) $r['tab'] . '"' : '';
    // Start an output buffer, we'll finish it after the select loop
    ob_start();
    ?>

		<select class="form-control" name="<?php 
    echo esc_attr($r['select_id']);
    ?>
" id="<?php 
    echo esc_attr($r['select_id']);
    ?>
_select"<?php 
    echo $tab;
    ?>
>

			<?php 
    foreach (bbp_get_topic_types() as $key => $label) {
        ?>

				<option value="<?php 
        echo esc_attr($key);
        ?>
"<?php 
        selected($key, $r['selected']);
        ?>
><?php 
        echo esc_html($label);
        ?>
</option>

			<?php 
    }
    ?>

		</select>

		<?php 
    // Return the results
    return apply_filters('bbp_get_form_topic_type_dropdown', ob_get_clean(), $r);
}
开发者ID:BeardandFedora,项目名称:StacheStack,代码行数:83,代码来源:bbpress.php

示例3: bbp_toggle_topic_handler

/**
 * Handles the front end opening/closing, spamming/unspamming,
 * sticking/unsticking and trashing/untrashing/deleting of topics
 *
 * @since bbPress (r2727)
 *
 * @param string $action The requested action to compare this function to
 * @uses bbp_get_topic() To get the topic
 * @uses current_user_can() To check if the user is capable of editing or
 *                           deleting the topic
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses check_ajax_referer() To verify the nonce and check the referer
 * @uses bbp_is_topic_open() To check if the topic is open
 * @uses bbp_close_topic() To close the topic
 * @uses bbp_open_topic() To open the topic
 * @uses bbp_is_topic_sticky() To check if the topic is a sticky
 * @uses bbp_unstick_topic() To unstick the topic
 * @uses bbp_stick_topic() To stick the topic
 * @uses bbp_is_topic_spam() To check if the topic is marked as spam
 * @uses bbp_spam_topic() To make the topic as spam
 * @uses bbp_unspam_topic() To unmark the topic as spam
 * @uses wp_trash_post() To trash the topic
 * @uses wp_untrash_post() To untrash the topic
 * @uses wp_delete_post() To delete the topic
 * @uses do_action() Calls 'bbp_toggle_topic_handler' with success, post data
 *                    and action
 * @uses bbp_get_forum_permalink() To get the forum link
 * @uses bbp_get_topic_permalink() To get the topic link
 * @uses wp_safe_redirect() To redirect to the topic
 * @uses bbPress::errors:add() To log the error messages
 */
function bbp_toggle_topic_handler($action = '')
{
    // Bail if required GET actions aren't passed
    if (empty($_GET['topic_id'])) {
        return;
    }
    // Setup possible get actions
    $possible_actions = array('bbp_toggle_topic_close', 'bbp_toggle_topic_stick', 'bbp_toggle_topic_spam', 'bbp_toggle_topic_trash');
    // Bail if actions aren't meant for this function
    if (!in_array($action, $possible_actions)) {
        return;
    }
    $failure = '';
    // Empty failure string
    $view_all = false;
    // Assume not viewing all
    $topic_id = (int) $_GET['topic_id'];
    // What's the topic id?
    $success = false;
    // Flag
    $post_data = array('ID' => $topic_id);
    // Prelim array
    $redirect = '';
    // Empty redirect URL
    // Make sure topic exists
    $topic = bbp_get_topic($topic_id);
    if (empty($topic)) {
        return;
    }
    // What is the user doing here?
    if (!current_user_can('edit_topic', $topic->ID) || 'bbp_toggle_topic_trash' === $action && !current_user_can('delete_topic', $topic->ID)) {
        bbp_add_error('bbp_toggle_topic_permission', __('<strong>ERROR:</strong> You do not have the permission to do that.', 'bbpress'));
        return;
    }
    // What action are we trying to perform?
    switch ($action) {
        // Toggle open/close
        case 'bbp_toggle_topic_close':
            check_ajax_referer('close-topic_' . $topic_id);
            $is_open = bbp_is_topic_open($topic_id);
            $success = true === $is_open ? bbp_close_topic($topic_id) : bbp_open_topic($topic_id);
            $failure = true === $is_open ? __('<strong>ERROR</strong>: There was a problem closing the topic.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem opening the topic.', 'bbpress');
            break;
            // Toggle sticky/super-sticky/unstick
        // Toggle sticky/super-sticky/unstick
        case 'bbp_toggle_topic_stick':
            check_ajax_referer('stick-topic_' . $topic_id);
            $is_sticky = bbp_is_topic_sticky($topic_id);
            $is_super = false === $is_sticky && !empty($_GET['super']) && "1" === $_GET['super'] ? true : false;
            $success = true === $is_sticky ? bbp_unstick_topic($topic_id) : bbp_stick_topic($topic_id, $is_super);
            $failure = true === $is_sticky ? __('<strong>ERROR</strong>: There was a problem unsticking the topic.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem sticking the topic.', 'bbpress');
            break;
            // Toggle spam
        // Toggle spam
        case 'bbp_toggle_topic_spam':
            check_ajax_referer('spam-topic_' . $topic_id);
            $is_spam = bbp_is_topic_spam($topic_id);
            $success = true === $is_spam ? bbp_unspam_topic($topic_id) : bbp_spam_topic($topic_id);
            $failure = true === $is_spam ? __('<strong>ERROR</strong>: There was a problem unmarking the topic as spam.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem marking the topic as spam.', 'bbpress');
            $view_all = !$is_spam;
            break;
            // Toggle trash
        // Toggle trash
        case 'bbp_toggle_topic_trash':
            $sub_action = !empty($_GET['sub_action']) && in_array($_GET['sub_action'], array('trash', 'untrash', 'delete')) ? $_GET['sub_action'] : false;
            if (empty($sub_action)) {
                break;
            }
            switch ($sub_action) {
//.........这里部分代码省略.........
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:101,代码来源:functions.php

示例4: aq_display_topic_status

/** 
 * Display Topic Status
 * -------------------------------------------------------------------------------------------*/
function aq_display_topic_status($topic_id = 0)
{
    $topic_id = $topic_id ? $topic_id : bbp_get_topic_id();
    $statuses = array(1, 2, 3);
    $status_id = get_post_meta($topic_id, '_bbps_topic_status', true);
    echo '<div class="aq-topic-status">';
    if (bbp_is_topic_sticky()) {
        echo '<span class="sticky">Sticky</span>';
    } elseif (in_array($status_id, $statuses)) {
        if ($status_id == 1) {
            echo '<span class="not-resolved">Not Resolved</span>';
        }
        if ($status_id == 2) {
            echo '<span class="resolved">Resolved</span>';
        }
        if ($status_id == 3) {
            echo '<span class="in-progress">In Progress</span>';
        }
    } elseif (bbp_is_topic_closed()) {
        echo '<span class="sticky">Sticky</span>';
    } else {
        echo '<span class="in-progress">In Progress</span>';
    }
    echo '</div>';
}
开发者ID:kanawanzx,项目名称:support_forum,代码行数:28,代码来源:bbpress-functions.php

示例5: row_actions

 /**
  * Topic Row actions
  *
  * Remove the quick-edit action link under the topic title and add the
  * content and close/stick/spam links
  *
  * @since 2.0.0 bbPress (r2485)
  *
  * @param array $actions Actions
  * @param array $topic Topic object
  * @uses bbp_get_topic_post_type() To get the topic post type
  * @uses bbp_topic_content() To output topic content
  * @uses bbp_get_topic_permalink() To get the topic link
  * @uses bbp_get_topic_title() To get the topic title
  * @uses current_user_can() To check if the current user can edit or
  *                           delete the topic
  * @uses bbp_is_topic_open() To check if the topic is open
  * @uses bbp_is_topic_spam() To check if the topic is marked as spam
  * @uses bbp_is_topic_sticky() To check if the topic is a sticky or a
  *                              super sticky
  * @uses get_post_type_object() To get the topic post type object
  * @uses add_query_arg() To add custom args to the url
  * @uses remove_query_arg() To remove custom args from the url
  * @uses wp_nonce_url() To nonce the url
  * @uses get_delete_post_link() To get the delete post link of the topic
  * @return array $actions Actions
  */
 public function row_actions($actions, $topic)
 {
     if ($this->bail()) {
         return $actions;
     }
     unset($actions['inline hide-if-no-js']);
     // Show view link if it's not set, the topic is trashed and the user can view trashed topics
     if (empty($actions['view']) && bbp_get_trash_status_id() === $topic->post_status && current_user_can('view_trash')) {
         $actions['view'] = '<a href="' . esc_url(bbp_get_topic_permalink($topic->ID)) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;', 'bbpress'), bbp_get_topic_title($topic->ID))) . '" rel="permalink">' . esc_html__('View', 'bbpress') . '</a>';
     }
     // Only show the actions if the user is capable of viewing them :)
     if (current_user_can('moderate', $topic->ID)) {
         // Pending
         // Show the 'approve' and 'view' link on pending posts only and 'unapprove' on published posts only
         $approve_uri = wp_nonce_url(add_query_arg(array('topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_approve'), remove_query_arg(array('bbp_topic_toggle_notice', 'topic_id', 'failed', 'super'))), 'approve-topic_' . $topic->ID);
         if (bbp_is_topic_published($topic->ID)) {
             $actions['unapproved'] = '<a href="' . esc_url($approve_uri) . '" title="' . esc_attr__('Unapprove this topic', 'bbpress') . '">' . _x('Unapprove', 'Unapprove Topic', 'bbpress') . '</a>';
         } elseif (!bbp_is_topic_private($topic->ID)) {
             $actions['approved'] = '<a href="' . esc_url($approve_uri) . '" title="' . esc_attr__('Approve this topic', 'bbpress') . '">' . _x('Approve', 'Approve Topic', 'bbpress') . '</a>';
             $actions['view'] = '<a href="' . esc_url(bbp_get_topic_permalink($topic->ID)) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;', 'bbpress'), bbp_get_topic_title($topic->ID))) . '" rel="permalink">' . esc_html__('View', 'bbpress') . '</a>';
         }
         // Close
         // Show the 'close' and 'open' link on published and closed posts only
         if (in_array($topic->post_status, array(bbp_get_public_status_id(), bbp_get_closed_status_id()))) {
             $close_uri = wp_nonce_url(add_query_arg(array('topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_close'), remove_query_arg(array('bbp_topic_toggle_notice', 'topic_id', 'failed', 'super'))), 'close-topic_' . $topic->ID);
             if (bbp_is_topic_open($topic->ID)) {
                 $actions['closed'] = '<a href="' . esc_url($close_uri) . '" title="' . esc_attr__('Close this topic', 'bbpress') . '">' . _x('Close', 'Close a Topic', 'bbpress') . '</a>';
             } else {
                 $actions['closed'] = '<a href="' . esc_url($close_uri) . '" title="' . esc_attr__('Open this topic', 'bbpress') . '">' . _x('Open', 'Open a Topic', 'bbpress') . '</a>';
             }
         }
         // Sticky
         // Dont show sticky if topic links is spam, trash or pending
         if (!bbp_is_topic_spam($topic->ID) && !bbp_is_topic_trash($topic->ID) && !bbp_is_topic_pending($topic->ID)) {
             $stick_uri = wp_nonce_url(add_query_arg(array('topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick'), remove_query_arg(array('bbp_topic_toggle_notice', 'topic_id', 'failed', 'super'))), 'stick-topic_' . $topic->ID);
             if (bbp_is_topic_sticky($topic->ID)) {
                 $actions['stick'] = '<a href="' . esc_url($stick_uri) . '" title="' . esc_attr__('Unstick this topic', 'bbpress') . '">' . esc_html__('Unstick', 'bbpress') . '</a>';
             } else {
                 $super_uri = wp_nonce_url(add_query_arg(array('topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick', 'super' => '1'), remove_query_arg(array('bbp_topic_toggle_notice', 'topic_id', 'failed', 'super'))), 'stick-topic_' . $topic->ID);
                 $actions['stick'] = '<a href="' . esc_url($stick_uri) . '" title="' . esc_attr__('Stick this topic to its forum', 'bbpress') . '">' . esc_html__('Stick', 'bbpress') . '</a> <a href="' . esc_url($super_uri) . '" title="' . esc_attr__('Stick this topic to front', 'bbpress') . '">' . esc_html__('(to front)', 'bbpress') . '</a>';
             }
         }
         // Spam
         $spam_uri = wp_nonce_url(add_query_arg(array('topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_spam'), remove_query_arg(array('bbp_topic_toggle_notice', 'topic_id', 'failed', 'super'))), 'spam-topic_' . $topic->ID);
         if (bbp_is_topic_spam($topic->ID)) {
             $actions['spam'] = '<a href="' . esc_url($spam_uri) . '" title="' . esc_attr__('Mark the topic as not spam', 'bbpress') . '">' . esc_html__('Not spam', 'bbpress') . '</a>';
         } else {
             $actions['spam'] = '<a href="' . esc_url($spam_uri) . '" title="' . esc_attr__('Mark this topic as spam', 'bbpress') . '">' . esc_html__('Spam', 'bbpress') . '</a>';
         }
     }
     // Do not show trash links for spam topics, or spam links for trashed topics
     if (current_user_can('delete_topic', $topic->ID)) {
         if (bbp_get_trash_status_id() === $topic->post_status) {
             $post_type_object = get_post_type_object(bbp_get_topic_post_type());
             $actions['untrash'] = "<a title='" . esc_attr__('Restore this item from the Trash', 'bbpress') . "' href='" . wp_nonce_url(add_query_arg(array('_wp_http_referer' => add_query_arg(array('post_type' => bbp_get_topic_post_type()), admin_url('edit.php'))), admin_url(sprintf($post_type_object->_edit_link . '&amp;action=untrash', $topic->ID))), 'untrash-' . $topic->post_type . '_' . $topic->ID) . "'>" . esc_html__('Restore', 'bbpress') . "</a>";
         } elseif (EMPTY_TRASH_DAYS) {
             $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__('Move this item to the Trash', 'bbpress') . "' href='" . esc_url(add_query_arg(array('_wp_http_referer' => add_query_arg(array('post_type' => bbp_get_topic_post_type()), admin_url('edit.php'))), get_delete_post_link($topic->ID))) . "'>" . esc_html__('Trash', 'bbpress') . "</a>";
         }
         if (bbp_get_trash_status_id() === $topic->post_status || !EMPTY_TRASH_DAYS) {
             $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__('Delete this item permanently', 'bbpress') . "' href='" . esc_url(add_query_arg(array('_wp_http_referer' => add_query_arg(array('post_type' => bbp_get_topic_post_type()), admin_url('edit.php'))), get_delete_post_link($topic->ID, '', true))) . "'>" . esc_html__('Delete Permanently', 'bbpress') . "</a>";
         } elseif (bbp_get_spam_status_id() === $topic->post_status) {
             unset($actions['trash']);
         }
     }
     return $actions;
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:93,代码来源:topics.php

示例6: bbp_toggle_topic

/**
 * Do the actual topic toggling
 *
 * This function is used by `bbp_toggle_topic_handler()` to do the actual heavy
 * lifting when it comes to toggling topic. It only really makes sense to call
 * within that context, so if you need to call this function directly, make sure
 * you're also doing what the handler does too.
 *
 * @since 2.6.0  bbPress (r6133)
 * @access private
 *
 * @param array $args
 */
function bbp_toggle_topic($args = array())
{
    // Parse the arguments
    $r = bbp_parse_args($args, array('id' => 0, 'action' => '', 'sub_action' => '', 'data' => array()));
    // Build the nonce suffix
    $nonce_suffix = bbp_get_topic_post_type() . '_' . (int) $r['id'];
    // Default return values
    $retval = array('status' => 0, 'message' => '', 'redirect_to' => bbp_get_topic_permalink($r['id'], bbp_get_redirect_to()), 'view_all' => false);
    // What action are we trying to perform?
    switch ($r['action']) {
        // Toggle approve/unapprove
        case 'bbp_toggle_topic_approve':
            check_ajax_referer("approve-{$nonce_suffix}");
            $is_pending = bbp_is_topic_pending($r['id']);
            $retval['view_all'] = !$is_pending;
            // Toggle
            $retval['status'] = true === $is_pending ? bbp_approve_topic($r['id']) : bbp_unapprove_topic($r['id']);
            // Feedback
            $retval['message'] = true === $is_pending ? __('<strong>ERROR</strong>: There was a problem approving the topic.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem unapproving the topic.', 'bbpress');
            break;
            // Toggle open/close
        // Toggle open/close
        case 'bbp_toggle_topic_close':
            check_ajax_referer("close-{$nonce_suffix}");
            $is_open = bbp_is_topic_open($r['id']);
            // Toggle
            $retval['status'] = true === $is_open ? bbp_close_topic($r['id']) : bbp_open_topic($r['id']);
            // Feedback
            $retval['message'] = true === $is_open ? __('<strong>ERROR</strong>: There was a problem closing the topic.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem opening the topic.', 'bbpress');
            break;
            // Toggle sticky/super-sticky/unstick
        // Toggle sticky/super-sticky/unstick
        case 'bbp_toggle_topic_stick':
            check_ajax_referer("stick-{$nonce_suffix}");
            $is_sticky = bbp_is_topic_sticky($r['id']);
            $is_super = false === $is_sticky && !empty($_GET['super']) && "1" === $_GET['super'] ? true : false;
            // Toggle
            $retval['status'] = true === $is_sticky ? bbp_unstick_topic($r['id']) : bbp_stick_topic($r['id'], $is_super);
            // Feedback
            $retval['message'] = true === $is_sticky ? __('<strong>ERROR</strong>: There was a problem unsticking the topic.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem sticking the topic.', 'bbpress');
            break;
            // Toggle spam
        // Toggle spam
        case 'bbp_toggle_topic_spam':
            check_ajax_referer("spam-{$nonce_suffix}");
            $is_spam = bbp_is_topic_spam($r['id']);
            $retval['view_all'] = !$is_spam;
            // Toggle
            $retval['status'] = true === $is_spam ? bbp_unspam_topic($r['id']) : bbp_spam_topic($r['id']);
            // Feedback
            $retval['message'] = true === $is_spam ? __('<strong>ERROR</strong>: There was a problem unmarking the topic as spam.', 'bbpress') : __('<strong>ERROR</strong>: There was a problem marking the topic as spam.', 'bbpress');
            break;
            // Toggle trash
        // Toggle trash
        case 'bbp_toggle_topic_trash':
            switch ($r['sub_action']) {
                case 'trash':
                    check_ajax_referer("trash-{$nonce_suffix}");
                    $retval['view_all'] = true;
                    $retval['status'] = wp_trash_post($r['id']);
                    $retval['message'] = __('<strong>ERROR</strong>: There was a problem trashing the topic.', 'bbpress');
                    break;
                case 'untrash':
                    check_ajax_referer("untrash-{$nonce_suffix}");
                    $retval['status'] = wp_untrash_post($r['id']);
                    $retval['message'] = __('<strong>ERROR</strong>: There was a problem untrashing the topic.', 'bbpress');
                    break;
                case 'delete':
                    check_ajax_referer("delete-{$nonce_suffix}");
                    $retval['status'] = wp_delete_post($r['id']);
                    $retval['message'] = __('<strong>ERROR</strong>: There was a problem deleting the topic.', 'bbpress');
                    break;
            }
            break;
    }
    // Maybe redirect back to the topic's forum
    if (isset($r['sub_action']) && 'delete' === $r['sub_action']) {
        $retval['redirect_to'] = bbp_get_forum_permalink($retval['status']->post_parent);
    }
    // Add view all if needed
    if (!empty($retval['view_all'])) {
        $retval['redirect_to'] = bbp_add_view_all($retval['redirect_to'], true);
    }
    // Filter & return
    return apply_filters('bbp_toggle_topic', $retval, $r, $args);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:99,代码来源:functions.php

示例7: bbp_topic_type_select

/**
 * Displays topic type select box (normal/sticky/super sticky)
 *
 * @since bbPress (r2784)
 *
 * @param $args This function supports these arguments:
 *  - stick_text: Sticky text
 *  - super_text: Super Sticky text
 *  - unstick_text: Unstick (normal) text
 *  - select_id: Select id. Defaults to bbp_stick_topic
 *  - tab: Tabindex
 *  - topic_id: Topic id
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_single_topic() To check if we're viewing a single topic
 * @uses bbp_is_topic_edit() To check if it is the topic edit page
 * @uses bbp_is_topic_super_sticky() To check if the topic is a super sticky
 * @uses bbp_is_topic_sticky() To check if the topic is a sticky
 */
function bbp_topic_type_select($args = '')
{
    $defaults = array('unstick_text' => __('Normal', 'bbpress'), 'stick_text' => __('Sticky', 'bbpress'), 'super_text' => __('Super Sticky', 'bbpress'), 'select_id' => 'bbp_stick_topic', 'tab' => bbp_get_tab_index(), 'topic_id' => 0);
    $r = bbp_parse_args($args, $defaults, 'topic_type_select');
    extract($r);
    // Edit topic
    if (bbp_is_single_topic() || bbp_is_topic_edit()) {
        // Get current topic id
        $topic_id = bbp_get_topic_id($topic_id);
        // Post value is passed
        if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && isset($_POST[$select_id])) {
            $sticky_current = $_POST[$select_id];
            // Topic is super sticky
        } elseif (bbp_is_topic_super_sticky($topic_id)) {
            $sticky_current = 'super';
            // Topic is sticky or normal
        } else {
            $sticky_current = bbp_is_topic_sticky($topic_id, false) ? 'stick' : 'unstick';
        }
        // New topic
    } else {
        // Post value is passed
        if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && isset($_POST[$select_id])) {
            $sticky_current = $_POST[$select_id];
            // Default to unstick
        } else {
            $sticky_current = 'unstick';
        }
    }
    // Used variables
    $tab = !empty($tab) ? ' tabindex="' . $tab . '"' : '';
    $select_id = esc_attr($select_id);
    $sticky_statuses = array('unstick' => $unstick_text, 'stick' => $stick_text, 'super' => $super_text);
    ?>

	<select name="<?php 
    echo $select_id;
    ?>
" id="<?php 
    echo $select_id;
    ?>
"<?php 
    echo $tab;
    ?>
>

		<?php 
    foreach ($sticky_statuses as $sticky_status => $label) {
        ?>

			<option value="<?php 
        echo $sticky_status;
        ?>
"<?php 
        selected($sticky_current, $sticky_status);
        ?>
><?php 
        echo $label;
        ?>
</option>

		<?php 
    }
    ?>

	</select>

	<?php 
}
开发者ID:rmccue,项目名称:bbPress,代码行数:87,代码来源:bbp-topic-template.php

示例8: apoc_topic_header_class

function apoc_topic_header_class($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    // Generate some classes
    $classes = array();
    $classes[] = 'page-header-' . rand(1, 6);
    $classes[] = bbp_is_topic_sticky($topic_id, false) ? 'sticky' : '';
    $classes[] = bbp_is_topic_super_sticky($topic_id) ? 'super-sticky' : '';
    $classes[] = 'status-' . get_post_status($topic_id);
    // Output it
    echo join(' ', $classes);
}
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:12,代码来源:bbpress.php

示例9: bbp_topic_id

 *
 * @package bbPress
 * @subpackage Theme
 */
?>
<li class="list-group-item bbp-body bbp-topic-list-group-item">
	<ul id="bbp-topic-<?php 
bbp_topic_id();
?>
" <?php 
bbp_topic_class();
?>
>
		<li class="bbp-topic-title">
			<?php 
if (bbp_is_topic_sticky() || bbp_is_topic_super_sticky()) {
    ?>
			<span class="pull-left bbp-sticky-icon bbp-topic-icon text-muted">
				<span class="glyphicon ipt-icon-pushpin"></span>
			</span>
			<?php 
} elseif (bbp_is_topic_closed()) {
    ?>
			<span class="pull-left bbp-sticky-icon bbp-topic-icon text-muted">
				<span class="glyphicon ipt-icon-bubbles3"></span>
			</span>
			<?php 
} else {
    ?>
			<span class="pull-left bbp-sticky-icon bbp-topic-icon text-muted">
				<span class="glyphicon ipt-icon-bubbles4"></span>
开发者ID:sleepystephen,项目名称:ipt-knowledgebase-theme-wp,代码行数:31,代码来源:loop-single-topic.php


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