Changeset 357:b01c0e011e2f for themes/ductile/_config.php
- Timestamp:
- 06/13/11 15:31:04 (14 years ago)
- Branch:
- themes
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_config.php
r345 r357 12 12 if (!defined('DC_CONTEXT_ADMIN')) { return; } 13 13 14 echo 15 '<p class="area">Ici, bientôt, la configuration du thème Ductile.</p>'; 14 l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 15 16 function adjustColor($c) 17 { 18 if ($c === '') { 19 return ''; 20 } 21 22 $c = strtoupper($c); 23 24 if (preg_match('/^[A-F0-9]{3,6}$/',$c)) { 25 $c = '#'.$c; 26 } 27 28 if (preg_match('/^#[A-F0-9]{6}$/',$c)) { 29 return $c; 30 } 31 32 if (preg_match('/^#[A-F0-9]{3,}$/',$c)) { 33 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); 34 } 35 36 return ''; 37 } 38 39 $ductile_base = array( 40 'body_link_c' => null, 41 'body_link_v_c' => null, 42 'body_link_f_c' => null 43 ); 44 45 $ductile_user = $core->blog->settings->themes->ductile_style; 46 $ductile_user = @unserialize($ductile_user); 47 if (!is_array($ductile_user)) { 48 $ductile_user = array(); 49 } 50 51 $ductile_user = array_merge($ductile_base,$ductile_user); 52 53 if (!empty($_POST)) 54 { 55 try 56 { 57 $ductile_user['body_link_c'] = adjustColor($_POST['body_link_c']); 58 $ductile_user['body_link_f_c'] = adjustColor($_POST['body_link_f_c']); 59 $ductile_user['body_link_v_c'] = adjustColor($_POST['body_link_v_c']); 60 61 $core->blog->settings->addNamespace('themes'); 62 $core->blog->settings->themes->put('ductile_style',serialize($ductile_user)); 63 $core->blog->triggerBlog(); 64 65 echo 66 '<div class="message"><p>'. 67 __('Style sheet upgraded.'). 68 '</p></div>'; 69 } 70 catch (Exception $e) 71 { 72 $core->error->add($e->getMessage()); 73 } 74 } 75 76 echo '<fieldset><legend>'.__('Links').'</legend>'. 77 '<p class="field"><label for="body_link_c">'.__('Links color:').' '. 78 form::field('body_link_c',7,7,$ductile_user['body_link_c'],'colorpicker').'</label></p>'. 79 80 '<p class="field"><label for="body_link_v_c">'.__('Visited links color:').' '. 81 form::field('body_link_v_c',7,7,$ductile_user['body_link_v_c'],'colorpicker').'</label></p>'. 82 83 '<p class="field"><label for="body_link_f_c">'.__('Focus links color:').' '. 84 form::field('body_link_f_c',7,7,$ductile_user['body_link_f_c'],'colorpicker').'</label></p>'. 85 '</fieldset>'; 86 16 87 ?>
Note: See TracChangeset
for help on using the changeset viewer.