Changeset 1081:862f566d2372
- Timestamp:
- 12/18/12 15:59:40 (13 years ago)
- Branch:
- default
- Location:
- themes/ductile
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_config.php
r1011 r1081 44 44 } 45 45 46 47 48 46 $contexts = array( 49 47 'default' => __('Home (first page)'), … … 67 65 __('Impact') => 'Impact', 68 66 __('Monospace') => 'Monospace' 67 ); 68 69 $webfont_apis = array( 70 __('none') => '', 71 __('javascript (Adobe)') => 'js', 72 __('stylesheet (Google)') => 'css' 69 73 ); 70 74 … … 227 231 // CSS 228 232 'body_font' => null, 233 'body_webfont_family' => null, 234 'body_webfont_url' => null, 235 'body_webfont_api' => null, 229 236 'alternate_font' => null, 237 'alternate_webfont_family' => null, 238 'alternate_webfont_url' => null, 239 'alternate_webfont_api' => null, 230 240 'blog_title_w' => null, 231 241 'blog_title_s' => null, … … 368 378 if ($conf_tab == 'css') { 369 379 $ductile_user['body_font'] = $_POST['body_font']; 380 $ductile_user['body_webfont_family'] = $_POST['body_webfont_family']; 381 $ductile_user['body_webfont_url'] = $_POST['body_webfont_url']; 382 $ductile_user['body_webfont_api'] = $_POST['body_webfont_api']; 383 370 384 $ductile_user['alternate_font'] = $_POST['alternate_font']; 385 $ductile_user['alternate_webfont_family'] = $_POST['alternate_webfont_family']; 386 $ductile_user['alternate_webfont_url'] = $_POST['alternate_webfont_url']; 387 $ductile_user['alternate_webfont_api'] = $_POST['alternate_webfont_api']; 371 388 372 389 $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']); … … 507 524 echo '<h3>'.__('General settings').'</h3>'; 508 525 509 echo '<fieldset><legend>'.__('Fonts').'</legend>'. 526 echo '<fieldset><legend>'.__('Fonts').'</legend>'; 527 528 echo '<div class="two-cols">'; 529 echo '<div class="col">'; 530 echo 510 531 '<p class="field"><label for="body_font">'.__('Main:').' '. 511 532 form::combo('body_font',$fonts,$ductile_user['body_font']).'</label>'. 512 533 (!empty($ductile_user['body_font']) ? ' '.fontDef($ductile_user['body_font']) : ''). 513 534 '</p>'. 514 535 '<p class="form-note">'.__('Set main font to default to use webfont below.').'</p> '. 536 '<p class="field"><label for="body_webfont_family">'.__('Webfont family:').'</label> '. 537 form::field('body_webfont_family',25,255,$ductile_user['body_webfont_family']).'</p>'. 538 '<p class="field"><label for="body_webfont_url">'.__('Webfont URL:').'</label> '. 539 form::field('body_webfont_url',50,255,$ductile_user['body_webfont_url']).'</p>'. 540 '<p class="field"><label for="body_webfont_url">'.__('Webfont API:').' '. 541 form::combo('body_webfont_api',$webfont_apis,$ductile_user['body_webfont_api']).'</label>'.'</p>'; 542 echo '</div>'; 543 echo '<div class="col">'; 544 echo 515 545 '<p class="field"><label for="alternate_font">'.__('Secondary:').' '. 516 546 form::combo('alternate_font',$fonts,$ductile_user['alternate_font']).'</label>'. 517 547 (!empty($ductile_user['alternate_font']) ? ' '.fontDef($ductile_user['alternate_font']) : ''). 518 548 '</p>'. 519 '</fieldset>'; 549 '<p class="form-note">'.__('Set secondary font to default to use webfont below.').'</p> '. 550 '<p class="field"><label for="alternate_webfont_family">'.__('Webfont family:').'</label> '. 551 form::field('alternate_webfont_family',25,255,$ductile_user['alternate_webfont_family']).'</p>'. 552 '<p class="field"><label for="alternate_webfont_url">'.__('Webfont URL:').'</label> '. 553 form::field('alternate_webfont_url',50,255,$ductile_user['alternate_webfont_url']).'</p>'. 554 '<p class="field"><label for="alternate_webfont_api">'.__('Webfont API:').' '. 555 form::combo('alternate_webfont_api',$webfont_apis,$ductile_user['alternate_webfont_api']).'</label>'.'</p>'; 556 echo '</div>'; 557 echo '</div>'; 558 echo '</fieldset>'; 520 559 521 560 echo '<div class="two-cols">'; -
themes/ductile/_public.php
r1045 r1081 250 250 $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme. 251 251 '/ductile.js"></script>'."\n"; 252 253 echo self::ductileWebfontHelper(); 254 } 255 256 public static function ductileWebfontHelper() 257 { 258 $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_style'); 259 260 if ($s === null) { 261 return; 262 } 263 264 $s = @unserialize($s); 265 if (!is_array($s)) { 266 return; 267 } 268 269 $ret = ''; 270 $css = array(); 271 $uri = array(); 272 if (!isset($s['body_font']) || ($s['body_font'] == '')) { 273 // See if webfont defined for main font 274 if (isset($s['body_webfont_api']) && isset($s['body_webfont_family']) && isset($s['body_webfont_url'])) { 275 $uri[] = $s['body_webfont_url']; 276 switch ($s['body_webfont_api']) { 277 case 'js': 278 $ret .= sprintf('<script type="text/javascript" src="%s"></script>',$s['body_webfont_url'])."\n"; 279 break; 280 case 'css': 281 $ret .= sprintf('<link type="text/css" href="%s" rel="stylesheet" />',$s['body_webfont_url'])."\n"; 282 break; 283 } 284 # Main font 285 $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 286 self::prop($css,$selectors,'font-family',$s['body_webfont_family']); 287 } 288 } 289 if (!isset($s['alternate_font']) || ($s['alternate_font'] == '')) { 290 // See if webfont defined for secondary font 291 if (isset($s['alternate_webfont_api']) && isset($s['alternate_webfont_family']) && isset($s['alternate_webfont_url'])) { 292 if (!in_array($s['alternate_webfont_url'], $uri)) { 293 switch ($s['alternate_webfont_api']) { 294 case 'js': 295 $ret .= sprintf('<script type="text/javascript" src="%s"></script>',$s['alternate_webfont_url'])."\n"; 296 break; 297 case 'css': 298 $ret .= sprintf('<link type="text/css" href="%s" rel="stylesheet" />',$s['alternate_webfont_url'])."\n"; 299 break; 300 } 301 } 302 # Secondary font 303 $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 304 self::prop($css,$selectors,'font-family',$s['alternate_webfont_family']); 305 } 306 } 307 # Style directives 308 $res = ''; 309 foreach ($css as $selector => $values) { 310 $res .= $selector." {\n"; 311 foreach ($values as $k => $v) { 312 $res .= $k.':'.$v.";\n"; 313 } 314 $res .= "}\n"; 315 } 316 if ($res != '') { 317 $ret .= '<style type="text/css">'."\n".$res.'</style>'."\n"; 318 } 319 320 return $ret; 252 321 } 253 322 -
themes/ductile/locales/fr/admin.po
r810 r1081 110 110 msgstr "Secondaire :" 111 111 112 msgid "none" 113 msgstr "aucune" 114 115 msgid "javascript (Adobe)" 116 msgstr "javascript (Adobe)" 117 118 msgid "stylesheet (Google)" 119 msgstr "feuille de style (Google)" 120 121 msgid "Set main font to default to use webfont below." 122 msgstr "Mettre la police de caractère principale à Défaut pour utiliser la fonte web ci-dessous." 123 124 msgid "Set secondary font to default to use webfont below." 125 msgstr "Mettre la police de caractère secondaire à Défaut pour utiliser la fonte web ci-dessous." 126 127 msgid "Webfont family:" 128 msgstr "Famille" 129 130 msgid "Webfont URL:" 131 msgstr "URL de la fonte web" 132 133 msgid "Webfont API:" 134 msgstr "Type d'API" 135 112 136 msgid "Ductile primary" 113 137 msgstr "Principale de Ductile"
Note: See TracChangeset
for help on using the changeset viewer.