Beispiel #1
0
function roots_theme_options_validate($input)
{
    global $roots_css_frameworks;
    $output = $defaults = roots_get_default_theme_options();
    if (isset($input['css_framework']) && array_key_exists($input['css_framework'], $roots_css_frameworks)) {
        $output['css_framework'] = $input['css_framework'];
    }
    // set the value of the main container class depending on the selected grid framework
    $output['container_class'] = $roots_css_frameworks[$output['css_framework']]['classes']['container'];
    if (isset($input['main_class'])) {
        $output['main_class'] = wp_filter_nohtml_kses($input['main_class']);
    }
    if (isset($input['sidebar_class'])) {
        $output['sidebar_class'] = wp_filter_nohtml_kses($input['sidebar_class']);
    }
    if (isset($input['google_analytics_id'])) {
        if (preg_match('/^ua-\\d{4,9}-\\d{1,4}$/i', $input['google_analytics_id'])) {
            $output['google_analytics_id'] = $input['google_analytics_id'];
        }
    }
    if (isset($input['root_relative_urls'])) {
        if ($input['root_relative_urls'] === 'yes') {
            $input['root_relative_urls'] = true;
        }
        if ($input['root_relative_urls'] === 'no') {
            $input['root_relative_urls'] = false;
        }
        $output['root_relative_urls'] = $input['root_relative_urls'];
    }
    if (isset($input['clean_menu'])) {
        if ($input['clean_menu'] === 'yes') {
            $input['clean_menu'] = true;
        }
        if ($input['clean_menu'] === 'no') {
            $input['clean_menu'] = false;
        }
        $output['clean_menu'] = $input['clean_menu'];
    }
    if (isset($input['fout_b_gone'])) {
        if ($input['fout_b_gone'] === 'yes') {
            $input['fout_b_gone'] = true;
        }
        if ($input['fout_b_gone'] === 'no') {
            $input['fout_b_gone'] = false;
        }
        $output['fout_b_gone'] = $input['fout_b_gone'];
    }
    if (isset($input['bootstrap_javascript'])) {
        if ($input['bootstrap_javascript'] === 'yes') {
            $input['bootstrap_javascript'] = true;
        }
        if ($input['bootstrap_javascript'] === 'no') {
            $input['bootstrap_javascript'] = false;
        }
        $output['bootstrap_javascript'] = $input['bootstrap_javascript'];
    }
    if (isset($input['bootstrap_less_javascript'])) {
        if ($input['bootstrap_less_javascript'] === 'yes') {
            $input['bootstrap_less_javascript'] = true;
        }
        if ($input['bootstrap_less_javascript'] === 'no') {
            $input['bootstrap_less_javascript'] = false;
        }
        $output['bootstrap_less_javascript'] = $input['bootstrap_less_javascript'];
    }
    return apply_filters('roots_theme_options_validate', $output, $input, $defaults);
}
Beispiel #2
0
function roots_theme_options_validate($input)
{
    global $roots_months;
    global $roots_days;
    $output = $defaults = roots_get_default_theme_options();
    //OTHER STUFF
    if (isset($input['google_analytics_id'])) {
        if (preg_match('/^ua-\\d{4,9}-\\d{1,4}$/i', $input['google_analytics_id'])) {
            $output['google_analytics_id'] = $input['google_analytics_id'];
        }
    }
    if (isset($input['DAAS_video'])) {
        $output['DAAS_video'] = $input['DAAS_video'];
    }
    if (isset($input['root_relative_urls'])) {
        if ($input['root_relative_urls'] === 'yes') {
            $input['root_relative_urls'] = true;
        }
        if ($input['root_relative_urls'] === 'no') {
            $input['root_relative_urls'] = false;
        }
        $output['root_relative_urls'] = $input['root_relative_urls'];
    }
    /*
     * Restore Defaults.
     *
     * In the event that the user clicked the "Restore Defaults"
     * button, the options defined in the theme's options.php
     * file will be added to the option for the active theme.
     */
    if (isset($_POST['reset'])) {
        add_settings_error('options-framework', 'restore_defaults', __('Default options restored.', 'optionsframework'), 'updated fade');
        return roots_get_default_theme_options();
    }
    return apply_filters('roots_theme_options_validate', $output, $input, $defaults);
}
Beispiel #3
0
function roots_theme_options_validate($input)
{
    global $roots_css_frameworks;
    $output = $defaults = roots_get_default_theme_options();
    if (isset($input['css_framework']) && array_key_exists($input['css_framework'], $roots_css_frameworks)) {
        $output['css_framework'] = $input['css_framework'];
    }
    // set the value of the main container class depending on the selected grid framework
    $output['container_class'] = $roots_css_frameworks[$output['css_framework']]['classes']['container'];
    if (isset($input['main_class'])) {
        $output['main_class'] = $input['main_class'];
    }
    if (isset($input['sidebar_class'])) {
        $output['sidebar_class'] = $input['sidebar_class'];
    }
    if (isset($input['google_analytics_id'])) {
        $output['google_analytics_id'] = $input['google_analytics_id'];
    }
    if (isset($input['root_relative_urls'])) {
        $output['root_relative_urls'] = $input['root_relative_urls'] === 'yes' ? true : false;
    }
    if (isset($input['clean_menu'])) {
        $output['clean_menu'] = $input['clean_menu'] === 'yes' ? true : false;
    }
    if (isset($input['fout_b_gone'])) {
        $output['fout_b_gone'] = $input['fout_b_gone'] === 'yes' ? true : false;
    }
    return apply_filters('roots_theme_options_validate', $output, $input, $defaults);
}
Beispiel #4
0
function roots_theme_options_validate($input)
{
    $output = $defaults = roots_get_default_theme_options();
    if (isset($input['css_grid_framework']) && array_key_exists($input['css_grid_framework'], roots_grid_framework())) {
        $output['css_grid_framework'] = $input['css_grid_framework'];
    }
    if (isset($input['css_main_class'])) {
        $output['css_main_class'] = $input['css_main_class'];
    }
    if (isset($input['css_sidebar_class'])) {
        $output['css_sidebar_class'] = $input['css_sidebar_class'];
    }
    if (isset($input['google_analytics_id'])) {
        $output['google_analytics_id'] = $input['google_analytics_id'];
    }
    // Link color must be 3 or 6 hexadecimal characters
    //	if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) )
    //		$output['link_color'] = '#' . strtolower( ltrim( $input['link_color'], '#' ) );
    return apply_filters('roots_theme_options_validate', $output, $input, $defaults);
}