Dotclear


Ignore:
Timestamp:
07/31/12 13:52:11 (13 years ago)
Author:
Dsls <dsls@…>
Branch:
sexy
Message:

sexy step 2 : no more cats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/_widgets_functions.php

    r776 r851  
    5858     } 
    5959      
    60      public static function categories($w) 
    61      { 
    62           global $core, $_ctx; 
    63            
    64           $rs = $core->blog->getCategories(array('post_type'=>'post')); 
    65           if ($rs->isEmpty()) { 
    66                return; 
    67           } 
    68            
    69           $res = 
    70           '<div class="categories">'. 
    71           ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''); 
    72            
    73           $ref_level = $level = $rs->level-1; 
    74           while ($rs->fetch()) 
    75           { 
    76                $class = ''; 
    77                if (($core->url->type == 'category' && $_ctx->categories instanceof record && $_ctx->categories->cat_id == $rs->cat_id) 
    78                || ($core->url->type == 'post' && $_ctx->posts instanceof record && $_ctx->posts->cat_id == $rs->cat_id)) { 
    79                     $class = ' class="category-current"'; 
    80                } 
    81                 
    82                if ($rs->level > $level) { 
    83                     $res .= str_repeat('<ul><li'.$class.'>',$rs->level - $level); 
    84                } elseif ($rs->level < $level) { 
    85                     $res .= str_repeat('</li></ul>',-($rs->level - $level)); 
    86                } 
    87                 
    88                if ($rs->level <= $level) { 
    89                     $res .= '</li><li'.$class.'>'; 
    90                } 
    91                 
    92                $res .= 
    93                '<a href="'.$core->blog->url.$core->url->getURLFor('category', $rs->cat_url).'">'. 
    94                html::escapeHTML($rs->cat_title).'</a>'. 
    95                ($w->postcount ? ' <span>('.$rs->nb_post.')</span>' : ''); 
    96                 
    97                 
    98                $level = $rs->level; 
    99           } 
    100            
    101           if ($ref_level - $level < 0) { 
    102                $res .= str_repeat('</li></ul>',-($ref_level - $level)); 
    103           } 
    104           $res .= '</div>'; 
    105            
    106           return $res; 
    107      } 
    108       
    10960     public static function bestof($w) 
    11061     { 
     
    292243          $params['no_content'] = true; 
    293244           
    294           if ($w->category) 
    295           { 
    296                if ($w->category == 'null') { 
    297                     $params['sql'] = ' AND P.cat_id IS NULL '; 
    298                } elseif (is_numeric($w->category)) { 
    299                     $params['cat_id'] = (integer) $w->category; 
    300                } else { 
    301                     $params['cat_url'] = $w->category; 
    302                } 
    303           } 
    304            
    305245          if ($w->tag) 
    306246          { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map