Dotclear

source: themes/ductile/_config.php @ 2393:662f66a598e3

Revision 2393:662f66a598e3, 23.7 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Load contextual help if possible

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     'category' => null,
276     'tag' => null,
277     'search' => null
278);
279
280$ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style');
281$ductile_user = @unserialize($ductile_user);
282if (!is_array($ductile_user)) {
283     $ductile_user = array();
284}
285$ductile_user = array_merge($ductile_base,$ductile_user);
286
287$ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists');
288$ductile_lists = @unserialize($ductile_lists);
289if (!is_array($ductile_lists)) {
290     $ductile_lists = $ductile_lists_base;
291}
292
293$ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts');
294$ductile_counts = @unserialize($ductile_counts);
295if (!is_array($ductile_counts)) {
296     $ductile_counts = $ductile_counts_base;
297}
298
299$ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers');
300$ductile_stickers = @unserialize($ductile_stickers);
301
302// If no stickers defined, add feed Atom one
303if (!is_array($ductile_stickers)) {
304     $ductile_stickers = array(array(
305          'label' => __('Subscribe'),
306          'url' => $core->blog->url.
307               $core->url->getURLFor('feed','atom'),
308          'image' => 'sticker-feed.png'
309          ));
310}
311
312$ductile_stickers_full = array();
313// Get all sticker images already used
314if (is_array($ductile_stickers)) {
315     foreach ($ductile_stickers as $v) {
316          $ductile_stickers_full[] = $v['image'];
317     }
318}
319// Get all sticker-*.png in img folder of theme
320$ductile_stickers_images = files::scandir($img_path);
321if (is_array($ductile_stickers_images)) {
322     foreach ($ductile_stickers_images as $v) {
323          if (preg_match('/^sticker\-(.*)\.png$/',$v)) {
324               if (!in_array($v,$ductile_stickers_full)) {
325                    // image not already used
326                    $ductile_stickers[] = array(
327                         'label' => null,
328                         'url' => null,
329                         'image' => $v);
330               }
331          }
332     }
333}
334
335$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html';
336
337if (!empty($_POST))
338{
339     try
340     {
341          # HTML
342          if ($conf_tab == 'html') {
343               $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']);
344               $ductile_user['logo_src'] = $_POST['logo_src'];
345               $ductile_user['preview_not_mandatory'] = (integer) !empty($_POST['preview_not_mandatory']);
346
347               $ductile_stickers = array();
348               for ($i = 0; $i < count($_POST['sticker_image']); $i++) {
349                    $ductile_stickers[] = array(
350                         'label' => $_POST['sticker_label'][$i],
351                         'url' => $_POST['sticker_url'][$i],
352                         'image' => $_POST['sticker_image'][$i]
353                    );
354               }
355
356               $order = array();
357               if (empty($_POST['ds_order']) && !empty($_POST['order'])) {
358                    $order = $_POST['order'];
359                    asort($order);
360                    $order = array_keys($order);
361               }
362               if (!empty($order)) {
363                    $new_ductile_stickers = array();
364                    foreach ($order as $i => $k) {
365                         $new_ductile_stickers[] = array(
366                              'label' => $ductile_stickers[$k]['label'],
367                              'url' => $ductile_stickers[$k]['url'],
368                              'image' => $ductile_stickers[$k]['image']
369                         );
370                    }
371                    $ductile_stickers = $new_ductile_stickers;
372               }
373
374               for ($i = 0; $i < count($_POST['list_type']); $i++) {
375                    $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i];
376               }
377
378               for ($i = 0; $i < count($_POST['count_nb']); $i++) {
379                    $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i];
380               }
381
382          }
383
384          # CSS
385          if ($conf_tab == 'css') {
386               $ductile_user['body_font'] = $_POST['body_font'];
387               $ductile_user['body_webfont_family'] = $_POST['body_webfont_family'];
388               $ductile_user['body_webfont_url'] = $_POST['body_webfont_url'];
389               $ductile_user['body_webfont_api'] = $_POST['body_webfont_api'];
390
391               $ductile_user['alternate_font'] = $_POST['alternate_font'];
392               $ductile_user['alternate_webfont_family'] = $_POST['alternate_webfont_family'];
393               $ductile_user['alternate_webfont_url'] = $_POST['alternate_webfont_url'];
394               $ductile_user['alternate_webfont_api'] = $_POST['alternate_webfont_api'];
395
396               $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']);
397               $ductile_user['blog_title_s'] = adjustFontSize($_POST['blog_title_s']);
398               $ductile_user['blog_title_c'] = adjustColor($_POST['blog_title_c']);
399
400               $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']);
401               $ductile_user['post_title_s'] = adjustFontSize($_POST['post_title_s']);
402               $ductile_user['post_title_c'] = adjustColor($_POST['post_title_c']);
403
404               $ductile_user['post_link_w'] = (integer) !empty($_POST['post_link_w']);
405               $ductile_user['post_link_v_c'] = adjustColor($_POST['post_link_v_c']);
406               $ductile_user['post_link_f_c'] = adjustColor($_POST['post_link_f_c']);
407
408               $ductile_user['post_simple_title_c'] = adjustColor($_POST['post_simple_title_c']);
409
410               $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']);
411               $ductile_user['blog_title_s_m'] = adjustFontSize($_POST['blog_title_s_m']);
412               $ductile_user['blog_title_c_m'] = adjustColor($_POST['blog_title_c_m']);
413
414               $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']);
415               $ductile_user['post_title_s_m'] = adjustFontSize($_POST['post_title_s_m']);
416               $ductile_user['post_title_c_m'] = adjustColor($_POST['post_title_c_m']);
417          }
418
419          $core->blog->settings->addNamespace('themes');
420          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user));
421          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers));
422          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists));
423          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts));
424
425          // Blog refresh
426          $core->blog->triggerBlog();
427
428          // Template cache reset
429          $core->emptyTemplatesCache();
430
431          dcPage::message(__('Theme configuration upgraded.'),true,true);
432     }
433     catch (Exception $e)
434     {
435          $core->error->add($e->getMessage());
436     }
437}
438
439// Legacy mode
440if (!$standalone_config) echo '</form>';
441
442# HTML Tab
443
444echo '<div class="multi-part" id="themes-list'.($conf_tab == 'html' ? '' : '-html').'" title="'.__('Content').'">'.
445'<h3>'.__('Content').'</h3>';
446
447echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
448
449echo '<h4>'.__('Header').'</h4>'.
450'<p class="field"><label for="subtitle_hidden">'.__('Hide blog description:').'</label> '.
451form::checkbox('subtitle_hidden',1,$ductile_user['subtitle_hidden']).'</p>';
452echo '<p class="field"><label for="logo_src">'.__('Logo URL:').'</label> '.
453     form::field('logo_src',40,255,$ductile_user['logo_src']).'</p>';
454if ($core->plugins->moduleExists('simpleMenu'))
455{
456     echo '<p>'.sprintf(__('To configure the top menu go to the <a href="%s">Simple Menu administration page</a>.'),'plugin.php?p=simpleMenu').'</p>';
457}
458
459echo '<h4 class="border-top pretty-title">'.__('Stickers').'</h4>';
460
461echo
462'<div class="table-outer">'.
463'<table class="dragable">'.'<caption>'.__('Stickers (footer)').'</caption>'.
464'<thead>'.
465'<tr>'.
466'<th scope="col">'.'</th>'.
467'<th scope="col">'.__('Image').'</th>'.
468'<th scope="col">'.__('Label').'</th>'.
469'<th scope="col">'.__('URL').'</th>'.
470'</tr>'.
471'</thead>'.
472'<tbody id="stickerslist">';
473$count = 0;
474foreach ($ductile_stickers as $i => $v) {
475     $count++;
476     echo
477     '<tr class="line" id="l_'.$i.'">'.
478     '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false).
479          form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'.
480     '<td>'.form::hidden(array('sticker_image[]'),$v['image']).'<img src="'.$img_url.$v['image'].'" alt="'.$v['image'].'" /> '.'</td>'.
481     '<td scope="row">'.form::field(array('sticker_label[]','dsl-'.$i),20,255,$v['label']).'</td>'.
482     '<td>'.form::field(array('sticker_url[]','dsu-'.$i),40,255,$v['url']).'</td>'.
483     '</tr>';
484}
485echo
486'</tbody>'.
487'</table></div>';
488
489echo '<h4 class="border-top pretty-title">'.__('Entries list types and limits').'</h4>';
490
491echo '<table id="entrieslist">'.'<caption class="hidden">'.__('Entries lists').'</caption>'.
492'<thead>'.
493'<tr>'.
494'<th scope="col">'.__('Context').'</th>'.
495'<th scope="col">'.__('Entries list type').'</th>'.
496'<th scope="col">'.__('Number of entries').'</th>'.
497'</tr>'.
498'</thead>'.
499'<tbody>';
500foreach ($ductile_lists as $k => $v) {
501     echo
502          '<tr>'.
503          '<td scope="row">'.$contexts[$k].'</td>'.
504          '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>';
505     if (array_key_exists($k,$ductile_counts)) {
506          echo '<td>'.form::hidden(array('count_ctx[]'),$k).form::field(array('count_nb[]'),2,3,$ductile_counts[$k]).'</td>';
507     } else {
508          echo '<td></td>';
509     }
510     echo
511          '</tr>';
512}
513echo
514'</tbody>'.
515'</table>';
516
517echo '<h4 class="border-top pretty-title">'.__('Miscellaneous options').'</h4>';
518echo '<p><label for="preview_not_mandatory" class="classic">'.__('Comment preview is not mandatory:').'</label> '.
519form::checkbox('preview_not_mandatory',1,$ductile_user['preview_not_mandatory']).'</p>';
520
521echo '<p><input type="hidden" name="conf_tab" value="html" /></p>';
522echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
523echo '</form>';
524
525echo '</div>'; // Close tab
526
527# CSS tab
528
529echo '<div class="multi-part" id="themes-list'.($conf_tab == 'css' ? '' : '-css').'" title="'.__('Presentation').'">';
530
531echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
532
533echo '<h3>'.__('General settings').'</h3>';
534
535echo '<h4 class="pretty-title">'.__('Fonts').'</h4>';
536
537echo '<div class="two-cols">';
538echo '<div class="col">';
539echo
540'<h5>'.__('Main text').'</h5>'.
541'<p class="field"><label for="body_font">'.__('Main font:').'</label> '.
542form::combo('body_font',$fonts,$ductile_user['body_font']).
543(!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : '').
544' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
545'</p>'.
546'<p class="field"><label for="body_webfont_family">'.__('Webfont family:').'</label> '.
547form::field('body_webfont_family',25,255,$ductile_user['body_webfont_family']).'</p>'.
548'<p class="field"><label for="body_webfont_url">'.__('Webfont URL:').'</label> '.
549form::field('body_webfont_url',50,255,$ductile_user['body_webfont_url']).'</p>'.
550'<p class="field"><label for="body_webfont_url">'.__('Webfont API:').'</label> '.
551form::combo('body_webfont_api',$webfont_apis,$ductile_user['body_webfont_api']).'</p>';
552echo '</div>';
553echo '<div class="col">';
554echo
555'<h5>'.__('Secondary text').'</h5>'.
556'<p class="field"><label for="alternate_font">'.__('Secondary font:').'</label> '.
557form::combo('alternate_font',$fonts,$ductile_user['alternate_font']).
558(!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : '').
559' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
560'</p>'.
561'<p class="field"><label for="alternate_webfont_family">'.__('Webfont family:').'</label> '.
562form::field('alternate_webfont_family',25,255,$ductile_user['alternate_webfont_family']).'</p>'.
563'<p class="field"><label for="alternate_webfont_url">'.__('Webfont URL:').'</label> '.
564form::field('alternate_webfont_url',50,255,$ductile_user['alternate_webfont_url']).'</p>'.
565'<p class="field"><label for="alternate_webfont_api">'.__('Webfont API:').'</label> '.
566form::combo('alternate_webfont_api',$webfont_apis,$ductile_user['alternate_webfont_api']).'</p>';
567echo '</div>';
568echo '</div>';
569
570echo '<h4 class="clear border-top pretty-title">'.__('Titles').'</h4>';
571echo '<div class="two-cols">';
572echo '<div class="col">';
573echo '<h5>'.__('Blog title').'</h5>'.
574'<p class="field"><label for="blog_title_w">'.__('In bold:').'</label> '.
575form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</p>'.
576
577'<p class="field"><label for="blog_title_s">'.__('Font size (in em by default):').'</label> '.
578form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'</p>'.
579
580'<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '.
581form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').
582contrastRatio($ductile_user['blog_title_c'],'#ffffff',
583     (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'),
584     $ductile_user['blog_title_w']).
585'</p>';
586
587echo '</div>';
588echo '<div class="col">';
589
590echo '<h5>'.__('Post title').'</h5>'.
591'<p class="field"><label for="post_title_w">'.__('In bold:').'</label> '.
592form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</p>'.
593
594'<p class="field"><label for="post_title_s">'.__('Font size (in em by default):').'</label> '.
595form::field('post_title_s',7,7,$ductile_user['post_title_s']).'</p>'.
596
597'<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '.
598form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').
599contrastRatio($ductile_user['post_title_c'],'#ffffff',
600     (!empty($ductile_user['post_title_s']) ? $ductile_user['post_title_s'] : '2.5em'),
601     $ductile_user['post_title_w']).
602'</p>';
603
604echo '</div>';
605echo '</div>';
606
607echo '<h5>'.__('Titles without link').'</h5>'.
608
609'<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '.
610form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').
611contrastRatio($ductile_user['post_simple_title_c'],'#ffffff',
612     '1.1em',  // H5 minimum size
613     false).
614'</p>';
615
616echo '<h4 class="border-top pretty-title">'.__('Inside posts links').'</h4>'.
617'<p class="field"><label for="post_link_w">'.__('In bold:').'</label> '.
618form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</p>'.
619
620'<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '.
621form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').
622contrastRatio($ductile_user['post_link_v_c'],'#ffffff',
623     '1em',
624     $ductile_user['post_link_w']).
625'</p>'.
626
627'<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '.
628form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').
629contrastRatio($ductile_user['post_link_f_c'],'#ebebee',
630     '1em',
631     $ductile_user['post_link_w']).
632'</p>';
633
634echo '<h3 class="border-top">'.__('Mobile specific settings').'</h3>';
635
636echo '<div class="two-cols">';
637echo '<div class="col">';
638
639echo '<h4 class="pretty-title">'.__('Blog title').'</h4>'.
640'<p class="field"><label for="blog_title_w_m">'.__('In bold:').'</label> '.
641form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</p>'.
642
643'<p class="field"><label for="blog_title_s_m">'.__('Font size (in em by default):').'</label> '.
644form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).'</p>'.
645
646'<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '.
647form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').
648contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc',
649     (!empty($ductile_user['blog_title_s_m']) ? $ductile_user['blog_title_s_m'] : '1.8em'),
650     $ductile_user['blog_title_w_m']).
651'</p>';
652
653echo '</div>';
654echo '<div class="col">';
655
656echo '<h4 class="pretty-title">'.__('Post title').'</h4>'.
657'<p class="field"><label for="post_title_w_m">'.__('In bold:').'</label> '.
658form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</p>'.
659
660'<p class="field"><label for="post_title_s_m">'.__('Font size (in em by default):').'</label> '.
661form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).'</p>'.
662
663'<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '.
664form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').
665contrastRatio($ductile_user['post_title_c_m'],'#ffffff',
666     (!empty($ductile_user['post_title_s_m']) ? $ductile_user['post_title_s_m'] : '1.5em'),
667     $ductile_user['post_title_w_m']).
668'</p>';
669
670echo '</div>';
671echo '</div>';
672
673echo '<p><input type="hidden" name="conf_tab" value="css" /></p>';
674echo '<p class="clear border-top"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
675echo '</form>';
676
677echo '</div>'; // Close tab
678
679dcPage::helpBlock('ductile');
680
681// Legacy mode
682if (!$standalone_config) echo '<form style="display:none">';
683?>
Note: See TracBrowser for help on using the repository browser.

Sites map