Dotclear

source: themes/ductile/_config.php @ 1526:b17db2367958

Revision 1526:b17db2367958, 23.5 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Admin stays sexy without javascript.

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

Sites map