Dotclear


Ignore:
Timestamp:
02/27/13 11:48:32 (12 years ago)
Author:
JcDenis
Branch:
sexy
Parents:
880:02c78f56f430 (diff), 1105:ce855d61f9ce (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with default branch in 2.5-RC

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/_widgets_functions.php

    r851 r1107  
    1818          global $core; 
    1919           
     20          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     21               ($w->homeonly == 2 && $core->url->type == 'default')) { 
     22               return; 
     23          } 
     24 
    2025          $value = isset($GLOBALS['_search']) ? html::escapeHTML($GLOBALS['_search']) : ''; 
    2126           
    2227          return 
    23           '<div id="search">'. 
     28          ($w->content_only ? '' : '<div id="search"'.($w->class ? ' class="'.html::escapeHTML($w->class).'"' : '').'>'). 
    2429          ($w->title ? '<h2><label for="q">'.html::escapeHTML($w->title).'</label></h2>' : ''). 
    2530          '<form action="'.$core->blog->url.'" method="get">'. 
     
    2934          '</fieldset>'. 
    3035          '</form>'. 
    31           '</div>'; 
     36          ($w->content_only ? '' : '</div>'); 
    3237     } 
    3338      
     
    3641          global $core; 
    3742           
    38           $res = 
    39           '<div id="topnav">'. 
     43          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     44               ($w->homeonly == 2 && $core->url->type == 'default')) { 
     45               return; 
     46          } 
     47 
     48          $res = 
     49          ($w->content_only ? '' : '<div id="topnav"'.($w->class ? ' class="'.html::escapeHTML($w->class).'"' : '').'>'). 
    4050          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    4151          '<ul>'; 
     
    5363          __('Archives').'</a></li>'. 
    5464          '</ul>'. 
    55           '</div>'; 
    56            
    57           return $res; 
    58      } 
    59       
     65          ($w->content_only ? '' : '</div>'); 
     66           
     67          return $res; 
     68     } 
     69      
     70 
    6071     public static function bestof($w) 
    6172     { 
    6273          global $core; 
    6374           
    64           if ($w->homeonly && $core->url->type != 'default') { 
     75          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     76               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    6577               return; 
    6678          } 
     
    7991           
    8092          $res = 
    81           '<div class="selected">'. 
     93          ($w->content_only ? '' : '<div class="selected'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    8294          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    8395          '<ul>'; 
     
    8799          } 
    88100           
    89           $res .= '</ul></div>'; 
     101          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
    90102           
    91103          return $res; 
     
    96108          global $core, $_ctx; 
    97109           
    98           if ($w->homeonly && $core->url->type != 'default' && $core->url->type != 'lang') { 
     110          if (($w->homeonly == 1 && $core->url->type != 'default' && $core->url->type != 'lang') || 
     111               ($w->homeonly == 2 && ($core->url->type == 'default' || $core->url->type == 'lang'))) { 
    99112               return; 
    100113          } 
     
    108121          $langs = l10n::getISOcodes(); 
    109122          $res = 
    110           '<div class="langs">'. 
     123          ($w->content_only ? '' : '<div class="langs'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    111124          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    112125          '<ul>'; 
     
    127140          } 
    128141           
    129           $res .= '</ul></div>'; 
     142          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
    130143           
    131144          return $res; 
     
    136149          global $core; 
    137150           
    138           if ($w->homeonly && $core->url->type != 'default') { 
     151          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     152               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    139153               return; 
    140154          } 
     
    144158           
    145159          $p_title = __('This blog\'s entries %s feed'); 
    146           $c_title = __('This blog\'s comments %s feed'); 
    147            
    148           $res = 
    149           '<div class="syndicate">'. 
     160           
     161          $res = 
     162          ($w->content_only ? '' : '<div class="syndicate'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    150163          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    151164          '<ul>'; 
     
    157170          __('Entries feed').'</a></li>'; 
    158171           
    159           if ($core->blog->settings->system->allow_comments || $core->blog->settings->system->allow_trackbacks) 
    160           { 
    161                $res .= 
    162                '<li><a type="'.$mime.'" '. 
    163                'href="'.$core->blog->url.$core->url->getURLFor('feed',$type.'/comments').'" '. 
    164                'title="'.sprintf($c_title,($type == 'atom' ? 'Atom' : 'RSS')).'" class="feed">'. 
    165                __('Comments feed').'</a></li>'; 
    166           } 
    167            
    168           $res .= '</ul></div>'; 
     172          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
    169173           
    170174          return $res; 
     
    179183          global $core; 
    180184           
    181           if ($w->homeonly && $core->url->type != 'default') { 
     185          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     186               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    182187               return; 
    183188          } 
     
    195200           
    196201          $res = 
    197           '<div class="feed">'. 
     202          ($w->content_only ? '' : '<div class="feed'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    198203          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    199204          '<ul>'; 
     
    201206          $i = 0; 
    202207          foreach ($feed->items as $item) { 
    203                $li = isset($item->link) ? '<a href="'.html::escapeHTML($item->link).'">'.$item->title.'</a>' : $item->title; 
     208               $title = isset($item->title) && strlen(trim($item->title)) ? $item->title : ''; 
     209               $link = isset($item->link) && strlen(trim($item->link)) ? $item->link : ''; 
     210                
     211               if (!$link && !$title) { 
     212                    continue; 
     213               } 
     214                
     215               if (!$title) { 
     216                    $title = substr($link,0,25).'...'; 
     217               } 
     218                
     219               $li = $link ? '<a href="'.html::escapeHTML($item->link).'">'.$title.'</a>' : $title; 
    204220               $res .= ' <li>'.$li.'</li> '; 
    205221               $i++; 
     
    209225          } 
    210226           
    211           $res .= '</ul></div>'; 
     227          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
    212228           
    213229          return $res; 
     
    218234          global $core; 
    219235           
    220           if ($w->homeonly && $core->url->type != 'default') { 
    221                return; 
    222           } 
    223            
    224           $res = 
    225           '<div class="text">'. 
     236          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     237               ($w->homeonly == 2 && $core->url->type == 'default')) { 
     238               return; 
     239          } 
     240           
     241          $res = 
     242          ($w->content_only ? '' : '<div class="text'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    226243          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    227244          $w->text. 
    228           '</div>'; 
     245          ($w->content_only ? '' : '</div>'); 
    229246           
    230247          return $res; 
     
    235252          global $core; 
    236253           
    237           if ($w->homeonly && $core->url->type != 'default') { 
     254          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     255               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    238256               return; 
    239257          } 
     
    258276           
    259277          $res = 
    260           '<div class="lastposts">'. 
     278          ($w->content_only ? '' : '<div class="lastposts'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    261279          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    262280          '<ul>'; 
     
    267285          } 
    268286           
    269           $res .= '</ul></div>'; 
     287          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
    270288           
    271289          return $res; 
     
    276294          global $core; 
    277295           
    278           if ($w->homeonly && $core->url->type != 'default') { 
     296          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     297               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    279298               return; 
    280299          } 
     
    288307          } 
    289308           
    290           $res = '<div class="lastcomments">'. 
     309          $res = ($w->content_only ? '' : '<div class="lastcomments'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    291310          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    292311          '<ul>'; 
     
    302321          } 
    303322           
    304           $res .= '</ul></div>'; 
     323          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
    305324           
    306325          return $res; 
  • plugins/widgets/_widgets_functions.php

    r1063 r1107  
    6868     } 
    6969      
    70      public static function categories($w) 
    71      { 
    72           global $core, $_ctx; 
    73            
    74           if (($w->homeonly == 1 && $core->url->type != 'default') || 
    75                ($w->homeonly == 2 && $core->url->type == 'default')) { 
    76                return; 
    77           } 
    7870 
    79           $rs = $core->blog->getCategories(array('post_type'=>'post')); 
    80           if ($rs->isEmpty()) { 
    81                return; 
    82           } 
    83            
    84           $res = 
    85           ($w->content_only ? '' : '<div class="categories'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    86           ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''); 
    87            
    88           $ref_level = $level = $rs->level-1; 
    89           while ($rs->fetch()) 
    90           { 
    91                $class = ''; 
    92                if (($core->url->type == 'category' && $_ctx->categories instanceof record && $_ctx->categories->cat_id == $rs->cat_id) 
    93                || ($core->url->type == 'post' && $_ctx->posts instanceof record && $_ctx->posts->cat_id == $rs->cat_id)) { 
    94                     $class = ' class="category-current"'; 
    95                } 
    96                 
    97                if ($rs->level > $level) { 
    98                     $res .= str_repeat('<ul><li'.$class.'>',$rs->level - $level); 
    99                } elseif ($rs->level < $level) { 
    100                     $res .= str_repeat('</li></ul>',-($rs->level - $level)); 
    101                } 
    102                 
    103                if ($rs->level <= $level) { 
    104                     $res .= '</li><li'.$class.'>'; 
    105                } 
    106                 
    107                $res .= 
    108                '<a href="'.$core->blog->url.$core->url->getURLFor('category', $rs->cat_url).'">'. 
    109                html::escapeHTML($rs->cat_title).'</a>'. 
    110                ($w->postcount ? ' <span>('.$rs->nb_post.')</span>' : ''); 
    111                 
    112                 
    113                $level = $rs->level; 
    114           } 
    115            
    116           if ($ref_level - $level < 0) { 
    117                $res .= str_repeat('</li></ul>',-($ref_level - $level)); 
    118           } 
    119           $res .= ($w->content_only ? '' : '</div>'); 
    120            
    121           return $res; 
    122      } 
    123       
    12471     public static function bestof($w) 
    12572     { 
     
    211158           
    212159          $p_title = __('This blog\'s entries %s feed'); 
    213           $c_title = __('This blog\'s comments %s feed'); 
    214160           
    215161          $res = 
     
    223169          'title="'.sprintf($p_title,($type == 'atom' ? 'Atom' : 'RSS')).'" class="feed">'. 
    224170          __('Entries feed').'</a></li>'; 
    225            
    226           if ($core->blog->settings->system->allow_comments || $core->blog->settings->system->allow_trackbacks) 
    227           { 
    228                $res .= 
    229                '<li><a type="'.$mime.'" '. 
    230                'href="'.$core->blog->url.$core->url->getURLFor('feed',$type.'/comments').'" '. 
    231                'title="'.sprintf($c_title,($type == 'atom' ? 'Atom' : 'RSS')).'" class="feed">'. 
    232                __('Comments feed').'</a></li>'; 
    233           } 
    234171           
    235172          $res .= '</ul>'.($w->content_only ? '' : '</div>'); 
     
    323260          $params['order'] = 'post_dt desc'; 
    324261          $params['no_content'] = true; 
    325            
    326           if ($w->category) 
    327           { 
    328                if ($w->category == 'null') { 
    329                     $params['sql'] = ' AND P.cat_id IS NULL '; 
    330                } elseif (is_numeric($w->category)) { 
    331                     $params['cat_id'] = (integer) $w->category; 
    332                } else { 
    333                     $params['cat_url'] = $w->category; 
    334                } 
    335           } 
    336262           
    337263          if ($w->tag) 
Note: See TracChangeset for help on using the changeset viewer.

Sites map