Changeset 604:163de7c22e02 for themes/ductile
- Timestamp:
- 07/21/11 13:40:00 (14 years ago)
- Branch:
- themes
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_config.php
r601 r604 13 13 14 14 l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); 15 16 $img_url = $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/'; 17 $img_path = dirname(__FILE__).'/img/'; 15 18 16 19 $list_types = array( … … 108 111 ); 109 112 110 $ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style');111 $ductile_user = @unserialize($ductile_user);112 if (!is_array($ductile_user)) {113 $ductile_user = array();114 }115 116 $ductile_user = array_merge($ductile_base,$ductile_user);117 118 $ductile_stickers_base = array(119 array('label' => null,'url' => null,'image' => null),120 array('label' => null,'url' => null,'image' => null),121 array('label' => null,'url' => null,'image' => null)122 );123 124 $ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers');125 $ductile_stickers = @unserialize($ductile_stickers);126 if (!is_array($ductile_stickers)) {127 $ductile_stickers = $ductile_stickers_base;128 }129 130 113 $ductile_lists_base = array( 131 114 'default' => null, … … 137 120 ); 138 121 139 $ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists');140 $ductile_lists = @unserialize($ductile_lists);141 if (!is_array($ductile_lists)) {142 $ductile_lists = $ductile_lists_base;143 }144 145 122 $ductile_counts_base = array( 146 123 'default' => null, … … 149 126 'search' => null 150 127 ); 151 152 $ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts');153 $ductile_counts = @unserialize($ductile_counts);154 if (!is_array($ductile_counts)) {155 $ductile_counts = $ductile_counts_base;156 }157 158 128 159 129 $conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; … … 167 137 $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']); 168 138 169 $count = 0; 170 if (!empty($_POST['sticker1_label']) && !empty($_POST['sticker1_url'])) { 171 $ductile_stickers[$count]['label'] = $_POST['sticker1_label']; 172 $ductile_stickers[$count]['url'] = $_POST['sticker1_url']; 173 $ductile_stickers[$count]['image'] = $_POST['sticker1_image']; 174 $count++; 175 } 176 if (!empty($_POST['sticker2_label']) && !empty($_POST['sticker2_url'])) { 177 $ductile_stickers[$count]['label'] = $_POST['sticker2_label']; 178 $ductile_stickers[$count]['url'] = $_POST['sticker2_url']; 179 $ductile_stickers[$count]['image'] = $_POST['sticker2_image']; 180 $count++; 181 } 182 if (!empty($_POST['sticker3_label']) && !empty($_POST['sticker3_url'])) { 183 $ductile_stickers[$count]['label'] = $_POST['sticker3_label']; 184 $ductile_stickers[$count]['url'] = $_POST['sticker3_url']; 185 $ductile_stickers[$count]['image'] = $_POST['sticker3_image']; 186 $count++; 187 } 188 for ($i = $count; $i < 3; $i++) { 189 $ductile_stickers[$i]['label'] = null; 190 $ductile_stickers[$i]['url'] = null; 191 $ductile_stickers[$i]['image'] = null; 139 $ductile_stickers = array(); 140 for ($i = 0; $i < count($_POST['sticker_label']); $i++) { 141 if (!empty($_POST['sticker_label'][$i]) && !empty($_POST['sticker_url'][$i])) { 142 $ductile_stickers[] = array( 143 'label' => $_POST['sticker_label'][$i], 144 'url' => $_POST['sticker_url'][$i], 145 'image' => $_POST['sticker_image'][$i] 146 ); 147 } 192 148 } 193 149 … … 253 209 } 254 210 211 $ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style'); 212 $ductile_user = @unserialize($ductile_user); 213 if (!is_array($ductile_user)) { 214 $ductile_user = array(); 215 } 216 217 $ductile_user = array_merge($ductile_base,$ductile_user); 218 219 $ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); 220 $ductile_stickers = @unserialize($ductile_stickers); 221 $ductile_stickers_full = array(); 222 if (is_array($ductile_stickers)) { 223 foreach ($ductile_stickers as $k => $v) { 224 $ductile_stickers_full[$v['image']] = array('label' => $v['label'],'url' => $v['url']); 225 } 226 } 227 // Get all sticker-*.png in img folder of theme 228 $ductile_stickers_images = files::scandir($img_path); 229 if (is_array($ductile_stickers_images)) { 230 foreach ($ductile_stickers_images as $v) { 231 if (preg_match('/^sticker\-(.*)\.png$/',$v)) { 232 if (!array_key_exists($v,$ductile_stickers_full)) { 233 // image not used by a saved sticker 234 $ductile_stickers_full[$v] = array('label' => null,'url' => null); 235 } 236 } 237 } 238 } 239 240 $ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists'); 241 $ductile_lists = @unserialize($ductile_lists); 242 if (!is_array($ductile_lists)) { 243 $ductile_lists = $ductile_lists_base; 244 } 245 246 $ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts'); 247 $ductile_counts = @unserialize($ductile_counts); 248 if (!is_array($ductile_counts)) { 249 $ductile_counts = $ductile_counts_base; 250 } 251 255 252 // To be deleted when adminThemeConfigManaged behaviour will be implemented in admin/blog_themes.php : 256 253 echo '</form>'; … … 268 265 269 266 echo '<fieldset><legend>'.__('Stickers').'</legend>'; 270 271 $img_url = $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/';272 267 273 268 echo '<table id="stickerslist">'.'<caption>'.__('Stickers (footer)').'</caption>'. … … 275 270 '<tr>'. 276 271 '<th scope="col">'.__('Position').'</th>'. 272 '<th scope="col">'.__('Image').'</th>'. 277 273 '<th scope="col">'.__('Label').'</th>'. 278 274 '<th scope="col">'.__('URL').'</th>'. 279 '<th scope="col">'.__('Icon').'</th>'.280 '<th>'.'</th>'.281 275 '</tr>'. 282 276 '</thead>'. 283 '<tbody>'. 284 '<tr>'. 285 '<td scope="raw">1</td>'. 286 '<td>'.form::field('sticker1_label',20,255,$ductile_stickers[0]['label']).'</td>'. 287 '<td>'.form::field('sticker1_url',40,255,$ductile_stickers[0]['url']).'</td>'. 288 '<td>'.form::combo('sticker1_image',$sticker_images,$ductile_stickers[0]['image']).'</td>'. 289 '<td>'.'<img src="'.$img_url.$ductile_stickers[0]['image'].'" />'.'</td>'. 290 '</tr>'. 291 '<tr>'. 292 '<td scope="raw">2</td>'. 293 '<td>'.form::field('sticker2_label',20,255,$ductile_stickers[1]['label']).'</td>'. 294 '<td>'.form::field('sticker2_url',40,255,$ductile_stickers[1]['url']).'</td>'. 295 '<td>'.form::combo('sticker2_image',$sticker_images,$ductile_stickers[1]['image']).'</td>'. 296 '<td>'.'<img src="'.$img_url.$ductile_stickers[1]['image'].'" />'.'</td>'. 297 '</td>'. 298 '</tr>'. 299 '<tr>'. 300 '<td scope="raw">3</td>'. 301 '<td>'.form::field('sticker3_label',20,255,$ductile_stickers[2]['label']).'</td>'. 302 '<td>'.form::field('sticker3_url',40,255,$ductile_stickers[2]['url']).'</td>'. 303 '<td>'.form::combo('sticker3_image',$sticker_images,$ductile_stickers[2]['image']).'</td>'. 304 '<td>'.'<img src="'.$img_url.$ductile_stickers[2]['image'].'" />'.'</td>'. 305 '</td>'. 306 '</tr>'. 277 '<tbody>'; 278 $count = 1; 279 foreach ($ductile_stickers_full as $k => $v) { 280 echo 281 '<tr>'. 282 '<td>'.form::field(array('sticker_position[]'),2,3,$count++).'</td>'. 283 '<td>'.form::hidden(array('sticker_image[]'),$k).'<img src="'.$img_url.$k.'" /> '.'</td>'. 284 '<td scope="raw">'.form::field(array('sticker_label[]'),20,255,$v['label']).'</td>'. 285 '<td>'.form::field(array('sticker_url[]'),40,255,$v['url']).'</td>'. 286 '</tr>'; 287 } 288 echo 307 289 '</tbody>'. 308 290 '</table>';
Note: See TracChangeset
for help on using the changeset viewer.