Dotclear


Ignore:
Timestamp:
02/27/13 11:48:32 (13 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

Location:
plugins/widgets
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/_default_widgets.php

    r851 r1107  
    1818$__widgets = new dcWidgets; 
    1919 
    20 $__widgets->create('search',__('Search engine'),array('defaultWidgets','search')); 
     20$__widgets->create('search',__('Search engine'),array('defaultWidgets','search'),null,'Search engine form'); 
    2121$__widgets->search->setting('title',__('Title:'),__('Search')); 
     22$__widgets->search->setting('homeonly',__('Display on:'),0,'combo', 
     23     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     24$__widgets->search->setting('content_only',__('Content only'),0,'check'); 
     25$__widgets->search->setting('class',__('CSS class:'),''); 
    2226 
    23 $__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation')); 
     27$__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation'),null,'List of navigation links'); 
    2428$__widgets->navigation->setting('title',__('Title:'),''); 
     29$__widgets->navigation->setting('homeonly',__('Display on:'),0,'combo', 
     30     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     31$__widgets->navigation->setting('content_only',__('Content only'),0,'check'); 
     32$__widgets->navigation->setting('class',__('CSS class:'),''); 
    2533 
    26 $__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof')); 
     34$__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof'),null,'List of selected entries'); 
    2735$__widgets->bestof->setting('title',__('Title:'),__('Best of me')); 
    2836$__widgets->bestof->setting('orderby',__('Sort:'),'asc','combo',array(__('Ascending') => 'asc', __('Descending') => 'desc')); 
    29 $__widgets->bestof->setting('homeonly',__('Home page only'),1,'check'); 
     37$__widgets->bestof->setting('homeonly',__('Display on:'),1,'combo', 
     38     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     39$__widgets->bestof->setting('content_only',__('Content only'),0,'check'); 
     40$__widgets->bestof->setting('class',__('CSS class:'),''); 
    3041 
    31 $__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs')); 
     42$__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs'),null,'List of available languages'); 
    3243$__widgets->langs->setting('title',__('Title:'),__('Languages')); 
    33 $__widgets->langs->setting('homeonly',__('Home page only'),1,'check'); 
     44$__widgets->langs->setting('homeonly',__('Display on:'),1,'combo', 
     45     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     46$__widgets->langs->setting('content_only',__('Content only'),0,'check'); 
     47$__widgets->langs->setting('class',__('CSS class:'),''); 
    3448 
    35 $__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe')); 
     49 
     50$__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe'),null,'RSS or Atom feed subscription links'); 
    3651$__widgets->subscribe->setting('title',__('Title:'),__('Subscribe')); 
    3752$__widgets->subscribe->setting('type',__('Feeds type:'),'atom','combo',array('Atom' => 'atom', 'RSS' => 'rss2')); 
    38 $__widgets->subscribe->setting('homeonly',__('Home page only'),0,'check'); 
     53$__widgets->subscribe->setting('homeonly',__('Display on:'),1,'combo', 
     54     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     55$__widgets->subscribe->setting('content_only',__('Content only'),0,'check'); 
     56$__widgets->subscribe->setting('class',__('CSS class:'),''); 
    3957 
    40 $__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed')); 
     58$__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed'); 
    4159$__widgets->feed->setting('title',__('Title:'),__('Somewhere else')); 
    4260$__widgets->feed->setting('url',__('Feed URL:'),''); 
    4361$__widgets->feed->setting('limit',__('Entries limit:'),10); 
    44 $__widgets->feed->setting('homeonly',__('Home page only'),1,'check'); 
     62$__widgets->feed->setting('homeonly',__('Display on:'),1,'combo', 
     63     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     64$__widgets->feed->setting('content_only',__('Content only'),0,'check'); 
     65$__widgets->feed->setting('class',__('CSS class:'),''); 
    4566 
    46 $__widgets->create('text',__('Text'),array('defaultWidgets','text')); 
     67$__widgets->create('text',__('Text'),array('defaultWidgets','text'),null,'Simple text'); 
    4768$__widgets->text->setting('title',__('Title:'),''); 
    4869$__widgets->text->setting('text',__('Text:'),'','textarea'); 
    49 $__widgets->text->setting('homeonly',__('Home page only'),0,'check'); 
     70$__widgets->text->setting('homeonly',__('Display on:'),0,'combo', 
     71     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     72$__widgets->text->setting('content_only',__('Content only'),0,'check'); 
     73$__widgets->text->setting('class',__('CSS class:'),''); 
    5074 
    51 $__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts')); 
     75$__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts'),null,'List of last entries published'); 
    5276$__widgets->lastposts->setting('title',__('Title:'),__('Last entries')); 
    5377if ($core->plugins->moduleExists('tags')) { 
     
    5579} 
    5680$__widgets->lastposts->setting('limit',__('Entries limit:'),10); 
    57 $__widgets->lastposts->setting('homeonly',__('Home page only'),1,'check'); 
     81$__widgets->lastposts->setting('homeonly',__('Display on:'),1,'combo', 
     82     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
     83$__widgets->lastposts->setting('content_only',__('Content only'),0,'check'); 
     84$__widgets->lastposts->setting('class',__('CSS class:'),''); 
    5885 
    59  
    60 $__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments')); 
    61 $__widgets->lastcomments->setting('title',__('Title:'),__('Last comments')); 
    62 $__widgets->lastcomments->setting('limit',__('Comments limit:'),10); 
    63 $__widgets->lastcomments->setting('homeonly',__('Home page only'),1,'check'); 
    6486 
    6587# --BEHAVIOR-- initWidgets 
  • plugins/widgets/_default_widgets.php

    r1063 r1107  
    4747$__widgets->langs->setting('class',__('CSS class:'),''); 
    4848 
    49 $__widgets->create('categories',__('Categories list'),array('defaultWidgets','categories'),null,'List of categories'); 
    50 $__widgets->categories->setting('title',__('Title:'),__('Categories')); 
    51 $__widgets->categories->setting('postcount',__('With entries counts'),0,'check'); 
    52 $__widgets->categories->setting('homeonly',__('Display on:'),0,'combo', 
    53      array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    54 $__widgets->categories->setting('content_only',__('Content only'),0,'check'); 
    55 $__widgets->categories->setting('class',__('CSS class:'),''); 
    5649 
    5750$__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe'),null,'RSS or Atom feed subscription links'); 
     
    8275$__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts'),null,'List of last entries published'); 
    8376$__widgets->lastposts->setting('title',__('Title:'),__('Last entries')); 
    84 $rs = $core->blog->getCategories(array('post_type'=>'post')); 
    85 $categories = array('' => '', __('Uncategorized') => 'null'); 
    86 while ($rs->fetch()) { 
    87      $categories[str_repeat('  ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title)] = $rs->cat_id; 
    88 } 
    89 $__widgets->lastposts->setting('category',__('Category:'),'','combo',$categories); 
    90 unset($rs,$categories); 
    9177if ($core->plugins->moduleExists('tags')) { 
    9278     $__widgets->lastposts->setting('tag',__('Tag:'),''); 
     
    9884$__widgets->lastposts->setting('class',__('CSS class:'),''); 
    9985 
    100 $__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments'),null,'List of last comments posted'); 
    101 $__widgets->lastcomments->setting('title',__('Title:'),__('Last comments')); 
    102 $__widgets->lastcomments->setting('limit',__('Comments limit:'),10); 
    103 $__widgets->lastcomments->setting('homeonly',__('Display on:'),1,'combo', 
    104      array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    105 $__widgets->lastcomments->setting('content_only',__('Content only'),0,'check'); 
    106 $__widgets->lastcomments->setting('class',__('CSS class:'),''); 
    10786 
    10887# --BEHAVIOR-- initWidgets 
     
    11695$__default_widgets['nav']->append($__widgets->navigation); 
    11796$__default_widgets['nav']->append($__widgets->bestof); 
    118 $__default_widgets['nav']->append($__widgets->categories); 
    11997$__default_widgets['extra']->append($__widgets->subscribe); 
    12098 
  • 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