Example #1
0
function dt_theme_options_web_fonts_refresh_ajax()
{
    $nonce = !empty($_POST['nonce']) ? $_POST['nonce'] : '';
    $fonts_list = '';
    if (wp_verify_nonce($nonce, 'dt_webfonts_refresh')) {
        // clear fonts cache
        delete_transient('dt_admin_fonts_list');
        // get fresh fonts list or default one (if there is some errors)
        $fonts_list_raw = dt_get_google_fonts_list();
        // form new list options
        foreach ($fonts_list_raw as $value => $title) {
            $fonts_list .= '<option value="' . esc_attr($value) . '">' . esc_html($title) . '</option>';
        }
        $fonts_list = '<select>' . $fonts_list . '</select>';
        $errors = dt_get_google_fonts_errors();
    }
    ?>
<div id="fonts-list"><?php 
    echo $fonts_list;
    ?>
</div><div id="errors"><?php 
    echo $errors;
    ?>
</div><?php 
    // IMPORTANT: don't forget to "exit"
    exit;
}
Example #2
0
/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the "id" fields, make sure to use all lowercase and no spaces.
 *  
 */
function optionsframework_options()
{
    $fl_arr = array('repeat' => _x('repeat', 'backend options', LANGUAGE_ZONE), 'repeat-x' => _x('repeat-x', 'backend options', LANGUAGE_ZONE), 'repeat-y' => _x('repeat-y', 'backend options', LANGUAGE_ZONE), 'no-repeat' => _x('no-repeat', 'backend options', LANGUAGE_ZONE));
    $repeat_x_arr = array('no-repeat' => _x('no-repeat', 'backend options', LANGUAGE_ZONE), 'repeat-x' => _x('repeat-x', 'backend options', LANGUAGE_ZONE));
    $v_arr = array('center' => _x('center', 'backend options', LANGUAGE_ZONE), 'top' => _x('top', 'backend options', LANGUAGE_ZONE), 'bottom' => _x('bottom', 'backend options', LANGUAGE_ZONE));
    $h_arr = array('center' => _x('center', 'backend options', LANGUAGE_ZONE), 'left' => _x('left', 'backend options', LANGUAGE_ZONE), 'right' => _x('right', 'backend options', LANGUAGE_ZONE));
    $colour_arr = array('blue' => _x('blue', 'backend options', LANGUAGE_ZONE), 'green' => _x('green', 'backend options', LANGUAGE_ZONE), 'orange' => _x('orange', 'backend options', LANGUAGE_ZONE), 'purple' => _x('purple', 'backend options', LANGUAGE_ZONE), 'yellow' => _x('yellow', 'backend options', LANGUAGE_ZONE), 'pink' => _x('pink', 'backend options', LANGUAGE_ZONE), 'white' => _x('white', 'backend options', LANGUAGE_ZONE));
    $footer_arr = array('every' => _x('on every page', 'backend options', LANGUAGE_ZONE), 'home' => _x('front page only', 'backend options', LANGUAGE_ZONE), 'ex_home' => _x('everywhere except front page', 'backend options', LANGUAGE_ZONE), 'nowhere' => _x('nowhere', 'backend options', LANGUAGE_ZONE));
    $homepage_arr = array('every' => _x('everywhere', 'backend options', LANGUAGE_ZONE), 'home' => _x('only on homepage templates', 'backend options', LANGUAGE_ZONE), 'ex_home' => _x('everywhere except homepage templates', 'backend options', LANGUAGE_ZONE), 'nowhere' => _x('nowhere', 'backend options', LANGUAGE_ZONE));
    $image_hovers = array('slice' => _x('slice', 'backend options', LANGUAGE_ZONE), 'fade' => _x('fade', 'backend options', LANGUAGE_ZONE));
    $google_fonts = dt_get_google_fonts_list();
    $menu_and_buttons = array('none' => '/images/menu-and-buttons/default.jpg', 'red' => '/images/menu-and-buttons/red.jpg', 'blue' => '/images/menu-and-buttons/blue.jpg', 'green' => '/images/menu-and-buttons/green.jpg', 'beige' => '/images/menu-and-buttons/beige.jpg', 'purple' => '/images/menu-and-buttons/purple.jpg', 'gold' => '/images/menu-and-buttons/gold.jpg', 'orange' => '/images/menu-and-buttons/orange.jpg', 'pink' => '/images/menu-and-buttons/pink.jpg');
    $web_fonts = dt_get_websafe_fonts();
    static $options = array();
    if (!$options) {
        $dirname = dirname(__FILE__);
        $options_files = array('options-presets', 'options-branding', 'options-misc', 'options-menu', 'options-buttons', 'options-backgrounds', 'options-fonts', 'options-widgetareas', 'options-socials');
        foreach ($options_files as $filename) {
            include_once $dirname . "/{$filename}.php";
        }
        $options = apply_filters('optionsframework_options', $options);
    }
    return $options;
}
Example #3
0
// Divider
$divider_html = '<div class="divider"></div>';
$backgrounds_set_1 = dt_get_images_in('images/backgrounds/patterns', 'images/backgrounds', trailingslashit(get_template_directory()));
// here we get presets images
$presets_images = dt_get_images_in('inc/presets/images', 'inc/presets/images', trailingslashit(get_template_directory()));
$id_based_presets_images = array('backgrounds_bottom_bar_bg_image' => array(), 'backgrounds_footer_bg_image' => array(), 'backgrounds_general_bg_image' => array(), 'backgrounds_general_title_bg_image' => array(), 'backgrounds_general_boxed_bg_image' => array(), 'backgrounds_header_bg_image' => array(), 'backgrounds_header_transparent_bg_image' => array(), 'backgrounds_sidebar_bg_image' => array(), 'backgrounds_slideshow_bg_image' => array(), 'backgrounds_background_img' => array(), 'backgrounds_top_bar_bg_image' => array(), 'backgrounds_stripes_stripe_1_bg_image' => array(), 'backgrounds_stripes_stripe_2_bg_image' => array(), 'backgrounds_stripes_stripe_3_bg_image' => array());
// convert all
if ($presets_images) {
    foreach ($presets_images as $full => $thumb) {
        $img_field_id = explode('.', $full);
        // ignore
        if (count($img_field_id) < 3) {
            continue;
        }
        $img_field_id = $img_field_id[1];
        $clear_key = 'backgrounds_' . str_replace('-', '_', $img_field_id);
        if (!isset($id_based_presets_images[$clear_key])) {
            continue;
        }
        $id_based_presets_images[$clear_key][$full] = $thumb;
    }
}
// merge all
foreach ($id_based_presets_images as $field => $value) {
    $id_based_presets_images[$field] = array_merge($value, $backgrounds_set_1);
}
// extract all
extract($id_based_presets_images);
$google_fonts = dt_get_google_fonts_list();
$web_fonts = dt_stylesheet_get_websafe_fonts();
$merged_fonts = array_merge($web_fonts, $google_fonts);