Dotclear


Ignore:
Timestamp:
11/17/13 20:25:53 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Children:
2567:6c11245cbf04, 2568:61c67a7d17fa
Message:

Add some people in CREDITS, remove trailing spaces and tabs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/blogroll/_public.php

    r1179 r2566  
    2727          $block='<ul>%s</ul>'; 
    2828          $item='<li%2$s>%1$s</li>'; 
    29            
     29 
    3030          if (isset($attr['category'])) { 
    3131               $category = addslashes($attr['category']); 
    3232          } 
    33            
     33 
    3434          if (isset($attr['block'])) { 
    3535               $block = addslashes($attr['block']); 
    3636          } 
    37            
     37 
    3838          if (isset($attr['item'])) { 
    3939               $item = addslashes($attr['item']); 
    4040          } 
    41            
     41 
    4242          $only_cat = 'null'; 
    4343          if (!empty($attr['only_category'])) { 
    4444               $only_cat = "'".addslashes($attr['only_category'])."'"; 
    4545          } 
    46            
     46 
    4747          return 
    4848          '<?php '. 
     
    5050          '?>'; 
    5151     } 
    52       
     52 
    5353     public static function blogrollXbelLink($attr) 
    5454     { 
     
    5656          return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getURLFor("xbel")').'; ?>'; 
    5757     } 
    58       
     58 
    5959     public static function getList($cat_title='<h3>%s</h3>',$block='<ul>%s</ul>',$item='<li>%s</li>',$category=null) 
    6060     { 
    6161          $blogroll = new dcBlogroll($GLOBALS['core']->blog); 
    62            
     62 
    6363          try { 
    6464               $links = $blogroll->getLinks(); 
     
    6666               return false; 
    6767          } 
    68            
     68 
    6969          $res = ''; 
    70            
     70 
    7171          $hierarchy = $blogroll->getLinksHierarchy($links); 
    72            
     72 
    7373          if ($category) { 
    7474               if (!isset($hierarchy[$category])) { 
     
    7777               $hierarchy = array($hierarchy[$category]); 
    7878          } 
    79            
     79 
    8080          foreach ($hierarchy as $k => $v) 
    8181          { 
     
    8383                    $res .= sprintf($cat_title,html::escapeHTML($k))."\n"; 
    8484               } 
    85                 
     85 
    8686               $res .= self::getLinksList($v,$block,$item); 
    8787          } 
    88            
     88 
    8989          return $res; 
    9090     } 
    91       
     91 
    9292     private static function getLinksList($links,$block='<ul>%s</ul>',$item='<li%2$s>%1$s</li>') 
    9393     { 
    9494          $list = ''; 
    95            
     95 
    9696          # Find current link item if any 
    9797          $current = -1; 
    9898          $current_size = 0; 
    9999          $self_uri = http::getSelfURI(); 
    100            
     100 
    101101          foreach ($links as $k => $v) 
    102102          { 
     
    109109               } 
    110110          } 
    111            
     111 
    112112          foreach ($links as $k => $v) 
    113113          { 
     
    117117               $lang  = $v['link_lang']; 
    118118               $xfn = $v['link_xfn']; 
    119                 
     119 
    120120               $link = 
    121121               '<a href="'.html::escapeHTML($href).'"'. 
     
    126126               html::escapeHTML($title). 
    127127               '</a>'; 
    128                 
     128 
    129129               $current_class = $current == $k ? ' class="active"' : ''; 
    130                 
     130 
    131131               $list .= sprintf($item,$link,$current_class)."\n"; 
    132132          } 
    133            
     133 
    134134          return sprintf($block,$list)."\n"; 
    135135     } 
    136       
     136 
    137137     # Widget function 
    138138     public static function linksWidget($w) 
    139139     { 
    140140          global $core; 
    141            
     141 
    142142          if (($w->homeonly == 1 && $core->url->type != 'default') || 
    143143               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    144144               return; 
    145145          } 
    146            
     146 
    147147          $links = self::getList('<h3>%s</h3>','<ul>%s</ul>','<li%2$s>%1$s</li>',$w->category); 
    148            
     148 
    149149          if (empty($links)) { 
    150150               return; 
    151151          } 
    152            
     152 
    153153          return 
    154154          ($w->content_only ? '' : '<div class="links'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
     
    164164     { 
    165165          $blogroll = new dcBlogroll($GLOBALS['core']->blog); 
    166            
     166 
    167167          try { 
    168168               $links = $blogroll->getLinks(); 
     
    171171               return; 
    172172          } 
    173            
     173 
    174174          if ($args) { 
    175175               self::p404(); 
    176176               return; 
    177177          } 
    178            
     178 
    179179          http::cache($GLOBALS['mod_files'],$GLOBALS['mod_ts']); 
    180            
     180 
    181181          header('Content-Type: text/xml; charset=UTF-8'); 
    182            
     182 
    183183          echo 
    184184          '<?xml version="1.0" encoding="UTF-8"?>'."\n". 
     
    188188          '<xbel version="1.0">'."\n". 
    189189          '<title>'.html::escapeHTML($GLOBALS['core']->blog->name)." blogroll</title>\n"; 
    190            
     190 
    191191          $i = 1; 
    192192          foreach ($blogroll->getLinksHierarchy($links) as $cat_title => $links) 
     
    197197                    "<title>".html::escapeHTML($cat_title)."</title>\n"; 
    198198               } 
    199                 
     199 
    200200               foreach ($links as $k => $v) 
    201201               { 
    202202                    $lang = $v['link_lang'] ? ' xml:lang="'.$v['link_lang'].'"' : ''; 
    203                      
     203 
    204204                    echo 
    205205                    '<bookmark href="'.$v['link_href'].'"'.$lang.'>'."\n". 
    206206                    '<title>'.html::escapeHTML($v['link_title'])."</title>\n"; 
    207                      
     207 
    208208                    if ($v['link_desc']) { 
    209209                         echo '<desc>'.html::escapeHTML($v['link_desc'])."</desc>\n"; 
    210210                    } 
    211                      
     211 
    212212                    if ($v['link_xfn']) { 
    213213                         echo 
     
    216216                         "</info>\n"; 
    217217                    } 
    218                      
     218 
    219219                    echo 
    220220                    "</bookmark>\n"; 
    221221               } 
    222                 
     222 
    223223               if ($cat_title != '') { 
    224224                    echo "</folder>\n"; 
    225225               } 
    226                 
     226 
    227227               $i++; 
    228228          } 
    229            
     229 
    230230          echo 
    231231          '</xbel>'; 
    232232     } 
    233233} 
    234 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map