public function run_compiler($scss_dir, $sass_vars, $sass_import_file, $css_name, $compile_method = 'scss_formatter_nested')
 {
     require_once WPCSC_PLUGIN_DIR . '/scssphp/scss.inc.php';
     $scss = new scssc();
     $scss->setImportPaths($scss_dir);
     $scss->setFormatter($compile_method);
     $scss->setVariables($sass_vars);
     $new_css = $scss->compile($sass_import_file);
     /* Write the CSS to the Database */
     $wpcscOptions = get_option('wpcsc1208_option_settings');
     /* Sanitze the CSS before going into the Database
        Refer to this doc, http://wptavern.com/wordpress-theme-review-team-sets-new-guidelines-for-custom-css-boxes */
     $wpcscOptions['wpcsc_content'][$css_name] = wp_kses($new_css, array('\'', '\\"'));
     update_option('wpcsc1208_option_settings', $wpcscOptions);
 }
     */
    $primarycolor = isset($_POST['customize_ajax_ref_color_styles']) ? $_POST['customize_ajax_ref_color_styles'] : get_theme_mod('primary_color', '#3CBEFE');
    // prove color
    if (!preg_match('/#([a-f0-9]{3}){1,2}\\b/i', $primarycolor)) {
        $primarycolor = '#3CBEFE';
    }
    /**
     * Theme CSS Active
     */
    $theme_css = isset($_POST['customize_ajax_ref_theme_styles']) ? intval($_POST['customize_ajax_ref_theme_styles']) : get_theme_mod('ref_theme_styles', 1);
    /**
     * Theme CSS Woo Active
     */
    $theme_css_woo = isset($_POST['customize_ajax_ref_wc_styles']) ? intval($_POST['customize_ajax_ref_wc_styles']) : get_theme_mod('ref_wc_styles', 1);
    $scss = new scssc();
    $scss->setVariables(array("primarycolor" => $primarycolor));
    $custom_css_theme = $custom_css_woo = '';
    $custom_css = $scss->compile('

						/********************************
						*   Color
						**********************************/
						a,
						.text-primary,
						.pagination > li > a, .pagination > li > span,
						.btn-primary .badge,
						.btn-link,
						.list-group-item.active > .badge, .nav-pills > .active > a > .badge,
						.panel-primary > .panel-heading .badge,
						.wpt-taxonomy-popular-show-hide, .wpt-repadd,
							{ color: $primarycolor; }
Ejemplo n.º 3
0
function compile_bootstrap_css()
{
    // Include the compiler class
    require_once TEMPLATEPATH . '/inc/scssphp/scss.inc.php';
    // Start new SCSS class
    $scss = new scssc();
    // Set the path where our SCSS files are located
    $scss->setImportPaths(TEMPLATEPATH . "/css/scss/");
    $scss->setFormatter('scss_formatter');
    // Get all colors from the customizer
    $cfColors = get_option('cf_colors');
    // Overwrite any SASS variable we want!
    $scss->setVariables($cfColors);
    // Run the compiler with the new variables
    $newCss = $scss->compile('
        @import "bootstrap.scss";
    ');
    //Find our current bootstrap file
    $cssFile = TEMPLATEPATH . '/css/bootstrap.min.css';
    $currentCss = file_get_contents($cssFile);
    // Overwrite default bootstrap css with the newly compiled CSS
    file_put_contents($cssFile, $newCss);
}