Пример #1
0
function themify_config_init()
{
    /* 	Set Error Reporting
     ***************************************************************************/
    if (defined('WP_DEBUG') && WP_DEBUG) {
        error_reporting(E_ERROR | E_WARNING | E_PARSE);
    } else {
        error_reporting(E_ERROR);
    }
    /* 	Global Vars
     ***************************************************************************/
    global $themify_config, $pagenow, $ThemifyConfig, $themify_gfonts;
    /*	Activate Theme
     ***************************************************************************/
    if (isset($_GET['activated']) && 'themes.php' == $pagenow) {
        themify_maybe_unset_image_script();
        themify_maybe_clear_legacy();
        header('Location: ' . admin_url() . 'admin.php?page=themify&firsttime=true');
    }
    /* 	Theme Config
     ***************************************************************************/
    define('THEMIFY_VERSION', '1.6.4');
    /*	Load Config from theme-config.php or custom-config.php
     ***************************************************************************/
    $themify_config = $ThemifyConfig->get_config();
    /* 	Google Fonts
     ***************************************************************************/
    $themify_gfonts = themify_get_google_font_lists();
    /* 	Woocommerce
     ***************************************************************************/
    if (themify_is_woocommerce_active()) {
        add_theme_support('woocommerce');
    }
}
Пример #2
0
function themify_config_init()
{
    /* 	Global Vars
     ***************************************************************************/
    global $themify_config, $pagenow, $ThemifyConfig, $themify_gfonts;
    /*	Activate Theme
     ***************************************************************************/
    if (isset($_GET['activated']) && 'themes.php' == $pagenow) {
        themify_maybe_clear_legacy();
        add_action('init', 'themify_theme_first_run', 20);
    }
    /* 	Theme Config
     ***************************************************************************/
    define('THEMIFY_VERSION', '2.2.7');
    /*	Load Config from theme-config.php or custom-config.php
     ***************************************************************************/
    $themify_config = $ThemifyConfig->get_config();
    /* 	Google Fonts
     ***************************************************************************/
    $themify_gfonts = themify_get_google_font_lists();
    /* 	Run after update
     ***************************************************************************/
    if ('update_ok' === get_option('themify_update_ok_flag')) {
        /**
         * Fires after the updater finished the updating process.
         *
         * @since 1.8.3
         */
        do_action('themify_updater_post_install');
    }
    /* 	Woocommerce
     ***************************************************************************/
    if (themify_is_woocommerce_active()) {
        add_theme_support('woocommerce');
    }
    /**
     * Editor Style
     * @since 2.0.2
     */
    add_editor_style();
    /**
     * Do not add custom background
     * @since 2.0.2
     */
    if (false) {
        add_theme_support('custom-background');
        add_theme_support('custom-header');
    }
}
Пример #3
0
function themify_config_init()
{
    /* 	Set Error Reporting
     ***************************************************************************/
    if (defined('WP_DEBUG') && WP_DEBUG) {
        error_reporting(E_ERROR | E_WARNING | E_PARSE);
    } else {
        error_reporting(E_ERROR);
    }
    /* 	Global Vars
     ***************************************************************************/
    global $themify_config, $pagenow, $ThemifyConfig, $themify_gfonts;
    /*	Activate Theme
     ***************************************************************************/
    if (isset($_GET['activated']) && 'themes.php' == $pagenow) {
        themify_maybe_clear_legacy();
        add_action('init', 'themify_theme_first_run', 20);
    }
    /* 	Theme Config
     ***************************************************************************/
    define('THEMIFY_VERSION', '1.9.9');
    /*	Load Config from theme-config.php or custom-config.php
     ***************************************************************************/
    $themify_config = $ThemifyConfig->get_config();
    /* 	Google Fonts
     ***************************************************************************/
    $themify_gfonts = themify_get_google_font_lists();
    /* 	Run after update
     ***************************************************************************/
    if ('update_ok' === get_option('themify_update_ok_flag')) {
        /**
         * Fires after the updater finished the updating process.
         *
         * @since 1.8.3
         */
        do_action('themify_updater_post_install');
    }
    /* 	Woocommerce
     ***************************************************************************/
    if (themify_is_woocommerce_active()) {
        add_theme_support('woocommerce');
    }
}
Пример #4
0
 /**
  * Returns a list of Google Web Fonts
  * @return array
  * @since 1.5.6
  */
 function themify_get_google_web_fonts_list()
 {
     $google_fonts_list = array(array('value' => '', 'name' => ''), array('value' => '', 'name' => '--- ' . __('Google Fonts', 'themify') . ' ---'));
     foreach (wp_list_pluck(themify_get_google_font_lists(), 'family') as $font) {
         $google_fonts_list[] = array('value' => $font, 'name' => $font);
     }
     return apply_filters('themify_get_google_web_fonts_list', $google_fonts_list);
 }
    /**
     * Displays the controls to setup the font.
     *
     * @param object $values
     */
    function render_fonts($values)
    {
        // Font family
        $font_family = '';
        if (isset($values->family)) {
            $font_family = !empty($values->family->name) ? $values->family->name : '';
            $font_variant = !empty($values->family->variant) ? $values->family->variant : '';
        }
        // Font styles and decoration
        $font_weight = !empty($values->bold) ? $values->bold : '';
        $font_italic = !empty($values->italic) ? $values->italic : '';
        $font_underline = !empty($values->underline) ? $values->underline : '';
        $font_linethrough = !empty($values->linethrough) ? $values->linethrough : '';
        $font_nostyle = !empty($values->nostyle) ? $values->nostyle : '';
        // Text transform
        $text_transform = !empty($values->texttransform) ? $values->texttransform : '';
        $text_notransform = !empty($values->notexttransform) ? $values->notexttransform : '';
        // Text align
        $font_align = !empty($values->align) ? $values->align : '';
        $font_noalign = !empty($values->noalign) ? $values->noalign : '';
        // Font size
        $font_size_num = isset($values->sizenum) ? $values->sizenum : '';
        $font_size_unit = isset($values->sizeunit) ? $values->sizeunit : 'px';
        // Line height
        $font_line_num = isset($values->linenum) ? $values->linenum : '';
        $font_line_unit = isset($values->lineunit) ? $values->lineunit : 'px';
        $units = array('px', '%', 'em');
        ?>

		<!-- FONT SIZE -->
		<div class="themify-customizer-brick">
			<input type="text" class="font_size_num" value="<?php 
        echo empty($font_size_num) ? '' : $font_size_num;
        ?>
" />
			<div class="custom-select">
				<select class="font_size_unit">
					<?php 
        foreach ($units as $unit) {
            ?>
						<option value="<?php 
            echo $unit;
            ?>
" <?php 
            selected($unit, $font_size_unit);
            ?>
><?php 
            echo $unit;
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			</div>

			<!-- FONT FAMILY -->
			<div class="custom-select font-family-select">
				<select class="themify_font_family">
					<option value=""></option>
					<optgroup label="<?php 
        _e('Web Safe Fonts', 'themify');
        ?>
">
						<?php 
        $fonts = themify_get_web_safe_font_list();
        unset($fonts[0]);
        unset($fonts[1]);
        foreach ($fonts as $font) {
            $value = "'" . json_encode(array('name' => esc_attr($font['value']), 'variant' => 'normal,bold,italic,bold italic', 'fonttype' => 'websafe')) . "'";
            if ($font_family == $font['family']) {
                $font_variants = array('normal', 'bold', 'italic', 'bold italic');
            }
            echo '<option value=' . $value . ' ' . selected($font_family, $font['value'], false) . '>' . $font['name'] . '</option>';
        }
        ?>
					</optgroup>
					<optgroup label="<?php 
        _e('Google Fonts', 'themify');
        ?>
">
						<?php 
        if (!isset($GLOBALS['themify_customizer_gfonts']) || '' == $GLOBALS['themify_customizer_gfonts']) {
            $fonts = themify_get_google_font_lists();
            foreach ($fonts as $font) {
                $value = "'" . json_encode(array('name' => isset($font['family']) ? esc_attr($font['family']) : '', 'variant' => isset($font['variant']) ? $font['variant'] : '', 'subsets' => isset($font['subsets']) ? $font['subsets'] : '', 'fonttype' => 'google')) . "'";
                $GLOBALS['themify_customizer_gfonts'] .= '<option class="google_font" value=' . $value . ' ' . selected($font_family, $font['family'], false) . '>' . $font['family'] . '</option>';
            }
        }
        echo $GLOBALS['themify_customizer_gfonts'];
        ?>
					</optgroup>
				</select>
			</div>
		</div>

		<div class="themify-customizer-brick">
			<!-- LINE HEIGHT -->
			<input type="text" class="font_line_num" value="<?php 
        echo empty($font_line_num) ? '' : $font_size_num;
        ?>
" />
			<div class="custom-select">
				<select class="font_line_unit">
					<?php 
        foreach ($units as $unit) {
            ?>
						<option value="<?php 
            echo $unit;
            ?>
" <?php 
            selected($unit, $font_line_unit);
            ?>
><?php 
            echo $unit;
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			</div>
			<label><?php 
        _e('Line Height', 'themify');
        ?>
</label>
		</div>

		<div>
			<!-- FONT VARIANT -->
			<select class="themify_font_variant" style="display:none">
				<option value=""></option>
				<?php 
        foreach ($font_variants as $variant) {
            echo '<option value=' . $variant . ' ' . selected($variant, $font_variant, false) . '>' . $variant . '</option>';
        }
        ?>
			</select>
		</div>

		<!-- TEXT STYLE & DECORATION -->
		<div class="themify_font_style themify-customizer-brick">
			<button type="button" class="button <?php 
        echo $this->style_is($font_italic, 'italic');
        ?>
" data-style="italic"><?php 
        _e('i', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_weight, 'bold');
        ?>
" data-style="bold"><?php 
        _e('B', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_underline, 'underline');
        ?>
" data-style="underline"><?php 
        _e('U', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_linethrough, 'linethrough');
        ?>
" data-style="linethrough"><?php 
        _e('S', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_nostyle, 'nostyle');
        ?>
" data-style="nostyle"><?php 
        _e('&times;', 'themify');
        ?>
</button>
		</div>

		<!-- TEXT TRANSFORM -->
		<div class="themify_text_transform themify-customizer-brick">
			<button type="button" class="button <?php 
        echo $this->style_is($text_transform, 'uppercase');
        ?>
" data-texttransform="uppercase"><?php 
        _e('AA', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($text_transform, 'lowercase');
        ?>
" data-texttransform="lowercase"><?php 
        _e('ab', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($text_transform, 'capitalize');
        ?>
" data-texttransform="capitalize"><?php 
        _e('Ab', 'themify');
        ?>
</button>
			<button type="button" class="button <?php 
        echo $this->style_is($text_notransform, 'notexttransform');
        ?>
" data-texttransform="notexttransform"><?php 
        _e('&times;', 'themify');
        ?>
</button>
		</div>

		<!-- TEXT ALIGN -->
		<div class="themify_font_align themify-customizer-brick">
			<button type="button" class="button <?php 
        echo $this->style_is($font_align, 'left');
        ?>
" data-align="left"><span class="ti-align-left"></span></button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_align, 'center');
        ?>
" data-align="center"><span class="ti-align-center"></span></button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_align, 'right');
        ?>
" data-align="right"><span class="ti-align-right"></span></button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_align, 'justify');
        ?>
" data-align="justify"><span class="ti-align-justify"></span></button>
			<button type="button" class="button <?php 
        echo $this->style_is($font_noalign, 'noalign');
        ?>
" data-align="noalign"><?php 
        _e('&times;', 'themify');
        ?>
</button>
		</div>
	<?php 
    }