Dotclear

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

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

Load contextual help if possible

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

Sites map