Dotclear

source: themes/ductile/_config.php @ 2002:a0de6679a058

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

Tableaux responsive. Poke jcDenis :-)

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
[390]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">';
[389]442
443echo '<fieldset><legend>'.__('Header').'</legend>'.
444'<p class="field"><label for="subtitle_hidden">'.__('Hide blog description:').' '.
[612]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}
[1008]450echo '<p class="field"><label for="logo_src">'.__('Logo URL:').' '.
[810]451     form::field('logo_src',40,255,$ductile_user['logo_src']).'</label>'.'</p>';
[612]452echo '</fieldset>';
[389]453
[425]454echo '<fieldset><legend>'.__('Stickers').'</legend>';
[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
[425]484echo '</fieldset>';
[419]485
[583]486echo '<fieldset><legend>'.__('Entries list types and limits').'</legend>';
[563]487
488echo '<table id="entrieslist">'.'<caption>'.__('Entries lists').'</caption>'.
489'<thead>'.
490'<tr>'.
491'<th scope="col">'.__('Context').'</th>'.
492'<th scope="col">'.__('Entries list type').'</th>'.
[583]493'<th scope="col">'.__('Number of entries').'</th>'.
[563]494'</tr>'.
495'</thead>'.
496'<tbody>';
497foreach ($ductile_lists as $k => $v) {
498     echo 
499          '<tr>'.
[1622]500          '<td scope="row">'.$contexts[$k].'</td>'.
[583]501          '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>';
502     if (array_key_exists($k,$ductile_counts)) {
503          echo '<td>'.form::hidden(array('count_ctx[]'),$k).form::field(array('count_nb[]'),2,3,$ductile_counts[$k]).'</td>';
504     } else {
505          echo '<td></td>';
506     }
507     echo
[563]508          '</tr>';
509}
510echo
511'</tbody>'.
512'</table>';
513
514echo '</fieldset>';
515
[1096]516echo '<fieldset><legend>'.__('Miscellaneous options').'</legend>';
517echo '<p class="field"><label for="preview_not_mandatory">'.__('Comment preview is not mandatory:').' '.
518form::checkbox('preview_not_mandatory',1,$ductile_user['preview_not_mandatory']).'</label>'.'</p>';
519echo '</fieldset>';
520
[1622]521echo '<p><input type="hidden" name="conf_tab" value="html" /></p>';
[605]522echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
[390]523echo '</form>';
524
[389]525echo '</div>'; // Close tab
526
527# CSS tab
528
[390]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">';
[389]532
[387]533echo '<h3>'.__('General settings').'</h3>';
534
[1081]535echo '<fieldset><legend>'.__('Fonts').'</legend>';
536
537echo '<div class="two-cols">';
538echo '<div class="col">';
539echo
[388]540'<p class="field"><label for="body_font">'.__('Main:').' '.
[656]541form::combo('body_font',$fonts,$ductile_user['body_font']).'</label>'.
542(!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : '').
543'</p>'.
[1526]544'<p class="form-note">'.__('Set main font to Default to use webfont below.').'</p> '.
[1081]545'<p class="field"><label for="body_webfont_family">'.__('Webfont family:').'</label> '.
546form::field('body_webfont_family',25,255,$ductile_user['body_webfont_family']).'</p>'.
547'<p class="field"><label for="body_webfont_url">'.__('Webfont URL:').'</label> '.
548form::field('body_webfont_url',50,255,$ductile_user['body_webfont_url']).'</p>'.
549'<p class="field"><label for="body_webfont_url">'.__('Webfont API:').' '.
550form::combo('body_webfont_api',$webfont_apis,$ductile_user['body_webfont_api']).'</label>'.'</p>';
551echo '</div>';
552echo '<div class="col">';
553echo
[388]554'<p class="field"><label for="alternate_font">'.__('Secondary:').' '.
[656]555form::combo('alternate_font',$fonts,$ductile_user['alternate_font']).'</label>'.
556(!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : '').
557'</p>'.
[1526]558'<p class="form-note">'.__('Set secondary font to Default to use webfont below.').'</p> '.
[1081]559'<p class="field"><label for="alternate_webfont_family">'.__('Webfont family:').'</label> '.
560form::field('alternate_webfont_family',25,255,$ductile_user['alternate_webfont_family']).'</p>'.
561'<p class="field"><label for="alternate_webfont_url">'.__('Webfont URL:').'</label> '.
562form::field('alternate_webfont_url',50,255,$ductile_user['alternate_webfont_url']).'</p>'.
563'<p class="field"><label for="alternate_webfont_api">'.__('Webfont API:').' '.
564form::combo('alternate_webfont_api',$webfont_apis,$ductile_user['alternate_webfont_api']).'</label>'.'</p>';
565echo '</div>';
566echo '</div>';
567echo '</fieldset>';
[376]568
[387]569echo '<div class="two-cols">';
570echo '<div class="col">';
571
572echo '<fieldset><legend>'.__('Blog title').'</legend>'.
[388]573'<p class="field"><label for="blog_title_w">'.__('In bold:').' '.
[387]574form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</label>'.'</p>'.
575
[395]576'<p class="field"><label for="blog_title_s">'.__('Font size (in em by default):').'</label> '.
577form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'</p>'.
[387]578
[389]579'<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '.
[653]580form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').
581contrastRatio($ductile_user['blog_title_c'],'#ffffff',
582     (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'),
583     $ductile_user['blog_title_w']).
584'</p>'.
[387]585'</fieldset>';
586
587echo '</div>';
588echo '<div class="col">';
589
590echo '<fieldset><legend>'.__('Post title').'</legend>'.
[388]591'<p class="field"><label for="post_title_w">'.__('In bold:').' '.
[387]592form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</label>'.'</p>'.
593
[395]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>'.
[387]596
[389]597'<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '.
[653]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>'.
[387]603'</fieldset>';
604
605echo '</div>';
606echo '</div>';
607
[515]608echo '<fieldset><legend>'.__('Titles without link').'</legend>'.
609
610'<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '.
[653]611form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').
612contrastRatio($ductile_user['post_simple_title_c'],'#ffffff',
613     '1.1em',  // H5 minimum size
614     false).
615'</p>'.
[515]616'</fieldset>';
617
[378]618echo '<fieldset><legend>'.__('Inside posts links').'</legend>'.
[388]619'<p class="field"><label for="post_link_w">'.__('In bold:').' '.
[387]620form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</label>'.'</p>'.
[357]621
[389]622'<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '.
[653]623form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').
624contrastRatio($ductile_user['post_link_v_c'],'#ffffff',
625     '1em',
626     $ductile_user['post_link_w']).
627'</p>'.
[357]628
[648]629'<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '.
[653]630form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').
631contrastRatio($ductile_user['post_link_f_c'],'#ebebee',
632     '1em',
633     $ductile_user['post_link_w']).
634'</p>'.
[357]635'</fieldset>';
636
[387]637echo '<h3>'.__('Mobile specific settings').'</h3>';
638
639echo '<div class="two-cols">';
640echo '<div class="col">';
641
642echo '<fieldset><legend>'.__('Blog title').'</legend>'.
[388]643'<p class="field"><label for="blog_title_w_m">'.__('In bold:').' '.
[387]644form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</label>'.'</p>'.
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']).
654'</p>'.
[387]655'</fieldset>';
656
657echo '</div>';
658echo '<div class="col">';
659
660echo '<fieldset><legend>'.__('Post title').'</legend>'.
[388]661'<p class="field"><label for="post_title_w_m">'.__('In bold:').' '.
[387]662form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</label>'.'</p>'.
663
[395]664'<p class="field"><label for="post_title_s_m">'.__('Font size (in em by default):').'</label> '.
665form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).'</p>'.
[387]666
[389]667'<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '.
[653]668form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').
669contrastRatio($ductile_user['post_title_c_m'],'#ffffff',
670     (!empty($ductile_user['post_title_s_m']) ? $ductile_user['post_title_s_m'] : '1.5em'),
671     $ductile_user['post_title_w_m']).
672'</p>'.
[387]673'</fieldset>';
674
675echo '</div>';
676echo '</div>';
677
[1622]678echo '<p><input type="hidden" name="conf_tab" value="css" /></p>';
[390]679echo '<p class="clear"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>';
680echo '</form>';
681
[389]682echo '</div>'; // Close tab
683
[634]684dcPage::helpBlock('ductile');
685
[613]686// Legacy mode
687if (!$standalone_config) echo '<form style="display:none">';
[622]688?>
Note: See TracBrowser for help on using the repository browser.

Sites map