Dotclear


Ignore:
Timestamp:
03/02/18 15:55:06 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Use specialized input fields (color, email, url, number, …) where is relevant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_config.php

    r2829 r3725  
    99# 
    1010# -- END LICENSE BLOCK ----------------------------------------- 
    11 if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    12  
    13 l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); 
    14  
    15 if (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/'); 
     11if (!defined('DC_CONTEXT_ADMIN')) {return;} 
     12 
     13l10n::set(dirname(__FILE__) . '/locales/' . $_lang . '/admin'); 
     14 
     15if (preg_match('#^http(s)?://#', $core->blog->settings->system->themes_url)) { 
     16    $img_url = http::concatURL($core->blog->settings->system->themes_url, '/' . $core->blog->settings->system->theme . '/img/'); 
    1717} else { 
    18      $img_url = http::concatURL($core->blog->url,$core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/'); 
    19 } 
    20 $img_path = dirname(__FILE__).'/img/'; 
    21  
    22 $tpl_path = dirname(__FILE__).'/tpl/'; 
    23  
    24 $standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme,'standalone_config'); 
     18    $img_url = http::concatURL($core->blog->url, $core->blog->settings->system->themes_url . '/' . $core->blog->settings->system->theme . '/img/'); 
     19} 
     20$img_path = dirname(__FILE__) . '/img/'; 
     21 
     22$tpl_path = dirname(__FILE__) . '/tpl/'; 
     23 
     24$standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme, 'standalone_config'); 
    2525 
    2626// Load contextual help 
    27 if (file_exists(dirname(__FILE__).'/locales/'.$_lang.'/resources.php')) { 
    28      require dirname(__FILE__).'/locales/'.$_lang.'/resources.php'; 
     27if (file_exists(dirname(__FILE__) . '/locales/' . $_lang . '/resources.php')) { 
     28    require dirname(__FILE__) . '/locales/' . $_lang . '/resources.php'; 
    2929} 
    3030 
    3131$list_types = array( 
    32      __('Title') => 'title', 
    33      __('Short') => 'short', 
    34      __('Full') => 'full' 
     32    __('Title') => 'title', 
     33    __('Short') => 'short', 
     34    __('Full') => 'full' 
    3535); 
    3636// Get all _entry-*.html in tpl folder of theme 
    3737$list_types_templates = files::scandir($tpl_path); 
    3838if (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      } 
     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    } 
    4949} 
    5050 
    5151$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'), 
    57      'archive' => __('Month archive entries') 
     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'), 
     57    'archive'      => __('Month archive entries') 
    5858); 
    5959 
    6060$fonts = array( 
    61      __('Default') => '', 
    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' 
     61    __('Default')          => '', 
     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' 
    7272); 
    7373 
    7474$webfont_apis = array( 
    75      __('none') => '', 
    76      __('javascript (Adobe)') => 'js', 
    77      __('stylesheet (Google)') => 'css' 
     75    __('none')                => '', 
     76    __('javascript (Adobe)') => 'js', 
     77    __('stylesheet (Google)') => 'css' 
    7878); 
    7979 
    8080$font_families = array( 
    81      // Theme standard 
    82      'Ductile body' => '"Century Schoolbook", "Century Schoolbook L", Georgia, serif', 
    83      'Ductile alternate' => '"Franklin gothic medium", "arial narrow", "DejaVu Sans Condensed", "helvetica neue", helvetica, sans-serif', 
    84  
    85      // Serif families 
    86      'Times New Roman' => 'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif', 
    87      'Georgia' => 'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif', 
    88      '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', 
    89  
    90      // Sans-serif families 
    91      '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', 
    92      'Verdana' => 'Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif', 
    93      'Trebuchet MS' => '"Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif', 
    94  
    95      // Cursive families 
    96      'Impact' => 'Impact, Haettenschweiler, "Franklin Gothic Bold", Charcoal, "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif', 
    97  
    98      // Monospace families 
    99      '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' 
     81    // Theme standard 
     82    'Ductile body'      => '"Century Schoolbook", "Century Schoolbook L", Georgia, serif', 
     83    'Ductile alternate' => '"Franklin gothic medium", "arial narrow", "DejaVu Sans Condensed", "helvetica neue", helvetica, sans-serif', 
     84 
     85    // Serif families 
     86    'Times New Roman'  => 'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif', 
     87    'Georgia'          => 'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif', 
     88    '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', 
     89 
     90    // Sans-serif families 
     91    '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', 
     92    'Verdana'          => 'Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif', 
     93    'Trebuchet MS'      => '"Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif', 
     94 
     95    // Cursive families 
     96    'Impact'            => 'Impact, Haettenschweiler, "Franklin Gothic Bold", Charcoal, "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif', 
     97 
     98    // Monospace families 
     99    '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' 
    100100); 
    101101 
    102102function fontDef($c) 
    103103{ 
    104      global $font_families; 
    105  
    106      return isset($font_families[$c]) ? '<span style="position:absolute;top:0;left:32em;">'.$font_families[$c].'</span>' : ''; 
     104    global $font_families; 
     105 
     106    return isset($font_families[$c]) ? '<span style="position:absolute;top:0;left:32em;">' . $font_families[$c] . '</span>' : ''; 
    107107} 
    108108 
    109109$ductile_base = array( 
    110      // HTML 
    111      'subtitle_hidden' => null, 
    112      'logo_src' => null, 
    113      'preview_not_mandatory' => null, 
    114      // CSS 
    115      'body_font' => null, 
    116      'body_webfont_family' => null, 
    117      'body_webfont_url' => null, 
    118      'body_webfont_api' => null, 
    119      'alternate_font' => null, 
    120      'alternate_webfont_family' => null, 
    121      'alternate_webfont_url' => null, 
    122      'alternate_webfont_api' => null, 
    123      'blog_title_w' => null, 
    124      'blog_title_s' => null, 
    125      'blog_title_c' => null, 
    126      'post_title_w' => null, 
    127      'post_title_s' => null, 
    128      'post_title_c' => null, 
    129      'post_link_w' => null, 
    130      'post_link_v_c' => null, 
    131      'post_link_f_c' => null, 
    132      'blog_title_w_m' => null, 
    133      'blog_title_s_m' => null, 
    134      'blog_title_c_m' => null, 
    135      'post_title_w_m' => null, 
    136      'post_title_s_m' => null, 
    137      'post_title_c_m' => null, 
    138      'post_simple_title_c' => null 
     110    // HTML 
     111    'subtitle_hidden'          => null, 
     112    'logo_src'                => null, 
     113    'preview_not_mandatory'    => null, 
     114    // CSS 
     115    'body_font'                => null, 
     116    'body_webfont_family'      => null, 
     117    'body_webfont_url'        => null, 
     118    'body_webfont_api'        => null, 
     119    'alternate_font'          => null, 
     120    'alternate_webfont_family' => null, 
     121    'alternate_webfont_url'    => null, 
     122    'alternate_webfont_api'    => null, 
     123    'blog_title_w'            => null, 
     124    'blog_title_s'            => null, 
     125    'blog_title_c'            => null, 
     126    'post_title_w'            => null, 
     127    'post_title_s'            => null, 
     128    'post_title_c'            => null, 
     129    'post_link_w'              => null, 
     130    'post_link_v_c'            => null, 
     131    'post_link_f_c'            => null, 
     132    'blog_title_w_m'          => null, 
     133    'blog_title_s_m'          => null, 
     134    'blog_title_c_m'          => null, 
     135    'post_title_w_m'          => null, 
     136    'post_title_s_m'          => null, 
     137    'post_title_c_m'          => null, 
     138    'post_simple_title_c'      => null 
    139139); 
    140140 
    141141$ductile_lists_base = array( 
    142      'default' => 'short', 
    143      'default-page' => 'short', 
    144      'category' => 'short', 
    145      'tag' => 'short', 
    146      'search' => 'short', 
    147      'archive' => 'short' 
     142    'default'      => 'short', 
     143    'default-page' => 'short', 
     144    'category'    => 'short', 
     145    'tag'          => 'short', 
     146    'search'      => 'short', 
     147    'archive'      => 'short' 
    148148); 
    149149 
    150150$ductile_counts_base = array( 
    151      'default' => null, 
    152      'default-page' => null, 
    153      'category' => null, 
    154      'tag' => null, 
    155      'search' => null 
    156 ); 
    157  
    158 $ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style'); 
     151    'default'      => null, 
     152    'default-page' => null, 
     153    'category'    => null, 
     154    'tag'          => null, 
     155    'search'      => null 
     156); 
     157 
     158$ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme . '_style'); 
    159159$ductile_user = @unserialize($ductile_user); 
    160160if (!is_array($ductile_user)) { 
    161      $ductile_user = array(); 
    162 } 
    163 $ductile_user = array_merge($ductile_base,$ductile_user); 
    164  
    165 $ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists'); 
     161    $ductile_user = array(); 
     162} 
     163$ductile_user = array_merge($ductile_base, $ductile_user); 
     164 
     165$ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme . '_entries_lists'); 
    166166$ductile_lists = @unserialize($ductile_lists); 
    167167if (!is_array($ductile_lists)) { 
    168      $ductile_lists = $ductile_lists_base; 
    169 } 
    170 $ductile_lists = array_merge($ductile_lists_base,$ductile_lists); 
    171  
    172 $ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts'); 
     168    $ductile_lists = $ductile_lists_base; 
     169} 
     170$ductile_lists = array_merge($ductile_lists_base, $ductile_lists); 
     171 
     172$ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme . '_entries_counts'); 
    173173$ductile_counts = @unserialize($ductile_counts); 
    174174if (!is_array($ductile_counts)) { 
    175      $ductile_counts = $ductile_counts_base; 
    176 } 
    177 $ductile_counts = array_merge($ductile_counts_base,$ductile_counts); 
    178  
    179 $ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); 
     175    $ductile_counts = $ductile_counts_base; 
     176} 
     177$ductile_counts = array_merge($ductile_counts_base, $ductile_counts); 
     178 
     179$ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme . '_stickers'); 
    180180$ductile_stickers = @unserialize($ductile_stickers); 
    181181 
    182182// If no stickers defined, add feed Atom one 
    183183if (!is_array($ductile_stickers)) { 
    184      $ductile_stickers = array(array( 
    185           'label' => __('Subscribe'), 
    186           'url' => $core->blog->url. 
    187                $core->url->getURLFor('feed','atom'), 
    188           'image' => 'sticker-feed.png' 
    189           )); 
     184    $ductile_stickers = array(array( 
     185        'label' => __('Subscribe'), 
     186        'url'   => $core->blog->url . 
     187        $core->url->getURLFor('feed', 'atom'), 
     188        'image' => 'sticker-feed.png' 
     189    )); 
    190190} 
    191191 
     
    193193// Get all sticker images already used 
    194194if (is_array($ductile_stickers)) { 
    195      foreach ($ductile_stickers as $v) { 
    196           $ductile_stickers_full[] = $v['image']; 
    197      } 
     195    foreach ($ductile_stickers as $v) { 
     196        $ductile_stickers_full[] = $v['image']; 
     197    } 
    198198} 
    199199// Get all sticker-*.png in img folder of theme 
    200200$ductile_stickers_images = files::scandir($img_path); 
    201201if (is_array($ductile_stickers_images)) { 
    202      foreach ($ductile_stickers_images as $v) { 
    203           if (preg_match('/^sticker\-(.*)\.png$/',$v)) { 
    204                if (!in_array($v,$ductile_stickers_full)) { 
    205                     // image not already used 
    206                     $ductile_stickers[] = array( 
    207                          'label' => null, 
    208                          'url' => null, 
    209                          'image' => $v); 
    210                } 
    211           } 
    212      } 
     202    foreach ($ductile_stickers_images as $v) { 
     203        if (preg_match('/^sticker\-(.*)\.png$/', $v)) { 
     204            if (!in_array($v, $ductile_stickers_full)) { 
     205                // image not already used 
     206                $ductile_stickers[] = array( 
     207                    'label' => null, 
     208                    'url'  => null, 
     209                    'image' => $v); 
     210            } 
     211        } 
     212    } 
    213213} 
    214214 
    215215$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; 
    216216 
    217 if (!empty($_POST)) 
    218 { 
    219      try 
    220      { 
    221           # HTML 
    222           if ($conf_tab == 'html') { 
    223                $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']); 
    224                $ductile_user['logo_src'] = $_POST['logo_src']; 
    225                $ductile_user['preview_not_mandatory'] = (integer) !empty($_POST['preview_not_mandatory']); 
    226  
    227                $ductile_stickers = array(); 
    228                for ($i = 0; $i < count($_POST['sticker_image']); $i++) { 
    229                     $ductile_stickers[] = array( 
    230                          'label' => $_POST['sticker_label'][$i], 
    231                          'url' => $_POST['sticker_url'][$i], 
    232                          'image' => $_POST['sticker_image'][$i] 
    233                     ); 
    234                } 
    235  
    236                $order = array(); 
    237                if (empty($_POST['ds_order']) && !empty($_POST['order'])) { 
    238                     $order = $_POST['order']; 
    239                     asort($order); 
    240                     $order = array_keys($order); 
    241                } 
    242                if (!empty($order)) { 
    243                     $new_ductile_stickers = array(); 
    244                     foreach ($order as $i => $k) { 
    245                          $new_ductile_stickers[] = array( 
    246                               'label' => $ductile_stickers[$k]['label'], 
    247                               'url' => $ductile_stickers[$k]['url'], 
    248                               'image' => $ductile_stickers[$k]['image'] 
    249                          ); 
    250                     } 
    251                     $ductile_stickers = $new_ductile_stickers; 
    252                } 
    253  
    254                for ($i = 0; $i < count($_POST['list_type']); $i++) { 
    255                     $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i]; 
    256                } 
    257  
    258                for ($i = 0; $i < count($_POST['count_nb']); $i++) { 
    259                     $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i]; 
    260                } 
    261  
    262           } 
    263  
    264           # CSS 
    265           if ($conf_tab == 'css') { 
    266                $ductile_user['body_font'] = $_POST['body_font']; 
    267                $ductile_user['body_webfont_family'] = $_POST['body_webfont_family']; 
    268                $ductile_user['body_webfont_url'] = $_POST['body_webfont_url']; 
    269                $ductile_user['body_webfont_api'] = $_POST['body_webfont_api']; 
    270  
    271                $ductile_user['alternate_font'] = $_POST['alternate_font']; 
    272                $ductile_user['alternate_webfont_family'] = $_POST['alternate_webfont_family']; 
    273                $ductile_user['alternate_webfont_url'] = $_POST['alternate_webfont_url']; 
    274                $ductile_user['alternate_webfont_api'] = $_POST['alternate_webfont_api']; 
    275  
    276                $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']); 
    277                $ductile_user['blog_title_s'] = dcThemeConfig::adjustFontSize($_POST['blog_title_s']); 
    278                $ductile_user['blog_title_c'] = dcThemeConfig::adjustColor($_POST['blog_title_c']); 
    279  
    280                $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']); 
    281                $ductile_user['post_title_s'] = dcThemeConfig::adjustFontSize($_POST['post_title_s']); 
    282                $ductile_user['post_title_c'] = dcThemeConfig::adjustColor($_POST['post_title_c']); 
    283  
    284                $ductile_user['post_link_w'] = (integer) !empty($_POST['post_link_w']); 
    285                $ductile_user['post_link_v_c'] = dcThemeConfig::adjustColor($_POST['post_link_v_c']); 
    286                $ductile_user['post_link_f_c'] = dcThemeConfig::adjustColor($_POST['post_link_f_c']); 
    287  
    288                $ductile_user['post_simple_title_c'] = dcThemeConfig::adjustColor($_POST['post_simple_title_c']); 
    289  
    290                $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']); 
    291                $ductile_user['blog_title_s_m'] = dcThemeConfig::adjustFontSize($_POST['blog_title_s_m']); 
    292                $ductile_user['blog_title_c_m'] = dcThemeConfig::adjustColor($_POST['blog_title_c_m']); 
    293  
    294                $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']); 
    295                $ductile_user['post_title_s_m'] = dcThemeConfig::adjustFontSize($_POST['post_title_s_m']); 
    296                $ductile_user['post_title_c_m'] = dcThemeConfig::adjustColor($_POST['post_title_c_m']); 
    297           } 
    298  
    299           $core->blog->settings->addNamespace('themes'); 
    300           $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user)); 
    301           $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); 
    302           $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists)); 
    303           $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts)); 
    304  
    305           // Blog refresh 
    306           $core->blog->triggerBlog(); 
    307  
    308           // Template cache reset 
    309           $core->emptyTemplatesCache(); 
    310  
    311           dcPage::message(__('Theme configuration upgraded.'),true,true); 
    312      } 
    313      catch (Exception $e) 
    314      { 
    315           $core->error->add($e->getMessage()); 
    316      } 
     217if (!empty($_POST)) { 
     218    try 
     219    { 
     220        # HTML 
     221        if ($conf_tab == 'html') { 
     222            $ductile_user['subtitle_hidden']       = (integer) !empty($_POST['subtitle_hidden']); 
     223            $ductile_user['logo_src']              = $_POST['logo_src']; 
     224            $ductile_user['preview_not_mandatory'] = (integer) !empty($_POST['preview_not_mandatory']); 
     225 
     226            $ductile_stickers = array(); 
     227            for ($i = 0; $i < count($_POST['sticker_image']); $i++) { 
     228                $ductile_stickers[] = array( 
     229                    'label' => $_POST['sticker_label'][$i], 
     230                    'url'   => $_POST['sticker_url'][$i], 
     231                    'image' => $_POST['sticker_image'][$i] 
     232                ); 
     233            } 
     234 
     235            $order = array(); 
     236            if (empty($_POST['ds_order']) && !empty($_POST['order'])) { 
     237                $order = $_POST['order']; 
     238                asort($order); 
     239                $order = array_keys($order); 
     240            } 
     241            if (!empty($order)) { 
     242                $new_ductile_stickers = array(); 
     243                foreach ($order as $i => $k) { 
     244                    $new_ductile_stickers[] = array( 
     245                        'label' => $ductile_stickers[$k]['label'], 
     246                        'url'   => $ductile_stickers[$k]['url'], 
     247                        'image' => $ductile_stickers[$k]['image'] 
     248                    ); 
     249                } 
     250                $ductile_stickers = $new_ductile_stickers; 
     251            } 
     252 
     253            for ($i = 0; $i < count($_POST['list_type']); $i++) { 
     254                $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i]; 
     255            } 
     256 
     257            for ($i = 0; $i < count($_POST['count_nb']); $i++) { 
     258                $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i]; 
     259            } 
     260 
     261        } 
     262 
     263        # CSS 
     264        if ($conf_tab == 'css') { 
     265            $ductile_user['body_font']           = $_POST['body_font']; 
     266            $ductile_user['body_webfont_family'] = $_POST['body_webfont_family']; 
     267            $ductile_user['body_webfont_url']    = $_POST['body_webfont_url']; 
     268            $ductile_user['body_webfont_api']    = $_POST['body_webfont_api']; 
     269 
     270            $ductile_user['alternate_font']           = $_POST['alternate_font']; 
     271            $ductile_user['alternate_webfont_family'] = $_POST['alternate_webfont_family']; 
     272            $ductile_user['alternate_webfont_url']    = $_POST['alternate_webfont_url']; 
     273            $ductile_user['alternate_webfont_api']    = $_POST['alternate_webfont_api']; 
     274 
     275            $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']); 
     276            $ductile_user['blog_title_s'] = dcThemeConfig::adjustFontSize($_POST['blog_title_s']); 
     277            $ductile_user['blog_title_c'] = dcThemeConfig::adjustColor($_POST['blog_title_c']); 
     278 
     279            $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']); 
     280            $ductile_user['post_title_s'] = dcThemeConfig::adjustFontSize($_POST['post_title_s']); 
     281            $ductile_user['post_title_c'] = dcThemeConfig::adjustColor($_POST['post_title_c']); 
     282 
     283            $ductile_user['post_link_w']   = (integer) !empty($_POST['post_link_w']); 
     284            $ductile_user['post_link_v_c'] = dcThemeConfig::adjustColor($_POST['post_link_v_c']); 
     285            $ductile_user['post_link_f_c'] = dcThemeConfig::adjustColor($_POST['post_link_f_c']); 
     286 
     287            $ductile_user['post_simple_title_c'] = dcThemeConfig::adjustColor($_POST['post_simple_title_c']); 
     288 
     289            $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']); 
     290            $ductile_user['blog_title_s_m'] = dcThemeConfig::adjustFontSize($_POST['blog_title_s_m']); 
     291            $ductile_user['blog_title_c_m'] = dcThemeConfig::adjustColor($_POST['blog_title_c_m']); 
     292 
     293            $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']); 
     294            $ductile_user['post_title_s_m'] = dcThemeConfig::adjustFontSize($_POST['post_title_s_m']); 
     295            $ductile_user['post_title_c_m'] = dcThemeConfig::adjustColor($_POST['post_title_c_m']); 
     296        } 
     297 
     298        $core->blog->settings->addNamespace('themes'); 
     299        $core->blog->settings->themes->put($core->blog->settings->system->theme . '_style', serialize($ductile_user)); 
     300        $core->blog->settings->themes->put($core->blog->settings->system->theme . '_stickers', serialize($ductile_stickers)); 
     301        $core->blog->settings->themes->put($core->blog->settings->system->theme . '_entries_lists', serialize($ductile_lists)); 
     302        $core->blog->settings->themes->put($core->blog->settings->system->theme . '_entries_counts', serialize($ductile_counts)); 
     303 
     304        // Blog refresh 
     305        $core->blog->triggerBlog(); 
     306 
     307        // Template cache reset 
     308        $core->emptyTemplatesCache(); 
     309 
     310        dcPage::message(__('Theme configuration upgraded.'), true, true); 
     311    } catch (Exception $e) { 
     312        $core->error->add($e->getMessage()); 
     313    } 
    317314} 
    318315 
    319316// Legacy mode 
    320 if (!$standalone_config) echo '</form>'; 
     317if (!$standalone_config) { 
     318    echo '</form>'; 
     319} 
    321320 
    322321# HTML Tab 
    323322 
    324 echo '<div class="multi-part" id="themes-list'.($conf_tab == 'html' ? '' : '-html').'" title="'.__('Content').'">'. 
    325 '<h3>'.__('Content').'</h3>'; 
    326  
    327 echo '<form id="theme_config" action="'.$core->adminurl->get('admin.blog.theme',array('conf' => '1')). 
    328 '" method="post" enctype="multipart/form-data">'; 
    329  
    330 echo '<h4>'.__('Header').'</h4>'. 
    331 '<p class="field"><label for="subtitle_hidden">'.__('Hide blog description:').'</label> '. 
    332 form::checkbox('subtitle_hidden',1,$ductile_user['subtitle_hidden']).'</p>'; 
    333 echo '<p class="field"><label for="logo_src">'.__('Logo URL:').'</label> '. 
    334      form::field('logo_src',40,255,$ductile_user['logo_src']).'</p>'; 
    335 if ($core->plugins->moduleExists('simpleMenu')) 
    336 { 
    337      echo '<p>'.sprintf(__('To configure the top menu go to the <a href="%s">Simple Menu administration page</a>.'), 
    338           $core->adminurl->get('admin.plugin.simpleMenu')).'</p>'; 
    339 } 
    340  
    341 echo '<h4 class="border-top pretty-title">'.__('Stickers').'</h4>'; 
     323echo '<div class="multi-part" id="themes-list' . ($conf_tab == 'html' ? '' : '-html') . '" title="' . __('Content') . '">' . 
     324'<h3>' . __('Content') . '</h3>'; 
     325 
     326echo '<form id="theme_config" action="' . $core->adminurl->get('admin.blog.theme', array('conf' => '1')) . 
     327    '" method="post" enctype="multipart/form-data">'; 
     328 
     329echo '<h4>' . __('Header') . '</h4>' . 
     330'<p class="field"><label for="subtitle_hidden">' . __('Hide blog description:') . '</label> ' . 
     331form::checkbox('subtitle_hidden', 1, $ductile_user['subtitle_hidden']) . '</p>'; 
     332echo '<p class="field"><label for="logo_src">' . __('Logo URL:') . '</label> ' . 
     333form::field('logo_src', 40, 255, $ductile_user['logo_src']) . '</p>'; 
     334if ($core->plugins->moduleExists('simpleMenu')) { 
     335    echo '<p>' . sprintf(__('To configure the top menu go to the <a href="%s">Simple Menu administration page</a>.'), 
     336        $core->adminurl->get('admin.plugin.simpleMenu')) . '</p>'; 
     337} 
     338 
     339echo '<h4 class="border-top pretty-title">' . __('Stickers') . '</h4>'; 
    342340 
    343341echo 
    344 '<div class="table-outer">'. 
    345 '<table class="dragable">'.'<caption>'.__('Stickers (footer)').'</caption>'. 
    346 '<thead>'. 
    347 '<tr>'. 
    348 '<th scope="col">'.'</th>'. 
    349 '<th scope="col">'.__('Image').'</th>'. 
    350 '<th scope="col">'.__('Label').'</th>'. 
    351 '<th scope="col">'.__('URL').'</th>'. 
    352 '</tr>'. 
    353 '</thead>'. 
    354 '<tbody id="stickerslist">'; 
     342'<div class="table-outer">' . 
     343'<table class="dragable">' . '<caption>' . __('Stickers (footer)') . '</caption>' . 
     344'<thead>' . 
     345'<tr>' . 
     346'<th scope="col">' . '</th>' . 
     347'<th scope="col">' . __('Image') . '</th>' . 
     348'<th scope="col">' . __('Label') . '</th>' . 
     349'<th scope="col">' . __('URL') . '</th>' . 
     350    '</tr>' . 
     351    '</thead>' . 
     352    '<tbody id="stickerslist">'; 
    355353$count = 0; 
    356354foreach ($ductile_stickers as $i => $v) { 
    357      $count++; 
    358      echo 
    359      '<tr class="line" id="l_'.$i.'">'. 
    360      '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false). 
    361           form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'. 
    362      '<td>'.form::hidden(array('sticker_image[]'),$v['image']).'<img src="'.$img_url.$v['image'].'" alt="'.$v['image'].'" /> '.'</td>'. 
    363      '<td scope="row">'.form::field(array('sticker_label[]','dsl-'.$i),20,255,$v['label']).'</td>'. 
    364      '<td>'.form::field(array('sticker_url[]','dsu-'.$i),40,255,$v['url']).'</td>'. 
    365      '</tr>'; 
     355    $count++; 
     356    echo 
     357    '<tr class="line" id="l_' . $i . '">' . 
     358    '<td class="handle minimal">' . form::number(array('order[' . $i . ']'), array( 
     359        'min'     => 0, 
     360        'default' => $count, 
     361        'class'   => 'position' 
     362    )) . 
     363    form::hidden(array('dynorder[]', 'dynorder-' . $i), $i) . '</td>' . 
     364    '<td>' . form::hidden(array('sticker_image[]'), $v['image']) . '<img src="' . $img_url . $v['image'] . '" alt="' . $v['image'] . '" /> ' . '</td>' . 
     365    '<td scope="row">' . form::field(array('sticker_label[]', 'dsl-' . $i), 20, 255, $v['label']) . '</td>' . 
     366    '<td>' . form::field(array('sticker_url[]', 'dsu-' . $i), 40, 255, $v['url']) . '</td>' . 
     367        '</tr>'; 
    366368} 
    367369echo 
    368 '</tbody>'. 
    369 '</table></div>'; 
    370  
    371 echo '<h4 class="border-top pretty-title">'.__('Entries list types and limits').'</h4>'; 
    372  
    373 echo '<table id="entrieslist">'.'<caption class="hidden">'.__('Entries lists').'</caption>'. 
    374 '<thead>'. 
    375 '<tr>'. 
    376 '<th scope="col">'.__('Context').'</th>'. 
    377 '<th scope="col">'.__('Entries list type').'</th>'. 
    378 '<th scope="col">'.__('Number of entries').'</th>'. 
    379 '</tr>'. 
    380 '</thead>'. 
    381 '<tbody>'; 
     370    '</tbody>' . 
     371    '</table></div>'; 
     372 
     373echo '<h4 class="border-top pretty-title">' . __('Entries list types and limits') . '</h4>'; 
     374 
     375echo '<table id="entrieslist">' . '<caption class="hidden">' . __('Entries lists') . '</caption>' . 
     376'<thead>' . 
     377'<tr>' . 
     378'<th scope="col">' . __('Context') . '</th>' . 
     379'<th scope="col">' . __('Entries list type') . '</th>' . 
     380'<th scope="col">' . __('Number of entries') . '</th>' . 
     381    '</tr>' . 
     382    '</thead>' . 
     383    '<tbody>'; 
    382384foreach ($ductile_lists as $k => $v) { 
    383      echo 
    384           '<tr>'. 
    385           '<td scope="row">'.$contexts[$k].'</td>'. 
    386           '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>'; 
    387      if (array_key_exists($k,$ductile_counts)) { 
    388           echo '<td>'.form::hidden(array('count_ctx[]'),$k).form::field(array('count_nb[]'),2,3,$ductile_counts[$k]).'</td>'; 
    389      } else { 
    390           echo '<td></td>'; 
    391      } 
    392      echo 
    393           '</tr>'; 
     385    echo 
     386    '<tr>' . 
     387    '<td scope="row">' . $contexts[$k] . '</td>' . 
     388    '<td>' . form::hidden(array('list_ctx[]'), $k) . form::combo(array('list_type[]'), $list_types, $v) . '</td>'; 
     389    if (array_key_exists($k, $ductile_counts)) { 
     390        echo '<td>' . form::hidden(array('count_ctx[]'), $k) . form::number(array('count_nb[]'), array( 
     391            'min'     => 0, 
     392            'max'     => 999, 
     393            'default' => $ductile_counts[$k] 
     394        )) . '</td>'; 
     395    } else { 
     396        echo '<td></td>'; 
     397    } 
     398    echo 
     399        '</tr>'; 
    394400} 
    395401echo 
    396 '</tbody>'. 
    397 '</table>'; 
    398  
    399 echo '<h4 class="border-top pretty-title">'.__('Miscellaneous options').'</h4>'; 
    400 echo '<p><label for="preview_not_mandatory" class="classic">'.__('Comment preview is not mandatory:').'</label> '. 
    401 form::checkbox('preview_not_mandatory',1,$ductile_user['preview_not_mandatory']).'</p>'; 
     402    '</tbody>' . 
     403    '</table>'; 
     404 
     405echo '<h4 class="border-top pretty-title">' . __('Miscellaneous options') . '</h4>'; 
     406echo '<p><label for="preview_not_mandatory" class="classic">' . __('Comment preview is not mandatory:') . '</label> ' . 
     407form::checkbox('preview_not_mandatory', 1, $ductile_user['preview_not_mandatory']) . '</p>'; 
    402408 
    403409echo '<p><input type="hidden" name="conf_tab" value="html" /></p>'; 
    404 echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; 
     410echo '<p class="clear">' . form::hidden('ds_order', '') . '<input type="submit" value="' . __('Save') . '" />' . $core->formNonce() . '</p>'; 
    405411echo '</form>'; 
    406412 
     
    409415# CSS tab 
    410416 
    411 echo '<div class="multi-part" id="themes-list'.($conf_tab == 'css' ? '' : '-css').'" title="'.__('Presentation').'">'; 
    412  
    413 echo '<form id="theme_config" action="'.$core->adminurl->get('admin.blog.theme',array('conf' => '1')). 
    414      '" method="post" enctype="multipart/form-data">'; 
    415  
    416 echo '<h3>'.__('General settings').'</h3>'; 
    417  
    418 echo '<h4 class="pretty-title">'.__('Fonts').'</h4>'; 
     417echo '<div class="multi-part" id="themes-list' . ($conf_tab == 'css' ? '' : '-css') . '" title="' . __('Presentation') . '">'; 
     418 
     419echo '<form id="theme_config" action="' . $core->adminurl->get('admin.blog.theme', array('conf' => '1')) . 
     420    '" method="post" enctype="multipart/form-data">'; 
     421 
     422echo '<h3>' . __('General settings') . '</h3>'; 
     423 
     424echo '<h4 class="pretty-title">' . __('Fonts') . '</h4>'; 
    419425 
    420426echo '<div class="two-cols">'; 
    421427echo '<div class="col">'; 
    422428echo 
    423 '<h5>'.__('Main text').'</h5>'. 
    424 '<p class="field"><label for="body_font">'.__('Main font:').'</label> '. 
    425 form::combo('body_font',$fonts,$ductile_user['body_font']). 
    426 (!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : ''). 
    427 ' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'. 
    428 '</p>'. 
    429 '<p class="field"><label for="body_webfont_family">'.__('Webfont family:').'</label> '. 
    430 form::field('body_webfont_family',25,255,$ductile_user['body_webfont_family']).'</p>'. 
    431 '<p class="field"><label for="body_webfont_url">'.__('Webfont URL:').'</label> '. 
    432 form::field('body_webfont_url',50,255,$ductile_user['body_webfont_url']).'</p>'. 
    433 '<p class="field"><label for="body_webfont_url">'.__('Webfont API:').'</label> '. 
    434 form::combo('body_webfont_api',$webfont_apis,$ductile_user['body_webfont_api']).'</p>'; 
     429'<h5>' . __('Main text') . '</h5>' . 
     430'<p class="field"><label for="body_font">' . __('Main font:') . '</label> ' . 
     431form::combo('body_font', $fonts, $ductile_user['body_font']) . 
     432(!empty($ductile_user['body_font']) ? ' ' . fontDef($ductile_user['body_font']) : '') . 
     433' <span class="form-note">' . __('Set to Default to use a webfont.') . '</span>' . 
     434'</p>' . 
     435'<p class="field"><label for="body_webfont_family">' . __('Webfont family:') . '</label> ' . 
     436form::field('body_webfont_family', 25, 255, $ductile_user['body_webfont_family']) . '</p>' . 
     437'<p class="field"><label for="body_webfont_url">' . __('Webfont URL:') . '</label> ' . 
     438form::url('body_webfont_url', 50, 255, $ductile_user['body_webfont_url']) . '</p>' . 
     439'<p class="field"><label for="body_webfont_url">' . __('Webfont API:') . '</label> ' . 
     440form::combo('body_webfont_api', $webfont_apis, $ductile_user['body_webfont_api']) . '</p>'; 
    435441echo '</div>'; 
    436442echo '<div class="col">'; 
    437443echo 
    438 '<h5>'.__('Secondary text').'</h5>'. 
    439 '<p class="field"><label for="alternate_font">'.__('Secondary font:').'</label> '. 
    440 form::combo('alternate_font',$fonts,$ductile_user['alternate_font']). 
    441 (!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : ''). 
    442 ' <span class="form-note">'.__('Set to Default to use a webfont.').'</span>'. 
    443 '</p>'. 
    444 '<p class="field"><label for="alternate_webfont_family">'.__('Webfont family:').'</label> '. 
    445 form::field('alternate_webfont_family',25,255,$ductile_user['alternate_webfont_family']).'</p>'. 
    446 '<p class="field"><label for="alternate_webfont_url">'.__('Webfont URL:').'</label> '. 
    447 form::field('alternate_webfont_url',50,255,$ductile_user['alternate_webfont_url']).'</p>'. 
    448 '<p class="field"><label for="alternate_webfont_api">'.__('Webfont API:').'</label> '. 
    449 form::combo('alternate_webfont_api',$webfont_apis,$ductile_user['alternate_webfont_api']).'</p>'; 
    450 echo '</div>'; 
    451 echo '</div>'; 
    452  
    453 echo '<h4 class="clear border-top pretty-title">'.__('Titles').'</h4>'; 
     444'<h5>' . __('Secondary text') . '</h5>' . 
     445'<p class="field"><label for="alternate_font">' . __('Secondary font:') . '</label> ' . 
     446form::combo('alternate_font', $fonts, $ductile_user['alternate_font']) . 
     447(!empty($ductile_user['alternate_font']) ? ' ' . fontDef($ductile_user['alternate_font']) : '') . 
     448' <span class="form-note">' . __('Set to Default to use a webfont.') . '</span>' . 
     449'</p>' . 
     450'<p class="field"><label for="alternate_webfont_family">' . __('Webfont family:') . '</label> ' . 
     451form::field('alternate_webfont_family', 25, 255, $ductile_user['alternate_webfont_family']) . '</p>' . 
     452'<p class="field"><label for="alternate_webfont_url">' . __('Webfont URL:') . '</label> ' . 
     453form::url('alternate_webfont_url', 50, 255, $ductile_user['alternate_webfont_url']) . '</p>' . 
     454'<p class="field"><label for="alternate_webfont_api">' . __('Webfont API:') . '</label> ' . 
     455form::combo('alternate_webfont_api', $webfont_apis, $ductile_user['alternate_webfont_api']) . '</p>'; 
     456echo '</div>'; 
     457echo '</div>'; 
     458 
     459echo '<h4 class="clear border-top pretty-title">' . __('Titles') . '</h4>'; 
    454460echo '<div class="two-cols">'; 
    455461echo '<div class="col">'; 
    456 echo '<h5>'.__('Blog title').'</h5>'. 
    457 '<p class="field"><label for="blog_title_w">'.__('In bold:').'</label> '. 
    458 form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</p>'. 
    459  
    460 '<p class="field"><label for="blog_title_s">'.__('Font size (in em by default):').'</label> '. 
    461 form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'</p>'. 
    462  
    463 '<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '. 
    464 form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker'). 
    465 dcThemeConfig::contrastRatio($ductile_user['blog_title_c'],'#ffffff', 
    466      (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'), 
    467      $ductile_user['blog_title_w']). 
    468 '</p>'; 
     462echo '<h5>' . __('Blog title') . '</h5>' . 
     463'<p class="field"><label for="blog_title_w">' . __('In bold:') . '</label> ' . 
     464form::checkbox('blog_title_w', 1, $ductile_user['blog_title_w']) . '</p>' . 
     465 
     466'<p class="field"><label for="blog_title_s">' . __('Font size (in em by default):') . '</label> ' . 
     467form::field('blog_title_s', 7, 7, $ductile_user['blog_title_s']) . '</p>' . 
     468 
     469'<p class="field picker"><label for="blog_title_c">' . __('Color:') . '</label> ' . 
     470form::color('blog_title_c', array('default' => $ductile_user['blog_title_c'])) . 
     471dcThemeConfig::contrastRatio($ductile_user['blog_title_c'], '#ffffff', 
     472    (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'), 
     473    $ductile_user['blog_title_w']) . 
     474    '</p>'; 
    469475 
    470476echo '</div>'; 
    471477echo '<div class="col">'; 
    472478 
    473 echo '<h5>'.__('Post title').'</h5>'. 
    474 '<p class="field"><label for="post_title_w">'.__('In bold:').'</label> '. 
    475 form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</p>'. 
    476  
    477 '<p class="field"><label for="post_title_s">'.__('Font size (in em by default):').'</label> '. 
    478 form::field('post_title_s',7,7,$ductile_user['post_title_s']).'</p>'. 
    479  
    480 '<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '. 
    481 form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker'). 
    482 dcThemeConfig::contrastRatio($ductile_user['post_title_c'],'#ffffff', 
    483      (!empty($ductile_user['post_title_s']) ? $ductile_user['post_title_s'] : '2.5em'), 
    484      $ductile_user['post_title_w']). 
    485 '</p>'; 
    486  
    487 echo '</div>'; 
    488 echo '</div>'; 
    489  
    490 echo '<h5>'.__('Titles without link').'</h5>'. 
    491  
    492 '<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '. 
    493 form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker'). 
    494 dcThemeConfig::contrastRatio($ductile_user['post_simple_title_c'],'#ffffff', 
    495      '1.1em',  // H5 minimum size 
    496      false). 
    497 '</p>'; 
    498  
    499 echo '<h4 class="border-top pretty-title">'.__('Inside posts links').'</h4>'. 
    500 '<p class="field"><label for="post_link_w">'.__('In bold:').'</label> '. 
    501 form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</p>'. 
    502  
    503 '<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '. 
    504 form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker'). 
    505 dcThemeConfig::contrastRatio($ductile_user['post_link_v_c'],'#ffffff', 
    506      '1em', 
    507      $ductile_user['post_link_w']). 
    508 '</p>'. 
    509  
    510 '<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '. 
    511 form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker'). 
    512 dcThemeConfig::contrastRatio($ductile_user['post_link_f_c'],'#ebebee', 
    513      '1em', 
    514      $ductile_user['post_link_w']). 
    515 '</p>'; 
    516  
    517 echo '<h3 class="border-top">'.__('Mobile specific settings').'</h3>'; 
     479echo '<h5>' . __('Post title') . '</h5>' . 
     480'<p class="field"><label for="post_title_w">' . __('In bold:') . '</label> ' . 
     481form::checkbox('post_title_w', 1, $ductile_user['post_title_w']) . '</p>' . 
     482 
     483'<p class="field"><label for="post_title_s">' . __('Font size (in em by default):') . '</label> ' . 
     484form::field('post_title_s', 7, 7, $ductile_user['post_title_s']) . '</p>' . 
     485 
     486'<p class="field picker"><label for="post_title_c">' . __('Color:') . '</label> ' . 
     487form::color('post_title_c', array('default' => $ductile_user['post_title_c'])) . 
     488dcThemeConfig::contrastRatio($ductile_user['post_title_c'], '#ffffff', 
     489    (!empty($ductile_user['post_title_s']) ? $ductile_user['post_title_s'] : '2.5em'), 
     490    $ductile_user['post_title_w']) . 
     491    '</p>'; 
     492 
     493echo '</div>'; 
     494echo '</div>'; 
     495 
     496echo '<h5>' . __('Titles without link') . '</h5>' . 
     497 
     498'<p class="field picker"><label for="post_simple_title_c">' . __('Color:') . '</label> ' . 
     499form::color('post_simple_title_c', array('default' => $ductile_user['post_simple_title_c'])) . 
     500dcThemeConfig::contrastRatio($ductile_user['post_simple_title_c'], '#ffffff', 
     501    '1.1em', // H5 minimum size 
     502    false) . 
     503    '</p>'; 
     504 
     505echo '<h4 class="border-top pretty-title">' . __('Inside posts links') . '</h4>' . 
     506'<p class="field"><label for="post_link_w">' . __('In bold:') . '</label> ' . 
     507form::checkbox('post_link_w', 1, $ductile_user['post_link_w']) . '</p>' . 
     508 
     509'<p class="field picker"><label for="post_link_v_c">' . __('Normal and visited links color:') . '</label> ' . 
     510form::color('post_link_v_c', array('default' => $ductile_user['post_link_v_c'])) . 
     511dcThemeConfig::contrastRatio($ductile_user['post_link_v_c'], '#ffffff', 
     512    '1em', 
     513    $ductile_user['post_link_w']) . 
     514'</p>' . 
     515 
     516'<p class="field picker"><label for="post_link_f_c">' . __('Active, hover and focus links color:') . '</label> ' . 
     517form::color('post_link_f_c', array('default' => $ductile_user['post_link_f_c'])) . 
     518dcThemeConfig::contrastRatio($ductile_user['post_link_f_c'], '#ebebee', 
     519    '1em', 
     520    $ductile_user['post_link_w']) . 
     521    '</p>'; 
     522 
     523echo '<h3 class="border-top">' . __('Mobile specific settings') . '</h3>'; 
    518524 
    519525echo '<div class="two-cols">'; 
    520526echo '<div class="col">'; 
    521527 
    522 echo '<h4 class="pretty-title">'.__('Blog title').'</h4>'. 
    523 '<p class="field"><label for="blog_title_w_m">'.__('In bold:').'</label> '. 
    524 form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</p>'. 
    525  
    526 '<p class="field"><label for="blog_title_s_m">'.__('Font size (in em by default):').'</label> '. 
    527 form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).'</p>'. 
    528  
    529 '<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '. 
    530 form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker'). 
    531 dcThemeConfig::contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc', 
    532      (!empty($ductile_user['blog_title_s_m']) ? $ductile_user['blog_title_s_m'] : '1.8em'), 
    533      $ductile_user['blog_title_w_m']). 
    534 '</p>'; 
     528echo '<h4 class="pretty-title">' . __('Blog title') . '</h4>' . 
     529'<p class="field"><label for="blog_title_w_m">' . __('In bold:') . '</label> ' . 
     530form::checkbox('blog_title_w_m', 1, $ductile_user['blog_title_w_m']) . '</p>' . 
     531 
     532'<p class="field"><label for="blog_title_s_m">' . __('Font size (in em by default):') . '</label> ' . 
     533form::field('blog_title_s_m', 7, 7, $ductile_user['blog_title_s_m']) . '</p>' . 
     534 
     535'<p class="field picker"><label for="blog_title_c_m">' . __('Color:') . '</label> ' . 
     536form::color('blog_title_c_m', array('default' => $ductile_user['blog_title_c_m'])) . 
     537dcThemeConfig::contrastRatio($ductile_user['blog_title_c_m'], '#d7d7dc', 
     538    (!empty($ductile_user['blog_title_s_m']) ? $ductile_user['blog_title_s_m'] : '1.8em'), 
     539    $ductile_user['blog_title_w_m']) . 
     540    '</p>'; 
    535541 
    536542echo '</div>'; 
    537543echo '<div class="col">'; 
    538544 
    539 echo '<h4 class="pretty-title">'.__('Post title').'</h4>'. 
    540 '<p class="field"><label for="post_title_w_m">'.__('In bold:').'</label> '. 
    541 form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</p>'. 
    542  
    543 '<p class="field"><label for="post_title_s_m">'.__('Font size (in em by default):').'</label> '. 
    544 form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).'</p>'. 
    545  
    546 '<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '. 
    547 form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker'). 
    548 dcThemeConfig::contrastRatio($ductile_user['post_title_c_m'],'#ffffff', 
    549      (!empty($ductile_user['post_title_s_m']) ? $ductile_user['post_title_s_m'] : '1.5em'), 
    550      $ductile_user['post_title_w_m']). 
    551 '</p>'; 
     545echo '<h4 class="pretty-title">' . __('Post title') . '</h4>' . 
     546'<p class="field"><label for="post_title_w_m">' . __('In bold:') . '</label> ' . 
     547form::checkbox('post_title_w_m', 1, $ductile_user['post_title_w_m']) . '</p>' . 
     548 
     549'<p class="field"><label for="post_title_s_m">' . __('Font size (in em by default):') . '</label> ' . 
     550form::field('post_title_s_m', 7, 7, $ductile_user['post_title_s_m']) . '</p>' . 
     551 
     552'<p class="field picker"><label for="post_title_c_m">' . __('Color:') . '</label> ' . 
     553form::color('post_title_c_m', array('default' => $ductile_user['post_title_c_m'])) . 
     554dcThemeConfig::contrastRatio($ductile_user['post_title_c_m'], '#ffffff', 
     555    (!empty($ductile_user['post_title_s_m']) ? $ductile_user['post_title_s_m'] : '1.5em'), 
     556    $ductile_user['post_title_w_m']) . 
     557    '</p>'; 
    552558 
    553559echo '</div>'; 
     
    555561 
    556562echo '<p><input type="hidden" name="conf_tab" value="css" /></p>'; 
    557 echo '<p class="clear border-top"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; 
     563echo '<p class="clear border-top"><input type="submit" value="' . __('Save') . '" />' . $core->formNonce() . '</p>'; 
    558564echo '</form>'; 
    559565 
     
    563569 
    564570// Legacy mode 
    565 if (!$standalone_config) echo '<form style="display:none">'; 
     571if (!$standalone_config) { 
     572    echo '<form style="display:none">'; 
     573} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map