Dotclear

source: themes/ductile/_config.php @ 1081:862f566d2372

Revision 1081:862f566d2372, 23.1 KB checked in by franck <carnet.franck.paul@…>, 13 years ago (diff)

Just for fun, Ductile may now use web fonts (from Google, Adobe and similar providers)

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

Sites map