Dotclear

source: themes/ductile/_config.php @ 2335:db52e903ff91

Revision 2335:db52e903ff91, 23.6 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Amélioration de la sémantique et de la présentation des configurateurs de Blowup et Ductile.

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
[563]26$list_types = array(
27     __('Title') => 'title',
28     __('Short') => 'short',
29     __('Full') => 'full'
30);
[657]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
[563]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'),
[564]52     'archive' => __('Month archive entries')
[563]53);
54
[376]55$fonts = array(
[1526]56     __('Default') => '',
[376]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
[1081]69$webfont_apis = array(
70     __('none') => '',
71     __('javascript (Adobe)') => 'js',
72     __('stylesheet (Google)') => 'css'
73);
74
[387]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
[656]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
[357]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
[653]139function computeContrastRatio($color,$background)
[649]140{
141     // Compute contrast ratio between two colors
142     
[653]143     $color = adjustColor($color);
144     if (($color == '') || (strlen($color) != 7)) return 0;
145     $background = adjustColor($background);
146     if (($background == '') || (strlen($background) != 7)) return 0;
[649]147     
[653]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));
[649]155
156     if ($l1 > $l2) {
[653]157          $ratio = ($l1 + 0.05) / ($l2 + 0.05);
[649]158     } else {
[653]159          $ratio = ($l2 + 0.05) / ($l1 + 0.05);
[649]160     }
[653]161     return $ratio;
[649]162}
163
[653]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 
[655]219               '<span style="position:absolute;top:0;left:23em;">'.
220               sprintf(__('ratio %.1f'),$ratio).
221               ($level != '' ? ' '.sprintf(__('(%s)'),$level) : '').
222               '</span>';
[649]223     }
224     return '';
225}
226
[357]227$ductile_base = array(
[389]228     // HTML
229     'subtitle_hidden' => null,
[810]230     'logo_src' => null,
[1096]231     'preview_not_mandatory' => null,
[389]232     // CSS
[376]233     'body_font' => null,
[1081]234     'body_webfont_family' => null,
235     'body_webfont_url' => null,
236     'body_webfont_api' => null,
[387]237     'alternate_font' => null,
[1081]238     'alternate_webfont_family' => null,
239     'alternate_webfont_url' => null,
240     'alternate_webfont_api' => null,
[387]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,
[515]255     'post_title_c_m' => null,
256     'post_simple_title_c' => null
[357]257);
258
[563]259$ductile_lists_base = array(
[646]260     'default' => 'short',
261     'default-page' => 'short',
262     'category' => 'short',
263     'tag' => 'short',
264     'search' => 'short',
[667]265     'archive' => 'short'
[563]266);
267
[583]268$ductile_counts_base = array(
269     'default' => null,
270     'category' => null,
271     'tag' => null,
272     'search' => null
273);
274
[605]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
[614]297// If no stickers defined, add feed Atom one
298if (!is_array($ductile_stickers)) {
299     $ductile_stickers = array(array(
300          'label' => __('Subscribe'),
[776]301          'url' => $core->blog->url.
302               $core->url->getURLFor('feed','atom'),
[614]303          'image' => 'sticker-feed.png'
304          ));
305}
306
[605]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
[390]330$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html';
331
[357]332if (!empty($_POST))
333{
334     try
335     {
[389]336          # HTML
[390]337          if ($conf_tab == 'html') {
338               $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']);
[810]339               $ductile_user['logo_src'] = $_POST['logo_src'];
[1096]340               $ductile_user['preview_not_mandatory'] = (integer) !empty($_POST['preview_not_mandatory']);
[605]341
[604]342               $ductile_stickers = array();
[605]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']
[604]364                         );
365                    }
[605]366                    $ductile_stickers = $new_ductile_stickers;
[419]367               }
[605]368               
[563]369               for ($i = 0; $i < count($_POST['list_type']); $i++) {
370                    $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i];
371               }
372               
[583]373               for ($i = 0; $i < count($_POST['count_nb']); $i++) {
374                    $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i];
375               }
376               
[390]377          }
[389]378         
379          # CSS
[390]380          if ($conf_tab == 'css') {
381               $ductile_user['body_font'] = $_POST['body_font'];
[1081]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
[390]386               $ductile_user['alternate_font'] = $_POST['alternate_font'];
[1081]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]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']);
[389]394         
[390]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']);
[387]398         
[390]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']);
[387]402         
[515]403               $ductile_user['post_simple_title_c'] = adjustColor($_POST['post_simple_title_c']);
404         
[390]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']);
[387]408         
[390]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          }
[376]413         
[357]414          $core->blog->settings->addNamespace('themes');
[394]415          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user));
[419]416          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers));
[563]417          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists));
[583]418          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts));
[572]419
420          // Blog refresh
[357]421          $core->blog->triggerBlog();
422
[572]423          // Template cache reset
424          $core->emptyTemplatesCache();
425         
[907]426          dcPage::message(__('Theme configuration upgraded.'),true,true);
[357]427     }
428     catch (Exception $e)
429     {
430          $core->error->add($e->getMessage());
431     }
432}
433
[613]434// Legacy mode
435if (!$standalone_config) echo '</form>';
436
[389]437# HTML Tab
438
[2003]439echo '<div class="multi-part" id="themes-list'.($conf_tab == 'html' ? '' : '-html').'" title="'.__('Content').'">'.
[2335]440'<h3>'.__('Content').'</h3>';
[390]441
442echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
[389]443
[2335]444echo '<h4>'.__('Header').'</h4>'.
445'<p class="field"><label for="subtitle_hidden">'.__('Hide blog description:').'</label> '.
446form::checkbox('subtitle_hidden',1,$ductile_user['subtitle_hidden']).'</p>';
447echo '<p class="field"><label for="logo_src">'.__('Logo URL:').'</label> '.
448     form::field('logo_src',40,255,$ductile_user['logo_src']).'</p>';
[612]449if ($core->plugins->moduleExists('simpleMenu'))
450{
451     echo '<p>'.sprintf(__('To configure the top menu go to the <a href="%s">Simple Menu administration page</a>.'),'plugin.php?p=simpleMenu').'</p>';
452}
[389]453
[2335]454echo '<h4 class="border-top pretty-title">'.__('Stickers').'</h4>';
[419]455
[2002]456echo 
457'<div class="table-outer">'.
458'<table class="dragable">'.'<caption>'.__('Stickers (footer)').'</caption>'.
[419]459'<thead>'.
460'<tr>'.
[605]461'<th scope="col">'.'</th>'.
[604]462'<th scope="col">'.__('Image').'</th>'.
[419]463'<th scope="col">'.__('Label').'</th>'.
464'<th scope="col">'.__('URL').'</th>'.
465'</tr>'.
466'</thead>'.
[605]467'<tbody id="stickerslist">';
468$count = 0;
469foreach ($ductile_stickers as $i => $v) {
470     $count++;
[604]471     echo 
[605]472     '<tr class="line" id="l_'.$i.'">'.
473     '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false).
474          form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'.
[1622]475     '<td>'.form::hidden(array('sticker_image[]'),$v['image']).'<img src="'.$img_url.$v['image'].'" alt="'.$v['image'].'" /> '.'</td>'.
476     '<td scope="row">'.form::field(array('sticker_label[]','dsl-'.$i),20,255,$v['label']).'</td>'.
[605]477     '<td>'.form::field(array('sticker_url[]','dsu-'.$i),40,255,$v['url']).'</td>'.
[604]478     '</tr>';
479}
480echo
[419]481'</tbody>'.
[2002]482'</table></div>';
[419]483
[2335]484echo '<h4 class="border-top pretty-title">'.__('Entries list types and limits').'</h4>';
[419]485
[2335]486echo '<table id="entrieslist">'.'<caption class="hidden">'.__('Entries lists').'</caption>'.
[563]487'<thead>'.
488'<tr>'.
489'<th scope="col">'.__('Context').'</th>'.
490'<th scope="col">'.__('Entries list type').'</th>'.
[583]491'<th scope="col">'.__('Number of entries').'</th>'.
[563]492'</tr>'.
493'</thead>'.
494'<tbody>';
495foreach ($ductile_lists as $k => $v) {
496     echo 
497          '<tr>'.
[1622]498          '<td scope="row">'.$contexts[$k].'</td>'.
[583]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
[563]506          '</tr>';
507}
508echo
509'</tbody>'.
510'</table>';
511
[2335]512echo '<h4 class="border-top pretty-title">'.__('Miscellaneous options').'</h4>';
513echo '<p><label for="preview_not_mandatory" class="classic">'.__('Comment preview is not mandatory:').'</label> '.
514form::checkbox('preview_not_mandatory',1,$ductile_user['preview_not_mandatory']).'</p>';
[1096]515
[1622]516echo '<p><input type="hidden" name="conf_tab" value="html" /></p>';
[605]517echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
[390]518echo '</form>';
519
[389]520echo '</div>'; // Close tab
521
522# CSS tab
523
[390]524echo '<div class="multi-part" id="themes-list'.($conf_tab == 'css' ? '' : '-css').'" title="'.__('Presentation').'">';
525
526echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">';
[389]527
[387]528echo '<h3>'.__('General settings').'</h3>';
529
[2335]530echo '<h4 class="pretty-title">'.__('Fonts').'</h4>';
[1081]531
532echo '<div class="two-cols">';
533echo '<div class="col">';
534echo
[2335]535'<h5>'.__('Main text').'</h5>'.
536'<p class="field"><label for="body_font">'.__('Main font:').'</label> '.
537form::combo('body_font',$fonts,$ductile_user['body_font']).
[656]538(!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : '').
[2335]539' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
[656]540'</p>'.
[1081]541'<p class="field"><label for="body_webfont_family">'.__('Webfont family:').'</label> '.
542form::field('body_webfont_family',25,255,$ductile_user['body_webfont_family']).'</p>'.
543'<p class="field"><label for="body_webfont_url">'.__('Webfont URL:').'</label> '.
544form::field('body_webfont_url',50,255,$ductile_user['body_webfont_url']).'</p>'.
[2335]545'<p class="field"><label for="body_webfont_url">'.__('Webfont API:').'</label> '.
546form::combo('body_webfont_api',$webfont_apis,$ductile_user['body_webfont_api']).'</p>';
[1081]547echo '</div>';
548echo '<div class="col">';
549echo
[2335]550'<h5>'.__('Secondary text').'</h5>'.
551'<p class="field"><label for="alternate_font">'.__('Secondary font:').'</label> '.
552form::combo('alternate_font',$fonts,$ductile_user['alternate_font']).
[656]553(!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : '').
[2335]554' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'.
[656]555'</p>'.
[1081]556'<p class="field"><label for="alternate_webfont_family">'.__('Webfont family:').'</label> '.
557form::field('alternate_webfont_family',25,255,$ductile_user['alternate_webfont_family']).'</p>'.
558'<p class="field"><label for="alternate_webfont_url">'.__('Webfont URL:').'</label> '.
559form::field('alternate_webfont_url',50,255,$ductile_user['alternate_webfont_url']).'</p>'.
[2335]560'<p class="field"><label for="alternate_webfont_api">'.__('Webfont API:').'</label> '.
561form::combo('alternate_webfont_api',$webfont_apis,$ductile_user['alternate_webfont_api']).'</p>';
[1081]562echo '</div>';
563echo '</div>';
[376]564
[2335]565echo '<h4 class="clear border-top pretty-title">'.__('Titles').'</h4>';
[387]566echo '<div class="two-cols">';
567echo '<div class="col">';
[2335]568echo '<h5>'.__('Blog title').'</h5>'.
569'<p class="field"><label for="blog_title_w">'.__('In bold:').'</label> '.
570form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</p>'.
[387]571
[395]572'<p class="field"><label for="blog_title_s">'.__('Font size (in em by default):').'</label> '.
573form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'</p>'.
[387]574
[389]575'<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '.
[653]576form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').
577contrastRatio($ductile_user['blog_title_c'],'#ffffff',
578     (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'),
579     $ductile_user['blog_title_w']).
[2335]580'</p>';
[387]581
582echo '</div>';
583echo '<div class="col">';
584
[2335]585echo '<h5>'.__('Post title').'</h5>'.
586'<p class="field"><label for="post_title_w">'.__('In bold:').'</label> '.
587form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</p>'.
[387]588
[395]589'<p class="field"><label for="post_title_s">'.__('Font size (in em by default):').'</label> '.
590form::field('post_title_s',7,7,$ductile_user['post_title_s']).'</p>'.
[387]591
[389]592'<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '.
[653]593form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').
594contrastRatio($ductile_user['post_title_c'],'#ffffff',
595     (!empty($ductile_user['post_title_s']) ? $ductile_user['post_title_s'] : '2.5em'),
596     $ductile_user['post_title_w']).
[2335]597'</p>';
[387]598
599echo '</div>';
600echo '</div>';
601
[2335]602echo '<h5>'.__('Titles without link').'</h5>'.
[515]603
604'<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '.
[653]605form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').
606contrastRatio($ductile_user['post_simple_title_c'],'#ffffff',
607     '1.1em',  // H5 minimum size
608     false).
[2335]609'</p>';
[515]610
[2335]611echo '<h4 class="border-top pretty-title">'.__('Inside posts links').'</h4>'.
612'<p class="field"><label for="post_link_w">'.__('In bold:').'</label> '.
613form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</p>'.
[357]614
[389]615'<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '.
[653]616form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').
617contrastRatio($ductile_user['post_link_v_c'],'#ffffff',
618     '1em',
619     $ductile_user['post_link_w']).
620'</p>'.
[357]621
[648]622'<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '.
[653]623form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').
624contrastRatio($ductile_user['post_link_f_c'],'#ebebee',
625     '1em',
626     $ductile_user['post_link_w']).
[2335]627'</p>';
[357]628
[2335]629echo '<h3 class="border-top">'.__('Mobile specific settings').'</h3>';
[387]630
631echo '<div class="two-cols">';
632echo '<div class="col">';
633
[2335]634echo '<h4 class="pretty-title">'.__('Blog title').'</h4>'.
635'<p class="field"><label for="blog_title_w_m">'.__('In bold:').'</label> '.
636form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</p>'.
[387]637
[395]638'<p class="field"><label for="blog_title_s_m">'.__('Font size (in em by default):').'</label> '.
639form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).'</p>'.
[387]640
[389]641'<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '.
[653]642form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').
643contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc',
644     (!empty($ductile_user['blog_title_s_m']) ? $ductile_user['blog_title_s_m'] : '1.8em'),
645     $ductile_user['blog_title_w_m']).
[2335]646'</p>';
[387]647
648echo '</div>';
649echo '<div class="col">';
650
[2335]651echo '<h4 class="pretty-title">'.__('Post title').'</h4>'.
652'<p class="field"><label for="post_title_w_m">'.__('In bold:').'</label> '.
653form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</p>'.
[387]654
[395]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>'.
[387]657
[389]658'<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '.
[653]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']).
[2335]663'</p>';
[387]664
665echo '</div>';
666echo '</div>';
667
[1622]668echo '<p><input type="hidden" name="conf_tab" value="css" /></p>';
[2335]669echo '<p class="clear border-top"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
[390]670echo '</form>';
671
[389]672echo '</div>'; // Close tab
673
[634]674dcPage::helpBlock('ductile');
675
[613]676// Legacy mode
677if (!$standalone_config) echo '<form style="display:none">';
[622]678?>
Note: See TracBrowser for help on using the repository browser.

Sites map