function font_head() { $options = (array) get_option('fonts'); $fonts = get_fonts(); $body_key = 'arial'; if (isset($options['body-font'])) { $body_key = $options['body-font']; } if (isset($fonts[$body_key])) { $body_font = $fonts[$body_key]; echo '<style>'; echo $body_font['font']; echo 'body { ' . $body_font['css'] . ' } '; echo '</style>'; } $h1_key = 'arial'; if (isset($options['h1-font'])) { $h1_key = $options['h1-font']; } if (isset($fonts[$h1_key])) { $h1_key = $fonts[$h1_key]; echo '<style>'; echo $h1_key['font']; echo 'h1 { ' . $h1_key['css'] . ' } '; echo '</style>'; } $h2_key = 'open-sans'; if (isset($options['h2-font'])) { $h2_key = $options['h2-font']; } if (isset($fonts[$h2_key])) { $h2_key = $fonts[$h2_key]; echo '<style>'; echo $h2_key['font']; echo 'h2 { ' . $h2_key['css'] . ' } '; echo '</style>'; } $h3_key = 'open-sans'; if (isset($options['h3-font'])) { $h3_key = $options['h3-font']; } if (isset($fonts[$h3_key])) { $h3_key = $fonts[$h3_key]; echo '<style>'; echo $h3_key['font']; echo 'h3 { ' . $h3_key['css'] . ' } '; echo '</style>'; } $h4_key = 'open-sans'; if (isset($options['h4-font'])) { $h4_key = $options['h4-font']; } if (isset($fonts[$h4_key])) { $h4_key = $fonts[$h4_key]; echo '<style>'; echo $h4_key['font']; echo 'h4 { ' . $h4_key['css'] . ' } '; echo '</style>'; } $h5_key = 'open-sans'; if (isset($options['h5-font'])) { $h5_key = $options['h5-font']; } if (isset($fonts[$h5_key])) { $h5_key = $fonts[$h5_key]; echo '<style>'; echo $h5_key['font']; echo 'h5 { ' . $h5_key['css'] . ' } '; echo '</style>'; } $h6_key = 'open-sans'; if (isset($options['h6-font'])) { $h6_key = $options['h6-font']; } if (isset($fonts[$h6_key])) { $h6_key = $fonts[$h6_key]; echo '<style>'; echo $h6_key['font']; echo 'h6 { ' . $h6_key['css'] . ' } '; echo '</style>'; } $p_key = 'open-sans'; if (isset($options['p-font'])) { $p_key = $options['p-font']; } if (isset($fonts[$p_key])) { $p_key = $fonts[$p_key]; echo '<style>'; echo $p_key['font']; echo 'p { ' . $p_key['css'] . ' } '; echo '</style>'; } }
function watermark() { need_login('page'); $fonts = get_fonts(); $this->output->set('fonts', $fonts); $watermark = $this->setting->get_conf('watermark'); $this->output->set('watermark', $watermark); //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('system_setting'), 'link' => site_link('setting')); $crumb_nav[] = array('name' => lang('watermark_setting')); $this->page_crumb($crumb_nav); $page_title = lang('watermark_setting') . ' - ' . lang('system_setting') . ' - ' . $this->setting->get_conf('site.title'); $page_keywords = $this->setting->get_conf('site.keywords'); $page_description = $this->setting->get_conf('site.description'); $this->page_init($page_title, $page_keywords, $page_description); $this->render(); }
function webfonts($custom_fontset, $is_ce) { // global post global $post; // output $font_output = ''; // weights array $weight_arr = array('light', 'light_italic', 'regular', 'regular_italic', 'semibold', 'semibold_italic', 'bold', 'bold_italic', 'custom_one', 'custom_one_italic'); // weights for default open sans $weight_arr_def = array('light' => '300', 'regular' => '400', 'semibold' => '600', 'bold' => '700', 'custom_one' => '800'); // classes array $classes = array(); // get css classes if ($is_ce) { $classes['ce'] = '.wysiwyg-ce h1, .wysiwyg-ce h2, .wysiwyg-ce h3, .wysiwyg-ce h4, .wysiwyg-ce h5, .wysiwyg-ce h6, #semplice h1, #semplice h2, #semplice h3, #semplice h4, #semplice h5, #semplice h6'; } else { // css classes $classes['standard'] = '.wysiwyg h1, .wysiwyg h2, .wysiwyg h3, .wysiwyg h4, .wysiwyg h5, .wysiwyg h6'; } if ($custom_fontset) { $post = $custom_fontset; setup_postdata($post); $type = get_field('type'); $font_output = ''; $embed_code = get_field('embed_code'); $search = array('/\\<link/'); $id = array('<link data-fontset-id="ce-fontset"'); $embed_code = preg_replace($search, $id, $embed_code); if ($type === 'service') { $font_output .= $embed_code; } else { $font_output .= '<style id="ce-fontset" type="text/css">'; $font_output .= get_field('css_code'); $font_output .= '</style>'; } // define the weight classes $font_output .= '<style id="ce-fontset" type="text/css">'; function get_fonts($weight, $is_body_font, $is_ce, $classes) { // font css $font_css = ''; $options = get_field($weight); // is the font name a double name like on clound.typography? if (strpos($options['font_name'], ',') !== false) { $font_name = explode(',', $options['font_name']); $font_name = '"' . $font_name['0'] . '", "' . $font_name['1'] . '"'; } else { $font_name = '"' . $options['font_name'] . '"'; } if ($options['font_name']) { if ($options['use_font_weight'] === 'yes') { $font_weight = 'font-weight: ' . preg_replace('/fw/', '', $options['font_weight']) . ';'; } else { $font_weight = 'font-weight: normal;'; } if (isset($options['font_style']) && $options['font_style'] === 'italic') { $font_style = 'font-style: italic;'; } else { $font_style = 'font-style: normal;'; } if ($options['category'] === 'sans-serif') { $category = 'Helvetica, Arial, sans-serif'; } else { $category = 'Georgia, Times New Roman, serif'; } if ($is_ce && is_admin()) { /* show only in content editor */ $ce_pre_body = '#semplice'; } else { $ce_pre_body = 'body, textarea, input'; } if ($is_body_font) { $font_css = $ce_pre_body . ' { font-family: ' . $font_name . ', ' . $category . ' !important; ' . $font_style . ' ' . $font_weight . '}'; $font_css .= '.' . $weight . ' { font-family: ' . $font_name . ', ' . $category . ' !important; ' . $font_style . ' ' . $font_weight . ' }'; } elseif ($is_ce && $weight === 'bold') { $font_css = '.' . $weight . ', ' . $classes['ce'] . ' { font-family: ' . $font_name . ', ' . $category . '; ' . $font_style . ' ' . $font_weight . ' }'; } elseif (!$is_ce && $weight === get_field('so_headings_font_weight', 'options')) { $font_css = '.' . $weight . ', ' . $classes['standard'] . ' { font-family: ' . $font_name . ', ' . $category . '; ' . $font_style . ' ' . $font_weight . ' }'; } else { $font_css = '.' . $weight . ' { font-family: ' . $font_name . ', ' . $category . ' !important; ' . $font_style . ' ' . $font_weight . ' }'; } } return $font_css; } // get fonts foreach ($weight_arr as $weight) { if ($weight === get_field('body_font')) { $font_output .= get_fonts($weight, true, $is_ce, $classes); } else { $font_output .= get_fonts($weight, false, $is_ce, $classes); } } // close custom fontset style $font_output .= '</style>'; wp_reset_postdata(); } else { // default open sans and playfair display $font_output .= '<link data-fontset-id="ce-fontset" href="http://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic,700,700italic" rel="stylesheet" type="text/css">'; $font_output .= '<link data-fontset-id="ce-fontset" href="http://fonts.googleapis.com/css?family=Libre+Baskerville:400,400italic" rel="stylesheet" type="text/css">'; $font_output .= '<style id="ce-fontset" type="text/css">'; $font_output .= '.light,.light_italic{font-family:"Open Sans", Arial, sans-serif;font-weight:300;}.regular,.regular_italic{font-family:"Open Sans", Arial, sans-serif;font-weight:400;}.semibold,.semibold_italic{font-family:"Open Sans", Arial, sans-serif;font-weight:600;}.bold,.bold_italic,strong,b{font-family:"Open Sans", Arial, sans-serif;font-weight:700;}.custom_one,.custom_one_italic{font-family:"Libre Baskerville", Georgia, serif;font-weight:400;}'; $font_output .= '.light_italic, .regular_italic, .semibold_italic, .bold_italic, .custom_one_italic {font-style:italic}'; // headings weight if ($is_ce) { $font_output .= $classes['ce'] . ' { font-weight: 700; }'; } elseif (!$is_ce && get_field('so_headings_font_weight', 'options')) { foreach ($weight_arr_def as $weight => $weight_css) { if ($weight === get_field('so_headings_font_weight', 'options')) { $font_output .= $classes['standard'] . ' { font-weight: ' . $weight_css . '; }'; } } } else { $font_output .= $classes['standard'] . ' { font-weight: 700; }'; } $font_output .= '</style>'; } echo $font_output; }