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

RevLine 
[345]1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
[631]3# This file is part of Ductile, a theme for Dotclear
[345]4#
[631]5# Copyright (c) 2011 - Association Dotclear
[345]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
[421]13l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin');
[357]14
[832]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}
[604]20$img_path = dirname(__FILE__).'/img/';
21
[657]22$tpl_path = dirname(__FILE__).'/tpl/';
23
[611]24$standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme,'standalone_config');
25
[2393]26// Load contextual help
27if (file_exists(dirname(__FILE__).'/locales/'.$_lang.'/resources.php')) {
28     require dirname(__FILE__).'/locales/'.$_lang.'/resources.php';
29}
30
[563]31$list_types = array(
32     __('Title') => 'title',
33     __('Short') => 'short',
34     __('Full') => 'full'
35);
[657]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
[563]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'),
[564]57     'archive' => __('Month archive entries')
[563]58);
59
[376]60$fonts = array(
[1526]61     __('Default') => '',
[376]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
[1081]74$webfont_apis = array(
75     __('none') => '',
76     __('javascript (Adobe)') => 'js',
77     __('stylesheet (Google)') => 'css'
78);
79
[387]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
[656]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;
[2393]117
[656]118     return isset($font_families[$c]) ? '<span style="position:absolute;top:0;left:32em;">'.$font_families[$c].'</span>' : '';
119}
120
[357]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
[653]144function computeContrastRatio($color,$background)
[649]145{
146     // Compute contrast ratio between two colors
[2393]147
[653]148     $color = adjustColor($color);
149     if (($color == '') || (strlen($color) != 7)) return 0;
150     $background = adjustColor($background);
151     if (($background == '') || (strlen($background) != 7)) return 0;
[2393]152
[653]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));
[649]160
161     if ($l1 > $l2) {
[653]162          $ratio = ($l1 + 0.05) / ($l2 + 0.05);
[649]163     } else {
[653]164          $ratio = ($l2 + 0.05) / ($l1 + 0.05);
[649]165     }
[653]166     return $ratio;
[649]167}
168
[653]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)));
[2393]204
[653]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);
[2393]223          return
[655]224               '<span style="position:absolute;top:0;left:23em;">'.
225               sprintf(__('ratio %.1f'),$ratio).
226               ($level != '' ? ' '.sprintf(__('(%s)'),$level) : '').
227               '</span>';
[649]228     }
229     return '';
230}
231
[357]232$ductile_base = array(
[389]233     // HTML
234     'subtitle_hidden' => null,
[810]235     'logo_src' => null,
[1096]236     'preview_not_mandatory' => null,
[389]237     // CSS
[376]238     'body_font' => null,
[1081]239     'body_webfont_family' => null,
240     'body_webfont_url' => null,
241     'body_webfont_api' => null,
[387]242     'alternate_font' => null,
[1081]243     'alternate_webfont_family' => null,
244     'alternate_webfont_url' => null,
245     'alternate_webfont_api' => null,
[387]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,
[515]260     'post_title_c_m' => null,
261     'post_simple_title_c' => null
[357]262);
263
[563]264$ductile_lists_base = array(
[646]265     'default' => 'short',
266     'default-page' => 'short',
267     'category' => 'short',
268     'tag' => 'short',
269     'search' => 'short',
[667]270     'archive' => 'short'
[563]271);
272
[583]273$ductile_counts_base = array(
274     'default' => null,
[2581]275     'default-page' => null,
[583]276     'category' => null,
277     'tag' => null,
278     'search' => null
279);
280
[605]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}
[2581]293$ductile_lists = array_merge($ductile_lists_base,$ductile_lists);
[605]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}
[2581]300$ductile_counts = array_merge($ductile_counts_base,$ductile_counts);
[605]301
302$ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers');
303$ductile_stickers = @unserialize($ductile_stickers);
304
[614]305// If no stickers defined, add feed Atom one
306if (!is_array($ductile_stickers)) {
307     $ductile_stickers = array(array(
308          'label' => __('Subscribe'),
[776]309          'url' => $core->blog->url.
310               $core->url->getURLFor('feed','atom'),
[614]311          'image' => 'sticker-feed.png'
312          ));
313}
314
[605]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
[390]338$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html';
339
[357]340if (!empty($_POST))
341{
342     try
343     {
[389]344          # HTML
[390]345          if ($conf_tab == 'html') {
346               $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']);
[810]347               $ductile_user['logo_src'] = $_POST['logo_src'];
[1096]348               $ductile_user['preview_not_mandatory'] = (integer) !empty($_POST['preview_not_mandatory']);
[605]349
[604]350               $ductile_stickers = array();
[605]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']
[604]372                         );
373                    }
[605]374                    $ductile_stickers = $new_ductile_stickers;
[419]375               }
[2393]376
[563]377               for ($i = 0; $i < count($_POST['list_type']); $i++) {
378                    $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i];
379               }
[2393]380
[583]381               for ($i = 0; $i < count($_POST['count_nb']); $i++) {
382                    $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i];
383               }
[2393]384
[390]385          }
[2393]386
[389]387          # CSS
[390]388          if ($conf_tab == 'css') {
389               $ductile_user['body_font'] = $_POST['body_font'];
[1081]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
[390]394               $ductile_user['alternate_font'] = $_POST['alternate_font'];
[1081]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'];
[390]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']);
[2393]402
[390]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']);
[2393]406
[390]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']);
[2393]410
[515]411               $ductile_user['post_simple_title_c'] = adjustColor($_POST['post_simple_title_c']);
[2393]412
[390]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']);
[2393]416
[390]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          }
[2393]421
[357]422          $core->blog->settings->addNamespace('themes');
[394]423          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user));
[419]424          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers));
[563]425          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists));
[583]426          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts));
[572]427
428          // Blog refresh
[357]429          $core->blog->triggerBlog();
430
[572]431          // Template cache reset
432          $core->emptyTemplatesCache();
[2393]433
[907]434          dcPage::message(__('Theme configuration upgraded.'),true,true);
[357]435     }
436     catch (Exception $e)
437     {
438          $core->error->add($e->getMessage());
439     }
440}
441
[613]442// Legacy mode
443if (!$standalone_config) echo '</form>';
444
[389]445# HTML Tab
446
[2003]447echo '<div class="multi-part" id="themes-list'.($conf_tab == 'html' ? '' : '-html').'" title="'.__('Content').'">'.
[2335]448'<h3>'.__('Content').'</h3>';
[390]449
450echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
[389]451
[2335]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>';
[612]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}
[389]461
[2335]462echo '<h4 class="border-top pretty-title">'.__('Stickers').'</h4>';
[419]463
[2393]464echo
[2002]465'<div class="table-outer">'.
466'<table class="dragable">'.'<caption>'.__('Stickers (footer)').'</caption>'.
[419]467'<thead>'.
468'<tr>'.
[605]469'<th scope="col">'.'</th>'.
[604]470'<th scope="col">'.__('Image').'</th>'.
[419]471'<th scope="col">'.__('Label').'</th>'.
472'<th scope="col">'.__('URL').'</th>'.
473'</tr>'.
474'</thead>'.
[605]475'<tbody id="stickerslist">';
476$count = 0;
477foreach ($ductile_stickers as $i => $v) {
478     $count++;
[2393]479     echo
[605]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>'.
[1622]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>'.
[605]485     '<td>'.form::field(array('sticker_url[]','dsu-'.$i),40,255,$v['url']).'</td>'.
[604]486     '</tr>';
487}
488echo
[419]489'</tbody>'.
[2002]490'</table></div>';
[419]491
[2335]492echo '<h4 class="border-top pretty-title">'.__('Entries list types and limits').'</h4>';
[419]493
[2335]494echo '<table id="entrieslist">'.'<caption class="hidden">'.__('Entries lists').'</caption>'.
[563]495'<thead>'.
496'<tr>'.
497'<th scope="col">'.__('Context').'</th>'.
498'<th scope="col">'.__('Entries list type').'</th>'.
[583]499'<th scope="col">'.__('Number of entries').'</th>'.
[563]500'</tr>'.
501'</thead>'.
502'<tbody>';
503foreach ($ductile_lists as $k => $v) {
[2393]504     echo
[563]505          '<tr>'.
[1622]506          '<td scope="row">'.$contexts[$k].'</td>'.
[583]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
[563]514          '</tr>';
515}
516echo
517'</tbody>'.
518'</table>';
519
[2335]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>';
[1096]523
[1622]524echo '<p><input type="hidden" name="conf_tab" value="html" /></p>';
[605]525echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
[390]526echo '</form>';
527
[389]528echo '</div>'; // Close tab
529
530# CSS tab
531
[390]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">';
[389]535
[387]536echo '<h3>'.__('General settings').'</h3>';
537
[2335]538echo '<h4 class="pretty-title">'.__('Fonts').'</h4>';
[1081]539
540echo '<div class="two-cols">';
541echo '<div class="col">';
542echo
[2335]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']).
[656]546(!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : '').
[2335]547' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
[656]548'</p>'.
[1081]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>'.
[2335]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>';
[1081]555echo '</div>';
556echo '<div class="col">';
557echo
[2335]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']).
[656]561(!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : '').
[2335]562' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
[656]563'</p>'.
[1081]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>'.
[2335]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>';
[1081]570echo '</div>';
571echo '</div>';
[376]572
[2335]573echo '<h4 class="clear border-top pretty-title">'.__('Titles').'</h4>';
[387]574echo '<div class="two-cols">';
575echo '<div class="col">';
[2335]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>'.
[387]579
[395]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>'.
[387]582
[389]583'<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '.
[653]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']).
[2335]588'</p>';
[387]589
590echo '</div>';
591echo '<div class="col">';
592
[2335]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>'.
[387]596
[395]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>'.
[387]599
[389]600'<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '.
[653]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']).
[2335]605'</p>';
[387]606
607echo '</div>';
608echo '</div>';
609
[2335]610echo '<h5>'.__('Titles without link').'</h5>'.
[515]611
612'<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '.
[653]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).
[2335]617'</p>';
[515]618
[2335]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>'.
[357]622
[389]623'<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '.
[653]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>'.
[357]629
[648]630'<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '.
[653]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']).
[2335]635'</p>';
[357]636
[2335]637echo '<h3 class="border-top">'.__('Mobile specific settings').'</h3>';
[387]638
639echo '<div class="two-cols">';
640echo '<div class="col">';
641
[2335]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>'.
[387]645
[395]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>'.
[387]648
[389]649'<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '.
[653]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']).
[2335]654'</p>';
[387]655
656echo '</div>';
657echo '<div class="col">';
658
[2335]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>'.
[387]662
[395]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>'.
[387]665
[389]666'<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '.
[653]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']).
[2335]671'</p>';
[387]672
673echo '</div>';
674echo '</div>';
675
[1622]676echo '<p><input type="hidden" name="conf_tab" value="css" /></p>';
[2335]677echo '<p class="clear border-top"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
[390]678echo '</form>';
679
[389]680echo '</div>'; // Close tab
681
[634]682dcPage::helpBlock('ductile');
683
[613]684// Legacy mode
685if (!$standalone_config) echo '<form style="display:none">';
Note: See TracBrowser for help on using the repository browser.

Sites map