Dotclear


Ignore:
Timestamp:
03/08/18 17:58:39 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting (PSR-2)

Location:
themes/ductile
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_define.php

    r3531 r3730  
    99# 
    1010# -- END LICENSE BLOCK ----------------------------------------- 
    11 if (!defined('DC_RC_PATH')) { return; } 
     11if (!defined('DC_RC_PATH')) {return;} 
    1212 
    1313$this->registerModule( 
    14      /* Name */                    "Ductile", 
    15      /* Description*/         "Mediaqueries compliant elegant theme", 
    16      /* Author */             "Dotclear Team", 
    17      /* Version */            '1.5', 
    18      /* Properties */         array( 
    19                                         'standalone_config' => true, 
    20                                         'type' => 'theme' 
    21                                    ) 
     14    "Ductile",                              // Name 
     15    "Mediaqueries compliant elegant theme", // Description 
     16    "Dotclear Team",                        // Author 
     17    '1.5',                                  // Version 
     18    array(                                  // Properties 
     19        'standalone_config' => true, 
     20        'type'              => 'theme' 
     21    ) 
    2222); 
  • themes/ductile/_prepend.php

    r3709 r3730  
    1212# -- END LICENSE BLOCK ----------------------------------------- 
    1313 
    14 if (!defined('DC_RC_PATH')) { return; } 
     14if (!defined('DC_RC_PATH')) {return;} 
    1515// public part below 
    1616 
    17 if (!defined('DC_CONTEXT_ADMIN')) { return false; } 
     17if (!defined('DC_CONTEXT_ADMIN')) {return false;} 
    1818// admin part below 
    1919 
    2020# Behaviors 
    21 $GLOBALS['core']->addBehavior('adminPageHTMLHead',array(__NAMESPACE__.'\tplDuctileThemeAdmin','adminPageHTMLHead')); 
     21$GLOBALS['core']->addBehavior('adminPageHTMLHead', array(__NAMESPACE__ . '\tplDuctileThemeAdmin', 'adminPageHTMLHead')); 
    2222 
    2323class tplDuctileThemeAdmin 
    2424{ 
    25      public static function adminPageHTMLHead() 
    26      { 
    27           global $core; 
    28           if ($core->blog->settings->system->theme != 'ductile') { return; } 
     25    public static function adminPageHTMLHead() 
     26    { 
     27        global $core; 
     28        if ($core->blog->settings->system->theme != 'ductile') {return;} 
    2929 
    30           echo "\n".'<!-- Header directives for Ductile configuration -->'."\n"; 
    31           $core->auth->user_prefs->addWorkspace('accessibility'); 
    32           if (!$core->auth->user_prefs->accessibility->nodragdrop) { 
    33                echo 
    34                     \dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). 
    35                     \dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'); 
    36                     echo <<<EOT 
     30        echo "\n" . '<!-- Header directives for Ductile configuration -->' . "\n"; 
     31        $core->auth->user_prefs->addWorkspace('accessibility'); 
     32        if (!$core->auth->user_prefs->accessibility->nodragdrop) { 
     33            echo 
     34            \dcPage::jsLoad('js/jquery/jquery-ui.custom.js') . 
     35            \dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'); 
     36            echo <<<EOT 
    3737<script type="text/javascript"> 
    3838$(function() { 
    39      $('#stickerslist').sortable({'cursor':'move'}); 
    40      $('#stickerslist tr').hover(function () { 
    41           $(this).css({'cursor':'move'}); 
    42      }, function () { 
    43           $(this).css({'cursor':'auto'}); 
    44      }); 
    45      $('#theme_config').submit(function() { 
    46           var order=[]; 
    47           $('#stickerslist tr td input.position').each(function() { 
    48                order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1')); 
    49           }); 
    50           $('input[name=ds_order]')[0].value = order.join(','); 
    51           return true; 
    52      }); 
    53      $('#stickerslist tr td input.position').hide(); 
    54      $('#stickerslist tr td.handle').addClass('handler'); 
     39    $('#stickerslist').sortable({'cursor':'move'}); 
     40    $('#stickerslist tr').hover(function () { 
     41        $(this).css({'cursor':'move'}); 
     42    }, function () { 
     43        $(this).css({'cursor':'auto'}); 
     44    }); 
     45    $('#theme_config').submit(function() { 
     46        var order=[]; 
     47        $('#stickerslist tr td input.position').each(function() { 
     48            order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1')); 
     49        }); 
     50        $('input[name=ds_order]')[0].value = order.join(','); 
     51        return true; 
     52    }); 
     53    $('#stickerslist tr td input.position').hide(); 
     54    $('#stickerslist tr td.handle').addClass('handler'); 
    5555}); 
    5656</script> 
    5757EOT; 
    58           } 
     58        } 
    5959 
    60      } 
     60    } 
    6161} 
  • themes/ductile/_public.php

    r3531 r3730  
    1212# -- END LICENSE BLOCK ----------------------------------------- 
    1313 
    14 if (!defined('DC_RC_PATH')) { return; } 
    15  
    16 \l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 
     14if (!defined('DC_RC_PATH')) {return;} 
     15 
     16\l10n::set(dirname(__FILE__) . '/locales/' . $_lang . '/main'); 
    1717 
    1818# Behaviors 
    19 $core->addBehavior('publicHeadContent',array(__NAMESPACE__.'\tplDuctileTheme','publicHeadContent')); 
    20 $core->addBehavior('publicInsideFooter',array(__NAMESPACE__.'\tplDuctileTheme','publicInsideFooter')); 
     19$core->addBehavior('publicHeadContent', array(__NAMESPACE__ . '\tplDuctileTheme', 'publicHeadContent')); 
     20$core->addBehavior('publicInsideFooter', array(__NAMESPACE__ . '\tplDuctileTheme', 'publicInsideFooter')); 
    2121 
    2222# Templates 
    23 $core->tpl->addValue('ductileEntriesList',array(__NAMESPACE__.'\tplDuctileTheme','ductileEntriesList')); 
    24 $core->tpl->addBlock('EntryIfContentIsCut',array(__NAMESPACE__.'\tplDuctileTheme','EntryIfContentIsCut')); 
    25 $core->tpl->addValue('ductileNbEntryPerPage',array(__NAMESPACE__.'\tplDuctileTheme','ductileNbEntryPerPage')); 
    26 $core->tpl->addValue('ductileLogoSrc',array(__NAMESPACE__.'\tplDuctileTheme','ductileLogoSrc')); 
    27 $core->tpl->addBlock('IfPreviewIsNotMandatory',array(__NAMESPACE__.'\tplDuctileTheme','IfPreviewIsNotMandatory')); 
     23$core->tpl->addValue('ductileEntriesList', array(__NAMESPACE__ . '\tplDuctileTheme', 'ductileEntriesList')); 
     24$core->tpl->addBlock('EntryIfContentIsCut', array(__NAMESPACE__ . '\tplDuctileTheme', 'EntryIfContentIsCut')); 
     25$core->tpl->addValue('ductileNbEntryPerPage', array(__NAMESPACE__ . '\tplDuctileTheme', 'ductileNbEntryPerPage')); 
     26$core->tpl->addValue('ductileLogoSrc', array(__NAMESPACE__ . '\tplDuctileTheme', 'ductileLogoSrc')); 
     27$core->tpl->addBlock('IfPreviewIsNotMandatory', array(__NAMESPACE__ . '\tplDuctileTheme', 'IfPreviewIsNotMandatory')); 
    2828 
    2929class tplDuctileTheme 
    3030{ 
    31      public static function ductileNbEntryPerPage($attr) 
    32      { 
    33           return '<?php '.__NAMESPACE__.'\tplDuctileTheme::ductileNbEntryPerPageHelper(); ?>'; 
    34      } 
    35  
    36      public static function ductileNbEntryPerPageHelper() 
    37      { 
    38           global $_ctx; 
    39  
    40           $nb_other = $nb_first = 0; 
    41  
    42           $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_entries_counts'); 
    43           if ($s !== null) { 
    44                $s = @unserialize($s); 
    45                if (is_array($s)) { 
    46                     switch ($GLOBALS['core']->url->type) { 
    47                          case 'default': 
    48                          case 'default-page': 
    49                               if (isset($s['default'])) { 
    50                                    $nb_first = $nb_other = (integer) $s['default']; 
    51                               } 
    52                               if (isset($s['default-page'])) { 
    53                                    $nb_other = (integer) $s['default-page']; 
    54                               } 
    55                               break; 
    56                          default: 
    57                               if (isset($s[$GLOBALS['core']->url->type])) { 
    58                                    // Nb de billets par page défini par la config du thème 
    59                                    $nb_first = $nb_other = (integer) $s[$GLOBALS['core']->url->type]; 
    60                               } 
    61                               break; 
    62                     } 
    63                } 
    64           } 
    65  
    66           if ($nb_other == 0) { 
    67                if (!empty($attr['nb'])) { 
    68                     // Nb de billets par page défini par défaut dans le template 
    69                     $nb_other = $nb_first = (integer) $attr['nb']; 
    70                } 
    71           } 
    72  
    73           if ($nb_other > 0) { 
    74                $_ctx->nb_entry_per_page = $nb_other; 
    75           } 
    76           if ($nb_first > 0) { 
    77                $_ctx->nb_entry_first_page = $nb_first; 
    78           } 
    79      } 
    80  
    81      public static function EntryIfContentIsCut($attr,$content) 
    82      { 
    83           global $core; 
    84  
    85           if (empty($attr['cut_string']) || !empty($attr['full'])) { 
    86                return ''; 
    87           } 
    88  
    89           $urls = '0'; 
    90           if (!empty($attr['absolute_urls'])) { 
    91                $urls = '1'; 
    92           } 
    93  
    94           $short = $core->tpl->getFilters($attr); 
    95           $cut = $attr['cut_string']; 
    96           $attr['cut_string'] = 0; 
    97           $full = $core->tpl->getFilters($attr); 
    98           $attr['cut_string'] = $cut; 
    99  
    100           return '<?php if (strlen('.sprintf($full,'$_ctx->posts->getContent('.$urls.')').') > '. 
    101                'strlen('.sprintf($short,'$_ctx->posts->getContent('.$urls.')').')) : ?>'. 
    102                $content. 
    103                '<?php endif; ?>'; 
    104      } 
    105  
    106      public static function ductileEntriesList($attr) 
    107      { 
    108           global $core; 
    109  
    110           $tpl_path = dirname(__FILE__).'/tpl/'; 
    111           $list_types = array('title','short','full'); 
    112  
    113           // Get all _entry-*.html in tpl folder of theme 
    114           $list_types_templates = \files::scandir($tpl_path); 
    115           if (is_array($list_types_templates)) { 
    116                foreach ($list_types_templates as $v) { 
    117                     if (preg_match('/^_entry\-(.*)\.html$/',$v,$m)) { 
    118                          if (isset($m[1])) { 
    119                               if (!in_array($m[1],$list_types)) { 
    120                                    // template not already in full list 
    121                                    $list_types[] = $m[1]; 
    122                               } 
    123                          } 
    124                     } 
    125                } 
    126           } 
    127  
    128           $default = isset($attr['default']) ? trim($attr['default']) : 'short'; 
    129           $ret = '<?php '."\n". 
    130                'switch ('.__NAMESPACE__.'\tplDuctileTheme::ductileEntriesListHelper(\''.$default.'\')) {'."\n"; 
    131  
    132           foreach ($list_types as $v) { 
    133                $ret .= ' case \''.$v.'\':'."\n". 
    134                     '?>'."\n". 
    135                               $core->tpl->includeFile(array('src' => '_entry-'.$v.'.html'))."\n". 
    136                     '<?php '."\n". 
    137                     '         break;'."\n"; 
    138           } 
    139  
    140           $ret .= '}'."\n". 
    141                '?>'; 
    142  
    143           return $ret; 
    144      } 
    145  
    146      public static function ductileEntriesListHelper($default) 
    147      { 
    148           $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_entries_lists'); 
    149           if ($s !== null) { 
    150                $s = @unserialize($s); 
    151                if (is_array($s)) { 
    152                     if (isset($s[$GLOBALS['core']->url->type])) { 
    153                          $model = $s[$GLOBALS['core']->url->type]; 
    154                          return $model; 
    155                     } 
    156                } 
    157           } 
    158           return $default; 
    159      } 
    160  
    161      public static function ductileLogoSrc($attr) 
    162      { 
    163           return '<?php echo '.__NAMESPACE__.'\tplDuctileTheme::ductileLogoSrcHelper(); ?>'; 
    164      } 
    165  
    166      public static function ductileLogoSrcHelper() 
    167      { 
    168           $img_url = $GLOBALS['core']->blog->settings->system->themes_url.'/'.$GLOBALS['core']->blog->settings->system->theme.'/img/logo.png'; 
    169  
    170           $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_style'); 
    171           if ($s === null) { 
    172                // no settings yet, return default logo 
    173                return $img_url; 
    174           } 
    175           $s = @unserialize($s); 
    176           if (!is_array($s)) { 
    177                // settings error, return default logo 
    178                return $img_url; 
    179           } 
    180  
    181           if (isset($s['logo_src'])) { 
    182                if ($s['logo_src'] !== null) { 
    183                     if ($s['logo_src'] != '') { 
    184                          if ((substr($s['logo_src'],0,1) == '/') || (parse_url($s['logo_src'],PHP_URL_SCHEME) != '')) { 
    185                               // absolute URL 
    186                               $img_url = $s['logo_src']; 
    187                          } else { 
    188                               // relative URL (base = img folder of ductile theme) 
    189                               $img_url = $GLOBALS['core']->blog->settings->system->themes_url.'/'.$GLOBALS['core']->blog->settings->system->theme.'/img/'.$s['logo_src']; 
    190                          } 
    191                     } 
    192                } 
    193           } 
    194  
    195           return $img_url; 
    196      } 
    197  
    198      public static function IfPreviewIsNotMandatory($attr,$content) 
    199      { 
    200           $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_style'); 
    201           if ($s !== null) { 
    202                $s = @unserialize($s); 
    203                if (is_array($s)) { 
    204                     if (isset($s['preview_not_mandatory'])) { 
    205                          if ($s['preview_not_mandatory']) { 
    206                               return $content; 
    207                          } 
    208                     } 
    209                } 
    210           } 
    211           return ''; 
    212      } 
    213  
    214      public static function publicInsideFooter($core) 
    215      { 
    216           $res = ''; 
    217           $default = false; 
    218           $img_url = $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/'; 
    219  
    220           $s = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); 
    221  
    222           if ($s === null) { 
    223                $default = true; 
    224           } else { 
    225                $s = @unserialize($s); 
    226                if (!is_array($s)) { 
    227                     $default = true; 
    228                } else { 
    229                     $s = array_filter($s,'self::cleanStickers'); 
    230                     if (count($s) == 0) { 
    231                          $default = true; 
    232                     } else { 
    233                          $count = 1; 
    234                          foreach ($s as $sticker) { 
    235                               $res .= self::setSticker($count,($count == count($s)),$sticker['label'],$sticker['url'],$img_url.$sticker['image']); 
    236                               $count++; 
    237                          } 
    238                     } 
    239                } 
    240           } 
    241  
    242           if ($default || $res == '') { 
    243                $res = self::setSticker(1,true,__('Subscribe'),$core->blog->url. 
    244                     $core->url->getURLFor('feed','atom'),$img_url.'sticker-feed.png'); 
    245           } 
    246  
    247           if ($res != '') { 
    248                $res = '<ul id="stickers">'."\n".$res.'</ul>'."\n"; 
    249                echo $res; 
    250           } 
    251      } 
    252  
    253      protected static function cleanStickers($s) 
    254      { 
    255           if (is_array($s)) { 
    256                if (isset($s['label']) && isset($s['url']) && isset($s['image'])) { 
    257                     if ($s['label'] != null && $s['url'] != null && $s['image'] != null) { 
    258                          return true; 
    259                     } 
    260                } 
    261           } 
    262           return false; 
    263      } 
    264  
    265      protected static function setSticker($position,$last,$label,$url,$image) 
    266      { 
    267           return '<li id="sticker'.$position.'"'.($last ? ' class="last"' : '').'>'."\n". 
    268                '<a href="'.$url.'">'."\n". 
    269                '<img alt="" src="'.$image.'" />'."\n". 
    270                '<span>'.$label.'</span>'."\n". 
    271                '</a>'."\n". 
    272                '</li>'."\n"; 
    273      } 
    274  
    275      public static function publicHeadContent($core) 
    276      { 
    277           echo 
    278                '<style type="text/css">'."\n". 
    279                '/* '.__('Additionnal style directives').' */'."\n". 
    280                self::ductileStyleHelper(). 
    281                "</style>\n"; 
    282  
    283           echo 
    284                '<script type="text/javascript" src="'. 
    285                $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme. 
    286                '/ductile.js"></script>'."\n"; 
    287  
    288           echo self::ductileWebfontHelper(); 
    289      } 
    290  
    291      public static function ductileWebfontHelper() 
    292      { 
    293           $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_style'); 
    294  
    295           if ($s === null) { 
    296                return; 
    297           } 
    298  
    299           $s = @unserialize($s); 
    300           if (!is_array($s)) { 
    301                return; 
    302           } 
    303  
    304           $ret = ''; 
    305           $css = array(); 
    306           $uri = array(); 
    307           if (!isset($s['body_font']) || ($s['body_font'] == '')) { 
    308                // See if webfont defined for main font 
    309                if (isset($s['body_webfont_api']) && isset($s['body_webfont_family']) && isset($s['body_webfont_url'])) { 
    310                     $uri[] = $s['body_webfont_url']; 
    311                     switch ($s['body_webfont_api']) { 
    312                          case 'js': 
    313                               $ret .= sprintf('<script type="text/javascript" src="%s"></script>',$s['body_webfont_url'])."\n"; 
    314                               break; 
    315                          case 'css': 
    316                               $ret .= sprintf('<link type="text/css" href="%s" rel="stylesheet" />',$s['body_webfont_url'])."\n"; 
    317                               break; 
    318                     } 
    319                     # Main font 
    320                     $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 
    321                     \dcThemeConfig::prop($css,$selectors,'font-family',$s['body_webfont_family']); 
    322                } 
    323           } 
    324           if (!isset($s['alternate_font']) || ($s['alternate_font'] == '')) { 
    325                // See if webfont defined for secondary font 
    326                if (isset($s['alternate_webfont_api']) && isset($s['alternate_webfont_family']) && isset($s['alternate_webfont_url'])) { 
    327                     if (!in_array($s['alternate_webfont_url'], $uri)) { 
    328                          switch ($s['alternate_webfont_api']) { 
    329                               case 'js': 
    330                                    $ret .= sprintf('<script type="text/javascript" src="%s"></script>',$s['alternate_webfont_url'])."\n"; 
    331                                    break; 
    332                               case 'css': 
    333                                    $ret .= sprintf('<link type="text/css" href="%s" rel="stylesheet" />',$s['alternate_webfont_url'])."\n"; 
    334                                    break; 
    335                          } 
    336                     } 
    337                     # Secondary font 
    338                     $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 
    339                     \dcThemeConfig::prop($css,$selectors,'font-family',$s['alternate_webfont_family']); 
    340                } 
    341           } 
    342           # Style directives 
    343           $res = ''; 
    344           foreach ($css as $selector => $values) { 
    345                $res .= $selector." {\n"; 
    346                foreach ($values as $k => $v) { 
    347                     $res .= $k.':'.$v.";\n"; 
    348                } 
    349                $res .= "}\n"; 
    350           } 
    351           if ($res != '') { 
    352                $ret .= '<style type="text/css">'."\n".$res.'</style>'."\n"; 
    353           } 
    354  
    355           return $ret; 
    356      } 
    357  
    358      public static function ductileStyleHelper() 
    359      { 
    360           $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_style'); 
    361  
    362           if ($s === null) { 
    363                return; 
    364           } 
    365  
    366           $s = @unserialize($s); 
    367           if (!is_array($s)) { 
    368                return; 
    369           } 
    370  
    371           $css = array(); 
    372  
    373           # Properties 
    374  
    375           # Blog description 
    376           $selectors = '#blogdesc'; 
    377           if (isset($s['subtitle_hidden'])) \dcThemeConfig::prop($css,$selectors,'display',($s['subtitle_hidden'] ? 'none' : null)); 
    378  
    379           # Main font 
    380           $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 
    381           if (isset($s['body_font'])) \dcThemeConfig::prop($css,$selectors,'font-family',self::fontDef($s['body_font'])); 
    382  
    383           # Secondary font 
    384           $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 
    385           if (isset($s['alternate_font'])) \dcThemeConfig::prop($css,$selectors,'font-family',self::fontDef($s['alternate_font'])); 
    386  
    387           # Inside posts links font weight 
    388           $selectors = '.post-excerpt a, .post-content a'; 
    389           if (isset($s['post_link_w'])) \dcThemeConfig::prop($css,$selectors,'font-weight',($s['post_link_w'] ? 'bold' : 'normal')); 
    390  
    391           # Inside posts links colors (normal, visited) 
    392           $selectors = '.post-excerpt a:link, .post-excerpt a:visited, .post-content a:link, .post-content a:visited'; 
    393           if (isset($s['post_link_v_c'])) \dcThemeConfig::prop($css,$selectors,'color',$s['post_link_v_c']); 
    394  
    395           # Inside posts links colors (hover, active, focus) 
    396           $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'; 
    397           if (isset($s['post_link_f_c'])) \dcThemeConfig::prop($css,$selectors,'color',$s['post_link_f_c']); 
    398  
    399           # Style directives 
    400           $res = ''; 
    401           foreach ($css as $selector => $values) { 
    402                $res .= $selector." {\n"; 
    403                foreach ($values as $k => $v) { 
    404                     $res .= $k.':'.$v.";\n"; 
    405                } 
    406                $res .= "}\n"; 
    407           } 
    408  
    409           # Large screens 
    410           $css_large = array(); 
    411  
    412           # Blog title font weight 
    413           $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    414           if (isset($s['blog_title_w'])) \dcThemeConfig::prop($css_large,$selectors,'font-weight',($s['blog_title_w'] ? 'bold' : 'normal')); 
    415  
    416           # Blog title font size 
    417           $selectors = 'h1'; 
    418           if (isset($s['blog_title_s'])) \dcThemeConfig::prop($css_large,$selectors,'font-size',$s['blog_title_s']); 
    419  
    420           # Blog title color 
    421           $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    422           if (isset($s['blog_title_c'])) \dcThemeConfig::prop($css_large,$selectors,'color',$s['blog_title_c']); 
    423  
    424           # Post title font weight 
    425           $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'; 
    426           if (isset($s['post_title_w'])) \dcThemeConfig::prop($css_large,$selectors,'font-weight',($s['post_title_w'] ? 'bold' : 'normal')); 
    427  
    428           # Post title font size 
    429           $selectors = 'h2.post-title'; 
    430           if (isset($s['post_title_s'])) \dcThemeConfig::prop($css_large,$selectors,'font-size',$s['post_title_s']); 
    431  
    432           # Post title color 
    433           $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'; 
    434           if (isset($s['post_title_c'])) \dcThemeConfig::prop($css_large,$selectors,'color',$s['post_title_c']); 
    435  
    436           # Simple title color (title without link) 
    437           $selectors = '#content-info h2, .post-title, .post h3, .post h4, .post h5, .post h6, .arch-block h3'; 
    438           if (isset($s['post_simple_title_c'])) \dcThemeConfig::prop($css_large,$selectors,'color',$s['post_simple_title_c']); 
    439  
    440           # Style directives for large screens 
    441           if (count($css_large)) { 
    442                $res .= '@media only screen and (min-width: 481px) {'."\n"; 
    443                foreach ($css_large as $selector => $values) { 
    444                     $res .= $selector." {\n"; 
    445                     foreach ($values as $k => $v) { 
    446                          $res .= $k.':'.$v.";\n"; 
    447                     } 
    448                     $res .= "}\n"; 
    449                } 
    450                $res .= "}\n"; 
    451           } 
    452  
    453           # Small screens 
    454           $css_small = array(); 
    455  
    456           # Blog title font weight 
    457           $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    458           if (isset($s['blog_title_w_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-weight',($s['blog_title_w_m'] ? 'bold' : 'normal')); 
    459  
    460           # Blog title font size 
    461           $selectors = 'h1'; 
    462           if (isset($s['blog_title_s_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-size',$s['blog_title_s_m']); 
    463  
    464           # Blog title color 
    465           $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    466           if (isset($s['blog_title_c_m'])) \dcThemeConfig::prop($css_small,$selectors,'color',$s['blog_title_c_m']); 
    467  
    468           # Post title font weight 
    469           $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'; 
    470           if (isset($s['post_title_w_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-weight',($s['post_title_w_m'] ? 'bold' : 'normal')); 
    471  
    472           # Post title font size 
    473           $selectors = 'h2.post-title'; 
    474           if (isset($s['post_title_s_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-size',$s['post_title_s_m']); 
    475  
    476           # Post title color 
    477           $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'; 
    478           if (isset($s['post_title_c_m'])) \dcThemeConfig::prop($css_small,$selectors,'color',$s['post_title_c_m']); 
    479  
    480           # Style directives for small screens 
    481           if (count($css_small)) { 
    482                $res .= '@media only screen and (max-width: 480px) {'."\n"; 
    483                foreach ($css_small as $selector => $values) { 
    484                     $res .= $selector." {\n"; 
    485                     foreach ($values as $k => $v) { 
    486                          $res .= $k.':'.$v.";\n"; 
    487                     } 
    488                     $res .= "}\n"; 
    489                } 
    490                $res .= "}\n"; 
    491           } 
    492  
    493           return $res; 
    494      } 
    495  
    496      protected static $fonts = array( 
    497           // Theme standard 
    498           'Ductile body' => '"Century Schoolbook", "Century Schoolbook L", Georgia, serif', 
    499           'Ductile alternate' => '"Franklin gothic medium", "arial narrow", "DejaVu Sans Condensed", "helvetica neue", helvetica, sans-serif', 
    500  
    501           // Serif families 
    502           'Times New Roman' => 'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif', 
    503           'Georgia' => 'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif', 
    504           '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', 
    505  
    506           // Sans-serif families 
    507           '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', 
    508           'Verdana' => 'Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif', 
    509           'Trebuchet MS' => '"Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif', 
    510  
    511           // Cursive families 
    512           'Impact' => 'Impact, Haettenschweiler, "Franklin Gothic Bold", Charcoal, "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif', 
    513  
    514           // Monospace families 
    515           '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' 
    516      ); 
    517  
    518      protected static function fontDef($c) 
    519      { 
    520           return isset(self::$fonts[$c]) ? self::$fonts[$c] : null; 
    521      } 
     31    public static function ductileNbEntryPerPage($attr) 
     32    { 
     33        return '<?php ' . __NAMESPACE__ . '\tplDuctileTheme::ductileNbEntryPerPageHelper(); ?>'; 
     34    } 
     35 
     36    public static function ductileNbEntryPerPageHelper() 
     37    { 
     38        global $_ctx; 
     39 
     40        $nb_other = $nb_first = 0; 
     41 
     42        $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme . '_entries_counts'); 
     43        if ($s !== null) { 
     44            $s = @unserialize($s); 
     45            if (is_array($s)) { 
     46                switch ($GLOBALS['core']->url->type) { 
     47                    case 'default': 
     48                    case 'default-page': 
     49                        if (isset($s['default'])) { 
     50                            $nb_first = $nb_other = (integer) $s['default']; 
     51                        } 
     52                        if (isset($s['default-page'])) { 
     53                            $nb_other = (integer) $s['default-page']; 
     54                        } 
     55                        break; 
     56                    default: 
     57                        if (isset($s[$GLOBALS['core']->url->type])) { 
     58                            // Nb de billets par page défini par la config du thème 
     59                            $nb_first = $nb_other = (integer) $s[$GLOBALS['core']->url->type]; 
     60                        } 
     61                        break; 
     62                } 
     63            } 
     64        } 
     65 
     66        if ($nb_other == 0) { 
     67            if (!empty($attr['nb'])) { 
     68                // Nb de billets par page défini par défaut dans le template 
     69                $nb_other = $nb_first = (integer) $attr['nb']; 
     70            } 
     71        } 
     72 
     73        if ($nb_other > 0) { 
     74            $_ctx->nb_entry_per_page = $nb_other; 
     75        } 
     76        if ($nb_first > 0) { 
     77            $_ctx->nb_entry_first_page = $nb_first; 
     78        } 
     79    } 
     80 
     81    public static function EntryIfContentIsCut($attr, $content) 
     82    { 
     83        global $core; 
     84 
     85        if (empty($attr['cut_string']) || !empty($attr['full'])) { 
     86            return ''; 
     87        } 
     88 
     89        $urls = '0'; 
     90        if (!empty($attr['absolute_urls'])) { 
     91            $urls = '1'; 
     92        } 
     93 
     94        $short              = $core->tpl->getFilters($attr); 
     95        $cut                = $attr['cut_string']; 
     96        $attr['cut_string'] = 0; 
     97        $full               = $core->tpl->getFilters($attr); 
     98        $attr['cut_string'] = $cut; 
     99 
     100        return '<?php if (strlen(' . sprintf($full, '$_ctx->posts->getContent(' . $urls . ')') . ') > ' . 
     101        'strlen(' . sprintf($short, '$_ctx->posts->getContent(' . $urls . ')') . ')) : ?>' . 
     102            $content . 
     103            '<?php endif; ?>'; 
     104    } 
     105 
     106    public static function ductileEntriesList($attr) 
     107    { 
     108        global $core; 
     109 
     110        $tpl_path   = dirname(__FILE__) . '/tpl/'; 
     111        $list_types = array('title', 'short', 'full'); 
     112 
     113        // Get all _entry-*.html in tpl folder of theme 
     114        $list_types_templates = \files::scandir($tpl_path); 
     115        if (is_array($list_types_templates)) { 
     116            foreach ($list_types_templates as $v) { 
     117                if (preg_match('/^_entry\-(.*)\.html$/', $v, $m)) { 
     118                    if (isset($m[1])) { 
     119                        if (!in_array($m[1], $list_types)) { 
     120                            // template not already in full list 
     121                            $list_types[] = $m[1]; 
     122                        } 
     123                    } 
     124                } 
     125            } 
     126        } 
     127 
     128        $default = isset($attr['default']) ? trim($attr['default']) : 'short'; 
     129        $ret     = '<?php ' . "\n" . 
     130        'switch (' . __NAMESPACE__ . '\tplDuctileTheme::ductileEntriesListHelper(\'' . $default . '\')) {' . "\n"; 
     131 
     132        foreach ($list_types as $v) { 
     133            $ret .= '   case \'' . $v . '\':' . "\n" . 
     134            '?>' . "\n" . 
     135            $core->tpl->includeFile(array('src' => '_entry-' . $v . '.html')) . "\n" . 
     136                '<?php ' . "\n" . 
     137                '       break;' . "\n"; 
     138        } 
     139 
     140        $ret .= '}' . "\n" . 
     141            '?>'; 
     142 
     143        return $ret; 
     144    } 
     145 
     146    public static function ductileEntriesListHelper($default) 
     147    { 
     148        $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme . '_entries_lists'); 
     149        if ($s !== null) { 
     150            $s = @unserialize($s); 
     151            if (is_array($s)) { 
     152                if (isset($s[$GLOBALS['core']->url->type])) { 
     153                    $model = $s[$GLOBALS['core']->url->type]; 
     154                    return $model; 
     155                } 
     156            } 
     157        } 
     158        return $default; 
     159    } 
     160 
     161    public static function ductileLogoSrc($attr) 
     162    { 
     163        return '<?php echo ' . __NAMESPACE__ . '\tplDuctileTheme::ductileLogoSrcHelper(); ?>'; 
     164    } 
     165 
     166    public static function ductileLogoSrcHelper() 
     167    { 
     168        $img_url = $GLOBALS['core']->blog->settings->system->themes_url . '/' . $GLOBALS['core']->blog->settings->system->theme . '/img/logo.png'; 
     169 
     170        $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme . '_style'); 
     171        if ($s === null) { 
     172            // no settings yet, return default logo 
     173            return $img_url; 
     174        } 
     175        $s = @unserialize($s); 
     176        if (!is_array($s)) { 
     177            // settings error, return default logo 
     178            return $img_url; 
     179        } 
     180 
     181        if (isset($s['logo_src'])) { 
     182            if ($s['logo_src'] !== null) { 
     183                if ($s['logo_src'] != '') { 
     184                    if ((substr($s['logo_src'], 0, 1) == '/') || (parse_url($s['logo_src'], PHP_URL_SCHEME) != '')) { 
     185                        // absolute URL 
     186                        $img_url = $s['logo_src']; 
     187                    } else { 
     188                        // relative URL (base = img folder of ductile theme) 
     189                        $img_url = $GLOBALS['core']->blog->settings->system->themes_url . '/' . $GLOBALS['core']->blog->settings->system->theme . '/img/' . $s['logo_src']; 
     190                    } 
     191                } 
     192            } 
     193        } 
     194 
     195        return $img_url; 
     196    } 
     197 
     198    public static function IfPreviewIsNotMandatory($attr, $content) 
     199    { 
     200        $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme . '_style'); 
     201        if ($s !== null) { 
     202            $s = @unserialize($s); 
     203            if (is_array($s)) { 
     204                if (isset($s['preview_not_mandatory'])) { 
     205                    if ($s['preview_not_mandatory']) { 
     206                        return $content; 
     207                    } 
     208                } 
     209            } 
     210        } 
     211        return ''; 
     212    } 
     213 
     214    public static function publicInsideFooter($core) 
     215    { 
     216        $res     = ''; 
     217        $default = false; 
     218        $img_url = $core->blog->settings->system->themes_url . '/' . $core->blog->settings->system->theme . '/img/'; 
     219 
     220        $s = $core->blog->settings->themes->get($core->blog->settings->system->theme . '_stickers'); 
     221 
     222        if ($s === null) { 
     223            $default = true; 
     224        } else { 
     225            $s = @unserialize($s); 
     226            if (!is_array($s)) { 
     227                $default = true; 
     228            } else { 
     229                $s = array_filter($s, 'self::cleanStickers'); 
     230                if (count($s) == 0) { 
     231                    $default = true; 
     232                } else { 
     233                    $count = 1; 
     234                    foreach ($s as $sticker) { 
     235                        $res .= self::setSticker($count, ($count == count($s)), $sticker['label'], $sticker['url'], $img_url . $sticker['image']); 
     236                        $count++; 
     237                    } 
     238                } 
     239            } 
     240        } 
     241 
     242        if ($default || $res == '') { 
     243            $res = self::setSticker(1, true, __('Subscribe'), $core->blog->url . 
     244                $core->url->getURLFor('feed', 'atom'), $img_url . 'sticker-feed.png'); 
     245        } 
     246 
     247        if ($res != '') { 
     248            $res = '<ul id="stickers">' . "\n" . $res . '</ul>' . "\n"; 
     249            echo $res; 
     250        } 
     251    } 
     252 
     253    protected static function cleanStickers($s) 
     254    { 
     255        if (is_array($s)) { 
     256            if (isset($s['label']) && isset($s['url']) && isset($s['image'])) { 
     257                if ($s['label'] != null && $s['url'] != null && $s['image'] != null) { 
     258                    return true; 
     259                } 
     260            } 
     261        } 
     262        return false; 
     263    } 
     264 
     265    protected static function setSticker($position, $last, $label, $url, $image) 
     266    { 
     267        return '<li id="sticker' . $position . '"' . ($last ? ' class="last"' : '') . '>' . "\n" . 
     268            '<a href="' . $url . '">' . "\n" . 
     269            '<img alt="" src="' . $image . '" />' . "\n" . 
     270            '<span>' . $label . '</span>' . "\n" . 
     271            '</a>' . "\n" . 
     272            '</li>' . "\n"; 
     273    } 
     274 
     275    public static function publicHeadContent($core) 
     276    { 
     277        echo 
     278        '<style type="text/css">' . "\n" . 
     279        '/* ' . __('Additionnal style directives') . ' */' . "\n" . 
     280        self::ductileStyleHelper() . 
     281            "</style>\n"; 
     282 
     283        echo 
     284        '<script type="text/javascript" src="' . 
     285        $core->blog->settings->system->themes_url . '/' . $core->blog->settings->system->theme . 
     286            '/ductile.js"></script>' . "\n"; 
     287 
     288        echo self::ductileWebfontHelper(); 
     289    } 
     290 
     291    public static function ductileWebfontHelper() 
     292    { 
     293        $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme . '_style'); 
     294 
     295        if ($s === null) { 
     296            return; 
     297        } 
     298 
     299        $s = @unserialize($s); 
     300        if (!is_array($s)) { 
     301            return; 
     302        } 
     303 
     304        $ret = ''; 
     305        $css = array(); 
     306        $uri = array(); 
     307        if (!isset($s['body_font']) || ($s['body_font'] == '')) { 
     308            // See if webfont defined for main font 
     309            if (isset($s['body_webfont_api']) && isset($s['body_webfont_family']) && isset($s['body_webfont_url'])) { 
     310                $uri[] = $s['body_webfont_url']; 
     311                switch ($s['body_webfont_api']) { 
     312                    case 'js': 
     313                        $ret .= sprintf('<script type="text/javascript" src="%s"></script>', $s['body_webfont_url']) . "\n"; 
     314                        break; 
     315                    case 'css': 
     316                        $ret .= sprintf('<link type="text/css" href="%s" rel="stylesheet" />', $s['body_webfont_url']) . "\n"; 
     317                        break; 
     318                } 
     319                # Main font 
     320                $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 
     321                \dcThemeConfig::prop($css, $selectors, 'font-family', $s['body_webfont_family']); 
     322            } 
     323        } 
     324        if (!isset($s['alternate_font']) || ($s['alternate_font'] == '')) { 
     325            // See if webfont defined for secondary font 
     326            if (isset($s['alternate_webfont_api']) && isset($s['alternate_webfont_family']) && isset($s['alternate_webfont_url'])) { 
     327                if (!in_array($s['alternate_webfont_url'], $uri)) { 
     328                    switch ($s['alternate_webfont_api']) { 
     329                        case 'js': 
     330                            $ret .= sprintf('<script type="text/javascript" src="%s"></script>', $s['alternate_webfont_url']) . "\n"; 
     331                            break; 
     332                        case 'css': 
     333                            $ret .= sprintf('<link type="text/css" href="%s" rel="stylesheet" />', $s['alternate_webfont_url']) . "\n"; 
     334                            break; 
     335                    } 
     336                } 
     337                # Secondary font 
     338                $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 
     339                \dcThemeConfig::prop($css, $selectors, 'font-family', $s['alternate_webfont_family']); 
     340            } 
     341        } 
     342        # Style directives 
     343        $res = ''; 
     344        foreach ($css as $selector => $values) { 
     345            $res .= $selector . " {\n"; 
     346            foreach ($values as $k => $v) { 
     347                $res .= $k . ':' . $v . ";\n"; 
     348            } 
     349            $res .= "}\n"; 
     350        } 
     351        if ($res != '') { 
     352            $ret .= '<style type="text/css">' . "\n" . $res . '</style>' . "\n"; 
     353        } 
     354 
     355        return $ret; 
     356    } 
     357 
     358    public static function ductileStyleHelper() 
     359    { 
     360        $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme . '_style'); 
     361 
     362        if ($s === null) { 
     363            return; 
     364        } 
     365 
     366        $s = @unserialize($s); 
     367        if (!is_array($s)) { 
     368            return; 
     369        } 
     370 
     371        $css = array(); 
     372 
     373        # Properties 
     374 
     375        # Blog description 
     376        $selectors = '#blogdesc'; 
     377        if (isset($s['subtitle_hidden'])) { 
     378            \dcThemeConfig::prop($css, $selectors, 'display', ($s['subtitle_hidden'] ? 'none' : null)); 
     379        } 
     380 
     381        # Main font 
     382        $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 
     383        if (isset($s['body_font'])) { 
     384            \dcThemeConfig::prop($css, $selectors, 'font-family', self::fontDef($s['body_font'])); 
     385        } 
     386 
     387        # Secondary font 
     388        $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 
     389        if (isset($s['alternate_font'])) { 
     390            \dcThemeConfig::prop($css, $selectors, 'font-family', self::fontDef($s['alternate_font'])); 
     391        } 
     392 
     393        # Inside posts links font weight 
     394        $selectors = '.post-excerpt a, .post-content a'; 
     395        if (isset($s['post_link_w'])) { 
     396            \dcThemeConfig::prop($css, $selectors, 'font-weight', ($s['post_link_w'] ? 'bold' : 'normal')); 
     397        } 
     398 
     399        # Inside posts links colors (normal, visited) 
     400        $selectors = '.post-excerpt a:link, .post-excerpt a:visited, .post-content a:link, .post-content a:visited'; 
     401        if (isset($s['post_link_v_c'])) { 
     402            \dcThemeConfig::prop($css, $selectors, 'color', $s['post_link_v_c']); 
     403        } 
     404 
     405        # Inside posts links colors (hover, active, focus) 
     406        $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'; 
     407        if (isset($s['post_link_f_c'])) { 
     408            \dcThemeConfig::prop($css, $selectors, 'color', $s['post_link_f_c']); 
     409        } 
     410 
     411        # Style directives 
     412        $res = ''; 
     413        foreach ($css as $selector => $values) { 
     414            $res .= $selector . " {\n"; 
     415            foreach ($values as $k => $v) { 
     416                $res .= $k . ':' . $v . ";\n"; 
     417            } 
     418            $res .= "}\n"; 
     419        } 
     420 
     421        # Large screens 
     422        $css_large = array(); 
     423 
     424        # Blog title font weight 
     425        $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     426        if (isset($s['blog_title_w'])) { 
     427            \dcThemeConfig::prop($css_large, $selectors, 'font-weight', ($s['blog_title_w'] ? 'bold' : 'normal')); 
     428        } 
     429 
     430        # Blog title font size 
     431        $selectors = 'h1'; 
     432        if (isset($s['blog_title_s'])) { 
     433            \dcThemeConfig::prop($css_large, $selectors, 'font-size', $s['blog_title_s']); 
     434        } 
     435 
     436        # Blog title color 
     437        $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     438        if (isset($s['blog_title_c'])) { 
     439            \dcThemeConfig::prop($css_large, $selectors, 'color', $s['blog_title_c']); 
     440        } 
     441 
     442        # Post title font weight 
     443        $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'; 
     444        if (isset($s['post_title_w'])) { 
     445            \dcThemeConfig::prop($css_large, $selectors, 'font-weight', ($s['post_title_w'] ? 'bold' : 'normal')); 
     446        } 
     447 
     448        # Post title font size 
     449        $selectors = 'h2.post-title'; 
     450        if (isset($s['post_title_s'])) { 
     451            \dcThemeConfig::prop($css_large, $selectors, 'font-size', $s['post_title_s']); 
     452        } 
     453 
     454        # Post title color 
     455        $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'; 
     456        if (isset($s['post_title_c'])) { 
     457            \dcThemeConfig::prop($css_large, $selectors, 'color', $s['post_title_c']); 
     458        } 
     459 
     460        # Simple title color (title without link) 
     461        $selectors = '#content-info h2, .post-title, .post h3, .post h4, .post h5, .post h6, .arch-block h3'; 
     462        if (isset($s['post_simple_title_c'])) { 
     463            \dcThemeConfig::prop($css_large, $selectors, 'color', $s['post_simple_title_c']); 
     464        } 
     465 
     466        # Style directives for large screens 
     467        if (count($css_large)) { 
     468            $res .= '@media only screen and (min-width: 481px) {' . "\n"; 
     469            foreach ($css_large as $selector => $values) { 
     470                $res .= $selector . " {\n"; 
     471                foreach ($values as $k => $v) { 
     472                    $res .= $k . ':' . $v . ";\n"; 
     473                } 
     474                $res .= "}\n"; 
     475            } 
     476            $res .= "}\n"; 
     477        } 
     478 
     479        # Small screens 
     480        $css_small = array(); 
     481 
     482        # Blog title font weight 
     483        $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     484        if (isset($s['blog_title_w_m'])) { 
     485            \dcThemeConfig::prop($css_small, $selectors, 'font-weight', ($s['blog_title_w_m'] ? 'bold' : 'normal')); 
     486        } 
     487 
     488        # Blog title font size 
     489        $selectors = 'h1'; 
     490        if (isset($s['blog_title_s_m'])) { 
     491            \dcThemeConfig::prop($css_small, $selectors, 'font-size', $s['blog_title_s_m']); 
     492        } 
     493 
     494        # Blog title color 
     495        $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     496        if (isset($s['blog_title_c_m'])) { 
     497            \dcThemeConfig::prop($css_small, $selectors, 'color', $s['blog_title_c_m']); 
     498        } 
     499 
     500        # Post title font weight 
     501        $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'; 
     502        if (isset($s['post_title_w_m'])) { 
     503            \dcThemeConfig::prop($css_small, $selectors, 'font-weight', ($s['post_title_w_m'] ? 'bold' : 'normal')); 
     504        } 
     505 
     506        # Post title font size 
     507        $selectors = 'h2.post-title'; 
     508        if (isset($s['post_title_s_m'])) { 
     509            \dcThemeConfig::prop($css_small, $selectors, 'font-size', $s['post_title_s_m']); 
     510        } 
     511 
     512        # Post title color 
     513        $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'; 
     514        if (isset($s['post_title_c_m'])) { 
     515            \dcThemeConfig::prop($css_small, $selectors, 'color', $s['post_title_c_m']); 
     516        } 
     517 
     518        # Style directives for small screens 
     519        if (count($css_small)) { 
     520            $res .= '@media only screen and (max-width: 480px) {' . "\n"; 
     521            foreach ($css_small as $selector => $values) { 
     522                $res .= $selector . " {\n"; 
     523                foreach ($values as $k => $v) { 
     524                    $res .= $k . ':' . $v . ";\n"; 
     525                } 
     526                $res .= "}\n"; 
     527            } 
     528            $res .= "}\n"; 
     529        } 
     530 
     531        return $res; 
     532    } 
     533 
     534    protected static $fonts = array( 
     535        // Theme standard 
     536        'Ductile body'      => '"Century Schoolbook", "Century Schoolbook L", Georgia, serif', 
     537        'Ductile alternate' => '"Franklin gothic medium", "arial narrow", "DejaVu Sans Condensed", "helvetica neue", helvetica, sans-serif', 
     538 
     539        // Serif families 
     540        'Times New Roman'   => 'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif', 
     541        'Georgia'           => 'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif', 
     542        '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', 
     543 
     544        // Sans-serif families 
     545        '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', 
     546        'Verdana'           => 'Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif', 
     547        'Trebuchet MS'      => '"Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif', 
     548 
     549        // Cursive families 
     550        'Impact'            => 'Impact, Haettenschweiler, "Franklin Gothic Bold", Charcoal, "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif', 
     551 
     552        // Monospace families 
     553        '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' 
     554    ); 
     555 
     556    protected static function fontDef($c) 
     557    { 
     558        return isset(self::$fonts[$c]) ? self::$fonts[$c] : null; 
     559    } 
    522560} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map