Dotclear

source: themes/ductile/_public.php @ 389:217c64dcfc81

Revision 389:217c64dcfc81, 7.9 KB checked in by Franck <carnet.franck.paul@…>, 14 years ago (diff)

Configuration (HTML) : mise en place des onglets (contenu html / contenant css) imparfaite* et ajout du masquage de la description du blog

  • Les colorpickers sont à l'ouest (à cause des onglets), l'onglet actif est toujours le premier
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12
13if (!defined('DC_RC_PATH')) { return; }
14
15$core->addBehavior('publicHeadContent',array('tplDuctileTheme','publicHeadContent'));
16
17class tplDuctileTheme
18{
19     public static function publicHeadContent($core)
20     {
21          echo 
22               '<style type="text/css">'."\n".
23               '/* Additionnal style directives */'."\n".
24               self::ductileStyleHelper().
25               "</style>\n";
26     }
27     
28     public static function ductileStyleHelper()
29     {
30          $s = $GLOBALS['core']->blog->settings->themes->ductile_style;
31
32          if ($s === null) {
33               return;
34          }
35
36          $s = @unserialize($s);
37          if (!is_array($s)) {
38               return;
39          }
40
41          $css = array();
42
43          # Properties
44         
45          # Blog description
46          $selectors = '#blogdesc';
47          if (isset($s['subtitle_hidden'])) self::prop($css,$selectors,'display',($s['subtitle_hidden'] ? 'none' : null));
48
49          # Main font
50          $selectors = 'body, #supranav li a span, #comments.me, a.comment-number';
51          if (isset($s['body_font'])) self::prop($css,$selectors,'font-family',self::fontDef($s['body_font']));
52
53          # Secondary font
54          $selectors = '#blogdesc, #supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer p';
55          if (isset($s['alternate_font'])) self::prop($css,$selectors,'font-family',self::fontDef($s['alternate_font']));
56         
57          # Inside posts links font weight
58          $selectors = '.post-excerpt a, .post-content a';
59          if (isset($s['post_link_w'])) self::prop($css,$selectors,'font-weight',($s['post_link_w'] ? 'bold' : 'normal'));
60
61          # Inside posts links colors (normal, visited)
62          $selectors = '.post-excerpt a:link, .post-excerpt a:visited, .post-content a:link, .post-content a:visited';
63          if (isset($s['post_link_v_c'])) self::prop($css,$selectors,'color',$s['post_link_v_c']);
64
65          # Inside posts links colors (hover, active, focus)
66          $selectors = '.post-excerpt a:hover, .post-excerpt a:active, .post-excerpt a:focus, .post-content a:hover, .post-content a:active, .post-content a:focus';
67          if (isset($s['post_link_f_c'])) self::prop($css,$selectors,'color',$s['post_link_f_c']);
68
69          # Style directives
70          $res = '';
71          foreach ($css as $selector => $values) {
72               $res .= $selector." {\n";
73               foreach ($values as $k => $v) {
74                    $res .= $k.':'.$v.";\n";
75               }
76               $res .= "}\n";
77          }
78
79          # Large screens
80          $css_large = array();
81
82          # Blog title font weight
83          $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus';
84          if (isset($s['blog_title_w'])) self::prop($css_large,$selectors,'font-weight',($s['blog_title_w'] ? 'bold' : 'normal'));
85         
86          # Blog title font size
87          $selectors = 'h1';
88          if (isset($s['blog_title_s'])) self::prop($css_large,$selectors,'font-size',$s['blog_title_s']);
89         
90          # Blog title color
91          $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus';
92          if (isset($s['blog_title_c'])) self::prop($css_large,$selectors,'color',$s['blog_title_c']);
93
94          # Post title font weight
95          $selectors = 'h2.post-title, h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus';
96          if (isset($s['post_title_w'])) self::prop($css_large,$selectors,'font-weight',($s['post_title_w'] ? 'bold' : 'normal'));
97         
98          # Post title font size
99          $selectors = 'h2.post-title';
100          if (isset($s['post_title_s'])) self::prop($css_large,$selectors,'font-size',$s['post_title_s']);
101         
102          # Post title color
103          $selectors = 'h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus';
104          if (isset($s['post_title_c'])) self::prop($css_large,$selectors,'color',$s['post_title_c']);
105
106          # Style directives for large screens
107          if (count($css_large)) {
108               $res .= '@media only screen and (min-width: 481px) {'."\n";
109               foreach ($css_large as $selector => $values) {
110                    $res .= $selector." {\n";
111                    foreach ($values as $k => $v) {
112                         $res .= $k.':'.$v.";\n";
113                    }
114                    $res .= "}\n";
115               }
116               $res .= "}\n";
117          }
118
119          # Small screens
120          $css_small = array();
121
122          # Blog title font weight
123          $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus';
124          if (isset($s['blog_title_w_m'])) self::prop($css_small,$selectors,'font-weight',($s['blog_title_w_m'] ? 'bold' : 'normal'));
125         
126          # Blog title font size
127          $selectors = 'h1';
128          if (isset($s['blog_title_s_m'])) self::prop($css_small,$selectors,'font-size',$s['blog_title_s_m']);
129         
130          # Blog title color
131          $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus';
132          if (isset($s['blog_title_c_m'])) self::prop($css_small,$selectors,'color',$s['blog_title_c_m']);
133
134          # Post title font weight
135          $selectors = 'h2.post-title, h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus';
136          if (isset($s['post_title_w_m'])) self::prop($css_small,$selectors,'font-weight',($s['post_title_w_m'] ? 'bold' : 'normal'));
137         
138          # Post title font size
139          $selectors = 'h2.post-title';
140          if (isset($s['post_title_s_m'])) self::prop($css_small,$selectors,'font-size',$s['post_title_s_m']);
141         
142          # Post title color
143          $selectors = 'h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus';
144          if (isset($s['post_title_c_m'])) self::prop($css_small,$selectors,'color',$s['post_title_c_m']);
145
146          # Style directives for small screens
147          if (count($css_small)) {
148               $res .= '@media only screen and (max-width: 480px) {'."\n";
149               foreach ($css_small as $selector => $values) {
150                    $res .= $selector." {\n";
151                    foreach ($values as $k => $v) {
152                         $res .= $k.':'.$v.";\n";
153                    }
154                    $res .= "}\n";
155               }
156               $res .= "}\n";
157          }
158         
159          return $res;
160     }
161
162     protected static $fonts = array(
163          // Theme standard
164          'Ductile body' => '"Century Schoolbook", "Century Schoolbook L", Georgia, serif',
165          'Ductile alternate' => '"Franklin gothic medium", "arial narrow", "DejaVu Sans Condensed", "helvetica neue", helvetica, sans-serif',
166
167          // Serif families
168          'Times New Roman' => 'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif',
169          'Georgia' => 'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif," "Bitstream Vera Serif", "Liberation Serif", Georgia, serif',
170          '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',
171
172          // Sans-serif families
173          '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',
174          'Verdana' => 'Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif',
175          'Trebuchet MS' => '"Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif',
176
177          // Cursive families
178          'Impact' => 'Impact, Haettenschweiler, "Franklin Gothic Bold", Charcoal, "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif',
179
180          // Monospace families
181          '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'
182     );
183
184     protected static function fontDef($c)
185     {
186          return isset(self::$fonts[$c]) ? self::$fonts[$c] : null;
187     }
188
189     protected static function prop(&$css,$selector,$prop,$value)
190     {
191          if ($value) {
192               $css[$selector][$prop] = $value;
193          }
194     }
195}
196?>
Note: See TracBrowser for help on using the repository browser.

Sites map