[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 ----------------------------------------- |
---|
| 11 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
| 12 | |
---|
[421] | 13 | l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); |
---|
[357] | 14 | |
---|
[604] | 15 | $img_url = $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/'; |
---|
[627] | 16 | $img_url = http::concatURL($core->blog->url,$img_url); |
---|
[604] | 17 | $img_path = dirname(__FILE__).'/img/'; |
---|
| 18 | |
---|
[611] | 19 | $standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme,'standalone_config'); |
---|
| 20 | |
---|
[563] | 21 | $list_types = array( |
---|
| 22 | __('Title') => 'title', |
---|
| 23 | __('Short') => 'short', |
---|
| 24 | __('Full') => 'full' |
---|
| 25 | ); |
---|
| 26 | |
---|
| 27 | $contexts = array( |
---|
| 28 | 'default' => __('Home (first page)'), |
---|
| 29 | 'default-page' => __('Home (other pages)'), |
---|
| 30 | 'category' => __('Entries for a category'), |
---|
| 31 | 'tag' => __('Entries for a tag'), |
---|
| 32 | 'search' => __('Search result entries'), |
---|
[564] | 33 | 'archive' => __('Month archive entries') |
---|
[563] | 34 | ); |
---|
| 35 | |
---|
[376] | 36 | $fonts = array( |
---|
| 37 | __('default') => '', |
---|
| 38 | __('Ductile primary') => 'Ductile body', |
---|
| 39 | __('Ductile secondary') => 'Ductile alternate', |
---|
| 40 | __('Times New Roman') => 'Times New Roman', |
---|
| 41 | __('Georgia') => 'Georgia', |
---|
| 42 | __('Garamond') => 'Garamond', |
---|
| 43 | __('Helvetica/Arial') => 'Helvetica/Arial', |
---|
| 44 | __('Verdana') => 'Verdana', |
---|
| 45 | __('Trebuchet MS') => 'Trebuchet MS', |
---|
| 46 | __('Impact') => 'Impact', |
---|
| 47 | __('Monospace') => 'Monospace' |
---|
| 48 | ); |
---|
| 49 | |
---|
[387] | 50 | function adjustFontSize($s) |
---|
| 51 | { |
---|
| 52 | if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$s,$m)) { |
---|
| 53 | if (empty($m[2])) { |
---|
| 54 | $m[2] = 'em'; |
---|
| 55 | } |
---|
| 56 | return $m[1].$m[2]; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | return null; |
---|
| 60 | } |
---|
| 61 | |
---|
[357] | 62 | function adjustColor($c) |
---|
| 63 | { |
---|
| 64 | if ($c === '') { |
---|
| 65 | return ''; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | $c = strtoupper($c); |
---|
| 69 | |
---|
| 70 | if (preg_match('/^[A-F0-9]{3,6}$/',$c)) { |
---|
| 71 | $c = '#'.$c; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | if (preg_match('/^#[A-F0-9]{6}$/',$c)) { |
---|
| 75 | return $c; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | if (preg_match('/^#[A-F0-9]{3,}$/',$c)) { |
---|
| 79 | 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); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | return ''; |
---|
| 83 | } |
---|
| 84 | |
---|
[653] | 85 | function computeContrastRatio($color,$background) |
---|
[649] | 86 | { |
---|
| 87 | // Compute contrast ratio between two colors |
---|
| 88 | |
---|
[653] | 89 | $color = adjustColor($color); |
---|
| 90 | if (($color == '') || (strlen($color) != 7)) return 0; |
---|
| 91 | $background = adjustColor($background); |
---|
| 92 | if (($background == '') || (strlen($background) != 7)) return 0; |
---|
[649] | 93 | |
---|
[653] | 94 | $l1 = (0.2126 * pow(hexdec(substr($color,1,2))/255,2.2)) + |
---|
| 95 | (0.7152 * pow(hexdec(substr($color,3,2))/255,2.2)) + |
---|
| 96 | (0.0722 * pow(hexdec(substr($color,5,2))/255,2.2)); |
---|
| 97 | |
---|
| 98 | $l2 = (0.2126 * pow(hexdec(substr($background,1,2))/255,2.2)) + |
---|
| 99 | (0.7152 * pow(hexdec(substr($background,3,2))/255,2.2)) + |
---|
| 100 | (0.0722 * pow(hexdec(substr($background,5,2))/255,2.2)); |
---|
[649] | 101 | |
---|
| 102 | if ($l1 > $l2) { |
---|
[653] | 103 | $ratio = ($l1 + 0.05) / ($l2 + 0.05); |
---|
[649] | 104 | } else { |
---|
[653] | 105 | $ratio = ($l2 + 0.05) / ($l1 + 0.05); |
---|
[649] | 106 | } |
---|
[653] | 107 | return $ratio; |
---|
[649] | 108 | } |
---|
| 109 | |
---|
[653] | 110 | function contrastRatioLevel($ratio,$size,$bold) |
---|
| 111 | { |
---|
| 112 | if ($size == '') { |
---|
| 113 | return ''; |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | // Eval font size in em (assume base font size in pixels equal to 16) |
---|
| 117 | if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$size,$m)) { |
---|
| 118 | if (empty($m[2])) { |
---|
| 119 | $m[2] = 'em'; |
---|
| 120 | } |
---|
| 121 | } else { |
---|
| 122 | return ''; |
---|
| 123 | } |
---|
| 124 | switch ($m[2]) { |
---|
| 125 | case '%': |
---|
| 126 | $s = (float) $m[1] / 100; |
---|
| 127 | break; |
---|
| 128 | case 'pt': |
---|
| 129 | $s = (float) $m[1] / 12; |
---|
| 130 | break; |
---|
| 131 | case 'px': |
---|
| 132 | $s = (float) $m[1] / 16; |
---|
| 133 | break; |
---|
| 134 | case 'em': |
---|
| 135 | $s = (float) $m[1]; |
---|
| 136 | break; |
---|
| 137 | case 'ex': |
---|
| 138 | $s = (float) $m[1] / 2; |
---|
| 139 | break; |
---|
| 140 | default: |
---|
| 141 | return ''; |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | $large = ((($s > 1.5) && ($bold == false)) || (($s > 1.2) && ($bold == true))); |
---|
| 145 | |
---|
| 146 | // Check ratio |
---|
| 147 | if ($ratio > 7) { |
---|
| 148 | return 'AAA'; |
---|
| 149 | } elseif (($ratio > 4.5) && $large) { |
---|
| 150 | return 'AAA'; |
---|
| 151 | } elseif ($ratio > 4.5) { |
---|
| 152 | return 'AA'; |
---|
| 153 | } elseif (($ratio > 3) && $large) { |
---|
| 154 | return 'AA'; |
---|
| 155 | } |
---|
| 156 | return ''; |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | function contrastRatio($color,$background,$size='',$bold=false) |
---|
| 160 | { |
---|
| 161 | if (($color != '') && ($background != '')) { |
---|
| 162 | $ratio = computeContrastRatio($color,$background); |
---|
| 163 | $level = contrastRatioLevel($ratio,$size,$bold); |
---|
| 164 | return |
---|
| 165 | '<span style="position:absolute;top:0;left:23em;">('. |
---|
[654] | 166 | sprintf(__('ratio = %.1f:1'),$ratio). |
---|
[653] | 167 | ($level != '' ? ' / '.sprintf(__('WCAG %s'),$level) : ''). |
---|
| 168 | ')</span>'; |
---|
[649] | 169 | } |
---|
| 170 | return ''; |
---|
| 171 | } |
---|
| 172 | |
---|
[357] | 173 | $ductile_base = array( |
---|
[389] | 174 | // HTML |
---|
| 175 | 'subtitle_hidden' => null, |
---|
| 176 | // CSS |
---|
[376] | 177 | 'body_font' => null, |
---|
[387] | 178 | 'alternate_font' => null, |
---|
| 179 | 'blog_title_w' => null, |
---|
| 180 | 'blog_title_s' => null, |
---|
| 181 | 'blog_title_c' => null, |
---|
| 182 | 'post_title_w' => null, |
---|
| 183 | 'post_title_s' => null, |
---|
| 184 | 'post_title_c' => null, |
---|
| 185 | 'post_link_w' => null, |
---|
| 186 | 'post_link_v_c' => null, |
---|
| 187 | 'post_link_f_c' => null, |
---|
| 188 | 'blog_title_w_m' => null, |
---|
| 189 | 'blog_title_s_m' => null, |
---|
| 190 | 'blog_title_c_m' => null, |
---|
| 191 | 'post_title_w_m' => null, |
---|
| 192 | 'post_title_s_m' => null, |
---|
[515] | 193 | 'post_title_c_m' => null, |
---|
| 194 | 'post_simple_title_c' => null |
---|
[357] | 195 | ); |
---|
| 196 | |
---|
[563] | 197 | $ductile_lists_base = array( |
---|
[646] | 198 | 'default' => 'short', |
---|
| 199 | 'default-page' => 'short', |
---|
| 200 | 'category' => 'short', |
---|
| 201 | 'tag' => 'short', |
---|
| 202 | 'search' => 'short', |
---|
| 203 | 'archive' => 'title' |
---|
[563] | 204 | ); |
---|
| 205 | |
---|
[583] | 206 | $ductile_counts_base = array( |
---|
| 207 | 'default' => null, |
---|
| 208 | 'category' => null, |
---|
| 209 | 'tag' => null, |
---|
| 210 | 'search' => null |
---|
| 211 | ); |
---|
| 212 | |
---|
[605] | 213 | $ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style'); |
---|
| 214 | $ductile_user = @unserialize($ductile_user); |
---|
| 215 | if (!is_array($ductile_user)) { |
---|
| 216 | $ductile_user = array(); |
---|
| 217 | } |
---|
| 218 | $ductile_user = array_merge($ductile_base,$ductile_user); |
---|
| 219 | |
---|
| 220 | $ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists'); |
---|
| 221 | $ductile_lists = @unserialize($ductile_lists); |
---|
| 222 | if (!is_array($ductile_lists)) { |
---|
| 223 | $ductile_lists = $ductile_lists_base; |
---|
| 224 | } |
---|
| 225 | |
---|
| 226 | $ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts'); |
---|
| 227 | $ductile_counts = @unserialize($ductile_counts); |
---|
| 228 | if (!is_array($ductile_counts)) { |
---|
| 229 | $ductile_counts = $ductile_counts_base; |
---|
| 230 | } |
---|
| 231 | |
---|
| 232 | $ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); |
---|
| 233 | $ductile_stickers = @unserialize($ductile_stickers); |
---|
| 234 | |
---|
[614] | 235 | // If no stickers defined, add feed Atom one |
---|
| 236 | if (!is_array($ductile_stickers)) { |
---|
| 237 | $ductile_stickers = array(array( |
---|
| 238 | 'label' => __('Subscribe'), |
---|
| 239 | 'url' => $core->blog->url.$core->url->getBase('feed').'/atom', |
---|
| 240 | 'image' => 'sticker-feed.png' |
---|
| 241 | )); |
---|
| 242 | } |
---|
| 243 | |
---|
[605] | 244 | $ductile_stickers_full = array(); |
---|
| 245 | // Get all sticker images already used |
---|
| 246 | if (is_array($ductile_stickers)) { |
---|
| 247 | foreach ($ductile_stickers as $v) { |
---|
| 248 | $ductile_stickers_full[] = $v['image']; |
---|
| 249 | } |
---|
| 250 | } |
---|
| 251 | // Get all sticker-*.png in img folder of theme |
---|
| 252 | $ductile_stickers_images = files::scandir($img_path); |
---|
| 253 | if (is_array($ductile_stickers_images)) { |
---|
| 254 | foreach ($ductile_stickers_images as $v) { |
---|
| 255 | if (preg_match('/^sticker\-(.*)\.png$/',$v)) { |
---|
| 256 | if (!in_array($v,$ductile_stickers_full)) { |
---|
| 257 | // image not already used |
---|
| 258 | $ductile_stickers[] = array( |
---|
| 259 | 'label' => null, |
---|
| 260 | 'url' => null, |
---|
| 261 | 'image' => $v); |
---|
| 262 | } |
---|
| 263 | } |
---|
| 264 | } |
---|
| 265 | } |
---|
| 266 | |
---|
[390] | 267 | $conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; |
---|
| 268 | |
---|
[357] | 269 | if (!empty($_POST)) |
---|
| 270 | { |
---|
| 271 | try |
---|
| 272 | { |
---|
[389] | 273 | # HTML |
---|
[390] | 274 | if ($conf_tab == 'html') { |
---|
| 275 | $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']); |
---|
[605] | 276 | |
---|
[604] | 277 | $ductile_stickers = array(); |
---|
[605] | 278 | for ($i = 0; $i < count($_POST['sticker_image']); $i++) { |
---|
| 279 | $ductile_stickers[] = array( |
---|
| 280 | 'label' => $_POST['sticker_label'][$i], |
---|
| 281 | 'url' => $_POST['sticker_url'][$i], |
---|
| 282 | 'image' => $_POST['sticker_image'][$i] |
---|
| 283 | ); |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | $order = array(); |
---|
| 287 | if (empty($_POST['ds_order']) && !empty($_POST['order'])) { |
---|
| 288 | $order = $_POST['order']; |
---|
| 289 | asort($order); |
---|
| 290 | $order = array_keys($order); |
---|
| 291 | } |
---|
| 292 | if (!empty($order)) { |
---|
| 293 | $new_ductile_stickers = array(); |
---|
| 294 | foreach ($order as $i => $k) { |
---|
| 295 | $new_ductile_stickers[] = array( |
---|
| 296 | 'label' => $ductile_stickers[$k]['label'], |
---|
| 297 | 'url' => $ductile_stickers[$k]['url'], |
---|
| 298 | 'image' => $ductile_stickers[$k]['image'] |
---|
[604] | 299 | ); |
---|
| 300 | } |
---|
[605] | 301 | $ductile_stickers = $new_ductile_stickers; |
---|
[419] | 302 | } |
---|
[605] | 303 | |
---|
[563] | 304 | for ($i = 0; $i < count($_POST['list_type']); $i++) { |
---|
| 305 | $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i]; |
---|
| 306 | } |
---|
| 307 | |
---|
[583] | 308 | for ($i = 0; $i < count($_POST['count_nb']); $i++) { |
---|
| 309 | $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i]; |
---|
| 310 | } |
---|
| 311 | |
---|
[390] | 312 | } |
---|
[389] | 313 | |
---|
| 314 | # CSS |
---|
[390] | 315 | if ($conf_tab == 'css') { |
---|
| 316 | $ductile_user['body_font'] = $_POST['body_font']; |
---|
| 317 | $ductile_user['alternate_font'] = $_POST['alternate_font']; |
---|
| 318 | |
---|
| 319 | $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']); |
---|
| 320 | $ductile_user['blog_title_s'] = adjustFontSize($_POST['blog_title_s']); |
---|
| 321 | $ductile_user['blog_title_c'] = adjustColor($_POST['blog_title_c']); |
---|
[389] | 322 | |
---|
[390] | 323 | $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']); |
---|
| 324 | $ductile_user['post_title_s'] = adjustFontSize($_POST['post_title_s']); |
---|
| 325 | $ductile_user['post_title_c'] = adjustColor($_POST['post_title_c']); |
---|
[387] | 326 | |
---|
[390] | 327 | $ductile_user['post_link_w'] = (integer) !empty($_POST['post_link_w']); |
---|
| 328 | $ductile_user['post_link_v_c'] = adjustColor($_POST['post_link_v_c']); |
---|
| 329 | $ductile_user['post_link_f_c'] = adjustColor($_POST['post_link_f_c']); |
---|
[387] | 330 | |
---|
[515] | 331 | $ductile_user['post_simple_title_c'] = adjustColor($_POST['post_simple_title_c']); |
---|
| 332 | |
---|
[390] | 333 | $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']); |
---|
| 334 | $ductile_user['blog_title_s_m'] = adjustFontSize($_POST['blog_title_s_m']); |
---|
| 335 | $ductile_user['blog_title_c_m'] = adjustColor($_POST['blog_title_c_m']); |
---|
[387] | 336 | |
---|
[390] | 337 | $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']); |
---|
| 338 | $ductile_user['post_title_s_m'] = adjustFontSize($_POST['post_title_s_m']); |
---|
| 339 | $ductile_user['post_title_c_m'] = adjustColor($_POST['post_title_c_m']); |
---|
| 340 | } |
---|
[376] | 341 | |
---|
[357] | 342 | $core->blog->settings->addNamespace('themes'); |
---|
[394] | 343 | $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user)); |
---|
[419] | 344 | $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); |
---|
[563] | 345 | $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists)); |
---|
[583] | 346 | $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts)); |
---|
[572] | 347 | |
---|
| 348 | // Blog refresh |
---|
[357] | 349 | $core->blog->triggerBlog(); |
---|
| 350 | |
---|
[572] | 351 | // Template cache reset |
---|
| 352 | $core->emptyTemplatesCache(); |
---|
| 353 | |
---|
[357] | 354 | echo |
---|
| 355 | '<div class="message"><p>'. |
---|
[389] | 356 | __('Theme configuration upgraded.'). |
---|
[357] | 357 | '</p></div>'; |
---|
| 358 | } |
---|
| 359 | catch (Exception $e) |
---|
| 360 | { |
---|
| 361 | $core->error->add($e->getMessage()); |
---|
| 362 | } |
---|
| 363 | } |
---|
| 364 | |
---|
[613] | 365 | // Legacy mode |
---|
| 366 | if (!$standalone_config) echo '</form>'; |
---|
| 367 | |
---|
[389] | 368 | # HTML Tab |
---|
| 369 | |
---|
[390] | 370 | echo '<div class="multi-part" id="themes-list'.($conf_tab == 'html' ? '' : '-html').'" title="'.__('Content').'">'; |
---|
| 371 | |
---|
| 372 | echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">'; |
---|
[389] | 373 | |
---|
| 374 | echo '<fieldset><legend>'.__('Header').'</legend>'. |
---|
| 375 | '<p class="field"><label for="subtitle_hidden">'.__('Hide blog description:').' '. |
---|
[612] | 376 | form::checkbox('subtitle_hidden',1,$ductile_user['subtitle_hidden']).'</label>'.'</p>'; |
---|
| 377 | if ($core->plugins->moduleExists('simpleMenu')) |
---|
| 378 | { |
---|
| 379 | echo '<p>'.sprintf(__('To configure the top menu go to the <a href="%s">Simple Menu administration page</a>.'),'plugin.php?p=simpleMenu').'</p>'; |
---|
| 380 | } |
---|
| 381 | echo '</fieldset>'; |
---|
[389] | 382 | |
---|
[425] | 383 | echo '<fieldset><legend>'.__('Stickers').'</legend>'; |
---|
[419] | 384 | |
---|
[605] | 385 | echo '<table class="dragable">'.'<caption>'.__('Stickers (footer)').'</caption>'. |
---|
[419] | 386 | '<thead>'. |
---|
| 387 | '<tr>'. |
---|
[605] | 388 | '<th scope="col">'.'</th>'. |
---|
[604] | 389 | '<th scope="col">'.__('Image').'</th>'. |
---|
[419] | 390 | '<th scope="col">'.__('Label').'</th>'. |
---|
| 391 | '<th scope="col">'.__('URL').'</th>'. |
---|
| 392 | '</tr>'. |
---|
| 393 | '</thead>'. |
---|
[605] | 394 | '<tbody id="stickerslist">'; |
---|
| 395 | $count = 0; |
---|
| 396 | foreach ($ductile_stickers as $i => $v) { |
---|
| 397 | $count++; |
---|
[604] | 398 | echo |
---|
[605] | 399 | '<tr class="line" id="l_'.$i.'">'. |
---|
| 400 | '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false). |
---|
| 401 | form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'. |
---|
| 402 | '<td>'.form::hidden(array('sticker_image[]'),$v['image']).'<img src="'.$img_url.$v['image'].'" /> '.'</td>'. |
---|
| 403 | '<td scope="raw">'.form::field(array('sticker_label[]','dsl-'.$i),20,255,$v['label']).'</td>'. |
---|
| 404 | '<td>'.form::field(array('sticker_url[]','dsu-'.$i),40,255,$v['url']).'</td>'. |
---|
[604] | 405 | '</tr>'; |
---|
| 406 | } |
---|
| 407 | echo |
---|
[419] | 408 | '</tbody>'. |
---|
| 409 | '</table>'; |
---|
| 410 | |
---|
[425] | 411 | echo '</fieldset>'; |
---|
[419] | 412 | |
---|
[583] | 413 | echo '<fieldset><legend>'.__('Entries list types and limits').'</legend>'; |
---|
[563] | 414 | |
---|
| 415 | echo '<table id="entrieslist">'.'<caption>'.__('Entries lists').'</caption>'. |
---|
| 416 | '<thead>'. |
---|
| 417 | '<tr>'. |
---|
| 418 | '<th scope="col">'.__('Context').'</th>'. |
---|
| 419 | '<th scope="col">'.__('Entries list type').'</th>'. |
---|
[583] | 420 | '<th scope="col">'.__('Number of entries').'</th>'. |
---|
[563] | 421 | '</tr>'. |
---|
| 422 | '</thead>'. |
---|
| 423 | '<tbody>'; |
---|
| 424 | foreach ($ductile_lists as $k => $v) { |
---|
| 425 | echo |
---|
| 426 | '<tr>'. |
---|
| 427 | '<td scope="raw">'.$contexts[$k].'</td>'. |
---|
[583] | 428 | '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>'; |
---|
| 429 | if (array_key_exists($k,$ductile_counts)) { |
---|
| 430 | echo '<td>'.form::hidden(array('count_ctx[]'),$k).form::field(array('count_nb[]'),2,3,$ductile_counts[$k]).'</td>'; |
---|
| 431 | } else { |
---|
| 432 | echo '<td></td>'; |
---|
| 433 | } |
---|
| 434 | echo |
---|
[563] | 435 | '</tr>'; |
---|
| 436 | } |
---|
| 437 | echo |
---|
| 438 | '</tbody>'. |
---|
| 439 | '</table>'; |
---|
| 440 | |
---|
| 441 | echo '</fieldset>'; |
---|
| 442 | |
---|
[390] | 443 | echo '<input type="hidden" name="conf_tab" value="html">'; |
---|
[605] | 444 | echo '<p class="clear">'.form::hidden('ds_order','').'<input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; |
---|
[390] | 445 | echo '</form>'; |
---|
| 446 | |
---|
[389] | 447 | echo '</div>'; // Close tab |
---|
| 448 | |
---|
| 449 | # CSS tab |
---|
| 450 | |
---|
[390] | 451 | echo '<div class="multi-part" id="themes-list'.($conf_tab == 'css' ? '' : '-css').'" title="'.__('Presentation').'">'; |
---|
| 452 | |
---|
| 453 | echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">'; |
---|
[389] | 454 | |
---|
[387] | 455 | echo '<h3>'.__('General settings').'</h3>'; |
---|
| 456 | |
---|
[376] | 457 | echo '<fieldset><legend>'.__('Fonts').'</legend>'. |
---|
[388] | 458 | '<p class="field"><label for="body_font">'.__('Main:').' '. |
---|
[376] | 459 | form::combo('body_font',$fonts,$ductile_user['body_font']).'</label></p>'. |
---|
| 460 | |
---|
[388] | 461 | '<p class="field"><label for="alternate_font">'.__('Secondary:').' '. |
---|
[376] | 462 | form::combo('alternate_font',$fonts,$ductile_user['alternate_font']).'</label></p>'. |
---|
| 463 | '</fieldset>'; |
---|
| 464 | |
---|
[387] | 465 | echo '<div class="two-cols">'; |
---|
| 466 | echo '<div class="col">'; |
---|
| 467 | |
---|
| 468 | echo '<fieldset><legend>'.__('Blog title').'</legend>'. |
---|
[388] | 469 | '<p class="field"><label for="blog_title_w">'.__('In bold:').' '. |
---|
[387] | 470 | form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</label>'.'</p>'. |
---|
| 471 | |
---|
[395] | 472 | '<p class="field"><label for="blog_title_s">'.__('Font size (in em by default):').'</label> '. |
---|
| 473 | form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'</p>'. |
---|
[387] | 474 | |
---|
[389] | 475 | '<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '. |
---|
[653] | 476 | form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker'). |
---|
| 477 | contrastRatio($ductile_user['blog_title_c'],'#ffffff', |
---|
| 478 | (!empty($ductile_user['blog_title_s']) ? $ductile_user['blog_title_s'] : '2em'), |
---|
| 479 | $ductile_user['blog_title_w']). |
---|
| 480 | '</p>'. |
---|
[387] | 481 | '</fieldset>'; |
---|
| 482 | |
---|
| 483 | echo '</div>'; |
---|
| 484 | echo '<div class="col">'; |
---|
| 485 | |
---|
| 486 | echo '<fieldset><legend>'.__('Post title').'</legend>'. |
---|
[388] | 487 | '<p class="field"><label for="post_title_w">'.__('In bold:').' '. |
---|
[387] | 488 | form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</label>'.'</p>'. |
---|
| 489 | |
---|
[395] | 490 | '<p class="field"><label for="post_title_s">'.__('Font size (in em by default):').'</label> '. |
---|
| 491 | form::field('post_title_s',7,7,$ductile_user['post_title_s']).'</p>'. |
---|
[387] | 492 | |
---|
[389] | 493 | '<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '. |
---|
[653] | 494 | form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker'). |
---|
| 495 | contrastRatio($ductile_user['post_title_c'],'#ffffff', |
---|
| 496 | (!empty($ductile_user['post_title_s']) ? $ductile_user['post_title_s'] : '2.5em'), |
---|
| 497 | $ductile_user['post_title_w']). |
---|
| 498 | '</p>'. |
---|
[387] | 499 | '</fieldset>'; |
---|
| 500 | |
---|
| 501 | echo '</div>'; |
---|
| 502 | echo '</div>'; |
---|
| 503 | |
---|
[515] | 504 | echo '<fieldset><legend>'.__('Titles without link').'</legend>'. |
---|
| 505 | |
---|
| 506 | '<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '. |
---|
[653] | 507 | form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker'). |
---|
| 508 | contrastRatio($ductile_user['post_simple_title_c'],'#ffffff', |
---|
| 509 | '1.1em', // H5 minimum size |
---|
| 510 | false). |
---|
| 511 | '</p>'. |
---|
[515] | 512 | '</fieldset>'; |
---|
| 513 | |
---|
[378] | 514 | echo '<fieldset><legend>'.__('Inside posts links').'</legend>'. |
---|
[388] | 515 | '<p class="field"><label for="post_link_w">'.__('In bold:').' '. |
---|
[387] | 516 | form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</label>'.'</p>'. |
---|
[357] | 517 | |
---|
[389] | 518 | '<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '. |
---|
[653] | 519 | form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker'). |
---|
| 520 | contrastRatio($ductile_user['post_link_v_c'],'#ffffff', |
---|
| 521 | '1em', |
---|
| 522 | $ductile_user['post_link_w']). |
---|
| 523 | '</p>'. |
---|
[357] | 524 | |
---|
[648] | 525 | '<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '. |
---|
[653] | 526 | form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker'). |
---|
| 527 | contrastRatio($ductile_user['post_link_f_c'],'#ebebee', |
---|
| 528 | '1em', |
---|
| 529 | $ductile_user['post_link_w']). |
---|
| 530 | '</p>'. |
---|
[357] | 531 | '</fieldset>'; |
---|
| 532 | |
---|
[387] | 533 | echo '<h3>'.__('Mobile specific settings').'</h3>'; |
---|
| 534 | |
---|
| 535 | echo '<div class="two-cols">'; |
---|
| 536 | echo '<div class="col">'; |
---|
| 537 | |
---|
| 538 | echo '<fieldset><legend>'.__('Blog title').'</legend>'. |
---|
[388] | 539 | '<p class="field"><label for="blog_title_w_m">'.__('In bold:').' '. |
---|
[387] | 540 | form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</label>'.'</p>'. |
---|
| 541 | |
---|
[395] | 542 | '<p class="field"><label for="blog_title_s_m">'.__('Font size (in em by default):').'</label> '. |
---|
| 543 | form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).'</p>'. |
---|
[387] | 544 | |
---|
[389] | 545 | '<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '. |
---|
[653] | 546 | form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker'). |
---|
| 547 | contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc', |
---|
| 548 | (!empty($ductile_user['blog_title_s_m']) ? $ductile_user['blog_title_s_m'] : '1.8em'), |
---|
| 549 | $ductile_user['blog_title_w_m']). |
---|
| 550 | '</p>'. |
---|
[387] | 551 | '</fieldset>'; |
---|
| 552 | |
---|
| 553 | echo '</div>'; |
---|
| 554 | echo '<div class="col">'; |
---|
| 555 | |
---|
| 556 | echo '<fieldset><legend>'.__('Post title').'</legend>'. |
---|
[388] | 557 | '<p class="field"><label for="post_title_w_m">'.__('In bold:').' '. |
---|
[387] | 558 | form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</label>'.'</p>'. |
---|
| 559 | |
---|
[395] | 560 | '<p class="field"><label for="post_title_s_m">'.__('Font size (in em by default):').'</label> '. |
---|
| 561 | form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).'</p>'. |
---|
[387] | 562 | |
---|
[389] | 563 | '<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '. |
---|
[653] | 564 | form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker'). |
---|
| 565 | contrastRatio($ductile_user['post_title_c_m'],'#ffffff', |
---|
| 566 | (!empty($ductile_user['post_title_s_m']) ? $ductile_user['post_title_s_m'] : '1.5em'), |
---|
| 567 | $ductile_user['post_title_w_m']). |
---|
| 568 | '</p>'. |
---|
[387] | 569 | '</fieldset>'; |
---|
| 570 | |
---|
| 571 | echo '</div>'; |
---|
| 572 | echo '</div>'; |
---|
| 573 | |
---|
[390] | 574 | echo '<input type="hidden" name="conf_tab" value="css">'; |
---|
| 575 | echo '<p class="clear"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; |
---|
| 576 | echo '</form>'; |
---|
| 577 | |
---|
[389] | 578 | echo '</div>'; // Close tab |
---|
| 579 | |
---|
[634] | 580 | dcPage::helpBlock('ductile'); |
---|
| 581 | |
---|
[613] | 582 | // Legacy mode |
---|
| 583 | if (!$standalone_config) echo '<form style="display:none">'; |
---|
[622] | 584 | ?> |
---|