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


PHP bb_get_forums函数代码示例

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


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

示例1: bb_get_forums_hierarchical

function bb_get_forums_hierarchical($root = 0, $depth = 0, $leaves = false, $_recursed = false)
{
    static $_leaves = false;
    if (!$_recursed) {
        $_leaves = false;
    }
    $root = (int) $root;
    if (false === $_leaves) {
        $_leaves = $leaves ? $leaves : bb_get_forums();
    }
    if (!$_leaves) {
        return false;
    }
    $branch = array();
    reset($_leaves);
    while (list($l, $leaf) = each($_leaves)) {
        if ($root == $leaf->forum_parent) {
            $new_root = (int) $leaf->forum_id;
            unset($_leaves[$l]);
            $branch[$new_root] = 1 == $depth ? true : bb_get_forums_hierarchical($new_root, $depth - 1, false, true);
            reset($_leaves);
        }
    }
    if (!$_recursed) {
        if (!$root) {
            foreach ($_leaves as $leaf) {
                // Attach orphans to root
                $branch[$leaf->forum_id] = true;
            }
        }
        $_leaves = false;
        return empty($branch) ? false : $branch;
    }
    return $branch ? $branch : true;
}
开发者ID:laiello,项目名称:cartonbank,代码行数:35,代码来源:functions.bb-forums.php

示例2: bb_is_installed

/**
 * Reports whether bbPress is installed by getting forums.
 *
 * @return boolean True if there are forums, otherwise false.
 */
