Hello, Question existencielle : au plus je vois les spécificités mustek/currywurst fleurir dans le core et les plugins, au plus je me demande s'il ne faudrait pas définir des "propriétés" inhérentes au tplset lui-même.
Par exemple : * une propriété sur le langage de la page : xhtml / html5 * une propriété sur le niveau d'imbrication des titres de la sidebar * ... Propriétés qui pourraient être héritées par les thèmes, ces derniers pouvant éventuellement les surcharger, et qui seraient exploitées par le core/les plugins en lieu et place des tests actuels sur les tplsets. Z'en dites ? -- Bruno 2014-02-14 14:50 GMT+01:00 <[email protected]>: > Revision: 2662 (87748fd865ef} Branch: default Author: franck Date: > 2014-02-14 > 14:49 +0100 Details: Details: > http://dev.dotclear.org/2.0/changeset/87748fd865ef<http://dev.dotclear.org/2.0/changeset/87748fd865ef> > Log > Message > > New rendering method (renderTitle) for widget title, fixes #1827 > > > diffstat: > > plugins/blogroll/_define.php | 2 +- > plugins/blogroll/_public.php | 2 +- > plugins/pages/_define.php | 2 +- > plugins/pages/_public.php | 2 +- > plugins/simpleMenu/_define.php | 2 +- > plugins/simpleMenu/_public.php | 2 +- > plugins/tags/_define.php | 2 +- > plugins/tags/_public.php | 2 +- > plugins/widgets/_define.php | 2 +- > plugins/widgets/_widgets_functions.php | 20 ++++++++++---------- > plugins/widgets/class.widgets.php | 26 ++++++++++++++++++++++++++ > 11 files changed, 45 insertions(+), 19 deletions(-) > > diffs (237 lines): > > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/blogroll/_define.php > --- a/plugins/blogroll/_define.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/blogroll/_define.php Fri Feb 14 14:49:43 2014 +0100 > @@ -15,7 +15,7 @@ > /* Name */ "Blogroll", > /* Description*/ "Manage your blogroll", > /* Author */ "Olivier Meunier", > - /* Version */ '1.3.1', > + /* Version */ '1.4', > array( > 'permissions' => 'blogroll', > 'type' => 'plugin' > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/blogroll/_public.php > --- a/plugins/blogroll/_public.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/blogroll/_public.php Fri Feb 14 14:49:43 2014 +0100 > @@ -152,7 +152,7 @@ > > return > ($w->content_only ? '' : '<div class="links'.($w->class ? > ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > $links. > ($w->content_only ? '' : '</div>'); > } > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/pages/_define.php > --- a/plugins/pages/_define.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/pages/_define.php Fri Feb 14 14:49:43 2014 +0100 > @@ -15,7 +15,7 @@ > /* Name */ "Pages", > /* Description*/ "Serve entries as simple web pages", > /* Author */ "Olivier Meunier", > - /* Version */ '1.3', > + /* Version */ '1.4', > array( > 'permissions' => 'contentadmin,pages', > 'priority' => 999, > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/pages/_public.php > --- a/plugins/pages/_public.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/pages/_public.php Fri Feb 14 14:49:43 2014 +0100 > @@ -269,7 +269,7 @@ > > $res = > ($w->content_only ? '' : '<div class="pages'.($w->class ? > ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > while ($rs->fetch()) { > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/simpleMenu/_define.php > --- a/plugins/simpleMenu/_define.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/simpleMenu/_define.php Fri Feb 14 14:49:43 2014 +0100 > @@ -15,7 +15,7 @@ > /* Name */ "simpleMenu", > /* Description*/ "Simple menu for Dotclear", > /* Author */ "Franck Paul", > - /* Version */ '1.1.2', > + /* Version */ '1.2', > array( > 'permissions' => 'admin', > 'type' => 'plugin' > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/simpleMenu/_public.php > --- a/plugins/simpleMenu/_public.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/simpleMenu/_public.php Fri Feb 14 14:49:43 2014 +0100 > @@ -53,7 +53,7 @@ > > return > ($w->content_only ? '' : '<div > class="simple-menu'.($w->class ? ' '.html::escapeHTML($w->class) : > '').'">'). > - ($w->title ? > '<h2>'.html::escapeHTML($w->title).'</h2>' : '').$menu. > + ($w->title ? > $w->renderTitle(html::escapeHTML($w->title)) : '').$menu. > ($w->content_only ? '' : '</div>'); > } > > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/tags/_define.php > --- a/plugins/tags/_define.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/tags/_define.php Fri Feb 14 14:49:43 2014 +0100 > @@ -15,7 +15,7 @@ > /* Name */ "Tags", > /* Description*/ "Tags for posts", > /* Author */ "Olivier Meunier", > - /* Version */ '1.2.1', > + /* Version */ '1.3', > array( > 'permissions' => 'usage,contentadmin', > 'priority' => 998, > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/tags/_public.php > --- a/plugins/tags/_public.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/tags/_public.php Fri Feb 14 14:49:43 2014 +0100 > @@ -267,7 +267,7 @@ > > $res = > ($w->content_only ? '' : '<div class="tags'.($w->class ? ' > '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > if ($core->url->type == 'post' && $_ctx->posts instanceof > record) { > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/widgets/_define.php > --- a/plugins/widgets/_define.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/widgets/_define.php Fri Feb 14 14:49:43 2014 +0100 > @@ -15,7 +15,7 @@ > /* Name */ "Widgets", > /* Description*/ "Widgets for your blog sidebars", > /* Author */ "Olivier Meunier & Dotclear Team", > - /* Version */ '3.1', > + /* Version */ '3.2', > array( > 'permissions' => 'admin', > 'priority' => 1000000000, > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/widgets/_widgets_functions.php > --- a/plugins/widgets/_widgets_functions.php Fri Feb 14 14:05:41 2014 > +0100 > +++ b/plugins/widgets/_widgets_functions.php Fri Feb 14 14:49:43 2014 > +0100 > @@ -27,7 +27,7 @@ > > return > ($w->content_only ? '' : '<div id="search"'.($w->class ? ' > class="'.html::escapeHTML($w->class).'"' : '').'>'). > - ($w->title ? '<h2><label > for="q">'.html::escapeHTML($w->title).'</label></h2>' : ''). > + ($w->title ? $w->renderTitle('<label > for="q">'.html::escapeHTML($w->title).'</label>') : ''). > '<form action="'.$core->blog->url.'" method="get" > role="search">'. > '<fieldset>'. > '<p><input type="text" size="10" maxlength="255" id="q" > name="q" value="'.$value.'" /> '. > @@ -48,7 +48,7 @@ > > $res = > ($w->content_only ? '' : '<div id="topnav"'.($w->class ? ' > class="'.html::escapeHTML($w->class).'"' : '').'>'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul role="navigation">'; > > if ($core->url->type != 'default') { > @@ -84,7 +84,7 @@ > > $res = > ($w->content_only ? '' : '<div > class="categories'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''); > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''); > > $ref_level = $level = $rs->level-1; > while ($rs->fetch()) > @@ -145,7 +145,7 @@ > > $res = > ($w->content_only ? '' : '<div class="selected'.($w->class > ? ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > while ($rs->fetch()) { > @@ -179,7 +179,7 @@ > $langs = l10n::getISOcodes(); > $res = > ($w->content_only ? '' : '<div class="langs'.($w->class ? > ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > while ($rs->fetch()) > @@ -219,7 +219,7 @@ > > $res = > ($w->content_only ? '' : '<div > class="syndicate'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > $res .= > @@ -268,7 +268,7 @@ > > $res = > ($w->content_only ? '' : '<div class="feed'.($w->class ? ' > '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > $i = 0; > @@ -308,7 +308,7 @@ > > $res = > ($w->content_only ? '' : '<div class="text'.($w->class ? ' > '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > $w->text. > ($w->content_only ? '' : '</div>'); > > @@ -355,7 +355,7 @@ > > $res = > ($w->content_only ? '' : '<div > class="lastposts'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > while ($rs->fetch()) { > @@ -390,7 +390,7 @@ > } > > $res = ($w->content_only ? '' : '<div > class="lastcomments'.($w->class ? ' '.html::escapeHTML($w->class) : > '').'">'). > - ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : > ''). > + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) > : ''). > '<ul>'; > > while ($rs->fetch()) > diff -r 86631ca0a3c4 -r 87748fd865ef plugins/widgets/class.widgets.php > --- a/plugins/widgets/class.widgets.php Fri Feb 14 14:05:41 2014 +0100 > +++ b/plugins/widgets/class.widgets.php Fri Feb 14 14:49:43 2014 +0100 > @@ -184,6 +184,32 @@ > return '<p>Callback not found for widget > '.$this->id.'</p>'; > } > > + /* Widget rendering tool > + --------------------------------------------------- */ > + public function renderTitle($title) > + { > + global $core; > + > + if (!$title) { > + return ''; > + } > + > + $wtscheme = > $core->themes->moduleInfo($core->blog->settings->system->theme,'widgettitleformat'); > + if (empty($wtscheme)) { > + $tplset = > $core->themes->moduleInfo($core->blog->settings->system->theme,'tplset'); > + if (empty($tplset) || $tplset == > DC_DEFAULT_TPLSET) { > + // Use H2 for mustek based themes > + $wtscheme = '<h2>%s</h2>'; > + } else { > + // Use H3 for currywurst based themes > + $wtscheme = '<h3>%s</h3>'; > + } > + } > + $ret = sprintf($wtscheme,$title); > + > + return $ret; > + } > + > /* Widget settings > --------------------------------------------------- */ > public function __get($n) > -- > Tracker mailing list - [email protected] - > http://ml.dotclear.net/listinfo/tracker > -- Dev mailing list - [email protected] - http://ml.dotclear.org/listinfo/dev
