Dotclear

source: themes/ductile/_config.php @ 2581:d0699826aef9

Revision 2581:d0699826aef9, 23.8 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Adapt Ductile to cope with nb of entries on home pages, addresses #1269

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3# This file is part of Ductile, a theme for Dotclear
4#
5# Copyright (c) 2011 - Association Dotclear
6# Licensed under the GPL version 2.0 license.
7# See LICENSE file or
8# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9#
10# -- END LICENSE BLOCK -----------------------------------------
11if (!defined('DC_CONTEXT_ADMIN')) { return; }
12
13l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin');
14
15if (preg_match('#^http(s)?://#',$core->blog->settings->system->themes_url)) {
16     $img_url = http::concatURL($core->blog->settings->system->themes_url,'/'.$core->blog->settings->system->theme.'/img/');
17} else {
18     $img_url = http::concatURL($core->blog->url,$core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/');
19}
20$img_path = dirname(__FILE__).'/img/';
21
22$tpl_path = dirname(__FILE__).'/tpl/';
23
24$standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme,'standalone_config');
25
26// Load contextual help
27if (file_exists(dirname(__FILE__).'/locales/'.$_lang.'/resources.php')) {
28     require dirname(__FILE__).'/locales/'.$_lang.'/resources.php';
29}
30
31$list_types = array(
32     __('Title') => 'title',
33     __('Short') => 'short',
34     __('Full') => 'full'
35);
36// Get all _entry-*.html in tpl folder of theme
37$list_types_templates = files::scandir($tpl_path);
38if (is_array($list_types_templates)) {
39     foreach ($list_types_templates as $v) {
40          if (preg_match('/^_entry\-(.*)\.html$/',$v,$m)) {
41               if (isset($m[1])) {
42                    if (!in_array($m[1],$list_types)) {
43                         // template not already in full list
44                         $list_types[__($m[1])] = $m[1];
45                    }
46               }
47          }
48     }
49}
50
51$contexts = array(
52     'default' => __('Home (first page)'),
53     'default-page' => __('Home (other pages)'),
54     'category' => __('Entries for a category'),
55     'tag' => __('Entries for a tag'),
56     'search' => __('Search result entries'),
57     'archive' => __('Month archive entries')
58);
59
60$fonts = array(
61     __('Default') => '',
62     __('Ductile primary') => 'Ductile body',
63     __('Ductile secondary') => 'Ductile alternate',
64     __('Times New Roman') => 'Times New Roman',
65     __('Georgia') => 'Georgia',
66     __('Garamond') => 'Garamond',
67     __('Helvetica/Arial') => 'Helvetica/Arial',
68     __('Verdana') => 'Verdana',
69     __('Trebuchet MS') => 'Trebuchet MS',
70     __('Impact') => 'Impact',
71     __('Monospace') => 'Monospace'
72);
73
74$webfont_apis = array(
75     __('none') => '',
76     __('javascript (Adobe)') => 'js',
77     __('stylesheet (Google)') => 'css'
78);
79
80function adjustFontSize($s)
81{
82     if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$s,$m)) {
83          if (empty($m[2])) {
84               $m[2] = 'em';
85          }
86          return $m[1].$m[2];
87     }
88
89     return null;
90}
91
92$font_families = array(
93     // Theme standard
94     'Ductile body' => '"Century Schoolbook", "Century Schoolbook L", Georgia, serif',
95     'Ductile alternate' => '"Franklin gothic medium", "arial narrow", "DejaVu Sans Condensed", "helvetica neue", helvetica, sans-serif',
96
97     // Serif families
98     'Times New Roman' => 'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif',
99     'Georgia' => 'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif',
100     'Garamond' => '"Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif',
101
102     // Sans-serif families
103     'Helvetica/Arial' => 'Frutiger, "Frutiger Linotype", Univers, Calibri, "Gill Sans", "Gill Sans MT", "Myriad Pro", Myriad, "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif',
104     'Verdana' => 'Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif',
105     'Trebuchet MS' => '"Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif',
106
107     // Cursive families
108     'Impact' => 'Impact, Haettenschweiler, "Franklin Gothic Bold", Charcoal, "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif',
109
110     // Monospace families
111     'Monospace' => 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace'
112);
113
114function fontDef($c)
115{
116     global $font_families;
117
118     return isset($font_families[$c]) ? '<span style="position:absolute;top:0;left:32em;">'.$font_families[$c].'</span>' : '';
119}
120
121function adjustColor($c)
122{
123     if ($c === '') {
124          return '';
125     }
126
127     $c = strtoupper($c);
128
129     if (preg_match('/^[A-F0-9]{3,6}$/',$c)) {
130          $c = '#'.$c;
131     }
132
133     if (preg_match('/^#[A-F0-9]{6}$/',$c)) {
134          return $c;
135     }
136
137     if (preg_match('/^#[A-F0-9]{3,}$/',$c)) {
138          return '#'.substr($c,1,1).substr($c,1,1).substr($c,2,1).substr($c,2,1).substr($c,3,1).substr($c,3,1);
139     }
140
141     return '';
142}
143
144function computeContrastRatio($color,$background)
145{
146     // Compute contrast ratio between two colors
147
148     $color = adjustColor($color);
149     if (($color == '') || (strlen($color) != 7)) return 0;
150     $background = adjustColor($background);
151     if (($background == '') || (strlen($background) != 7)) return 0;
152
153     $l1 = (0.2126 * pow(hexdec(substr($color,1,2))/255,2.2)) +
154          (0.7152 * pow(hexdec(substr($color,3,2))/255,2.2)) +
155          (0.0722 * pow(hexdec(substr($color,5,2))/255,2.2));
156
157     $l2 = (0.2126 * pow(hexdec(substr($background,1,2))/255,2.2)) +
158          (0.7152 * pow(hexdec(substr($background,3,2))/255,2.2)) +
159          (0.0722 * pow(hexdec(substr($background,5,2))/255,2.2));
160
161     if ($l1 > $l2) {
162          $ratio = ($l1 + 0.05) / ($l2 + 0.05);
163     } else {
164          $ratio = ($l2 + 0.05) / ($l1 + 0.05);
165     }
166     return $ratio;
167}
168
169function contrastRatioLevel($ratio,$size,$bold)
170{
171     if ($size == '') {
172          return '';
173     }
174
175     // Eval font size in em (assume base font size in pixels equal to 16)
176     if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$size,$m)) {
177          if (empty($m[2])) {
178               $m[2] = 'em';
179          }
180     } else {
181          return '';
182     }
183     switch ($m[2]) {
184          case '%':
185               $s = (float) $m[1] / 100;
186               break;
187          case 'pt':
188               $s = (float) $m[1] / 12;
189               break;
190          case 'px':
191               $s = (float) $m[1] / 16;
192               break;
193          case 'em':
194               $s = (float) $m[1];
195               break;
196          case 'ex':
197               $s = (float) $m[1] / 2;
198               break;
199          default:
200               return '';
201     }
202
203     $large = ((($s > 1.5) && ($bold == false)) || (($s > 1.2) && ($bold == true)));
204
205     // Check ratio
206     if ($ratio > 7) {
207          return 'AAA';
208     } elseif (($ratio > 4.5) && $large) {
209          return 'AAA';
210     } elseif ($ratio > 4.5) {
211          return 'AA';
212     } elseif (($ratio > 3) && $large) {
213          return 'AA';
214     }
215     return '';
216}
217
218function contrastRatio($color,$background,$size='',$bold=false)
219{
220     if (($color != '') && ($background != '')) {
221          $ratio = computeContrastRatio($color,$background);
222          $level = contrastRatioLevel($ratio,$size,$bold);
223          return
224               '<span style="position:absolute;top:0;left:23em;">'.
225               sprintf(__('ratio %.1f'),$ratio).
226               ($level != '' ? ' '.sprintf(__('(%s)'),$level) : '').
227               '</span>';
228     }
229     return '';
230}
231
232$ductile_base = array(
233     // HTML
234     'subtitle_hidden' => null,
235     'logo_src' => null,
236     'preview_not_mandatory' => null,
237     // CSS
238     'body_font' => null,
239     'body_webfont_family' => null,
240     'body_webfont_url' => null,
241     'body_webfont_api' => null,
242     'alternate_font' => null,
243     'alternate_webfont_family' => null,
244     'alternate_webfont_url' => null,
245     'alternate_webfont_api' => null,
246     'blog_title_w' => null,
247     'blog_title_s' => null,
248     'blog_title_c' => null,
249     'post_title_w' => null,
250     'post_title_s' => null,
251     'post_title_c' => null,
252     'post_link_w' => null,
253     'post_link_v_c' => null,
254     'post_link_f_c' => null,
255     'blog_title_w_m' => null,
256     'blog_title_s_m' => null,
257     'blog_title_c_m' => null,
258     'post_title_w_m' => null,
259     'post_title_s_m' => null,
260     'post_title_c_m' => null,
261     'post_simple_title_c' => null
262);
263
264$ductile_lists_base = array(
265     'default' => 'short',
266     'default-page' => 'short',
267     'category' => 'short',
268     'tag' => 'short',
269     'search' => 'short',
270     'archive' => 'short'
271);
272
273$ductile_counts_base = array(
274     'default' => null,
275     'default-page' => null,
276     'category' => null,
277     'tag' => null,
278     'search' => null
279);
280
281$ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style');
282$ductile_user = @unserialize($ductile_user);
283if (!is_array($ductile_user)) {
284     $ductile_user = array();
285}
286$ductile_user = array_merge($ductile_base,$ductile_user);
287
288$ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists');
289$ductile_lists = @unserialize($ductile_lists);
290if (!is_array($ductile_lists)) {
291     $ductile_lists = $ductile_lists_base;
292}
293$ductile_lists = array_merge($ductile_lists_base,$ductile_lists);
294
295$ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts');
296$ductile_counts = @unserialize($ductile_counts);
297if (!is_array($ductile_counts)) {
298     $ductile_counts = $ductile_counts_base;
299}
300$ductile_counts = array_merge($ductile_counts_base,$ductile_counts);
301
302$ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers');
303$ductile_stickers = @unserialize($ductile_stickers);
304
305// If no stickers defined, add feed Atom one
306if (!is_array($ductile_stickers)) {
307     $ductile_stickers = array(array(
308          'label' => __('Subscribe'),
309          'url' => $core->blog->url.
310               $core->url->getURLFor('feed','atom'),
311          'image' => 'sticker-feed.png'
312          ));
313}
314
315$ductile_stickers_full = array();
316// Get all sticker images already used
317if (is_array($ductile_stickers)) {
318     foreach ($ductile_stickers as $v) {
319          $ductile_stickers_full[] = $v['image'];
320     }
321}
322// Get all sticker-*.png in img folder of theme
323$ductile_stickers_images = files::scandir($img_path);
324if (is_array($ductile_stickers_images)) {
325     foreach ($ductile_stickers_images as $v) {
326          if (preg_match('/^sticker\-(.*)\.png$/',$v)) {
327               if (!in_array($v,$ductile_stickers_full)) {
328                    // image not already used
329                    $ductile_stickers[] = array(
330                         'label' => null,
331                         'url' => null,
332                         'image' => $v);
333               }
334          }
335     }
336}
337
338$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html';
339
340if (!empty($_POST))
341{
342     try
343     {
344          # HTML
345          if ($conf_tab == 'html') {
346               $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']);
347               $ductile_user['logo_src'] = $_POST['logo_src'];
348               $ductile_user['preview_not_mandatory'] = (integer) !empty($_POST['preview_not_mandatory']);
349
350               $ductile_stickers = array();
351               for ($i = 0; $i < count($_POST['sticker_image']); $i++) {
352                    $ductile_stickers[] = array(
353                         'label' => $_POST['sticker_label'][$i],
354                         'url' => $_POST['sticker_url'][$i],
355                         'image' => $_POST['sticker_image'][$i]
356                    );
357               }
358
359               $order = array();
360               if (empty($_POST['ds_order']) && !empty($_POST['order'])) {
361                    $order = $_POST['order'];
362                    asort($order);
363                    $order = array_keys($order);
364               }
365               if (!empty($order)) {
366                    $new_ductile_stickers = array();
367                    foreach ($order as $i => $k) {
368                         $new_ductile_stickers[] = array(
369                              'label' => $ductile_stickers[$k]['label'],
370                              'url' => $ductile_stickers[$k]['url'],
371                              'image' => $ductile_stickers[$k]['image']
372                         );
373                    }
374                    $ductile_stickers = $new_ductile_stickers;
375               }
376
377               for ($i = 0; $i < count($_POST['list_type']); $i++) {
378                    $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i];
379               }
380
381               for ($i = 0; $i < count($_POST['count_nb']); $i++) {
382                    $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i];
383               }
384
385          }
386
387          # CSS
388          if ($conf_tab == 'css') {
389               $ductile_user['body_font'] = $_POST['body_font'];
390               $ductile_user['body_webfont_family'] = $_POST['body_webfont_family'];
391               $ductile_user['body_webfont_url'] = $_POST['body_webfont_url'];
392               $ductile_user['body_webfont_api'] = $_POST['body_webfont_api'];
393
394               $ductile_user['alternate_font'] = $_POST['alternate_font'];
395               $ductile_user['alternate_webfont_family'] = $_POST['alternate_webfont_family'];
396               $ductile_user['alternate_webfont_url'] = $_POST['alternate_webfont_url'];
397               $ductile_user['alternate_webfont_api'] = $_POST['alternate_webfont_api'];
398
399               $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']);
400               $ductile_user['blog_title_s'] = adjustFontSize($_POST['blog_title_s']);
401               $ductile_user['blog_title_c'] = adjustColor($_POST['blog_title_c']);
402
403               $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']);
404               $ductile_user['post_title_s'] = adjustFontSize($_POST['post_title_s']);
405               $ductile_user['post_title_c'] = adjustColor($_POST['post_title_c']);
406
407               $ductile_user['post_link_w'] = (integer) !empty($_POST['post_link_w']);
408               $ductile_user['post_link_v_c'] = adjustColor($_POST['post_link_v_c']);
409               $ductile_user['post_link_f_c'] = adjustColor($_POST['post_link_f_c']);
410
411               $ductile_user['post_simple_title_c'] = adjustColor($_POST['post_simple_title_c']);
412
413               $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']);
414               $ductile_user['blog_title_s_m'] = adjustFontSize($_POST['blog_title_s_m']);
415               $ductile_user['blog_title_c_m'] = adjustColor($_POST['blog_title_c_m']);
416
417               $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']);
418               $ductile_user['post_title_s_m'] = adjustFontSize($_POST['post_title_s_m']);
419               $ductile_user['post_title_c_m'] = adjustColor($_POST['post_title_c_m']);
420          }
421
422          $core->blog->settings->addNamespace('themes');
423          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user));
424          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers));
425          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists));
426          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts));
427
428          // Blog refresh
429          $core->blog->triggerBlog();
430
431          // Template cache reset
432          $core->emptyTemplatesCache();
433
434          dcPage::message(__('Theme configuration upgraded.'),true,true);
435     }
436     catch (Exception $e)
437     {
438          $core->error->add($e->getMessage());
439     }
440}
441
442// Legacy mode
443if (!$standalone_config) echo '</form>';
444
445# HTML Tab
446
447echo '<div class="multi-part" id="themes-list'.($conf_tab == 'html' ? '' : '-html').'" title="'.__('Content').'">'.
448'<h3>'.__('Content').'</h3>';
449
450echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
451
452echo '<h4>'.__('Header').'</h4>'.
453'<p class="field"><label for="subtitle_hidden">'.__('Hide blog description:').'</label> '.
454form::checkbox('subtitle_hidden',1,$ductile_user['subtitle_hidden']).'</p>';
455echo '<p class="field"><label for="logo_src">'.__('Logo URL:').'</label> '.
456     form::field('logo_src',40,255,$ductile_user['logo_src']).'</p>';
457if ($core->plugins->moduleExists('simpleMenu'))
458{
459     echo '<p>'.sprintf(__('To configure the top menu go to the <a href="%s">Simple Menu administration page</a>.'),'plugin.php?p=simpleMenu').'</p>';
460}
461
462echo '<h4 class="border-top pretty-title">'.__('Stickers').'</h4>';
463
464echo
465'<div class="table-outer">'.
466'<table class="dragable">'.'<caption>'.__('Stickers (footer)').'</caption>'.
467'<thead>'.
468'<tr>'.
469'<th scope="col">'.'</th>'.
470'<th scope="col">'.__('Image').'</th>'.
471'<th scope="col">'.__('Label').'</th>'.
472'<th scope="col">'.__('URL').'</th>'.
473'</tr>'.
474'</thead>'.
475'<tbody id="stickerslist">';
476$count = 0;
477foreach ($ductile_stickers as $i => $v) {
478     $count++;
479     echo
480     '<tr class="line" id="l_'.$i.'">'.
481     '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false).
482          form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'.
483     '<td>'.form::hidden(array('sticker_image[]'),$v['image']).'<img src="'.$img_url.$v['image'].'" alt="'.$v['image'].'" /> '.'</td>'.
484     '<td scope="row">'.form::field(array('sticker_label[]','dsl-'.$i),20,255,$v['label']).'</td>'.
485     '<td>'.form::field(array('sticker_url[]','dsu-'.$i),40,255,$v['url']).'</td>'.
486     '</tr>';
487}
488echo
489'</tbody>'.
490'</table></div>';
491
492echo '<h4 class="border-top pretty-title">'.__('Entries list types and limits').'</h4>';
493
494echo '<table id="entrieslist">'.'<caption class="hidden">'.__('Entries lists').'</caption>'.
495'<thead>'.
496'<tr>'.
497'<th scope="col">'.__('Context').'</th>'.
498'<th scope="col">'.__('Entries list type').'</th>'.
499'<th scope="col">'.__('Number of entries').'</th>'.
500'</tr>'.
501'</thead>'.
502'<tbody>';
503foreach ($ductile_lists as $k => $v) {
504     echo
505          '<tr>'.
506          '<td scope="row">'.$contexts[$k].'</td>'.
507          '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>';
508     if (array_key_exists($k,$ductile_counts)) {
509          echo '<td>'.form::hidden(array('count_ctx[]'),$k).form::field(array('count_nb[]'),2,3,$ductile_counts[$k]).'</td>';
510     } else {
511          echo '<td></td>';
512     }
513     echo
514          '</tr>';
515}
516echo
517'</tbody>'.
518'</table>';
519
520echo '<h4 class="border-top pretty-title">'.__('Miscellaneous options').'</h4>';
521echo '<p><label for="preview_not_mandatory" class="classic">'.__('Comment preview is not mandatory:').'</label> '.
522form::checkbox('preview_not_mandatory',1,$ductile_user['preview_not_mandatory']).'</p>';
523
524echo '<p><input type="hidden" name="conf_tab" value="html" /></p>';
525echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
526echo '</form>';
527
528echo '</div>'; // Close tab
529
530# CSS tab
531
532echo '<div class="multi-part" id="themes-list'.($conf_tab == 'css' ? '' : '-css').'" title="'.__('Presentation').'">';
533
534echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
535
536echo '<h3>'.__('General settings').'</h3>';
537
538echo '<h4 class="pretty-title">'.__('Fonts').'</h4>';
539
540echo '<div class="two-cols">';
541echo '<div class="col">';
542echo
543'<h5>'.__('Main text').'</h5>'.
544'<p class="field"><label for="body_font">'.__('Main font:').'</label> '.
545form::combo('body_font',$fonts,$ductile_user['body_font']).
546(!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : '').
547' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
548'</p>'.
549'<p class="field"><label for="body_webfont_family">'.__('Webfont family:').'</label> '.
550form::field('body_webfont_family',25,255,$ductile_user['body_webfont_family']).'</p>'.
551'<p class="field"><label for="body_webfont_url">'.__('Webfont URL:').'</label> '.
552form::field('body_webfont_url',50,255,$ductile_user['body_webfont_url']).'</p>'.
553'<p class="field"><label for="body_webfont_url">'.__('Webfont API:').'</label> '.
554form::combo('body_webfont_api',$webfont_apis,$ductile_user['body_webfont_api']).'</p>';
555echo '</div>';
556echo '<div class="col">';
557echo
558'<h5>'.__('Secondary text').'</h5>'.
559'<p class="field"><label for="alternate_font">'.__('Secondary font:').'</label> '.
560form::combo('alternate_font',$fonts,$ductile_user['alternate_font']).
561(!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : '').
562' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
563'</p>'.
564'<p class="field"><label for="alternate_webfont_family">'.__('Webfont family:').'</label> '.
565form::field('alternate_webfont_family',25,255,$ductile_user['alternate_webfont_family']).'</p>'.
566'<p class="field"><label for="alternate_webfont_url">'.__('Webfont URL:').'</label> '.
567form::field('alternate_webfont_url',50,255,$ductile_user['alternate_webfont_url']).'</p>'.
568'<p class="field"><label for="alternate_webfont_api">'.__('Webfont API:').'</label> '.
569form::combo('alternate_webfont_api',$webfont_apis,$ductile_user['alternate_webfont_api']).'</p>';
570echo '</div>';
571echo '</div>';
572
573echo '<h4 class="clear border-top pretty-title">'.__('Titles').'</h4>';
574echo '<div class="two-cols">';
575echo '<div class="col">';
576echo '<h5>'.__('Blog title').'</h5>'.
577'<p class="field"><label for="blog_title_w">'.__('In bold:').'</label> '.
578form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</p>'.
579
580'<p class="field"><label for="blog_title_s">'.__('Font size (in em by default):').'</label> '.
581form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'</p>'.
582
583'<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '.
584form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').
585contrastRatio($ductile_user['blog_title_c'],'#ffffff',
586     (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'),
587     $ductile_user['blog_title_w']).
588'</p>';
589
590echo '</div>';
591echo '<div class="col">';
592
593echo '<h5>'.__('Post title').'</h5>'.
594'<p class="field"><label for="post_title_w">'.__('In bold:').'</label> '.
595form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</p>'.
596
597'<p class="field"><label for="post_title_s">'.__('Font size (in em by default):').'</label> '.
598form::field('post_title_s',7,7,$ductile_user['post_title_s']).'</p>'.
599
600'<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '.
601form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').
602contrastRatio($ductile_user['post_title_c'],'#ffffff',
603     (!empty($ductile_user['post_title_s']) ? $ductile_user['post_title_s'] : '2.5em'),
604     $ductile_user['post_title_w']).
605'</p>';
606
607echo '</div>';
608echo '</div>';
609
610echo '<h5>'.__('Titles without link').'</h5>'.
611
612'<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '.
613form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').
614contrastRatio($ductile_user['post_simple_title_c'],'#ffffff',
615     '1.1em',  // H5 minimum size
616     false).
617'</p>';
618
619echo '<h4 class="border-top pretty-title">'.__('Inside posts links').'</h4>'.
620'<p class="field"><label for="post_link_w">'.__('In bold:').'</label> '.
621form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</p>'.
622
623'<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '.
624form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').
625contrastRatio($ductile_user['post_link_v_c'],'#ffffff',
626     '1em',
627     $ductile_user['post_link_w']).
628'</p>'.
629
630'<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '.
631form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').
632contrastRatio($ductile_user['post_link_f_c'],'#ebebee',
633     '1em',
634     $ductile_user['post_link_w']).
635'</p>';
636
637echo '<h3 class="border-top">'.__('Mobile specific settings').'</h3>';
638
639echo '<div class="two-cols">';
640echo '<div class="col">';
641
642echo '<h4 class="pretty-title">'.__('Blog title').'</h4>'.
643'<p class="field"><label for="blog_title_w_m">'.__('In bold:').'</label> '.
644form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</p>'.
645
646'<p class="field"><label for="blog_title_s_m">'.__('Font size (in em by default):').'</label> '.
647form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).'</p>'.
648
649'<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '.
650form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').
651contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc',
652     (!empty($ductile_user['blog_title_s_m']) ? $ductile_user['blog_title_s_m'] : '1.8em'),
653     $ductile_user['blog_title_w_m']).
654'</p>';
655
656echo '</div>';
657echo '<div class="col">';
658
659echo '<h4 class="pretty-title">'.__('Post title').'</h4>'.
660'<p class="field"><label for="post_title_w_m">'.__('In bold:').'</label> '.
661form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</p>'.
662
663'<p class="field"><label for="post_title_s_m">'.__('Font size (in em by default):').'</label> '.
664form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).'</p>'.
665
666'<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '.
667form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').
668contrastRatio($ductile_user['post_title_c_m'],'#ffffff',
669     (!empty($ductile_user['post_title_s_m']) ? $ductile_user['post_title_s_m'] : '1.5em'),
670     $ductile_user['post_title_w_m']).
671'</p>';
672
673echo '</div>';
674echo '</div>';
675
676echo '<p><input type="hidden" name="conf_tab" value="css" /></p>';
677echo '<p class="clear border-top"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
678echo '</form>';
679
680echo '</div>'; // Close tab
681
682dcPage::helpBlock('ductile');
683
684// Legacy mode
685if (!$standalone_config) echo '<form style="display:none">';
Note: See TracBrowser for help on using the repository browser.

Sites map