function bb_is_installed()
{
    // Maybe grab all the forums and cache them
    global $bbdb;
    $bbdb->suppress_errors();
    $forums = (array) @bb_get_forums();
    $bbdb->suppress_errors(false);
    if (!$forums) {
        return false;
    }
    return true;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:17,代码来源:functions.bb-core.php

示例3: bb_repermalink

<?php

require './bb-load.php';
bb_repermalink();
$bb_db_override = false;
do_action('bb_index.php_pre_db');
if (isset($_GET['new']) && '1' == $_GET['new']) {
    $forums = false;
} elseif (!$bb_db_override) {
    $forums = bb_get_forums();
    // Comment to hide forums
    if ($topics = get_latest_topics(false, $page)) {
        bb_cache_last_posts($topics);
    }
    if ($super_stickies = get_sticky_topics()) {
        bb_cache_last_posts($super_stickies);
    }
}
bb_load_template('front-page.php', array('bb_db_override', 'super_stickies'));
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:19,代码来源:index.php

示例4: switch

switch ($_POST['action']) {
    case 'add':
        if (!isset($_POST['forum_name']) || '' === $_POST['forum_name']) {
            bb_die(__('Bad forum name.  Go back and try again.'));
        }
        bb_check_admin_referer('add-forum');
        if (false !== bb_new_forum($_POST)) {
            bb_safe_redirect($sent_from);
            exit;
        } else {
            bb_die(__('The forum was not added'));
        }
        break;
    case 'update':
        bb_check_admin_referer('update-forum');
        if (!($forums = bb_get_forums())) {
            bb_die(__('No forums to update!'));
        }
        if ((int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name']) {
            bb_update_forum($_POST);
        }
        foreach (array('action', 'id') as $arg) {
            $sent_from = remove_query_arg($arg, $sent_from);
        }
        bb_safe_redirect(add_query_arg('message', 'updated', $sent_from));
        exit;
        break;
    case 'delete':
        bb_check_admin_referer('delete-forums');
        $forum_id = (int) $_POST['forum_id'];
        $move_topics_forum = (int) $_POST['move_topics_forum'];
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:bb-forum.php

示例5: bb_getTopicCount

 /**
  * Returns a numerical count of topics
  *
  * @since 1.0
  * @return integer|object The number of topics when successfully executed or an IXR_Error object on failure
  * @param array $args Arguments passed by the XML-RPC call
  * @param string $args[0] The username for authentication
  * @param string $args[1] The password for authentication
  * @param integer|string $args[2] The forum id or slug (optional)
  *
  * XML-RPC request to get a count of all topics in the bbPress instance
  * <methodCall>
  *     <methodName>bb.getTopicCount</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *     </params>
  * </methodCall>
  *
  * XML-RPC request to get a count of all topics in the forum with id number 34
  * <methodCall>
  *     <methodName>bb.getTopicCount</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><int>34</int></value></param>
  *     </params>
  * </methodCall>
  *
  * XML-RPC request to get a count of all topics in the forum with slug "first-forum"
  * <methodCall>
  *     <methodName>bb.getTopicCount</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><string>first-forum</string></value></param>
  *     </params>
  * </methodCall>
  */
 function bb_getTopicCount($args)
 {
     do_action('bb_xmlrpc_call', 'bb.getTopicCount');
     // Escape args
     $this->escape($args);
     // Get the login credentials
     $username = $args[0];
     $password = (string) $args[1];
     // Check the user is valid
     if ($this->auth_readonly) {
         $user = $this->authenticate($username, $password);
     }
     do_action('bb_xmlrpc_call_authenticated', 'bb.getTopicCount');
     // If an error was raised by authentication or by an action then return it
     if ($this->error) {
         return $this->error;
     }
     // Can be numeric id or slug
     if (isset($args[2]) && ($forum_id = $args[2])) {
         // Check for bad data
         if (!is_string($forum_id) && !is_integer($forum_id)) {
             $this->error = new IXR_Error(400, __('The forum id is invalid.'));
             return $this->error;
         }
         // Check the requested forum exists
         if (!($forum = bb_get_forum($forum_id))) {
             $this->error = new IXR_Error(400, __('The forum does not exist.'));
             return $this->error;
         }
         // OK, let's trust the count in the forum table
         $count = (int) $forum->topics;
     } else {
         // Get all forums
         $forums = bb_get_forums();
         // Return an error when no forums exist
         if (!$forums) {
             $this->error = new IXR_Error(400, __('No forums found.'));
             return $this->error;
         }
         // Count the topics
         $count = 0;
         foreach ($forums as $forum) {
             $count += (int) $forum->topics;
         }
     }
     do_action('bb_xmlrpc_call_return', 'bb.getTopicCount');
     // Return the count of topics
     return $count;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:88,代码来源:xmlrpc.php

示例6: get_forums

 function get_forums()
 {
     bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_get_forums');
     return bb_get_forums();
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:5,代码来源:functions.bb-deprecated.php

示例7: array

function &bb_forums($args = '')
{
    global $bb_forums_loop;
    $default_type = 'flat';
    if (is_numeric($args)) {
        $args = array('child_of' => $args);
    } elseif (func_num_args() > 1) {
        // bb_forums( 'ul', $args ); Deprecated
        $default_type = $args;
        $args = func_get_arg(1);
    } elseif ($args && is_string($args) && false === strpos($args, '=')) {
        $args = array('type' => $args);
    }
    // hierarchical not used here.  Sent to bb_get_forums for proper ordering.
    $args = wp_parse_args($args, array('hierarchical' => true, 'type' => $default_type, 'walker' => 'BB_Walker_Blank'));
    $levels = array('', '');
    if (in_array($args['type'], array('list', 'ul'))) {
        $levels = array('<ul>', '</ul>');
    }
    $forums = bb_get_forums($args);
    if (!class_exists($args['walker'])) {
        $args['walker'] = 'BB_Walker_Blank';
    }
    if ($bb_forums_loop = BB_Loop::start($forums, $args['walker'])) {
        $bb_forums_loop->preserve(array('forum', 'forum_id'));
        $bb_forums_loop->walker->db_fields = array('id' => 'forum_id', 'parent' => 'forum_parent');
        list($bb_forums_loop->walker->start_lvl, $bb_forums_loop->walker->end_lvl) = $levels;
        return $bb_forums_loop->elements;
    }
    $false = false;
    return $false;
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:32,代码来源:functions.bb-template.php

示例8: bb_export

function bb_export()
{
    global $bb;
    define('BB_EXPORTING', true);
    do_action('bb_pre_export');
    $bb->use_cache = false;
    // Turn off hard cache
    $bb->page_topics = 100;
    echo "<forums-data version='0.75'>\n";
    if (BB_EXPORT_LEVEL & BB_EXPORT_USERS) {
        $page = 1;
        while (($users = bb_user_search(array('page' => $page++))) && !is_nxt_error($users)) {
            foreach ($users as $user) {
                echo bb_export_user($user->ID);
            }
        }
        unset($users, $user, $page);
    }
    if (BB_EXPORT_LEVEL & BB_EXPORT_FORUMS) {
        $forums = bb_get_forums();
        foreach ($forums as $forum) {
            echo bb_export_forum($forum->forum_id);
        }
        unset($forums, $forum);
    }
    if (BB_EXPORT_LEVEL & BB_EXPORT_TOPICS) {
        $page = 1;
        while ($topics = get_latest_topics(0, $page++)) {
            foreach ($topics as $topic) {
                echo bb_export_topic($topic->topic_id);
            }
        }
        unset($topics, $topic, $page);
    }
    do_action('bb_export');
    echo '</forums-data>';
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:37,代码来源:export.php

示例9: WP_Ajax_Response

         $position = 1;
     }
     $x = new WP_Ajax_Response(array('what' => 'forum', 'id' => $forum_id, 'data' => $data, 'position' => $position, 'supplemental' => array('name' => $forum->forum_name)));
     $x->send();
     break;
 case 'order-forums':
     if (!bb_current_user_can('manage_forums')) {
         die('-1');
     }
     bb_check_ajax_referer($action);
     if (!is_array($_POST['order'])) {
         die('0');
     }
     global $bbdb;
     $forums = array();
     bb_get_forums();
     // cache
     foreach ($_POST['order'] as $pos => $forum_id) {
         $forum = $bbdb->escape_deep(get_object_vars(bb_get_forum($forum_id)));
         $forum['forum_order'] = $pos;
         $forums[(int) $forum_id] = $forum;
     }
     foreach ($_POST['root'] as $root => $ids) {
         foreach ($ids as $forum_id) {
             $forums[(int) $forum_id]['forum_parent'] = (int) $root;
         }
     }
     foreach ($forums as $forum) {
         bb_update_forum($forum);
     }
     die('1');
开发者ID:laiello,项目名称:cartonbank,代码行数:31,代码来源:admin-ajax.php


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