Changeset 419:c22178d34030 for themes/ductile/_public.php
- Timestamp:
- 06/27/11 14:38:41 (14 years ago)
- Branch:
- themes
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_public.php
r394 r419 13 13 if (!defined('DC_RC_PATH')) { return; } 14 14 15 # Behaviors 15 16 $core->addBehavior('publicHeadContent',array('tplDuctileTheme','publicHeadContent')); 17 18 # Template items 19 $core->tpl->addValue('Stickers',array('tplDuctileTheme','showStickers')); 16 20 17 21 class tplDuctileTheme 18 22 { 23 public static function showStickers($attr) 24 { 25 $res = ''; 26 $default = false; 27 $img_url = $GLOBALS['core']->blog->settings->system->themes_url.'/'.$GLOBALS['core']->blog->settings->system->theme.'/img/'; 28 29 $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_stickers'); 30 31 if ($s === null) { 32 $default = true; 33 } else { 34 $s = @unserialize($s); 35 if (!is_array($s)) { 36 $default = true; 37 } else { 38 $s = array_filter($s,"self::cleanStickers"); 39 if (count($s) == 0) { 40 $default = true; 41 } else { 42 $count = 1; 43 foreach ($s as $sticker) { 44 $res .= self::setSticker($count,($count == count($s)),$sticker['label'],$sticker['url'],$img_url.$sticker['image']); 45 $count++; 46 } 47 } 48 } 49 } 50 51 if ($default || $res == '') { 52 $res = self::setSticker(1,true,__('Feed'),$GLOBALS['core']->blog->url.$GLOBALS['core']->url->getBase('feed').'/atom',$img_url.'sticker-feed.png'); 53 } 54 55 if ($res != '') { 56 $res = '<ul id="stickers">'."\n".$res.'</ul>'."\n"; 57 return $res; 58 } 59 } 60 61 protected static function cleanStickers($s) 62 { 63 if (is_array($s)) { 64 if (isset($s['label']) && isset($s['url']) && isset($s['image'])) { 65 if ($s['label'] != null && $s['url'] != null && $s['image'] != null) { 66 return true; 67 } 68 } 69 } 70 return false; 71 } 72 73 protected static function setSticker($position,$last,$label,$url,$image) 74 { 75 return '<li id="sticker'.$position.'"'.($last ? ' class="last"' : '').'>'."\n". 76 '<a href="'.$url.'">'."\n". 77 '<img alt="" src="'.$image.'" />'."\n". 78 '<span>'.$label.'</span>'."\n". 79 '</a>'."\n". 80 '</li>'."\n"; 81 } 82 19 83 public static function publicHeadContent($core) 20 84 {
Note: See TracChangeset
for help on using the changeset viewer.