function blogs_directory_output($content)
{
    global $wpdb, $current_site, $post, $blogs_directory_base;
    $bg_color = '';
    if ($post->post_name == $blogs_directory_base) {
        $blogs_directory_sort_by = get_site_option('blogs_directory_sort_by', 'alphabetically');
        $blogs_directory_per_page = get_site_option('blogs_directory_per_page', '10');
        $blogs_directory_background_color = get_site_option('blogs_directory_background_color', '#F2F2EA');
        $blogs_directory_alternate_background_color = get_site_option('blogs_directory_alternate_background_color', '#FFFFFF');
        $blogs_directory_border_color = get_site_option('blogs_directory_border_color', '#CFD0CB');
        $blogs_directory = blogs_directory_url_parse();
        $blogs_directory_title_blogs_page = get_site_option('blogs_directory_title_blogs_page');
        $blogs_directory_show_description = get_site_option('blogs_directory_show_description');
        $blogs_directory_hide_blogs = get_site_option('blogs_directory_hide_blogs');
        if ($blogs_directory['page_type'] == 'landing') {
            $search_form_content = blogs_directory_search_form_output('', $blogs_directory['phrase']);
            $navigation_content = blogs_directory_landing_navigation_output('', $blogs_directory_per_page, $blogs_directory['page']);
            //EDITS BEGIN
            //$content .= $search_form_content;
            //$content .= '<br />';
            $content .= '<div style="float:left; width:100%">';
            $content .= '<h1>' . $blogs_directory_title_blogs_page . '</h1>';
            $content .= '<table border="0" border="0" cellpadding="2px" cellspacing="2px" width="100%" bgcolor="" class="blogs_directory_table">';
            //=================================//
            $avatar_default = get_option('avatar_default');
            $tic_toc = 'toc';
            //=================================//
            if ($blogs_directory['page'] == 1) {
                $start = 0;
            } else {
                $math = $blogs_directory['page'] - 1;
                $math = $blogs_directory_per_page * $math;
                $start = $math;
            }
            $query = "SELECT * FROM " . $wpdb->base_prefix . "blogs WHERE spam = 0 AND deleted = 0 AND archived = '0' AND blog_id != 1";
            if (isset($blogs_directory_hide_blogs['private']) && 1 == $blogs_directory_hide_blogs['private']) {
                $query .= " AND public = 1";
            }
            if ($blogs_directory_sort_by == 'alphabetically') {
                if (is_subdomain_install()) {
                    $query .= " ORDER BY domain ASC";
                } else {
                    $query .= " ORDER BY path ASC";
                }
            } else {
                if ($blogs_directory_sort_by == 'latest') {
                    $query .= " ORDER BY blog_id DESC";
                } else {
                    $query .= " ORDER BY last_updated DESC";
                }
            }
            $query .= " LIMIT " . intval($start) . ", " . intval($blogs_directory_per_page);
            $blogs = $wpdb->get_results($query, ARRAY_A);
            $blogs = apply_filters('blogs_directory_blogs_list', $blogs);
            if (count($blogs) > 0) {
                //=================================//
                foreach ($blogs as $blog) {
                    //Hide some blogs
                    if (blogs_directory_hide_some_blogs($blog['blog_id'])) {
                        continue;
                    }
                    //=============================//
                    $blog_title = get_blog_option($blog['blog_id'], 'blogname', $blog['domain'] . $blog['path']);
                    if ($tic_toc == 'toc') {
                        $tic_toc = 'tic';
                    } else {
                        $tic_toc = 'toc';
                    }
                    if ($tic_toc == 'tic') {
                        $bg_color = $blogs_directory_alternate_background_color;
                    } else {
                        $bg_color = $blogs_directory_background_color;
                    }
                    //=============================//
                    $content .= '<tr>';
                    if (function_exists('get_blog_avatar')) {
                        $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a style="text-decoration:none;" href="http://' . $blog['domain'] . $blog['path'] . '">' . get_blog_avatar($blog['blog_id'], 32, $avatar_default) . '</a></center></td>';
                    } else {
                        $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"></td>';
                    }
                    $content .= '<td style="background-color:' . $bg_color . ';" width="90%">';
                    $content .= '<a style="text-decoration:none; font-size:1.5em; margin-left:20px;" href="http://' . $blog['domain'] . $blog['path'] . '">' . $blog_title . '</a><br />';
                    //show description for blog
                    if (1 == $blogs_directory_show_description) {
                        $blogdescription = get_blog_option($blog['blog_id'], 'blogdescription', $blog['domain'] . $blog['path']);
                        $content .= '<span class="blogs_dir_search_blog_description" style="font-size: 12px; color: #9D88B0" >' . $blogdescription . '</span>';
                    }
                    $content .= '</td>';
                    $content .= '</tr>';
                }
                //=================================//
            }
            $content .= '</table>';
            $content .= '</div>';
            $content .= $navigation_content;
        } else {
            if ($blogs_directory['page_type'] == 'search') {
                //=====================================//
                if ($blogs_directory['page'] == 1) {
                    $start = 0;
                } else {
                    $math = $blogs_directory['page'] - 1;
                    $math = $blogs_directory_per_page * $math;
                    $start = $math;
                }
                //get all blogs
                $query = "SELECT * FROM " . $wpdb->base_prefix . "blogs";
                if (isset($blogs_directory_hide_blogs['private']) && 1 == $blogs_directory_hide_blogs['private']) {
                    $query .= " WHERE public = 1";
                }
                if ($blogs_directory_sort_by == 'alphabetically') {
                    if (is_subdomain_install()) {
                        $query .= " ORDER BY domain ASC";
                    } else {
                        $query .= " ORDER BY path ASC";
                    }
                } else {
                    if ($blogs_directory_sort_by == 'latest') {
                        $query .= " ORDER BY blog_id DESC";
                    } else {
                        $query .= " ORDER BY last_updated DESC";
                    }
                }
                $temp_blogs = $wpdb->get_results($query, ARRAY_A);
                $blogs = array();
                //search by
                if (!empty($temp_blogs)) {
                    foreach ($temp_blogs as $blog) {
                        //Hide some blogs
                        if (blogs_directory_hide_some_blogs($blog['blog_id'])) {
                            continue;
                        }
                        if ($current_site->id != $blog['blog_id']) {
                            $search_arr = explode(' ', $blogs_directory['phrase']);
                            $query = "SELECT option_name FROM {$wpdb->base_prefix}{$blog['blog_id']}_options WHERE option_name IN ('blogname', 'blogdescription') AND option_value LIKE '%" . join("%' AND option_value LIKE '%", $search_arr) . "%'; ";
                            $found_words = $wpdb->get_results($query, ARRAY_A);
                            if (count($found_words) == 0) {
                                continue;
                            }
                            $found_word_name = 0;
                            $found_word_description = 0;
                            foreach ($found_words as $found_word) {
                                if ($found_word['option_name'] == 'blogname') {
                                    $found_word_name++;
                                } else {
                                    if ($found_word['option_name'] == 'blogdescription') {
                                        $found_word_description++;
                                    }
                                }
                            }
                            $blogname = get_blog_option($blog['blog_id'], 'blogname', $blog['domain'] . $blog['path']);
                            $blogdescription = get_blog_option($blog['blog_id'], 'blogdescription', $blog['domain'] . $blog['path']);
                            $percent = $found_word_name + $found_word_description;
                            if (0 < $percent) {
                                $blog['blogname'] = $blogname;
                                $blog['blogdescription'] = $blogdescription;
                                $blog['percent'] = $percent;
                                $blogs[] = $blog;
                            }
                        }
                    }
                    //sort blogs by percent
                    if (1 < count($blogs)) {
                        $fn = create_function('$a, $b', '
                        if( $a["percent"] == $b["percent"] ) return 0;
                        return ( $a["percent"] > $b["percent"] ) ? -1 : 1;
                    ');
                        usort($blogs, $fn);
                    }
                }
                //=====================================//
                $search_form_content = blogs_directory_search_form_output('', $blogs_directory['phrase']);
                if (!empty($blogs)) {
                    if (count($blogs) < $blogs_directory_per_page) {
                        $next = 'no';
                    } else {
                        $next = 'yes';
                    }
                    $navigation_content = blogs_directory_search_navigation_output('', $blogs_directory_per_page, $blogs_directory['page'], $blogs_directory['phrase'], $next);
                }
                //$content .= $search_form_content;
                //$content .= '<br />';
                $content .= '<div style="float:left; width:100%">';
                $content .= '<table border="0" border="0" cellpadding="2px" cellspacing="2px" width="100%" bgcolor="" class="blogs_directory_search_table">';
                $content .= '<tr>';
                $content .= '<th style="background-color:' . $blogs_directory_background_color . '; border-bottom-style:solid; border-bottom-color:' . $blogs_directory_border_color . '; border-bottom-width:1px; font-size:12px;" width="10%"> </td>';
                $content .= '<th style="background-color:' . $blogs_directory_background_color . '; border-bottom-style:solid; border-bottom-color:' . $blogs_directory_border_color . '; border-bottom-width:1px; font-size:12px;" width="90%"><center><strong>' . $blogs_directory_title_blogs_page . '</strong></center></td>';
                $content .= '</tr>';
                //=================================//
                $avatar_default = get_option('avatar_default');
                $tic_toc = 'toc';
                //=================================//
                if (!empty($blogs)) {
                    foreach ($blogs as $blog) {
                        //=============================//
                        if ($tic_toc == 'toc') {
                            $tic_toc = 'tic';
                        } else {
                            $tic_toc = 'toc';
                        }
                        if ($tic_toc == 'tic') {
                            $bg_color = $blogs_directory_alternate_background_color;
                        } else {
                            $bg_color = $blogs_directory_background_color;
                        }
                        //=============================//
                        $content .= '<tr>';
                        if (function_exists('get_blog_avatar')) {
                            $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a style="text-decoration:none;" href="http://' . $blog['domain'] . $blog['path'] . '">' . get_blog_avatar($blog['blog_id'], 32, $avatar_default) . '</a></center></td>';
                        } else {
                            $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"></td>';
                        }
                        $content .= '<td style="background-color:' . $bg_color . ';" width="90%">';
                        $content .= '<a style="text-decoration:none; font-size:1.5em; margin-left:20px;" href="http://' . $blog['domain'] . $blog['path'] . '">' . $blog['blogname'] . '</a><br />';
                        $content .= '<span class="blogs_dir_search_blog_description" style="font-size: 12px; color: #9D88B0" >' . $blog['blogdescription'] . '</span>';
                        $content .= '</td>';
                        $content .= '</tr>';
                    }
                } else {
                    $content .= '<tr>';
                    $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"></td>';
                    $content .= '<td style="background-color:' . $bg_color . ';" width="90%">' . __('No results...', 'blogs-directory') . '</td>';
                    $content .= '</tr>';
                }
                //=================================//
                $content .= '</table>';
                $content .= '</div>';
                if (!empty($blogs)) {
                    $content .= $navigation_content;
                }
            } else {
                $content = __('Invalid page.', 'blogs-directory');
            }
        }
    }
    return $content;
}
 /**
  * 
  *
  * @since 1.0.0
  *
  * @param none
  * @return none
  */
 function process_categories_body($content)
 {
     global $post;
     if (is_admin()) {
         return $content;
     }
     if (!in_the_loop()) {
         return $content;
     }
     $this->load_config();
     //echo "opts<pre>"; print_r($this->opts); echo "</pre>";
     $data = array();
     // We get the bcat options. This 'should' contain the variable 'landing_page_id' is the admin properly set things up
     if (!isset($this->opts['landing_page_id']) || !intval($this->opts['landing_page_id'])) {
         $opts['landing_page_id'] = 0;
     }
     if ($post->ID != intval($this->opts['landing_page_id'])) {
         return $content;
     }
     // Remove our own filter. Since we are here we should not need it. Plus in case other process call the content filters.
     //remove_filter('the_content', array($this, 'process_categories_body'), 99);
     $category = get_query_var('category_name');
     if ($category) {
         $data['term'] = get_term_by('slug', $category, SITE_CATEGORIES_TAXONOMY);
         if (is_wp_error($data['term']) || !$data['term']) {
             // Here is some fuzzy logic. The query_var 'category_name' is the first item off the page slug as in /page-slug/category-name/page-number/
             // So we need to check if it is a real intval (3, 6, 12, etc.) then we assume we don't have a category and we are viewing the top-level page
             // list of blog categories. IF we do have a valid category-name then the next query_var is the page-number
             $category_int = intval($category);
             if ($category == $category_int && $category_int != 0) {
                 $data['current_page'] = $category_int;
                 $category = '';
             } else {
                 $data['current_page'] = get_query_var('page');
                 if (!$data['current_page']) {
                     $data['current_page'] = get_query_var('start_at');
                 }
             }
         } else {
             $data['current_page'] = get_query_var('page');
             if (!$data['current_page']) {
                 $data['current_page'] = get_query_var('start_at');
             }
         }
     }
     if (!isset($data['current_page']) || $data['current_page'] == 0) {
         $data['current_page'] = 1;
     }
     if ($category) {
         $args = $this->opts['sites'];
         $data['category'] = $category;
         $sites = $this->get_taxonomy_sites($data['term']->term_id);
         if (count($sites) < $args['per_page']) {
             $data['sites'] = $sites;
         } else {
             $data['offset'] = intval($args['per_page']) * (intval($data['current_page']) - 1);
             $data['sites'] = array_slice($sites, $data['offset'], $args['per_page'], true);
             $data['total_pages'] = ceil(count($sites) / intval($args['per_page']));
             if (intval($data['current_page']) > 1) {
                 $data['prev'] = array();
                 $data['prev']['page_number'] = intval($data['current_page']) - 1;
                 if (isset($this->opts['landing_page_rewrite']) && $this->opts['landing_page_rewrite'] == true) {
                     $data['prev']['link_url'] = trailingslashit($this->opts['landing_page_slug']) . $data['term']->slug . '/' . $data['prev']['page_number'];
                 } else {
                     $data['prev']['link_url'] = $this->opts['landing_page_slug'] . '&amp;category_name=' . $data['term']->slug . '&amp;start_at=' . $data['prev']['page_number'];
                 }
                 $data['prev']['link_label'] = __('Previous page', SITE_CATEGORIES_I18N_DOMAIN);
             }
             if ($data['current_page'] < $data['total_pages']) {
                 $data['next'] = array();
                 $data['next']['page_number'] = $data['current_page'] + 1;
                 if (isset($this->opts['landing_page_rewrite']) && $this->opts['landing_page_rewrite'] == true) {
                     $data['next']['link_url'] = trailingslashit($this->opts['landing_page_slug']) . $data['term']->slug . '/' . $data['next']['page_number'];
                 } else {
                     $data['next']['link_url'] = $this->opts['landing_page_slug'] . '&amp;category_name=' . $data['term']->slug . '&amp;start_at=' . $data['next']['page_number'];
                 }
                 $data['next']['link_label'] = __('Next page', SITE_CATEGORIES_I18N_DOMAIN);
             }
         }
         if (!function_exists('get_blog_avatar')) {
             $args['icon_show'] = false;
         } else {
             $default_icon_src = $this->get_default_category_icon_url();
         }
         if (count($data['sites'])) {
             foreach ($data['sites'] as $idx => $site) {
                 $data['sites'][$idx]->bact_site_description = get_blog_option($site->blog_id, 'bact_site_description');
                 if (isset($args['icon_show']) && $args['icon_show'] == true) {
                     $icon_image_src = get_blog_avatar($site->blog_id, $args['icon_size']);
                     if (!$icon_image_src || !strlen($icon_image_src)) {
                         $data['sites'][$idx]->icon_image_src = $default_icon_src;
                     } else {
                         $data['sites'][$idx]->icon_image_src = $icon_image_src;
                     }
                 }
             }
         }
         $categories_string = apply_filters('site_categories_landing_list_sites_display', $content, $data, $args);
         return $categories_string;
     } else {
         $args = $this->opts['categories'];
         $get_terms_args = array();
         $get_terms_args['hide_empty'] = $args['hide_empty'];
         $get_terms_args['orderby'] = $args['orderby'];
         $get_terms_args['order'] = $args['order'];
         $get_terms_args['pad_counts'] = true;
         $get_terms_args['hierarchical'] = false;
         if ($args['show_style'] == "grid") {
             $get_terms_args['pad_counts'] = 1;
             $get_terms_args['parent'] = 0;
             $get_terms_args['hierarchical'] = 0;
             // For the grid we replace the 'per_page' value with the number of rows * cols
             if (!isset($args['grid_cols'])) {
                 $args['grid_cols'] = 2;
             }
             if (!isset($args['grid_rows'])) {
                 $args['grid_rows'] = 3;
             }
             $args['per_page'] = intval($args['grid_rows']) * intval($args['grid_cols']);
         } else {
             if ($args['show_style'] == "accordion") {
                 $get_terms_args['pad_counts'] = 1;
                 $get_terms_args['parent'] = 0;
                 $get_terms_args['hierarchical'] = 0;
             }
         }
         //echo "args<pre>"; print_r($args); echo "</pre>";
         //echo "get_terms_args<pre>"; print_r($get_terms_args); echo "</pre>";
         $categories = get_terms(SITE_CATEGORIES_TAXONOMY, $get_terms_args);
         //echo "categories<pre>"; print_r($categories); echo "</pre>";
         if ($categories && count($categories)) {
             if (count($categories) < $args['per_page']) {
                 $data['categories'] = $categories;
             } else {
                 $data['offset'] = intval($args['per_page']) * (intval($data['current_page']) - 1);
                 $data['categories'] = array_slice($categories, $data['offset'], $args['per_page'], true);
                 $data['total_pages'] = ceil(count($categories) / intval($args['per_page']));
                 if (intval($data['current_page']) > 1) {
                     $data['prev'] = array();
                     $data['prev']['page_number'] = intval($data['current_page']) - 1;
                     if (isset($this->opts['landing_page_rewrite']) && $this->opts['landing_page_rewrite'] == true) {
                         $data['prev']['link_url'] = trailingslashit($this->opts['landing_page_slug']) . $data['prev']['page_number'];
                     } else {
                         $data['prev']['link_url'] = $this->opts['landing_page_slug'] . '&amp;start_at=' . $data['prev']['page_number'];
                     }
                     $data['prev']['link_label'] = __('Previous page', SITE_CATEGORIES_I18N_DOMAIN);
                 }
                 if ($data['current_page'] < $data['total_pages']) {
                     $data['next'] = array();
                     $data['next']['page_number'] = $data['current_page'] + 1;
                     if (isset($this->opts['landing_page_rewrite']) && $this->opts['landing_page_rewrite'] == true) {
                         $data['next']['link_url'] = trailingslashit($this->opts['landing_page_slug']) . $data['next']['page_number'];
                     } else {
                         $data['next']['link_url'] = $this->opts['landing_page_slug'] . '&amp;start_at=' . $data['next']['page_number'];
                     }
                     $data['next']['link_label'] = __('Next page', SITE_CATEGORIES_I18N_DOMAIN);
                 }
             }
             if (count($data['categories'])) {
                 foreach ($data['categories'] as $idx => $data_category) {
                     if (isset($args['icon_show']) && $args['icon_show'] == true) {
                         $data['categories'][$idx]->icon_image_src = $this->get_category_term_icon_src($data_category->term_id, $args['icon_size']);
                     }
                     if (isset($this->opts['landing_page_rewrite']) && $this->opts['landing_page_rewrite'] == true) {
                         $data['categories'][$idx]->bcat_url = trailingslashit($this->opts['landing_page_slug']) . $data_category->slug;
                     } else {
                         $data['categories'][$idx]->bcat_url = $this->opts['landing_page_slug'] . '&amp;category_name=' . $data_category->slug;
                     }
                     if ($args['show_style'] == "grid" || $args['show_style'] == "accordion") {
                         $get_terms_args = array();
                         $get_terms_args['hide_empty'] = $args['hide_empty'];
                         $get_terms_args['orderby'] = $args['orderby'];
                         $get_terms_args['order'] = $args['order'];
                         $get_terms_args['parent'] = $data_category->term_id;
                         $get_terms_args['hierarchical'] = 0;
                         //echo "child get_terms_args<pre>"; print_r($get_terms_args); echo "</pre>";
                         $child_categories = get_terms(SITE_CATEGORIES_TAXONOMY, $get_terms_args);
                         if ($child_categories && count($child_categories)) {
                             // We tally the count of the children to make sure the parent count shows correctly.
                             $children_count = 0;
                             foreach ($child_categories as $child_category) {
                                 $children_count += $child_category->count;
                                 if (isset($this->opts['landing_page_rewrite']) && $this->opts['landing_page_rewrite'] == true) {
                                     $child_category->bcat_url = trailingslashit($this->opts['landing_page_slug']) . $child_category->slug;
                                 } else {
                                     $child_category->bcat_url = $this->opts['landing_page_slug'] . '&amp;category_name=' . $child_category->slug;
                                 }
                                 if (isset($args['icon_show_children']) && $args['icon_show_children'] == true) {
                                     $child_category->icon_image_src = $this->get_category_term_icon_src($child_category->term_id, $args['icon_size_children']);
                                 }
                             }
                             if ($args['show_style'] == "accordion") {
                                 $data['categories'][$idx]->count = $children_count;
                             }
                             $data['categories'][$idx]->children = $child_categories;
                         }
                     }
                 }
             }
             if ($args['show_style'] == "ul" || $args['show_style'] == "ol") {
                 $categories_string = apply_filters('site_categories_landing_list_display', $content, $data, $args);
             } else {
                 if ($args['show_style'] == "grid") {
                     $categories_string = apply_filters('site_categories_landing_grid_display', $content, $data, $args);
                 } else {
                     if ($args['show_style'] == "accordion") {
                         $categories_string = apply_filters('site_categories_landing_accordion_display', $content, $data, $args);
                     }
                 }
             }
             return $categories_string;
         }
     }
     return $content;
 }
 function widget($args, $instance)
 {
     global $site_categories, $current_site;
     $site_categories->load_config();
     extract($args);
     $data = get_site_transient('site-categories-sites-data-' . $this->number);
     if (!$data) {
         switch_to_blog($current_site->blog_id);
         $bcat_term = get_term($instance['category'], SITE_CATEGORIES_TAXONOMY);
         $sites = $site_categories->get_taxonomy_sites($instance['category'], $instance['include_children']);
         if (count($sites) < $instance['per_page']) {
             $data['sites'] = $sites;
         } else {
             $data['offset'] = intval($instance['per_page']) * (intval($data['current_page']) - 1);
             $data['sites'] = array_slice($sites, $data['offset'], $instance['per_page'], true);
             $data['total_pages'] = ceil(count($sites) / intval($instance['per_page']));
         }
         if (intval($instance['show_more_link'])) {
             if (isset($site_categories->opts['landing_page_rewrite']) && $site_categories->opts['landing_page_rewrite'] == true) {
                 $data['landing']['link_url'] = trailingslashit($site_categories->opts['landing_page_slug']) . $bcat_term->slug;
             } else {
                 $data['landing']['link_url'] = trailingslashit($site_categories->opts['landing_page_slug']) . "&category_name=" . $bcat_term->slug;
             }
             if (isset($instance['landing_link_label'])) {
                 $data['landing']['link_label'] = $instance['landing_link_label'];
             } else {
                 $data['landing']['link_label'] = __('More Sites', SITE_CATEGORIES_I18N_DOMAIN);
             }
         }
         restore_current_blog();
         if (!function_exists('get_blog_avatar')) {
             $instance['icon_show'] = false;
         } else {
             $default_icon_src = $site_categories->get_default_category_icon_url();
         }
         if (isset($data['sites']) && count($data['sites'])) {
             foreach ($data['sites'] as $idx => $site) {
                 if (isset($instance['icon_show']) && $instance['icon_show'] == true) {
                     $icon_image_src = get_blog_avatar($site->blog_id, $instance['icon_size']);
                     if (!$icon_image_src || !strlen($icon_image_src)) {
                         $data['sites'][$idx]->icon_image_src = $default_icon_src;
                     } else {
                         $data['sites'][$idx]->icon_image_src = $icon_image_src;
                     }
                 }
             }
         }
         set_site_transient('site-categories-sites-data-' . $this->number, $data, 30);
     }
     $categories_content = apply_filters('categories_widget_list_sites_display', '', $data, $instance);
     if (strlen($categories_content)) {
         echo $before_widget;
         $title = apply_filters('widget_title', $instance['title']);
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo $categories_content;
         echo $after_widget;
     }
 }