Changeset 2772:df84ff8c6261
- Timestamp:
- 11/10/14 12:00:56 (11 years ago)
- Branch:
- default
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/default-templates/currywurst/_footer.html
r2670 r2772 2 2 3 3 <div class="footer" id="footer" role="contentinfo"> 4 <div class="widgets footer__widgets" id="blogcustom"> 5 <h2 class="blogcustom__title">{{tpl:lang Blog info}}</h2> 6 {{tpl:Widgets type="custom"}} 7 </div> <!-- End #custom widgets --> 4 <tpl:IfWidgets type="custom"> 5 <div class="widgets footer__widgets" id="blogcustom"> 6 <h2 class="blogcustom__title">{{tpl:lang Blog info}}</h2> 7 {{tpl:Widgets type="custom"}} 8 </div> <!-- End #custom widgets --> 9 </tpl:IfWidgets> 8 10 9 11 {{tpl:SysBehavior behavior="publicInsideFooter"}} -
inc/public/default-templates/currywurst/_sidebar.html
r2670 r2772 1 1 <div class="sidebar" id="sidebar" role="complementary"> 2 <div class="widgets blognav__widgets" id="blognav"> 3 <h2 class="blognav__title">{{tpl:lang Blog menu}}</h2> 4 {{tpl:Widgets type="nav"}} 5 </div> <!-- End #blognav --> 6 <div class="widgets blogextra__widgets" id="blogextra"> 7 <h2 class="blogextra__title">{{tpl:lang Extra menu}}</h2> 8 {{tpl:Widgets type="extra"}} 9 </div> <!-- End #blogextra --> 2 <tpl:IfWidgets type="nav"> 3 <div class="widgets blognav__widgets" id="blognav"> 4 <h2 class="blognav__title">{{tpl:lang Blog menu}}</h2> 5 {{tpl:Widgets type="nav"}} 6 </div> <!-- End #blognav --> 7 </tpl:IfWidgets> 8 <tpl:IfWidgets type="extra"> 9 <div class="widgets blogextra__widgets" id="blogextra"> 10 <h2 class="blogextra__title">{{tpl:lang Extra menu}}</h2> 11 {{tpl:Widgets type="extra"}} 12 </div> <!-- End #blogextra --> 13 </tpl:IfWidgets> 10 14 </div> -
plugins/widgets/_public.php
r2566 r2772 17 17 $core->tpl->addValue('Widgets',array('publicWidgets','tplWidgets')); 18 18 $core->tpl->addBlock('Widget',array('publicWidgets','tplWidget')); 19 $core->tpl->addBlock('IfWidgets',array('publicWidgets','tplIfWidgets')); 19 20 20 21 class publicWidgets … … 66 67 echo $w->call($k); 67 68 } 69 } 70 71 public static function tplIfWidgets($attr,$content) 72 { 73 $type = isset($attr['type']) ? $attr['type'] : ''; 74 75 # widgets to disable 76 $disable = isset($attr['disable']) ? trim($attr['disable']) : ''; 77 78 if ($type == '') { 79 $res = "publicWidgets::ifWidgetsHandler('nav','".addslashes($disable)."') &&"."\n". 80 " publicWidgets::ifWidgetsHandler('extra','".addslashes($disable)."') &&"."\n". 81 " publicWidgets::ifWidgetsHandler('custom','".addslashes($disable)."')"."\n"; 82 } else { 83 if (!in_array($type, array('nav','extra','custom'))) { 84 $type = 'nav'; 85 } 86 $res = "publicWidgets::ifWidgetsHandler('".addslashes($type)."','".addslashes($disable)."')"; 87 } 88 return '<?php if('.$res.') : ?>'.$content.'<?php endif; ?>'; 89 } 90 91 public static function ifWidgetsHandler($type,$disable='') 92 { 93 $wtype = 'widgets_'.$type; 94 $GLOBALS['core']->blog->settings->addNameSpace('widgets'); 95 $widgets = $GLOBALS['core']->blog->settings->widgets->{$wtype}; 96 97 if (!$widgets) { // If widgets value is empty, get defaults 98 $widgets = self::defaultWidgets($type); 99 } else { // Otherwise, load widgets 100 $widgets = dcWidgets::load($widgets); 101 } 102 103 return (!$widgets->isEmpty()); 68 104 } 69 105
Note: See TracChangeset
for help on using the changeset viewer.