Dotclear

Changeset 3531:f2de7e462b78


Ignore:
Timestamp:
02/17/17 19:31:34 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Using theme\<theme_name> namespace for _public.php and _prepend.php, in order to simplify theme copy and hack

Location:
themes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • themes/berlin/_define.php

    r3427 r3531  
    1515     /* Description*/         "Dotclear 2.7+ default theme", 
    1616     /* Author */             "Dotclear Team", 
    17      /* Version */            '1.1', 
     17     /* Version */            '1.2', 
    1818     /* Properties */         array( 
    1919                                        'type' => 'theme', 
  • themes/berlin/_public.php

    r3427 r3531  
    11<?php 
     2namespace themes\berlin; 
     3 
    24# -- BEGIN LICENSE BLOCK --------------------------------------- 
    35# This file is part of Berlin, a theme for Dotclear 
     
    1113if (!defined('DC_RC_PATH')) { return; } 
    1214 
    13 l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 
     15\l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 
    1416//__('Show menu').__('Hide menu').__('Navigation'); 
    1517 
    16 $core->addBehavior('publicHeadContent',array('behaviorBerlinTheme','publicHeadContent')); 
     18$core->addBehavior('publicHeadContent',array(__NAMESPACE__.'\behaviorBerlinTheme','publicHeadContent')); 
    1719 
    1820class behaviorBerlinTheme 
     
    2022     public static function publicHeadContent() 
    2123     { 
    22 //        global $core,$_ctx; 
    23  
    24           echo dcUtils::jsVars(array( 
     24          echo \dcUtils::jsVars(array( 
    2525               'dotclear_berlin_show_menu' => __('Show menu'), 
    2626               'dotclear_berlin_hide_menu' => __('Hide menu'), 
  • themes/customCSS/_define.php

    r2566 r3531  
    1616     /* Description*/         "A CSS customizable theme", 
    1717     /* Author */             "Olivier", 
    18      /* Version */            '1.1', 
     18     /* Version */            '1.2', 
    1919     array( 
    2020          'type'         =>        'theme' 
  • themes/customCSS/_public.php

    r2566 r3531  
    11<?php 
     2namespace themes\customcss; 
     3 
    24# -- BEGIN LICENSE BLOCK --------------------------------------- 
    35# 
     
    1214if (!defined('DC_RC_PATH')) { return; } 
    1315 
    14 $core->addBehavior('publicHeadContent',array('tplCustomTheme','publicHeadContent')); 
     16$core->addBehavior('publicHeadContent',array(__NAMESPACE__.'\tplCustomTheme','publicHeadContent')); 
    1517 
    1618class tplCustomTheme 
  • themes/ductile/_define.php

    r2581 r3531  
    1515     /* Description*/         "Mediaqueries compliant elegant theme", 
    1616     /* Author */             "Dotclear Team", 
    17      /* Version */            '1.4', 
     17     /* Version */            '1.5', 
    1818     /* Properties */         array( 
    1919                                        'standalone_config' => true, 
  • themes/ductile/_prepend.php

    r3421 r3531  
    11<?php 
     2namespace themes\ductile; 
     3 
    24# -- BEGIN LICENSE BLOCK --------------------------------------- 
    35# This file is part of Ductile, a theme for Dotclear 
     
    1719 
    1820# Behaviors 
    19 $GLOBALS['core']->addBehavior('adminPageHTMLHead',array('tplDuctileThemeAdmin','adminPageHTMLHead')); 
     21$GLOBALS['core']->addBehavior('adminPageHTMLHead',array(__NAMESPACE__.'\tplDuctileThemeAdmin','adminPageHTMLHead')); 
    2022 
    2123class tplDuctileThemeAdmin 
     
    3032          if (!$core->auth->user_prefs->accessibility->nodragdrop) { 
    3133               echo 
    32                     dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). 
    33                     dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'); 
     34                    \dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). 
     35                    \dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'); 
    3436                    echo <<<EOT 
    3537<script type="text/javascript"> 
  • themes/ductile/_public.php

    r2716 r3531  
    11<?php 
     2namespace themes\ductile; 
     3 
    24# -- BEGIN LICENSE BLOCK --------------------------------------- 
    35# This file is part of Ductile, a theme for Dotclear 
     
    1214if (!defined('DC_RC_PATH')) { return; } 
    1315 
    14 l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 
     16\l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 
    1517 
    1618# Behaviors 
    17 $core->addBehavior('publicHeadContent',array('tplDuctileTheme','publicHeadContent')); 
    18 $core->addBehavior('publicInsideFooter',array('tplDuctileTheme','publicInsideFooter')); 
     19$core->addBehavior('publicHeadContent',array(__NAMESPACE__.'\tplDuctileTheme','publicHeadContent')); 
     20$core->addBehavior('publicInsideFooter',array(__NAMESPACE__.'\tplDuctileTheme','publicInsideFooter')); 
    1921 
    2022# Templates 
    21 $core->tpl->addValue('ductileEntriesList',array('tplDuctileTheme','ductileEntriesList')); 
    22 $core->tpl->addBlock('EntryIfContentIsCut',array('tplDuctileTheme','EntryIfContentIsCut')); 
    23 $core->tpl->addValue('ductileNbEntryPerPage',array('tplDuctileTheme','ductileNbEntryPerPage')); 
    24 $core->tpl->addValue('ductileLogoSrc',array('tplDuctileTheme','ductileLogoSrc')); 
    25 $core->tpl->addBlock('IfPreviewIsNotMandatory',array('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')); 
    2628 
    2729class tplDuctileTheme 
     
    2931     public static function ductileNbEntryPerPage($attr) 
    3032     { 
    31           return '<?php tplDuctileTheme::ductileNbEntryPerPageHelper(); ?>'; 
     33          return '<?php '.__NAMESPACE__.'\tplDuctileTheme::ductileNbEntryPerPageHelper(); ?>'; 
    3234     } 
    3335 
     
    110112 
    111113          // Get all _entry-*.html in tpl folder of theme 
    112           $list_types_templates = files::scandir($tpl_path); 
     114          $list_types_templates = \files::scandir($tpl_path); 
    113115          if (is_array($list_types_templates)) { 
    114116               foreach ($list_types_templates as $v) { 
     
    126128          $default = isset($attr['default']) ? trim($attr['default']) : 'short'; 
    127129          $ret = '<?php '."\n". 
    128                'switch (tplDuctileTheme::ductileEntriesListHelper(\''.$default.'\')) {'."\n"; 
     130               'switch ('.__NAMESPACE__.'\tplDuctileTheme::ductileEntriesListHelper(\''.$default.'\')) {'."\n"; 
    129131 
    130132          foreach ($list_types as $v) { 
     
    159161     public static function ductileLogoSrc($attr) 
    160162     { 
    161           return '<?php echo tplDuctileTheme::ductileLogoSrcHelper(); ?>'; 
     163          return '<?php echo '.__NAMESPACE__.'\tplDuctileTheme::ductileLogoSrcHelper(); ?>'; 
    162164     } 
    163165 
     
    225227                    $default = true; 
    226228               } else { 
    227                     $s = array_filter($s,array('tplDuctileTheme', 'cleanStickers')); 
     229                    $s = array_filter($s,'self::cleanStickers'); 
    228230                    if (count($s) == 0) { 
    229231                         $default = true; 
     
    317319                    # Main font 
    318320                    $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 
    319                     dcThemeConfig::prop($css,$selectors,'font-family',$s['body_webfont_family']); 
     321                    \dcThemeConfig::prop($css,$selectors,'font-family',$s['body_webfont_family']); 
    320322               } 
    321323          } 
     
    335337                    # Secondary font 
    336338                    $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 
    337                     dcThemeConfig::prop($css,$selectors,'font-family',$s['alternate_webfont_family']); 
     339                    \dcThemeConfig::prop($css,$selectors,'font-family',$s['alternate_webfont_family']); 
    338340               } 
    339341          } 
     
    373375          # Blog description 
    374376          $selectors = '#blogdesc'; 
    375           if (isset($s['subtitle_hidden'])) dcThemeConfig::prop($css,$selectors,'display',($s['subtitle_hidden'] ? 'none' : null)); 
     377          if (isset($s['subtitle_hidden'])) \dcThemeConfig::prop($css,$selectors,'display',($s['subtitle_hidden'] ? 'none' : null)); 
    376378 
    377379          # Main font 
    378380          $selectors = 'body, .supranav li a span, #comments.me, a.comment-number'; 
    379           if (isset($s['body_font'])) dcThemeConfig::prop($css,$selectors,'font-family',self::fontDef($s['body_font'])); 
     381          if (isset($s['body_font'])) \dcThemeConfig::prop($css,$selectors,'font-family',self::fontDef($s['body_font'])); 
    380382 
    381383          # Secondary font 
    382384          $selectors = '#blogdesc, .supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer'; 
    383           if (isset($s['alternate_font'])) dcThemeConfig::prop($css,$selectors,'font-family',self::fontDef($s['alternate_font'])); 
     385          if (isset($s['alternate_font'])) \dcThemeConfig::prop($css,$selectors,'font-family',self::fontDef($s['alternate_font'])); 
    384386 
    385387          # Inside posts links font weight 
    386388          $selectors = '.post-excerpt a, .post-content a'; 
    387           if (isset($s['post_link_w'])) dcThemeConfig::prop($css,$selectors,'font-weight',($s['post_link_w'] ? 'bold' : 'normal')); 
     389          if (isset($s['post_link_w'])) \dcThemeConfig::prop($css,$selectors,'font-weight',($s['post_link_w'] ? 'bold' : 'normal')); 
    388390 
    389391          # Inside posts links colors (normal, visited) 
    390392          $selectors = '.post-excerpt a:link, .post-excerpt a:visited, .post-content a:link, .post-content a:visited'; 
    391           if (isset($s['post_link_v_c'])) dcThemeConfig::prop($css,$selectors,'color',$s['post_link_v_c']); 
     393          if (isset($s['post_link_v_c'])) \dcThemeConfig::prop($css,$selectors,'color',$s['post_link_v_c']); 
    392394 
    393395          # Inside posts links colors (hover, active, focus) 
    394396          $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'; 
    395           if (isset($s['post_link_f_c'])) dcThemeConfig::prop($css,$selectors,'color',$s['post_link_f_c']); 
     397          if (isset($s['post_link_f_c'])) \dcThemeConfig::prop($css,$selectors,'color',$s['post_link_f_c']); 
    396398 
    397399          # Style directives 
     
    410412          # Blog title font weight 
    411413          $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    412           if (isset($s['blog_title_w'])) dcThemeConfig::prop($css_large,$selectors,'font-weight',($s['blog_title_w'] ? 'bold' : 'normal')); 
     414          if (isset($s['blog_title_w'])) \dcThemeConfig::prop($css_large,$selectors,'font-weight',($s['blog_title_w'] ? 'bold' : 'normal')); 
    413415 
    414416          # Blog title font size 
    415417          $selectors = 'h1'; 
    416           if (isset($s['blog_title_s'])) dcThemeConfig::prop($css_large,$selectors,'font-size',$s['blog_title_s']); 
     418          if (isset($s['blog_title_s'])) \dcThemeConfig::prop($css_large,$selectors,'font-size',$s['blog_title_s']); 
    417419 
    418420          # Blog title color 
    419421          $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    420           if (isset($s['blog_title_c'])) dcThemeConfig::prop($css_large,$selectors,'color',$s['blog_title_c']); 
     422          if (isset($s['blog_title_c'])) \dcThemeConfig::prop($css_large,$selectors,'color',$s['blog_title_c']); 
    421423 
    422424          # Post title font weight 
    423425          $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'; 
    424           if (isset($s['post_title_w'])) dcThemeConfig::prop($css_large,$selectors,'font-weight',($s['post_title_w'] ? 'bold' : 'normal')); 
     426          if (isset($s['post_title_w'])) \dcThemeConfig::prop($css_large,$selectors,'font-weight',($s['post_title_w'] ? 'bold' : 'normal')); 
    425427 
    426428          # Post title font size 
    427429          $selectors = 'h2.post-title'; 
    428           if (isset($s['post_title_s'])) dcThemeConfig::prop($css_large,$selectors,'font-size',$s['post_title_s']); 
     430          if (isset($s['post_title_s'])) \dcThemeConfig::prop($css_large,$selectors,'font-size',$s['post_title_s']); 
    429431 
    430432          # Post title color 
    431433          $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'; 
    432           if (isset($s['post_title_c'])) dcThemeConfig::prop($css_large,$selectors,'color',$s['post_title_c']); 
     434          if (isset($s['post_title_c'])) \dcThemeConfig::prop($css_large,$selectors,'color',$s['post_title_c']); 
    433435 
    434436          # Simple title color (title without link) 
    435437          $selectors = '#content-info h2, .post-title, .post h3, .post h4, .post h5, .post h6, .arch-block h3'; 
    436           if (isset($s['post_simple_title_c'])) dcThemeConfig::prop($css_large,$selectors,'color',$s['post_simple_title_c']); 
     438          if (isset($s['post_simple_title_c'])) \dcThemeConfig::prop($css_large,$selectors,'color',$s['post_simple_title_c']); 
    437439 
    438440          # Style directives for large screens 
     
    454456          # Blog title font weight 
    455457          $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    456           if (isset($s['blog_title_w_m'])) dcThemeConfig::prop($css_small,$selectors,'font-weight',($s['blog_title_w_m'] ? 'bold' : 'normal')); 
     458          if (isset($s['blog_title_w_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-weight',($s['blog_title_w_m'] ? 'bold' : 'normal')); 
    457459 
    458460          # Blog title font size 
    459461          $selectors = 'h1'; 
    460           if (isset($s['blog_title_s_m'])) dcThemeConfig::prop($css_small,$selectors,'font-size',$s['blog_title_s_m']); 
     462          if (isset($s['blog_title_s_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-size',$s['blog_title_s_m']); 
    461463 
    462464          # Blog title color 
    463465          $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
    464           if (isset($s['blog_title_c_m'])) dcThemeConfig::prop($css_small,$selectors,'color',$s['blog_title_c_m']); 
     466          if (isset($s['blog_title_c_m'])) \dcThemeConfig::prop($css_small,$selectors,'color',$s['blog_title_c_m']); 
    465467 
    466468          # Post title font weight 
    467469          $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'; 
    468           if (isset($s['post_title_w_m'])) dcThemeConfig::prop($css_small,$selectors,'font-weight',($s['post_title_w_m'] ? 'bold' : 'normal')); 
     470          if (isset($s['post_title_w_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-weight',($s['post_title_w_m'] ? 'bold' : 'normal')); 
    469471 
    470472          # Post title font size 
    471473          $selectors = 'h2.post-title'; 
    472           if (isset($s['post_title_s_m'])) dcThemeConfig::prop($css_small,$selectors,'font-size',$s['post_title_s_m']); 
     474          if (isset($s['post_title_s_m'])) \dcThemeConfig::prop($css_small,$selectors,'font-size',$s['post_title_s_m']); 
    473475 
    474476          # Post title color 
    475477          $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'; 
    476           if (isset($s['post_title_c_m'])) dcThemeConfig::prop($css_small,$selectors,'color',$s['post_title_c_m']); 
     478          if (isset($s['post_title_c_m'])) \dcThemeConfig::prop($css_small,$selectors,'color',$s['post_title_c_m']); 
    477479 
    478480          # Style directives for small screens 
Note: See TracChangeset for help on using the changeset viewer.

Sites map