Changeset 419:c22178d34030 for themes
- Timestamp:
- 06/27/11 14:38:41 (14 years ago)
- Branch:
- themes
- Location:
- themes/ductile
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_config.php
r395 r419 13 13 14 14 l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 15 16 $sticker_images = array( 17 __('Contact') => 'sticker-contact.png', 18 __('Feed') => 'sticker-feed.png', 19 __('About') => 'sticker-about.png' 20 ); 15 21 16 22 $fonts = array( … … 94 100 $ductile_user = array_merge($ductile_base,$ductile_user); 95 101 102 $ductile_stickers_base = array( 103 array('label' => null,'url' => null,'image' => null), 104 array('label' => null,'url' => null,'image' => null), 105 array('label' => null,'url' => null,'image' => null) 106 ); 107 108 $ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); 109 $ductile_stickers = @unserialize($ductile_stickers); 110 if (!is_array($ductile_stickers)) { 111 $ductile_stickers = array(); 112 } 113 114 $ductile_stickers = $ductile_stickers_base; 115 96 116 $conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; 97 117 … … 103 123 if ($conf_tab == 'html') { 104 124 $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']); 125 126 $count = 0; 127 if (!empty($_POST['sticker1_label']) && !empty($_POST['sticker1_url'])) { 128 $ductile_stickers[$count]['label'] = $_POST['sticker1_label']; 129 $ductile_stickers[$count]['url'] = $_POST['sticker1_url']; 130 $ductile_stickers[$count]['image'] = $_POST['sticker1_image']; 131 $count++; 132 } 133 if (!empty($_POST['sticker2_label']) && !empty($_POST['sticker2_url'])) { 134 $ductile_stickers[$count]['label'] = $_POST['sticker2_label']; 135 $ductile_stickers[$count]['url'] = $_POST['sticker2_url']; 136 $ductile_stickers[$count]['image'] = $_POST['sticker2_image']; 137 $count++; 138 } 139 if (!empty($_POST['sticker3_label']) && !empty($_POST['sticker3_url'])) { 140 $ductile_stickers[$count]['label'] = $_POST['sticker3_label']; 141 $ductile_stickers[$count]['url'] = $_POST['sticker3_url']; 142 $ductile_stickers[$count]['image'] = $_POST['sticker3_image']; 143 $count++; 144 } 145 for ($i = $count; $i < 3; $i++) { 146 $ductile_stickers[$i]['label'] = null; 147 $ductile_stickers[$i]['url'] = null; 148 $ductile_stickers[$i]['image'] = null; 149 } 105 150 } 106 151 … … 133 178 $core->blog->settings->addNamespace('themes'); 134 179 $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user)); 180 $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); 135 181 $core->blog->triggerBlog(); 136 182 … … 159 205 '</fieldset>'; 160 206 207 //echo '<fieldset><legend>'.__('Stickers').'</legend>'; 208 echo '<h3>'.__('Stickers').'</h3>'; 209 210 echo '<table id="stickerslist">'.'<caption>'.__('Stickers').'</caption>'. 211 '<thead>'. 212 '<tr>'. 213 '<th scope="col">'.__('Position').'</th>'. 214 '<th scope="col">'.__('Label').'</th>'. 215 '<th scope="col">'.__('URL').'</th>'. 216 '<th scope="col">'.__('Icon').'</th>'. 217 '</tr>'. 218 '</thead>'. 219 '<tbody>'. 220 '<tr>'. 221 '<td scope="raw">1</td>'. 222 '<td>'.form::field('sticker1_label',20,255,$ductile_stickers[0]['label']).'</td>'. 223 '<td>'.form::field('sticker1_url',40,255,$ductile_stickers[0]['url']).'</td>'. 224 '<td>'.form::combo('sticker1_image',$sticker_images,$ductile_stickers[0]['image']).'</td>'. 225 '</tr>'. 226 '<tr>'. 227 '<td scope="raw">2</td>'. 228 '<td>'.form::field('sticker2_label',20,255,$ductile_stickers[1]['label']).'</td>'. 229 '<td>'.form::field('sticker2_url',40,255,$ductile_stickers[1]['url']).'</td>'. 230 '<td>'.form::combo('sticker2_image',$sticker_images,$ductile_stickers[1]['image']).'</td>'. 231 '</tr>'. 232 '<tr>'. 233 '<td scope="raw">3</td>'. 234 '<td>'.form::field('sticker3_label',20,255,$ductile_stickers[2]['label']).'</td>'. 235 '<td>'.form::field('sticker3_url',40,255,$ductile_stickers[2]['url']).'</td>'. 236 '<td>'.form::combo('sticker3_image',$sticker_images,$ductile_stickers[2]['image']).'</td>'. 237 '</tr>'. 238 '</tbody>'. 239 '</table>'; 240 241 //echo '</fieldset>'; 242 161 243 echo '<input type="hidden" name="conf_tab" value="html">'; 162 244 echo '<p class="clear"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; -
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 { -
themes/ductile/tpl/_footer.html
r401 r419 5 5 --> 6 6 7 <!-- 7 8 <ul id="stickers"> 8 9 <li id="sticker1"><a href="{{tpl:BlogURL}}pages/Contact"><img src="{{tpl:BlogThemeURL}}/img/sticker-contact.png" alt="" /><span>Contact</span></a></li> … … 10 11 <li id="sticker3" class="last"><a href="{{tpl:BlogURL}}pages/About"><img src="{{tpl:BlogThemeURL}}/img/sticker-about.png" alt="" /><span>À propos</span></a></li> 11 12 </ul> 13 --> 14 {{tpl:Stickers}} 12 15 13 16 <p>{{tpl:SysPoweredBy}}</p> 14 17 </div> 15 18
Note: See TracChangeset
for help on using the changeset viewer.