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

PHP get_ChapterCache函数代码示例

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

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



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

示例1: display_hierarchy

 /**
  * Display a content hierarchy as list with chapters and posts
  *
  * @param array Params
  */
 function display_hierarchy($params = array())
 {
     $params = array_merge(array('block_start' => '', 'block_end' => '', 'block_body_start' => '', 'block_body_end' => '', 'list_start' => '<ul class="chapters_list">', 'list_end' => '</ul>', 'list_subs_start' => '<ul>', 'list_subs_end' => '</ul>', 'item_start' => '<li>', 'item_end' => '</li>', 'item_before_opened' => '', 'item_before_closed' => '', 'item_before_post' => '', 'class_opened' => 'opened', 'class_closed' => 'closed', 'class_selected' => 'selected', 'class_post' => 'post', 'display_blog_title' => true, 'open_children_levels' => 0, 'list_posts' => true), $params);
     global $blog, $cat, $Item;
     $BlogCache =& get_BlogCache();
     $ChapterCache =& get_ChapterCache();
     if (!empty($this->disp_params['blog_ID'])) {
         // Set a Blog from widget setting
         $this->Blog =& $BlogCache->get_by_ID(intval($this->disp_params['blog_ID']), false, false);
     }
     if (empty($this->Blog) && !empty($blog)) {
         // Use current Blog
         $this->Blog =& $BlogCache->get_by_ID($blog, false, false);
     }
     if (empty($this->Blog)) {
         // No Blog, Exit here
         return;
     }
     $chapter_path = array();
     if (!empty($cat)) {
         // A category is opened
         $params['chapter_path'] = $ChapterCache->get_chapter_path($this->Blog->ID, $cat);
     } elseif (!empty($Item) && !$Item->is_intro()) {
         // A post is opened (Ignore intro posts)
         $params['chapter_path'] = $ChapterCache->get_chapter_path($this->Blog->ID, $Item->main_cat_ID);
     }
     echo $params['block_body_start'];
     echo $params['list_start'];
     if ($params['display_blog_title']) {
         // Display blog title
         echo str_replace('>', ' class="title ' . $params['class_selected'] . '">', $params['item_start']);
         echo '<a href="' . $this->Blog->get('url') . '" class="link">' . $this->Blog->get('name') . '</a>';
         echo $params['item_end'];
     }
     $callbacks = array('line' => array($this, 'display_chapter'), 'before_level' => array($this, 'cat_before_level'), 'after_level' => array($this, 'cat_after_level'), 'posts' => array($this, 'display_post_row'));
     echo $ChapterCache->recurse($callbacks, $this->Blog->ID, NULL, 0, 0, $params);
     echo $params['list_end'];
     echo $params['block_body_end'];
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:44,代码来源:_content_hierarchy.widget.php


示例2: xmlrpcs_check_cats

/**
 * Check whether the main category and the extra categories are valid
 * in a Blog's context and try to fix errors.
 *
 * @author Tilman BLUMENBACH / Tblue
 *
 * @param integer The main category to check (by reference).
 * @param object The Blog to which the category is supposed to belong to (by reference).
 * @param array Extra categories for the post (by reference).
 *
 * @return boolean False on error (use xmlrpcs_resperror() to return it), true on success.
 */
function xmlrpcs_check_cats(&$maincat, &$Blog, &$extracats)
{
    global $xmlrpcs_errcode, $xmlrpcs_errmsg, $xmlrpcerruser;
    // Trim $maincat and $extracats (qtm sends whitespace before the cat IDs):
    $maincat = trim($maincat);
    $extracats = array_map('trim', $extracats);
    $ChapterCache =& get_ChapterCache();
    // ---- CHECK MAIN CATEGORY ----
    if ($ChapterCache->get_by_ID($maincat, false) === false) {
        // Category does not exist!
        // Remove old category from extra cats:
        if (($key = array_search($maincat, $extracats)) !== false) {
            unset($extracats[$key]);
        }
        // Set new category (blog default):
        $maincat = $Blog->get_default_cat_ID();
        logIO('Invalid main cat ID - new ID: ' . $maincat);
    } else {
        if (get_allow_cross_posting() < 2 && get_catblog($maincat) != $Blog->ID) {
            // We cannot use a maincat of another blog than the current one:
            $xmlrpcs_errcode = $xmlrpcerruser + 11;
            $xmlrpcs_errmsg = 'Current crossposting setting does not allow moving posts to a different blog.';
            return false;
        }
    }
    // ---- CHECK EXTRA CATEGORIES ----
    foreach ($extracats as $ecat) {
        if ($ecat == $maincat) {
            // We already checked the maincat above (or reset it):
            continue;
        }
        logIO('Checking extra cat: ' . $ecat);
        if ($ChapterCache->get_by_ID($ecat, false) === false) {
            // Extra cat does not exist:
            $xmlrpcs_errcode = $xmlrpcerruser + 11;
            $xmlrpcs_errmsg = 'Extra category ' . (int) $ecat . ' not found in requested blog.';
            return false;
        }
    }
    if (!in_array($maincat, $extracats)) {
        logIO('$maincat was not found in $extracats array - adding.');
        $extracats[] = $maincat;
    }
    return true;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:57,代码来源:_xmlrpcs.funcs.php


示例3: skin_init


//.........这里部分代码省略.........
            // auto requires jQuery
            // fp> if we add this here, we have to exetnd the inner if()
            // init_ratings_js( 'blog' );
            // Get list of active filters:
            $active_filters = $MainList->get_active_filters();
            if (!empty($active_filters)) {
                // The current page is being filtered...
                if (array_diff($active_filters, array('page')) == array()) {
                    // This is just a follow "paged" page
                    $disp_detail = 'posts-next';
                    $seo_page_type = 'Next page';
                    if ($Blog->get_setting('paged_noindex')) {
                        // We prefer robots not to index category pages:
                        $robots_index = false;
                    }
                } elseif (array_diff($active_filters, array('cat_array', 'cat_modifier', 'cat_focus', 'posts', 'page')) == array()) {
                    // This is a category page
                    $disp_detail = 'posts-cat';
                    $seo_page_type = 'Category page';
                    if ($Blog->get_setting('chapter_noindex')) {
                        // We prefer robots not to index category pages:
                        $robots_index = false;
                    }
                    global $cat, $catsel;
                    if (empty($catsel) && preg_match('~^[0-9]+$~', $cat)) {
                        // We are on a single cat page:
                        // NOTE: we must have selected EXACTLY ONE CATEGORY through the cat parameter
                        // BUT: - this can resolve to including children
                        //      - selecting exactly one cat through catsel[] is NOT OK since not equivalent (will exclude children)
                        // echo 'SINGLE CAT PAGE';
                        if ($Blog->get_setting('canonical_cat_urls') && $redir == 'yes' || $Blog->get_setting('relcanonical_cat_urls')) {
                            // Check if the URL was canonical:
                            if (!isset($Chapter)) {
                                $ChapterCache =& get_ChapterCache();
                                /**
                                 * @var Chapter
                                 */
                                $Chapter =& $ChapterCache->get_by_ID($MainList->filters['cat_array'][0], false);
                            }
                            if ($Chapter) {
                                if ($Chapter->parent_ID) {
                                    // This is a sub-category page (i-e: not a level 1 category)
                                    $disp_detail = 'posts-subcat';
                                }
                                $canonical_url = $Chapter->get_permanent_url(NULL, NULL, $MainList->get_active_filter('page'), NULL, '&');
                                if (!is_same_url($ReqURL, $canonical_url)) {
                                    // fp> TODO: we're going to lose the additional params, it would be better to keep them...
                                    // fp> what additional params actually?
                                    if ($Blog->get_setting('canonical_cat_urls') && $redir == 'yes') {
                                        // REDIRECT TO THE CANONICAL URL:
                                        header_redirect($canonical_url, true);
                                    } else {
                                        // Use rel="canonical":
                                        add_headline('<link rel="canonical" href="' . $canonical_url . '" />');
                                    }
                                }
                            } else {
                                // If the requested chapter was not found display 404 page
                                $Messages->add(T_('The requested chapter was not found'));
                                global $disp;
                                $disp = '404';
                                break;
                            }
                        }
                        if ($post_navigation == 'same_category') {
                            // Category is set and post navigation should go through the same category, set navigation target param
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:67,代码来源:_skin.funcs.php


示例4: 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


示例5: display_post_button

 /**
  * Display button to create a new post
  *
  * @param integer Chapter ID
  */
 function display_post_button($chapter_ID, $Item = NULL)
 {
     global $Blog;
     $post_button = '';
     $chapter_is_locked = false;
     $write_new_post_url = $Blog->get_write_item_url($chapter_ID);
     if ($write_new_post_url != '') {
         // Display button to write a new post
         $post_button = '<a href="' . $write_new_post_url . '"><span class="ficon newTopic" title="' . T_('Post new topic') . '"></span></a>';
     } else {
         // If a creating of new post is unavailable
         $ChapterCache =& get_ChapterCache();
         $current_Chapter = $ChapterCache->get_by_ID($chapter_ID, false, false);
         if ($current_Chapter && $current_Chapter->lock) {
             // Display icon to inform that this forum is locked
             $post_button = '<span class="ficon locked" title="' . T_('This forum is locked: you cannot post, reply to, or edit topics.') . '"></span>';
             $chapter_is_locked = true;
         }
     }
     if (!empty($Item)) {
         if ($Item->comment_status == 'closed' || $Item->comment_status == 'disabled' || $Item->is_locked()) {
             // Display icon to inform that this topic is locked for comments
             if (!$chapter_is_locked) {
                 // Display this button only when chapter is not locked, to avoid a duplicate button
                 $post_button .= ' <span class="ficon locked" title="' . T_('This topic is locked: you cannot edit posts or make replies.') . '"></span>';
             }
         } else {
             // Display button to post a reply
             $post_button .= ' <a href="' . $Item->get_feedback_url() . '#form_p' . $Item->ID . '"><span class="ficon postReply" title="' . T_('Reply to topic') . '"></span></a>';
         }
     }
     if (!empty($post_button)) {
         // Display button
         echo '<div class="post_button">';
         echo $post_button;
         echo '</div>';
     }
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:43,代码来源:_skin.class.php


示例6: display_init

    /**
     * Get ready for displaying the skin.
     *
     * This may register some CSS or JS...
     */
    function display_init()
    {
        global $Messages, $disp, $debug;
        // Request some common features that the parent function (Skin::display_init()) knows how to provide:
        parent::display_init(array('jquery', 'font_awesome', 'bootstrap', 'bootstrap_evo_css', 'bootstrap_messages', 'style_css', 'colorbox', 'bootstrap_init_tooltips', 'disp_auto'));
        // Skin specific initializations:
        // Add custom CSS:
        $custom_css = '';
        // Custom background color:
        if ($color = $this->get_setting('bg_color')) {
            $custom_css = 'body { background: ' . $color . " }\n";
        }
        // Custom text color:
        if ($color = $this->get_setting('text_color')) {
            $custom_css .= '.main, .content blockquote, .content address, .content p, .content li, .content td, .content dd, .result_content, .search_title, .main textarea { color: ' . $color . " }\n";
        }
        // Custom headings color:
        if ($color = $this->get_setting('headings_color')) {
            $custom_css .= '.content h1, .content h2, .content h3, .content h4, .content h5, .content h6, .content cite, .main .title { color: ' . $color . " }\n";
            $custom_css .= '.content cite { border-bottom: 2px solid ' . $color . " }\n";
        }
        // Custom link color:
        if ($color = $this->get_setting('link_color')) {
            $custom_css .= '.main a, .main .nav > li a, .main .pagination>li>a, .main .panel-default>.panel-heading a, .main .panel-default>.panel-heading .panel-icon, .main .panel-title, .main .evo_post_more_link, .main .evo_comment .panel-heading .evo_comment_title { color: ' . $color . " }\n";
        }
        // Custom link hover color:
        if ($color = $this->get_setting('link_h_color')) {
            $custom_css .= '.content a:hover, .color-hover a:hover, .main .nav > li a:hover, .main .pagination>li>a:hover, .main .pagination>li>span:hover, .main .pagination>li.active>span, .main .pager li>a, .main .pager li>span, .profile_column_right .panel-default .panel-heading, .main .panel-title a, .main .evo_post_more_link a, .main .evo_post__excerpt_more_link a, .main .evo_comment .panel-heading a:hover, .main .evo_comment .panel-heading a, profile_column_left h1, .profile_column_left .profile_buttons .btn-primary, .profile_column_left .profile_buttons .btn-primary button, .profile_column_left h1, .main button, .main input.submit, .main input.preview, .main input[type="reset"], .main input[type="submit"] { color: ' . $color . " }\n";
            $custom_css .= '#bCalendarToday { background: ' . $color . " }\n";
        }
        // Sections background color:
        if ($color = $this->get_setting('section_bg')) {
            $custom_css .= '.main .nav > li a, .main .pager li>a, .main .pager li>span, .featured_post, .main .panel-default>.panel-heading, .main .evo_post_more_link a, .main .evo_post__excerpt_more_link a, .evo_comment_footer small a { background: ' . $color . " }\n";
            $custom_css .= '.main .pagination>li>a, .main .pagination>li>span, .small >span, .profile_column_left .profile_buttons .btn-group a, .profile_column_left .profile_buttons p a button, .main .input.submit, .main input[type="button"]:focus, .main input[type="reset"]:focus, .main  input[type="submit"]:focus, .main button:active, .main input[type="button"]:active, .main input[type="reset"]:active, .main input[type="submit"]:active, .main input[type="submit"] { background: ' . $color . " !important }\n";
        }
        // Divider color:
        if ($color = $this->get_setting('divider_color')) {
            $custom_css .= '.post, .main .panel-group .panel li, .content ul li, .main .evo_comment { border-bottom: 1px solid ' . $color . " }\n";
            $custom_css .= '.post, .main .panel-group .panel li ul, .content ul li ul { border-top: 1px solid ' . $color . " }\n";
            $custom_css .= 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], textarea, input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, textarea:focus { border: 2px solid ' . $color . " !important }\n";
        }
        // Custom link hover color:
        if ($color = $this->get_setting('header_bg')) {
            $custom_css .= '.masterhead { background-color: ' . $color . " }\n";
        }
        // Custom link hover color:
        if ($color = $this->get_setting('header_color')) {
            $custom_css .= '.masterhead, .masterhead .widget_core_coll_title a, .masterhead .widget_core_coll_title a:hover { color: ' . $color . "}\n";
        }
        // Limit images by max height:
        $max_image_height = intval($this->get_setting('max_image_height'));
        if ($max_image_height > 0) {
            add_css_headline('.evo_image_block img { max-height: ' . $max_image_height . 'px; width: auto; }');
        }
        // Initialize a template depending on current page
        switch ($disp) {
            case 'front':
                // Init star rating for intro posts:
                init_ratings_js('blog', true);
                break;
            case 'posts':
                global $cat, $bootstrap_manual_posts_text;
                // Init star rating for intro posts:
                init_ratings_js('blog', true);
                $bootstrap_manual_posts_text = T_('Posts');
                if (!empty($cat)) {
                    // Init the <title> for categories page:
                    $ChapterCache =& get_ChapterCache();
                    if ($Chapter =& $ChapterCache->get_by_ID($cat, false)) {
                        $bootstrap_manual_posts_text = $Chapter->get('name');
                    }
                }
                break;
        }
        if ($this->is_left_navigation_visible() && $this->get_setting('left_navigation') == true) {
            // Include JS code for left navigation panel only when it is displayed:
            require_js($this->get_url() . 'left_navigation.js');
        }
        // Function for custom css
        if (!empty($custom_css)) {
            $custom_css = '<style type="text/css">
			<!--
				' . $custom_css . '
			-->
			</style>';
            add_headline($custom_css);
        }
    }
开发者ID:b2evolution,项目名称:material_manual_skin,代码行数:93,代码来源:_skin.class.php


示例7: get_chapters

 /**
  * Get chapters
  *
  * @param integer Chapter parent ID
  */
 function get_chapters($parent_ID = 0)
 {
     global $Blog, $skin_chapters_cache;
     if (isset($skin_chapters_cache)) {
         // Get chapters from cache
         return $skin_chapters_cache;
     }
     $skin_chapters_cache = array();
     if ($parent_ID > 0) {
         // Get children of selected chapter
         global $DB, $Settings;
         $skin_chapters_cache = array();
         $SQL = new SQL();
         $SQL->SELECT('cat_ID');
         $SQL->FROM('T_categories');
         $SQL->WHERE('cat_parent_ID = ' . $DB->quote($parent_ID));
         if ($Settings->get('chapter_ordering') == 'manual') {
             // Manual order
             $SQL->ORDER_BY('cat_meta, cat_order');
         } else {
             // Alphabetic order
             $SQL->ORDER_BY('cat_meta, cat_name');
         }
         $ChapterCache =& get_ChapterCache();
         $categories = $DB->get_results($SQL->get());
         foreach ($categories as $c => $category) {
             $skin_chapters_cache[$c] = $ChapterCache->get_by_ID($category->cat_ID);
             // Get children
             $SQL->WHERE('cat_parent_ID = ' . $DB->quote($category->cat_ID));
             $children = $DB->get_results($SQL->get());
             foreach ($children as $child) {
                 $skin_chapters_cache[$c]->children[] = $ChapterCache->get_by_ID($child->cat_ID);
             }
         }
     } else {
         // Get the all chapters for current blog
         $ChapterCache =& get_ChapterCache();
         $ChapterCache->load_subset($Blog->ID);
         if (isset($ChapterCache->subset_cache[$Blog->ID])) {
             $skin_chapters_cache = $ChapterCache->subset_cache[$Blog->ID];
             foreach ($skin_chapters_cache as $c => $Chapter) {
                 // Init children
                 foreach ($skin_chapters_cache as $child) {
                     // Again go through all chapters to find a children for current chapter
                     if ($Chapter->ID == $child->get('parent_ID')) {
                         // Add to array of children
                         $skin_chapters_cache[$c]->children[] = $child;
                     }
                 }
             }
             foreach ($skin_chapters_cache as $c => $Chapter) {
                 // Unset the child chapters
                 if ($Chapter->get('parent_ID')) {
                     unset($skin_chapters_cache[$c]);
                 }
             }
         }
     }
     return $skin_chapters_cache;
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:65,代码来源:_skin.class.php


示例8: manual_display_chapters

/**
 * Display chapters list
 *
 * @param array Params
 */
function manual_display_chapters($params = array())
{
    global $Blog, $blog, $cat_ID;
    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($Blog)) {
        // No Blog, Exit here
        return;
    }
    $ChapterCache =& get_ChapterCache();
    $chapter_path = array();
    if (!empty($cat_ID)) {
        // A category is opened
        $chapter_path = $ChapterCache->get_chapter_path($Blog->ID, $cat_ID);
    }
    $callbacks = array('line' => 'manual_display_chapter_row', 'posts' => 'manual_display_post_row');
    $params = array_merge(array('sorted' => true, 'expand_all' => false, 'chapter_path' => $chapter_path), $params);
    $ChapterCache->recurse($callbacks, $Blog->ID, NULL, 0, 0, $params);
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:27,代码来源:_item.funcs.php


示例9: cat_line

 /**
  * Callback: Generate category line when it has children
  *
  * @param object Chapter we want to display
  * @param integer Level of the category in the recursive tree
  * @return string HTML
  */
 function cat_line($Chapter, $level)
 {
     global $cat_array;
     if (!isset($cat_array)) {
         $cat_array = array();
     }
     $exclude_cats = sanitize_id_list($this->disp_params['exclude_cats'], true);
     if (in_array($Chapter->ID, $exclude_cats)) {
         // Cat ID is excluded, skip it
         return;
     }
     // ID of the current selected category
     $first_selected_cat_ID = isset($cat_array[0]) ? $cat_array[0] : 0;
     if (!isset($this->disp_params['current_parents'])) {
         // Try to find the parent categories in order to select it because of widget setting is enabled
         $this->disp_params['current_all_cats'] = array();
         // All children of the root parent of the selcted category
         $this->disp_params['current_parents'] = array();
         // All parents of the selected category
         $this->disp_params['current_selected_level'] = 0;
         // Level of the selected category
         if ($first_selected_cat_ID > 0) {
             $this->disp_params['current_selected_level'] = $this->disp_params['current_selected_level'] + 1;
             $ChapterCache =& get_ChapterCache();
             $parent_Chapter =& $ChapterCache->get_by_ID($first_selected_cat_ID, false, false);
             while ($parent_Chapter !== NULL) {
                 // Go up to the first/root category
                 $root_parent_ID = $parent_Chapter->ID;
                 if ($parent_Chapter =& $parent_Chapter->get_parent_Chapter()) {
                     $this->disp_params['current_parents'][] = $parent_Chapter->ID;
                     $this->disp_params['current_all_cats'][] = $parent_Chapter->ID;
                     $this->disp_params['current_selected_level'] = $this->disp_params['current_selected_level'] + 1;
                 }
             }
             // Load all categories of the current selected path (these categories should be visible on page)
             $this->disp_params['current_all_cats'] = $cat_array;
             $this->load_category_children($root_parent_ID, $this->disp_params['current_all_cats'], $this->disp_params['current_parents']);
         }
     }
     $parent_cat_is_visible = isset($this->disp_params['parent_cat_is_visible']) ? $this->disp_params['parent_cat_is_visible'] : false;
     $start_level = intval($this->disp_params['start_level']);
     if ($start_level > 1 && ($start_level > $level + 1 || !in_array($Chapter->ID, $this->disp_params['current_all_cats']) && !$this->disp_params['parent_cat_is_visible'] || $this->disp_params['current_selected_level'] < $level && !$this->disp_params['parent_cat_is_visible'])) {
         // Don't show this item because of level restriction
         $this->disp_params['parent_cat_is_visible'] = false;
         //return '<span style="font-size:10px">hidden: ('.$level.'|'.$this->disp_params['current_selected_level'].')</span>';
         return '';
     } elseif (!isset($this->disp_params['current_cat_level'])) {
         // Save level of the current selected category
         $this->disp_params['current_cat_level'] = $level;
         $this->disp_params['parent_cat_is_visible'] = true;
     }
     if ($this->disp_params['mark_first_selected'] && $Chapter->ID == $first_selected_cat_ID || $this->disp_params['mark_children'] && $Chapter->ID != $first_selected_cat_ID && in_array($Chapter->ID, $cat_array) || $this->disp_params['mark_parents'] && $Chapter->ID != $first_selected_cat_ID && in_array($Chapter->ID, $this->disp_params['current_parents'])) {
         // This category should be selected
         $start_tag = $this->disp_params['item_selected_start'];
     } else {
         if (empty($Chapter->children)) {
             // This category has no children
             $start_tag = $this->disp_params['item_last_start'];
         } else {
             $start_tag = $this->disp_params['item_start'];
         }
     }
     if ($Chapter->meta) {
         // Add class name "meta" for meta categories
         $start_tag = $this->add_cat_class_attr($start_tag, 'meta');
     }
     $r = $start_tag;
     if ($this->disp_params['use_form'] || $this->disp_params['display_checkboxes']) {
         // We want to add form fields:
         $cat_checkbox_params = '';
         if ($Chapter->meta) {
             // Disable the checkbox of meta category ( and hide it by css )
             $cat_checkbox_params = ' disabled="disabled"';
         }
         $r .= '<label><input type="checkbox" name="catsel[]" value="' . $Chapter->ID . '" class="checkbox middle"';
         if (in_array($Chapter->ID, $cat_array)) {
             // This category is in the current selection
             $r .= ' checked="checked"';
         }
         $r .= $cat_checkbox_params . ' /> ';
     }
     $cat_name = $Chapter->dget('name');
     if ($Chapter->lock && isset($this->disp_params['show_locked']) && $this->disp_params['show_locked']) {
         $cat_name .= '<span style="padding:0 5px;" >' . get_icon('file_not_allowed', 'imgtag', array('title' => T_('Locked'))) . '</span>';
     }
     // Make a link from category name
     $r .= '<a href="';
     if ($this->disp_params['link_type'] == 'context') {
         // We want to preserve current browsing context:
         $r .= regenerate_url('cats,catsel', 'cat=' . $Chapter->ID);
     } else {
         $r .= $Chapter->get_permanent_url();
     }
//.........这里部分代码省略.........
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:101,代码来源:_coll_category_list.widget.php


示例10: get_catname

/**
 * Get name for a given cat ID.
 *
 * @return string Cat name in case of success, false on failure.
 */
function get_catname($cat_ID)
{
    $ChapterCache =& get_ChapterCache();
    $Chapter =& $ChapterCache->get_by_ID($cat_ID);
    return $Chapter->name;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:11,代码来源:mtimport.ctrl.php


示例11: get_ChapterCache

 /**
  *
  */
 function &get_parent_Chapter()
 {
     if (!isset($this->parent_Chapter)) {
         // Not resoleved yet!
         if (empty($this->parent_ID)) {
             $this->parent_Chapter = NULL;
         } else {
             $ChapterCache =& get_ChapterCache();
             $this->parent_Chapter =& $ChapterCache->get_by_ID($this->parent_ID, false);
         }
     }
     return $this->parent_Chapter;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:16,代码来源:_chapter.class.php


示例12: display_init

 /**
  * Get ready for displaying the skin.
  *
  * This may register some CSS or JS...
  */
 function display_init()
 {
     global $Messages, $disp, $debug;
     // Request some common features that the parent function (Skin::display_init()) knows how to provide:
     parent::display_init(array('jquery', 'font_awesome', 'bootstrap', 'bootstrap_evo_css', 'bootstrap_messages', 'style_css', 'colorbox', 'bootstrap_init_tooltips', 'disp_auto'));
     // Skin specific initializations:
     // Limit images by max height:
     $max_image_height = intval($this->get_setting('max_image_height'));
     if ($max_image_height > 0) {
         add_css_headline('.evo_image_block img { max-height: ' . $max_image_height . 'px; width: auto; }');
     }
     // Initialize a template depending on current page
     switch ($disp) {
         case 'front':
             // Init star rating for intro posts:
             init_ratings_js('blog', true);
             break;
         case 'posts':
             global $cat, $bootstrap_manual_posts_text;
             // Init star rating for intro posts:
             init_ratings_js('blog', true);
             $bootstrap_manual_posts_text = T_('Posts');
             if (!empty($cat)) {
                 // Init the <title> for categories page:
                 $ChapterCache =& get_ChapterCache();
                 if ($Chapter =& $ChapterCache->get_by_ID($cat, false)) {
                     $bootstrap_manual_posts_text = $Chapter->get('name');
                 }
             }
             break;
     }
     if ($this->is_left_navigation_visible()) {
         // Include JS code for left navigation panel only when it is displayed:
         require_js($this->get_url() . 'left_navigation.js');
     }
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:41,代码来源:_skin.class.php


示例13: display

    /**
     * Display the widget!
     *
     * @param array MUST contain at least the basic display params
     */
    function display($params)
    {
        global $cat_modifier;
        global $Blog;
        $this->init_display($params);
        /**
         * @var ChapterCache
         */
        $ChapterCache =& get_ChapterCache();
        $callbacks = array('line' => array($this, 'cat_line'), 'no_children' => array($this, 'cat_no_children'), 'before_level' => array($this, 'cat_before_level'), 'after_level' => array($this, 'cat_after_level'));
        if (!empty($params['callback_posts'])) {
            $callbacks['posts'] = $params['callback_posts'];
        }
        // START DISPLAY:
        echo $this->disp_params['block_start'];
        // Display title if requested
        $this->disp_title();
        if ($this->disp_params['use_form']) {
            // We want a complete form:
            echo '<form method="get" action="' . $Blog->gen_blogurl() . '">';
        }
        $aggregate_coll_IDs = $Blog->get_setting('aggregate_coll_IDs');
        if (empty($aggregate_coll_IDs)) {
            // ____________________ We want to display cats for ONE blog ____________________
            $tmp_disp = '';
            if ($this->disp_params['option_all']) {
                // We want to display a link to all cats:
                $tmp_disp .= $this->disp_params['item_start'] . '<a href="';
                if ($this->disp_params['link_type'] == 'context') {
                    // We want to preserve current browsing context:
                    $tmp_disp .= regenerate_url('cats,catsel');
                } else {
                    $tmp_disp .= $Blog->gen_blogurl();
                }
                $tmp_disp .= '">' . $this->disp_params['option_all'] . '</a>';
                $tmp_disp .= $this->disp_params['item_end'];
            }
            $r = $tmp_disp . $ChapterCache->recurse($callbacks, $Blog->ID);
            if (!empty($r)) {
                echo $this->disp_params['list_start'];
                echo $r;
                echo $this->disp_params['list_end'];
            }
        } else {
            // ____________________ We want to display cats for SEVERAL blogs ____________________
            $BlogCache =& get_BlogCache();
            // Make sure everything is loaded at once (vs multiple queries)
            // fp> TODO: scaling
            $ChapterCache->load_all();
            echo $this->disp_params['collist_start'];
            if ($aggregate_coll_IDs == '*') {
                $BlogCache->load_all();
                $coll_ID_array = $BlogCache->get_ID_array();
            } else {
                $coll_ID_array = sanitize_id_list($aggregate_coll_IDs, true);
            }
            foreach ($coll_ID_array as $curr_blog_ID) {
                // Get blog:
                $loop_Blog =& $BlogCache->get_by_ID($curr_blog_ID, false);
                if (empty($loop_Blog)) {
                    // That one doesn't exist (any more?)
                    continue;
                }
                // Display blog title, if requested:
                if ($this->disp_params['disp_names_for_coll_list']) {
                    echo $this->disp_params['coll_start'];
                    echo '<a href="';
                    if ($this->disp_params['link_type'] == 'context') {
                        // We want to preserve current browsing context:
                        echo regenerate_url('blog,cats,catsel', 'blog=' . $curr_blog_ID);
                    } else {
                        $loop_Blog->disp('url', 'raw');
                    }
                    echo '">';
                    $loop_Blog->disp('name');
                    echo '</a>';
                    echo $this->disp_params['coll_end'];
                }
                $r = $ChapterCache->recurse($callbacks, $curr_blog_ID);
                if (!empty($r)) {
                    echo $this->disp_params['list_start'];
                    echo $r;
                    echo $this->disp_params['list_end'];
                }
            }
        }
        if ($this->disp_params['use_form'] || $this->disp_params['display_checkboxes']) {
            // We want to add form fields:
            ?>
			<div class="tile">
				<input type="radio" name="cat" value="" id="catANY" class="radio" <?php 
            if ($cat_modifier != '-' && $cat_modifier != '*') {
                echo 'checked="checked" ';
            }
            ?>
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_coll_category_list.widget.php


示例14: cats_optionslist

function cats_optionslist($forcat)
{
    global $cache_blogs, $cache_optionslist, $cat_name_id_associations;
    if (!isset($cat_name_id_associations)) {
        // Create a map fro the category name-id associations to populate during optionlist initialization
        $cat_name_id_associations = array();
    }
    if (!isset($cache_optionslist)) {
        $ChapterCache =& get_ChapterCache();
        $ChapterCache->reveal_children(NULL, true);
        $callbacks = array('line' => 'proces_cat_line');
        $cache_optionslist = '';
        foreach ($cache_blogs as $i_blog) {
            $cache_optionslist .= '<option value="#NEW#' . $i_blog->blog_ID . '">[-- create in blog ' . $i_blog->blog_shortname . ' --]:</option>';
            $cache_optionslist .= $ChapterCache->recurse($callbacks, $i_blog->blog_ID, NULL, 0, 0, array('sorted' => true));
        }
    }
    $cat_id = isset($cat_name_id_associations[$forcat]) ? $cat_name_id_associations[$forcat] : false;
    if ($cat_id) {
        echo str_replace('<option value="' . $cat_id . '">', '<option value="' . $cat_id . '" selected="selected">', $cache_optionslist);
    } else {
        echo $cache_optionslist;
    }
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:24,代码来源:mtimport.ctrl.php


示例15: compile_cat_array

/**
 * Compiles the cat array from $cat (recursive + optional modifiers) and $catsel[] (non recursive)
 *
 * @param string
 * @param array
 * @param array by ref, will be modified
 * @param string by ref, will be modified
 * @param integer blog number to restrict to
 */
function compile_cat_array($cat, $catsel, &$cat_array, &$cat_modifier, $restrict_to_blog = 0)
{
    // echo '$cat='.$cat;
    // pre_dump( $catsel );
    // echo '$restrict_to_blog'.$restrict_to_blog;
    $cat_array = array();
    $cat_modifier = '';
    // Check for cat string (which will be handled recursively)
    if ($cat != 'all' && !empty($cat)) {
        // specified a category string:
        $cat_modifier = substr($cat, 0, 1);
        // echo 'cats['.$first_char.']';
        if ($cat_modifier == '*' || $cat_modifier == '-' || $cat_modifier == '|') {
            $cat = substr($cat, 1);
        } else {
            $cat_modifier = '';
        }
        if (strlen($cat)) {
            // There are some values to explode...
            $req_cat_array = explode(',', $cat);
            // Getting required sub-categories:
            // and add everything to cat array
            // ----------------- START RECURSIVE CAT LIST ----------------
            $ChapterCache =& get_ChapterCache();
            if ($restrict_to_blog > 0) {
                // Load all Chapters from the given blog
                $ChapterCache->reveal_children($restrict_to_blog, true);
            } else {
                // Load all chapters
                $ChapterCache->reveal_children(NULL, true);
            }
            foreach ($req_cat_array as $cat_ID) {
                // run recursively through the cats
                $current_Chapter = $ChapterCache->get_by_ID($cat_ID, false);
                if (empty($current_Chapter)) {
                    // The requested Chapter doesn't exists in the given context
                    continue;
                }
                if (!in_array($cat_ID, $cat_array)) {
                    // Not already in list
                    $cat_array[] = $cat_ID;
                    $ChapterCache->iterate_through_category_children($current_Chapter, array('line' => 'cat_req'), true, array('sorted' => true));
                }
            }
            // ----------------- END RECURSIVE CAT LIST ----------------
        }
    }
    // Add explicit selections:
    if (!empty($catsel)) {
        // echo "Explicit selections!<br />";
        $cat_array = array_merge($cat_array, $catsel);
        $cat_array = array_unique($cat_array);
    }
    // echo '$cat_modifier='.$cat_modifier;
    // pre_dump( $cat_array );
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:65,代码来源:_category.funcs.php


示例16: comment_mass_delete_process

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_Class函数代码示例发布时间:2022-05-15
下一篇:
PHP get_Cache函数代码示例发布时间: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