'sticker-contact.png', __('Feed') => 'sticker-feed.png', __('About') => 'sticker-about.png' ); $fonts = array( __('default') => '', __('Ductile primary') => 'Ductile body', __('Ductile secondary') => 'Ductile alternate', __('Times New Roman') => 'Times New Roman', __('Georgia') => 'Georgia', __('Garamond') => 'Garamond', __('Helvetica/Arial') => 'Helvetica/Arial', __('Verdana') => 'Verdana', __('Trebuchet MS') => 'Trebuchet MS', __('Impact') => 'Impact', __('Monospace') => 'Monospace' ); function adjustFontSize($s) { if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$s,$m)) { if (empty($m[2])) { $m[2] = 'em'; } return $m[1].$m[2]; } return null; } function adjustColor($c) { if ($c === '') { return ''; } $c = strtoupper($c); if (preg_match('/^[A-F0-9]{3,6}$/',$c)) { $c = '#'.$c; } if (preg_match('/^#[A-F0-9]{6}$/',$c)) { return $c; } if (preg_match('/^#[A-F0-9]{3,}$/',$c)) { return '#'.substr($c,1,1).substr($c,1,1).substr($c,2,1).substr($c,2,1).substr($c,3,1).substr($c,3,1); } return ''; } $ductile_base = array( // HTML 'subtitle_hidden' => null, // CSS 'body_font' => null, 'alternate_font' => null, 'blog_title_w' => null, 'blog_title_s' => null, 'blog_title_c' => null, 'post_title_w' => null, 'post_title_s' => null, 'post_title_c' => null, 'post_link_w' => null, 'post_link_v_c' => null, 'post_link_f_c' => null, 'blog_title_w_m' => null, 'blog_title_s_m' => null, 'blog_title_c_m' => null, 'post_title_w_m' => null, 'post_title_s_m' => null, 'post_title_c_m' => null, 'post_simple_title_c' => null ); $ductile_user = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_style'); $ductile_user = @unserialize($ductile_user); if (!is_array($ductile_user)) { $ductile_user = array(); } $ductile_user = array_merge($ductile_base,$ductile_user); $ductile_stickers_base = array( array('label' => null,'url' => null,'image' => null), array('label' => null,'url' => null,'image' => null), array('label' => null,'url' => null,'image' => null) ); $ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); $ductile_stickers = @unserialize($ductile_stickers); if (!is_array($ductile_stickers)) { $ductile_stickers = $ductile_stickers_base; } $conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; if (!empty($_POST)) { try { # HTML if ($conf_tab == 'html') { $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']); $count = 0; if (!empty($_POST['sticker1_label']) && !empty($_POST['sticker1_url'])) { $ductile_stickers[$count]['label'] = $_POST['sticker1_label']; $ductile_stickers[$count]['url'] = $_POST['sticker1_url']; $ductile_stickers[$count]['image'] = $_POST['sticker1_image']; $count++; } if (!empty($_POST['sticker2_label']) && !empty($_POST['sticker2_url'])) { $ductile_stickers[$count]['label'] = $_POST['sticker2_label']; $ductile_stickers[$count]['url'] = $_POST['sticker2_url']; $ductile_stickers[$count]['image'] = $_POST['sticker2_image']; $count++; } if (!empty($_POST['sticker3_label']) && !empty($_POST['sticker3_url'])) { $ductile_stickers[$count]['label'] = $_POST['sticker3_label']; $ductile_stickers[$count]['url'] = $_POST['sticker3_url']; $ductile_stickers[$count]['image'] = $_POST['sticker3_image']; $count++; } for ($i = $count; $i < 3; $i++) { $ductile_stickers[$i]['label'] = null; $ductile_stickers[$i]['url'] = null; $ductile_stickers[$i]['image'] = null; } } # CSS if ($conf_tab == 'css') { $ductile_user['body_font'] = $_POST['body_font']; $ductile_user['alternate_font'] = $_POST['alternate_font']; $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']); $ductile_user['blog_title_s'] = adjustFontSize($_POST['blog_title_s']); $ductile_user['blog_title_c'] = adjustColor($_POST['blog_title_c']); $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']); $ductile_user['post_title_s'] = adjustFontSize($_POST['post_title_s']); $ductile_user['post_title_c'] = adjustColor($_POST['post_title_c']); $ductile_user['post_link_w'] = (integer) !empty($_POST['post_link_w']); $ductile_user['post_link_v_c'] = adjustColor($_POST['post_link_v_c']); $ductile_user['post_link_f_c'] = adjustColor($_POST['post_link_f_c']); $ductile_user['post_simple_title_c'] = adjustColor($_POST['post_simple_title_c']); $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']); $ductile_user['blog_title_s_m'] = adjustFontSize($_POST['blog_title_s_m']); $ductile_user['blog_title_c_m'] = adjustColor($_POST['blog_title_c_m']); $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']); $ductile_user['post_title_s_m'] = adjustFontSize($_POST['post_title_s_m']); $ductile_user['post_title_c_m'] = adjustColor($_POST['post_title_c_m']); } $core->blog->settings->addNamespace('themes'); $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user)); $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); $core->blog->triggerBlog(); echo '

'. __('Theme configuration upgraded.'). '

'; } catch (Exception $e) { $core->error->add($e->getMessage()); } } // To be deleted when adminThemeConfigManaged behaviour will be implemented in admin/blog_themes.php : echo ''; # HTML Tab echo '
'; echo '
'; echo '
'.__('Header').''. '

'.'

'. '
'; echo '
'.__('Stickers').''; echo ''.''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. '
'.__('Stickers (footer)').'
'.__('Position').''.__('Label').''.__('URL').''.__('Icon').'
1'.form::field('sticker1_label',20,255,$ductile_stickers[0]['label']).''.form::field('sticker1_url',40,255,$ductile_stickers[0]['url']).''.form::combo('sticker1_image',$sticker_images,$ductile_stickers[0]['image']).'
2'.form::field('sticker2_label',20,255,$ductile_stickers[1]['label']).''.form::field('sticker2_url',40,255,$ductile_stickers[1]['url']).''.form::combo('sticker2_image',$sticker_images,$ductile_stickers[1]['image']).'
3'.form::field('sticker3_label',20,255,$ductile_stickers[2]['label']).''.form::field('sticker3_url',40,255,$ductile_stickers[2]['url']).''.form::combo('sticker3_image',$sticker_images,$ductile_stickers[2]['image']).'
'; echo '
'; echo ''; echo '

'.$core->formNonce().'

'; echo '
'; echo '
'; // Close tab # CSS tab echo '
'; echo '
'; echo '

'.__('General settings').'

'; echo '
'.__('Fonts').''. '

'. '

'. '
'; echo '
'; echo '
'; echo '
'.__('Blog title').''. '

'.'

'. '

'. form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).'

'. '

'. form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').'

'. '
'; echo '
'; echo '
'; echo '
'.__('Post title').''. '

'.'

'. '

'. form::field('post_title_s',7,7,$ductile_user['post_title_s']).'

'. '

'. form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').'

'. '
'; echo '
'; echo '
'; echo '
'.__('Titles without link').''. '

'. form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').'

'. '
'; echo '
'.__('Inside posts links').''. '

'.'

'. '

'. form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').'

'. '

'. form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').'

'. '
'; echo '

'.__('Mobile specific settings').'

'; echo '
'; echo '
'; echo '
'.__('Blog title').''. '

'.'

'. '

'. form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).'

'. '

'. form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').'

'. '
'; echo '
'; echo '
'; echo '
'.__('Post title').''. '

'.'

'. '

'. form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).'

'. '

'. form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').'

'. '
'; echo '
'; echo '
'; echo ''; echo '

'.$core->formNonce().'

'; echo '
'; echo '
'; // Close tab // To be deleted when adminThemeConfigManaged behaviour will be implemented in admin/blog_themes.php : echo '
'; ?>