• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_BlogCache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: uninstall_b2evolution

/**
 * Uninstall b2evolution: Delete DB & Cache files
 */
function uninstall_b2evolution()
{
    global $DB;
    /* REMOVE PAGE CACHE */
    load_class('_core/model/_pagecache.class.php', 'PageCache');
    // Remove general page cache
    $PageCache = new PageCache(NULL);
    $PageCache->cache_delete();
    // Skip if T_blogs table is already deleted. Note that db_delete() will not throw any errors on missing tables.
    if ($DB->query('SHOW TABLES LIKE "T_blogs"')) {
        // Get all blogs
        $blogs_SQL = new SQL();
        $blogs_SQL->SELECT('blog_ID');
        $blogs_SQL->FROM('T_blogs');
        $blogs = $DB->get_col($blogs_SQL->get());
        $BlogCache =& get_BlogCache('blog_ID');
        foreach ($blogs as $blog_ID) {
            $Blog = $BlogCache->get_by_ID($blog_ID);
            // Remove page cache of current blog
            $PageCache = new PageCache($Blog);
            $PageCache->cache_delete();
        }
    }
    /* REMOVE DATABASE */
    db_delete();
    echo '<p>' . T_('Reset done!') . '</p>';
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:30,代码来源:_functions_delete.php


示例2: get_available_FileRoots

 /**
  * Get an array of ALL available Fileroots (not just the cached ones).
  *
  * @todo fp> it would probably make sense to refactor this as the constructor for the file roots
  * and initialize the whole cache at construction time
  *
  * @param string Special file root ID (Used e.g. to view file root of the special user)
  * @return array of FileRoots (key being the FileRoot's ID)
  */
 static function get_available_FileRoots($special_root_ID = NULL)
 {
     global $current_User;
     global $collections_Module;
     $r = array();
     $FileRootCache =& get_FileRootCache();
     if (!empty($special_root_ID) && ($special_FileRoot =& $FileRootCache->get_by_ID($special_root_ID, true)) && $current_User->check_perm('files', 'edit_allowed', false, $special_FileRoot)) {
         // Try to add special file root if current user has an access
         $r[$special_FileRoot->ID] =& $special_FileRoot;
     }
     // The user's blog (if available) is the default/first one:
     $user_FileRoot =& $FileRootCache->get_by_type_and_ID('user', $current_User->ID, true);
     if ($user_FileRoot) {
         // We got a user media dir:
         $r[$user_FileRoot->ID] =& $user_FileRoot;
     }
     if (isset($collections_Module)) {
         // Blog/collection media dirs:
         $BlogCache =& get_BlogCache();
         $bloglist = $BlogCache->load_user_blogs('blog_media_browse', $current_User->ID);
         foreach ($bloglist as $blog_ID) {
             if ($Root =& $FileRootCache->get_by_type_and_ID('collection', $blog_ID, true)) {
                 $r[$Root->ID] =& $Root;
             }
         }
     }
     // Shared root:
     $shared_FileRoot =& $FileRootCache->get_by_type_and_ID('shared', 0, true);
     if ($shared_FileRoot) {
         // We got a shared dir:
         $r[$shared_FileRoot->ID] =& $shared_FileRoot;
     }
     if (isset($collections_Module)) {
         // Skins root:
         $skins_FileRoot =& $FileRootCache->get_by_type_and_ID('skins', 0, false);
         if ($skins_FileRoot) {
             // We got a skins dir:
             $r[$skins_FileRoot->ID] =& $skins_FileRoot;
         }
     }
     // Import root:
     $import_FileRoot =& $FileRootCache->get_by_type_and_ID('import', 0, true);
     if ($import_FileRoot) {
         // We got an import dir:
         $r[$import_FileRoot->ID] =& $import_FileRoot;
     }
     return $r;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:57,代码来源:_filerootcache.class.php


示例3: get_available_FileRoots

 /**
  * Get an array of ALL available Fileroots (not just the cached ones).
  *
  * @todo fp> it would probably make sense to refactor this as the constructor for the file roots
  * and initialize the whole cache at construction time
  *
  * @static
  *
  * @return array of FileRoots (key being the FileRoot's ID)
  */
 function get_available_FileRoots()
 {
     global $current_User;
     global $collections_Module;
     $r = array();
     // The user's blog (if available) is the default/first one:
     $user_FileRoot =& $this->get_by_type_and_ID('user', $current_User->ID, true);
     if ($user_FileRoot) {
         // We got a user media dir:
         $r[$user_FileRoot->ID] =& $user_FileRoot;
     }
     if (isset($collections_Module)) {
         // Blog/collection media dirs:
         $BlogCache =& get_BlogCache();
         $bloglist = $BlogCache->load_user_blogs('blog_media_browse', $current_User->ID);
         foreach ($bloglist as $blog_ID) {
             if ($Root =& $this->get_by_type_and_ID('collection', $blog_ID, true)) {
                 $r[$Root->ID] =& $Root;
             }
         }
     }
     // Shared root:
     $shared_FileRoot =& $this->get_by_type_and_ID('shared', 0, true);
     if ($shared_FileRoot) {
         // We got a shared dir:
         $r[$shared_FileRoot->ID] =& $shared_FileRoot;
     }
     if (isset($collections_Module)) {
         // Skins root:
         $skins_FileRoot =& $this->get_by_type_and_ID('skins', 0, false);
         if ($skins_FileRoot) {
             // We got a skins dir:
             $r[$skins_FileRoot->ID] =& $skins_FileRoot;
         }
     }
     return $r;
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:47,代码来源:_filerootcache.class.php


示例4: where_visibility

 /**
  * Restrict to the visibility/sharing statuses we want to show
  *
  * @param array Restrict to these statuses
  * @param string What blogs should be used to check the status permissions:
  *               - Empty string to use current blog setting
  *               - A list separated by ','
  *               - Value '*' to use all blogs
  *               - Value '-' to use only current blog without aggregated blog
  */
 function where_visibility($show_statuses, $aggregate_coll_IDs = NULL)
 {
     $this->show_statuses = $show_statuses;
     if (!isset($this->blog)) {
         debug_die('Status restriction requires to work with a specific blog first.');
     }
     if (empty($aggregate_coll_IDs) && !empty($this->blog)) {
         // Blog IDs are not defined, Use them depending on current collection setting
         // NOTE! collection can be 0, for example, on disp=usercomments|useritems where we display data from all collections
         $BlogCache =& get_BlogCache();
         $Blog =& $BlogCache->get_by_ID($this->blog);
         $aggregate_coll_IDs = $Blog->get_setting('aggregate_coll_IDs');
     }
     $blog_IDs = array();
     if (empty($aggregate_coll_IDs) || $aggregate_coll_IDs == '-') {
         // Get status restriction only for current blog
         $this->WHERE_and(statuses_where_clause($show_statuses, $this->dbprefix, $this->blog, 'blog_post!', true, $this->author));
         return;
         // Exit here, because we don't need to check the permissions for multiple blogs
     }
     // Check status permission for multiple blogs
     if ($aggregate_coll_IDs == '*') {
         // Get the status restrictions for all blogs
         global $DB;
         $blog_IDs = $DB->get_col('SELECT blog_ID FROM T_blogs ORDER BY blog_ID');
     } else {
         // Get the status restrictions for several blogs
         $blog_IDs = explode(',', $aggregate_coll_IDs);
     }
     $status_restrictions = array();
     foreach ($blog_IDs as $blog_ID) {
         // Check status permission for each blog separately
         $status_restrictions[] = 'cat_blog_ID=' . $blog_ID . ' AND ' . statuses_where_clause($show_statuses, $this->dbprefix, $blog_ID, 'blog_post!', true, $this->author);
     }
     $this->WHERE_and('( ' . implode(' ) OR ( ', $status_restrictions) . ' )');
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:46,代码来源:_itemquery.class.php


示例5: load_by_categories

    /**
     * Load items by the given categories or collection ID
     * After the Items are loaded create a map of loaded items by categories
     *
     * @param array of category ids
     * @param integer collection ID
     * @return boolean true if load items was required and it was loaded successfully, false otherwise
     */
    function load_by_categories($cat_array, $coll_ID)
    {
        global $DB, $posttypes_specialtypes;
        if (empty($cat_array) && empty($coll_ID)) {
            // Nothing to load
            return false;
        }
        // In case of an empty cat_array param, use categoriesfrom the given collection
        if (empty($cat_array)) {
            // Get all categories from the given subset
            $ChapterCache =& get_ChapterCache();
            $subset_chapters = $ChapterCache->get_chapters_by_subset($coll_ID);
            $cat_array = array();
            foreach ($subset_chapters as $Chapter) {
                $cat_array[] = $Chapter->ID;
            }
        }
        // Check which category is not loaded
        $not_loaded_cat_ids = array();
        foreach ($cat_array as $cat_ID) {
            if (!isset($this->items_by_cat_map[$cat_ID])) {
                // This category is not loaded
                $not_loaded_cat_ids[] = $cat_ID;
                // Initialize items_by_cat_map for this cat_ID
                $this->items_by_cat_map[$cat_ID] = array('items' => array(), 'sorted' => false);
            }
        }
        if (empty($not_loaded_cat_ids)) {
            // Requested categories items are all loaded
            return false;
        }
        // Query to load all Items from the given categories
        $sql = 'SELECT postcat_cat_ID as cat_ID, postcat_post_ID as post_ID FROM T_postcats
					WHERE postcat_cat_ID IN ( ' . implode(', ', $not_loaded_cat_ids) . ' )
					ORDER BY postcat_post_ID';
        $cat_posts = $DB->get_results($sql, ARRAY_A, 'Get all category post ids pair by category');
        // Initialize $Blog from coll_ID
        $BlogCache =& get_BlogCache();
        $Blog = $BlogCache->get_by_ID($coll_ID);
        $visibility_statuses = is_admin_page() ? get_visibility_statuses('keys', array('trash')) : get_inskin_statuses($coll_ID, 'post');
        // Create ItemQuery for loading visible items
        $ItemQuery = new ItemQuery($this->dbtablename, $this->dbprefix, $this->dbIDname);
        // Set filters what to select
        $ItemQuery->SELECT($this->dbtablename . '.*');
        $ItemQuery->where_chapter2($Blog, $not_loaded_cat_ids, "");
        $ItemQuery->where_visibility($visibility_statuses);
        $ItemQuery->where_datestart(NULL, NULL, NULL, NULL, $Blog->get_timestamp_min(), $Blog->get_timestamp_max());
        $ItemQuery->where_types('-' . implode(',', $posttypes_specialtypes));
        // Clear previous items from the cache and load by the defined SQL
        $this->clear(true);
        $this->load_by_sql($ItemQuery);
        foreach ($cat_posts as $row) {
            // Iterate through the post - cat pairs and fill the map
            if (empty($this->cache[$row['post_ID']])) {
                // The Item was not loaded because it does not correspond to the defined filters
                continue;
            }
            // Add to the map
            $this->items_by_cat_map[$row['cat_ID']]['items'][] = $this->get_by_ID($row['post_ID']);
        }
    }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:69,代码来源:_itemcache.class.php


示例6: load_Blog

 /**
  * Load the Blog object for the Item, without returning it.
  *
  * This is needed for {@link Results} object callbacks.
  */
 function load_Blog()
 {
     if (is_null($this->Blog)) {
         $BlogCache =& get_BlogCache();
         $this->Blog =& $BlogCache->get_by_ID($this->get_blog_ID());
     }
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:12,代码来源:_itemlight.class.php


示例7: pbm_process_messages


//.........这里部分代码省略.........
        if (!$pbmUser) {
            pbm_msg(sprintf(T_('Authentication failed for user &laquo;%s&raquo;'), htmlspecialchars($user_login)), true);
            rmdir_r($tmpDirMIME);
            continue;
        }
        $pbmUser->get_Group();
        // Load group
        if (!empty($is_cron_mode)) {
            // Assign current User if we are in cron mode. This is needed in order to check user permissions
            global $current_User;
            $current_User = duplicate($pbmUser);
        }
        // Activate User's locale
        locale_activate($pbmUser->get('locale'));
        pbm_msg('<b class="green">Success</b>');
        if ($post_categories = xmlrpc_getpostcategories($content)) {
            $main_cat_ID = array_shift($post_categories);
            $extra_cat_IDs = $post_categories;
            pbm_msg('Extra categories: ' . implode(', ', $extra_cat_IDs));
        } else {
            $main_cat_ID = $Settings->get('eblog_default_category');
            $extra_cat_IDs = array();
        }
        pbm_msg('Main category ID: ' . $main_cat_ID);
        $ChapterCache =& get_ChapterCache();
        $pbmChapter =& $ChapterCache->get_by_ID($main_cat_ID, false, false);
        if (empty($pbmChapter)) {
            pbm_msg(sprintf(T_('Requested category %s does not exist!'), $main_cat_ID), true);
            rmdir_r($tmpDirMIME);
            continue;
        }
        $blog_ID = $pbmChapter->blog_ID;
        pbm_msg('Blog ID: ' . $blog_ID);
        $BlogCache =& get_BlogCache();
        $pbmBlog =& $BlogCache->get_by_ID($blog_ID, false, false);
        if (empty($pbmBlog)) {
            pbm_msg(sprintf(T_('Requested blog %s does not exist!'), $blog_ID), true);
            rmdir_r($tmpDirMIME);
            continue;
        }
        // Check permission:
        pbm_msg(sprintf('Checking permissions for user &laquo;%s&raquo; to post to Blog #%d', $user_login, $blog_ID));
        if (!$pbmUser->check_perm('blog_post!published', 'edit', false, $blog_ID)) {
            pbm_msg(T_('Permission denied.'), true);
            rmdir_r($tmpDirMIME);
            continue;
        }
        if (($hasAttachment || $hasRelated) && !$pbmUser->check_perm('files', 'add', false, $blog_ID)) {
            pbm_msg(T_('You have no permission to add/upload files.'), true);
            rmdir_r($tmpDirMIME);
            continue;
        }
        pbm_msg('<b class="green">Success</b>');
        // Remove content after terminator
        $eblog_terminator = $Settings->get('eblog_body_terminator');
        if (!empty($eblog_terminator) && ($os_terminator = evo_strpos($content, $eblog_terminator)) !== false) {
            $content = evo_substr($content, 0, $os_terminator);
        }
        $post_title = pbm_get_post_title($content, $subject);
        // Remove 'title' and 'category' tags
        $content = xmlrpc_removepostdata($content);
        // Remove <br> tags from string start and end
        // We do it here because there might be extra <br> left after deletion of <auth>, <category> and <title> tags
        $content = preg_replace(array('~^(\\s*<br[\\s/]*>\\s*){1,}~i', '~(\\s*<br[\\s/]*>\\s*){1,}$~i'), '', $content);
        if ($hasAttachment || $hasRelated) {
            // Handle attachments
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:67,代码来源:_post_by_mail.funcs.php


示例8: upgrade_b2evo_tables


//.........这里部分代码省略.........
        if (count($setting_rows)) {
            // Initialize an array of custom fields from blog settings
            foreach ($setting_rows as $setting_row) {
                if (preg_match('/custom_(double|varchar)\\d+/', $setting_row->cset_name, $matches)) {
                    // It is a custom field
                    if (!isset($custom_fields[$setting_row->cset_coll_ID])) {
                        $custom_fields[$setting_row->cset_coll_ID] = array();
                    }
                    // Delete this blog setting
                    $blog_setting_delete_data[] = 'cset_coll_ID = ' . $DB->quote($setting_row->cset_coll_ID) . ' AND cset_name = ' . $DB->quote($setting_row->cset_name);
                    $cf_type = $matches[1];
                    $cf_key = $setting_row->cset_value;
                    $cf_label = '';
                    $cf_name = '';
                    foreach ($setting_rows as $s_row) {
                        if ($s_row->cset_name == 'custom_' . $cf_type . '_' . $cf_key) {
                            // Label
                            $cf_label = $s_row->cset_value;
                            // Delete this blog setting
                            $blog_setting_delete_data[] = 'cset_coll_ID = ' . $DB->quote($s_row->cset_coll_ID) . ' AND cset_name = ' . $DB->quote($s_row->cset_name);
                        }
                        if ($s_row->cset_name == 'custom_fname_' . $cf_key) {
                            // Name
                            $cf_name = $s_row->cset_value;
                            // Delete this blog setting
                            $blog_setting_delete_data[] = 'cset_coll_ID = ' . $DB->quote($s_row->cset_coll_ID) . ' AND cset_name = ' . $DB->quote($s_row->cset_name);
                        }
                    }
                    $custom_fields[$setting_row->cset_coll_ID][] = array('type' => $cf_type, 'key' => $cf_key, 'label' => $cf_label, 'name' => $cf_name);
                }
            }
            if (count($custom_fields)) {
                // Create post type for each blog with custom fields
                $BlogCache =& get_BlogCache();
                $itypes_insert_data = array();
                $item_type_max_ID = $DB->get_var('SELECT MAX( ityp_ID ) FROM T_items__type') + 1;
                foreach ($custom_fields as $blog_ID => $c_fields) {
                    if (!($cf_Blog = $BlogCache->get_by_ID($blog_ID, false, false))) {
                        // Skip incorrect blog ID
                        continue;
                    }
                    $itypes_insert_data[] = '( ' . $item_type_max_ID . ', ' . $DB->quote('custom_' . $cf_Blog->get('shortname')) . ', ' . '"Posts", ' . '"single", ' . $DB->quote($cf_Blog->get_setting('require_title') == 'none' ? 'never' : $cf_Blog->get_setting('require_title')) . ', ' . $DB->quote(intval($cf_Blog->get_setting('allow_html_post'))) . ', ' . $DB->quote($cf_Blog->get_setting('location_country') == 'hidden' ? 'never' : $cf_Blog->get_setting('location_country')) . ', ' . $DB->quote($cf_Blog->get_setting('location_region') == 'hidden' ? 'never' : $cf_Blog->get_setting('location_region')) . ', ' . $DB->quote($cf_Blog->get_setting('location_subregion') == 'hidden' ? 'never' : $cf_Blog->get_setting('location_subregion')) . ', ' . $DB->quote($cf_Blog->get_setting('location_city') == 'hidden' ? 'never' : $cf_Blog->get_setting('location_city')) . ', ' . $DB->quote($cf_Blog->get_setting('show_location_coordinates') ? 'optional' : 'never') . ', ' . $DB->quote(intval($cf_Blog->get_setting('disable_comments_bypost'))) . ' )';
                    // Update default post type
                    $blog_setting_item_types[$cf_Blog->ID] = $item_type_max_ID;
                    $blog_categories = $DB->get_col('SELECT cat_ID FROM T_categories WHERE cat_blog_ID = ' . $cf_Blog->ID);
                    if (count($blog_categories)) {
                        // Set new post type for each post
                        $DB->query('UPDATE T_items__item SET post_ityp_ID = ' . $item_type_max_ID . '
							WHERE post_ityp_ID = 1
							  AND post_main_cat_ID IN ( ' . implode(', ', $blog_categories) . ' )');
                        if (!empty($posttypes_perms['page'])) {
                            // Find the Pages that have at least one defined custom field:
                            $pages_SQL = new SQL();
                            $pages_SQL->SELECT('post_ID');
                            $pages_SQL->FROM('T_items__item');
                            $pages_SQL->FROM_add('INNER JOIN T_items__item_settings ON post_ID = iset_item_ID');
                            $pages_SQL->WHERE('post_main_cat_ID IN ( ' . implode(', ', $blog_categories) . ' )');
                            $pages_SQL->WHERE_and('post_ityp_ID IN ( ' . implode(', ', $posttypes_perms['page']) . ' )');
                            $pages_SQL->WHERE_and('iset_name LIKE ' . $DB->quote('custom_double_%') . ' OR iset_name LIKE ' . $DB->quote('custom_varchar_%'));
                            $pages_SQL->WHERE_and('iset_value != ""');
                            $pages_SQL->GROUP_BY('post_ID');
                            $pages_IDs = $DB->get_col($pages_SQL->get());
                            $page_type_max_ID = 0;
                            if (count($pages_IDs) > 0) {
                                // We have the Pages that have the defined custom fields
                                // Increase post type ID for new special post type for pages
开发者ID:Edind304,项目名称:b2evolution,代码行数:67,代码来源:_functions_evoupgrade.php


示例9: get_deleted_blogs

 /**
  * Get all own blogs of this user which current user can delete
  *
  * @return array Blogs
  */
 function get_deleted_blogs()
 {
     global $DB, $current_User;
     // Get all own blogs of the edited user
     $BlogCache =& get_BlogCache();
     $BlogCache->ID_array = array();
     $user_Blogs = $BlogCache->load_where('blog_owner_user_ID = ' . $DB->quote($this->ID));
     $deleted_Blogs = array();
     foreach ($user_Blogs as $user_Blog) {
         if ($current_User->check_perm('blog_properties', 'edit', false, $user_Blog->ID)) {
             // Current user has a permission to delete this blog
             $deleted_Blogs[] = $user_Blog;
         }
     }
     return $deleted_Blogs;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:21,代码来源:_user.class.php


示例10: get_messages_link_to

/**
 * Get messaging urls for the messaging notification emails
 *
 * @param integer thread ID the corresponding thread ID to display messages, and null to display all threads
 * @return array( threads/messages url, messaging preferences url )
 */
function get_messages_link_to($thread_ID = NULL)
{
    global $Settings, $admin_url;
    if (empty($thread_ID)) {
        $link_tail = 'threads';
    } else {
        $link_tail = 'messages&thrd_ID=' . $thread_ID;
    }
    $messages_link_to = $Settings->get('messages_link_to');
    if ($messages_link_to != 'admin') {
        $BlogCache =& get_BlogCache();
        /*
         * @var Blog
         */
        $link_to_Blog = $BlogCache->get_by_ID($messages_link_to, false, false);
        if ($link_to_Blog) {
            $message_link = url_add_param($link_to_Blog->gen_blogurl(), 'disp=' . $link_tail);
            $prefs_link = url_add_param($link_to_Blog->gen_blogurl(), 'disp=userprefs');
            return array($message_link, $prefs_link);
        }
    }
    // link to admin
    $message_link = $admin_url . '?ctrl=' . $link_tail;
    $prefs_link = $admin_url . '?ctrl=user&user_tab=userprefs';
    return array($message_link, $prefs_link);
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:32,代码来源:_messaging.funcs.php


示例11: get_bloglist_buttons

 /**
  * Returns list of buttons for available Collections (aka Blogs) to work on.
  *
  * @return string HTML
  */
 function get_bloglist_buttons($title = '')
 {
     global $current_User, $blog, $pagenow;
     $max_buttons = 7;
     if (empty($this->coll_list_permname)) {
         // We have not requested a list of blogs to be displayed
         return;
     }
     // Prepare url params:
     $url_params = '?';
     $form_params = '';
     foreach ($this->coll_list_url_params as $name => $value) {
         $url_params .= $name . '=' . $value . '&amp;';
         $form_params .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
     }
     $template = $this->get_template('CollectionList');
     $BlogCache =& get_BlogCache();
     $blog_array = $BlogCache->load_user_blogs($this->coll_list_permname, $this->coll_list_permlevel);
     $buttons = '';
     $select_options = '';
     $count = 0;
     $current_is_displayed = false;
     foreach ($blog_array as $l_blog_ID) {
         // Loop through all blogs that match the requested permission:
         $l_Blog =& $BlogCache->get_by_ID($l_blog_ID);
         $count++;
         if ($count < $max_buttons || $current_is_displayed && $count == $max_buttons || $l_blog_ID == $blog) {
             // Not too many yet OR current blog, add blog as a button:
             $buttons .= $template[$l_blog_ID == $blog ? 'beforeEachSel' : 'beforeEach'];
             $buttons .= '<a href="' . $url_params . 'blog=' . $l_blog_ID . '" class="' . ($l_blog_ID == $blog ? 'CurrentBlog' : 'OtherBlog') . '"';
             if (!is_null($this->coll_list_onclick)) {
                 // We want to include an onclick attribute:
                 $buttons .= ' onclick="' . sprintf($this->coll_list_onclick, $l_blog_ID) . '"';
             }
             $buttons .= '>' . $l_Blog->dget('shortname', 'htmlbody') . '</a> ';
             if ($l_blog_ID == $blog) {
                 $current_is_displayed = true;
                 $buttons .= $template['afterEachSel'];
             } else {
                 $buttons .= $template['afterEach'];
             }
         }
         // Add item select list:
         $select_options .= '<option value="' . $l_blog_ID . '"';
         if ($l_blog_ID == $blog) {
             $select_options .= ' selected="selected"';
         }
         $select_options .= '>' . $l_Blog->dget('shortname', 'formvalue') . '</option>';
     }
     $r = $template['before'];
     $r .= $title;
     if (!empty($this->coll_list_all_title)) {
         // We want to add an "all" button
         $r .= $template[$blog == 0 ? 'beforeEachSel' : 'beforeEach'];
         $r .= '<a href="' . $this->coll_list_all_url . '" class="' . ($blog == 0 ? 'CurrentBlog' : 'OtherBlog') . '">' . $this->coll_list_all_title . '</a> ';
         $r .= $template[$blog == 0 ? 'afterEachSel' : 'afterEach'];
     }
     $r .= $template['buttons_start'];
     $r .= $buttons;
     $r .= $template['buttons_end'];
     $r .= $template['select_start'];
     if ($count > $max_buttons) {
         // We could not display all blogs as buttons
         $r .= '<form action="' . $pagenow . '" method="get">';
         $r .= $form_params;
         $r .= '<select name="blog" onchange="';
         if (empty($this->coll_list_onclick)) {
             // Just submit...
             $r .= 'this.form.submit();';
         } else {
             $r .= sprintf($this->coll_list_onclick, 'this.value');
         }
         $r .= '">' . $select_options . '</select>';
         $r .= '<noscript><input type="submit" value="Go" /></noscript></form>';
     }
     $r .= $template['select_end'];
     $r .= $template['after'];
     return $r;
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:84,代码来源:_adminUI_general.class.php


示例12: manual_display_posts

/**
 * Display a list of the posts for current chapter
 *
 * @param array params
 * @return string List with posts
 */
function manual_display_posts($params = array(), $level = 0)
{
    $params = array_merge(array('chapter_ID' => 0, 'chapters_items_mode' => 'std'), $params);
    global $DB, $Blog, $blog;
    if (empty($Blog) && !empty($blog)) {
        // Set Blog if it still doesn't exist
        $BlogCache =& get_BlogCache();
        $Blog =& $BlogCache->get_by_ID($blog, false);
    }
    if (empty($params['chapter_ID']) || empty($Blog)) {
        // No chapter ID, Exit here
        return;
    }
    if ($params['chapters_items_mode'] == 'order') {
        // Get all subchapters in this mode to following insertion into posts list below
        $sub_chapters = manual_get_chapters($params['chapter_ID']);
    }
    // Get the posts of current category
    $ItemList = new ItemList2($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $Blog->get_setting('posts_per_page'));
    $ItemList->load_from_Request();
    $ItemList->set_filters(array('cat_array' => array($params['chapter_ID']), 'unit' => 'all'));
    $ItemList->query();
    // Split items in two arrays to know what items are from main category and what items are from extra category
    $items_main = array();
    $items_extra = array();
    while ($cur_Item = $ItemList->get_item()) {
        if ($cur_Item->main_cat_ID == $params['chapter_ID']) {
            // Item is from main category
            $items_main[] = $cur_Item;
        } else {
            // Item is from extra catogry
            $items_extra[] = $cur_Item;
        }
    }
    // ---- Display Items from MAIN category ---- //
    $prev_item_order = 0;
    foreach ($items_main as $cur_Item) {
        if ($params['chapters_items_mode'] == 'order') {
            // In this mode we display the chapters inside a posts list
            foreach ($sub_chapters as $s => $sub_Chapter) {
                // Loop through categories to find for current order
                if ($sub_Chapter->get('order') <= $cur_Item->get('order') && $sub_Chapter->get('order') > $prev_item_order || $cur_Item->get('order') == 0 && $sub_Chapter->get('order') >= $cur_Item->get('order')) {
                    // Display chapter
                    manual_display_chapter(array_merge($params, array('Chapter' => $sub_Chapter)), $level);
                    // Remove this chapter from array to avoid the duplicates
                    unset($sub_chapters[$s]);
                }
            }
            // Save current post order for next iteration
            $prev_item_order = $cur_Item->get('order');
        }
        manual_display_post_row($cur_Item, $level, array('post_navigation' => 'same_category', 'nav_target' => $params['chapter_ID'], 'link_type' => 'permalink', 'title_field' => 'urltitle'));
    }
    if ($params['chapters_items_mode'] == 'order') {
        foreach ($sub_chapters as $s => $sub_Chapter) {
            // Loop through rest categories that have order more than last item
            manual_display_chapter(array_merge($params, array('Chapter' => $sub_Chapter)), $level);
            // Remove this chapter from array to avoid the duplicates
            unset($sub_chapters[$s]);
        }
    }
    // ---- Display Items from EXTRA category ---- //
    foreach ($items_extra as $cur_Item) {
        manual_display_post_row($cur_Item, $level, array('post_navigation' => 'same_category', 'nav_target' => $params['chapter_ID'], 'link_type' => 'permalink', 'title_field' => 'urltitle', 'title_before' => '<i>', 'title_after' => '</i>'));
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:72,代码来源:_item.funcs.php


示例13: InitMainList

 /**
  * Event handler: Called when a MainList object gets created.
  *
  * Note: you must create your own MainList object here, set filters and query the database, see init_MainList() for detailes.
  *
  * @param array Associative array of parameters
  *   - 'MainList': The "MainList" object (by reference).
  *   - 'limit': The number of posts to display
  *
  * @return boolean True if you've created your own MainList object and queried the database, false otherwise.
  */
 function InitMainList(&$params)
 {
     global $Blog;
     global $preview, $disp;
     global $postIDlist, $postIDarray, $cat_array;
     $params['MainList'] = new ItemList2($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $params['limit']);
     // COPY (FUNC)
     if (!$preview) {
         if ($disp == 'page') {
             // Get pages:
             $params['MainList']->set_default_filters(array('types' => '1000'));
         }
         if ($disp == 'search' && param('s', 'string')) {
             // Here we allow b2evolution to search in posts and in pages
             $this->msg('TEST plugin: InitMainList() method allows us to search in both posts and pages.', 'note');
             $params['MainList']->set_default_filters(array('types' => '1,1000'));
         }
         $params['MainList']->load_from_Request(false);
         // Save aggregate setting
         $saved_aggregate_state = $Blog->get_setting('aggregate_coll_IDs');
         if ($disp == 'posts' && !empty($params['MainList']->filters['tags'])) {
             // If the MainList if filtered by tag we search for posts in all public blogs
             if (!empty($params['MainList']->filters['tags'])) {
                 // All public blogs
                 $BlogCache =& get_BlogCache();
                 $Blog->set_setting('aggregate_coll_IDs', implode(',', $BlogCache->load_public()));
                 $this->msg('TEST plugin: InitMainList() method allows us to display tagged posts from all public blogs.', 'note');
             }
         }
         // Run the query:
         $params['MainList']->query();
         // Restore aggregate setting to its original value
         $Blog->set_setting('aggregate_coll_IDs', $saved_aggregate_state);
         // Old style globals for category.funcs:
         $postIDlist = $params['MainList']->get_page_ID_list();
         $postIDarray = $params['MainList']->get_page_ID_array();
     } else {
         // We want to preview a single post, we are going to fake a lot of things...
         $params['MainList']->preview_from_request();
         // Legacy for the category display
         $cat_array = array();
     }
     return true;
     // This is required!
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:56,代码来源:_test.plugin.php


示例14: disp_coll_select

 /**
  * List of collections/blogs
  *
  * @param array MUST contain at least the basic display params
  */
 function disp_coll_select($params)
 {
     /**
      * @var Blog
      */
     global $Blog, $baseurl;
     echo $params['block_start'];
     $filter = $params['filter'];
     $order_by = $params['order_by'];
     $order_dir = $params['order_dir'];
     /**
      * @var BlogCache
      */
     $BlogCache =& get_BlogCache();
     if ($filter == 'owner') {
         // Load blogs of same owner
         $blog_array = $BlogCache->load_owner_blogs($Blog->owner_user_ID, $order_by, $order_dir);
     } else {
         // Load all public blogs
         $blog_array = $BlogCache->load_public($order_by, $order_dir);
     }
     $select_options = '';
     $select_options .= '<option value="-1"> - Select - </option>';
     foreach ($blog_array as $l_blog_ID) {
         // Loop through all public blogs:
         $l_Blog =& $BlogCache->get_by_ID($l_blog_ID);
         // Add item select list:
         $select_options .= '<option data-url="' . $l_Blog->gen_blogurl() . '" value="' . $l_blog_ID . '" title="' . $l_Blog->dget('tagline', 'formvalue') . '"';
         $select_options .= $Blog && $l_blog_ID == $Blog->ID ? ' selected="selected"' : '';
         $select_options .= '>' . $l_Blog->dget('shortname', 'formvalue') . '</option>' . "\n";
     }
     if (!empty($select_options)) {
         echo '<form class="" action="' . $baseurl . '" method="get">';
         echo '<div class="form-group col-xs-12">';
         echo '<div class="selwrap">';
         echo '<label for="blog" class="blog_sel_lbl control-label">' . $params['title'] . '</label>';
         echo '<select name="blog" class="blog_sel_w chosen">' . $select_options . '</select>';
         echo '</div>';
         echo '</div>';
         echo '<noscript><input type="submit" value="' . T_('Go') . '" /></noscript></form>';
     }
     echo $params['block_end'];
 }
开发者ID:eminozlem,项目名称:b2-blog-selector-plugin,代码行数:48,代码来源:_blog_selector.plugin.php


示例15: display_chapter_posts

 /**
  * Display a list of the posts for current chapter
  *
  * @param array params
  * @return string List with posts
  */
 function display_chapter_posts($params = array())
 {
     $params = array_merge(array('chapter_ID' => 0, 'item_start' => '<li>', 'item_end' => '</li>', 'class_selected' => 'selected', 'class_post' => 'post', 'chapters_items_mode' => 'std', 'display_children' => false, 'display_posts' => false), $params);
     global $DB, $Item, $Blog, $blog;
     if (empty($Blog) && !empty($blog)) {
         // Set Blog if it still doesn't exist
         $BlogCache =& get_BlogCache();
         $Blog =& $BlogCache->get_by_ID($blog, false);
     }
     if (empty($params['chapter_ID']) || empty($Blog)) {
         // No chapter ID, Exit here
         return;
     }
     if ($params['chapters_items_mode'] == 'order') {
         // Get all subchapters in this mode to following insertion into posts list below
         $sub_chapters = $this->get_chapters($params['chapter_ID']);
     }
     // Get the posts of current category
     $ItemList = new ItemList2($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $Blog->get_setting('posts_per_page'));
     $ItemList->load_from_Request();
     $ItemList->set_filters(array('cat_array' => array($params['chapter_ID']), 'unit' => 'all'));
     $ItemList->query();
     $selected_item_ID = !empty($Item) && !empty($Item->ID) ? $Item->ID : 0;
     // Split items in two arrays to know what items are from main category and what items are from extra category
     $items_main = array();
     $items_extra = array();
     while ($cur_Item = $ItemList->get_item()) {
         if ($cur_Item->main_cat_ID == $params['chapter_ID']) {
             // Item is from main category
             $items_main[] = $cur_Item;
         } else {
             // Item is from extra catogry
             $items_extra[] = $cur_Item;
         }
     }
     // ---- Display Items from MAIN category ---- //
     $prev_item_order = 0;
     foreach ($items_main as $cur_Item) {
         if ($params['chapters_items_mode'] == 'order') {
             // In this mode we display the chapters inside a posts list
             foreach ($sub_chapters as $s => $sub_Chapter) {
                 // Loop through categories to find for current order
                 if ($sub_Chapter->get('order') <= $cur_Item->get('order') && $sub_Chapter->get('order') > $prev_item_order || $cur_Item->get('order') == 0 && $sub_Chapter->get('order') >= $cur_Item->get('order')) {
                     // Display chapter
                     $this->display_chapter_item(array_merge($params, array('Chapter' => $sub_Chapter)));
                     // Remove this chapter from array to avoid the duplicates
                     unset($sub_chapters[$s]);
                 }
             }
             // Save current post order for next iteration
             $prev_item_order = $cur_Item->get('order');
         }
         $classes = array('post');
         if ($selected_item_ID == $cur_Item->ID) {
             // This post is selected
             $classes[] = $params['class_selected'];
         }
         // Display a post
         if (empty($classes)) {
             echo $params['item_start'];
         } else {
             // Add attr "class" for item start tag
             echo str_replace('>', ' class="' . implode(' ', $classes) . '">', $params['item_start']);
         }
         // Display a permanent link to post
         $cur_Item->title(array('post_navigation' => 'same_category', 'nav_target' => $params['chapter_ID'], 'link_type' => 'permalink', 'link_class' => 'link'));
         //echo ' <span class="red">'.( $cur_Item->get('order') > 0 ? $cur_Item->get('order') : 'NULL').'</span>'.$params['item_end'];
         echo $params['item_end'];
     }
     if ($params['chapters_items_mode'] == 'order') {
         foreach ($sub_chapters as $s => $sub_Chapter) {
             // Loop through rest categories that have order more than last item
             $this->display_chapter_item(array_merge($params, array('Chapter' => $sub_Chapter)));
             // Remove this chapter from array to avoid the duplicates
             unset($sub_chapters[$s]);
         }
     }
     // ---- Display Items from EXTRA category ---- //
     foreach ($items_extra as $cur_Item) {
         $classes = array('post');
         if ($selected_item_ID == $cur_Item->ID) {
             // This post is selected
             $classes[] = $params['class_selected'];
         }
         // Display a post
         if (empty($classes)) {
             echo $params['item_start'];
         } else {
             // Add attr "class" for item start tag
             echo str_replace('>', ' class="' . implode(' ', $classes) . '">', $params['item_start']);
         }
         // Display a permanent link to post
         $cur_Item->title(array('post_navigation' => 'same_category', 'nav_target' => $params['chapter_ID'], 'link_type' => 'permalink', 'link_class' => 'link', 'before' => '<i>', 'after' => '</i>'));
         //echo ' <span class="red">'.( $cur_Item->get('order') > 0 ? $cur_Item->get('order') : 'NULL').'</span>'.$params['item_end'];
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_skin.class.php


示例16: create

    /**
     * Create a new blog...
     *
     * @param string Kind of blog ( 'std', 'photo', 'group', 'forum' )
     */
    function create($kind = '')
    {
        global $DB, $Messages, $basepath, $admin_url, $current_User, $Settings;
        $DB->begin();
        // DB INSERT
        $this->dbinsert();
        $Messages->add(T_('The new blog has been created.'), 'success');
        // Change access mode if a stub file exists:
        $stub_filename = 'blog' . $this->ID . '.php';
        if (is_file($basepath . $stub_filename)) {
            // Stub file exists and is waiting ;)
            $DB->query('UPDATE T_blogs
						SET blog_access_type = "relative", blog_siteurl = "' . $stub_filename . '"
						WHERE blog_ID = ' . $this->ID);
            $Messages->add(sprintf(T_('The new blog has been associated with the stub file &laquo;%s&raquo;.'), $stub_filename), 'success');
        } elseif ($this->access_type == 'relati 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_Cache函数代码示例发布时间:2022-05-15
下一篇:
PHP get_AJAX_constructor函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap