Beispiel #1
0
function cuttz_scss_compile()
{
    if (!current_user_can('update_themes')) {
        return;
    }
    $scss = new scssc();
    $scss->setFormatter('scss_formatter');
    if (file_exists(CHILD_DIR . '/lib/stylesheet-core/style.scss')) {
        if (filemtime(CHILD_DIR . '/lib/stylesheet-core/style.scss') > filemtime(CHILD_DIR . '/style.css')) {
            $css = "@charset \"UTF-8\"; \n\n/*S********************************************************************************\n******************** Make all your changes to themes/cuttz/lib/stylesheet-core/style.scss **************************\n**** This file will be overwritten by style.scss and your changes will be lost ****\n**********************************************************************************/\n\n";
            $css = '';
            $css .= $scss->compile('@import "' . CHILD_DIR . '/lib/stylesheet-core/style.scss' . '"');
            file_put_contents(CHILD_DIR . '/style.css', $css);
            if (function_exists('w3tc_browsercache_flush')) {
                //check if W3Total cache is installed and active
                w3tc_browsercache_flush();
                //flush the w3tc browser cache to fetch the new css
            }
        }
    }
    if (file_exists(cuttz_current_skin_path() . '/style.scss')) {
        if (filemtime(cuttz_current_skin_path() . '/style.scss') > @filemtime(cuttz_current_skin_path() . '/autogenerated.css')) {
            $css = "@charset \"UTF-8\"; \n\n/*D*********************************************************************************\n******************** Make all your changes to style.scss **************************\n**** This file will be overwritten by style.scss and your changes will be lost ****\n**********************************************************************************/\n\n";
            $css .= $scss->compile('@import "' . cuttz_current_skin_path() . '/style.scss' . '"');
            file_put_contents(cuttz_current_skin_path() . '/autogenerated.css', $css);
            if (function_exists('w3tc_browsercache_flush')) {
                //check if W3Total cache is installed and active
                w3tc_browsercache_flush();
                //flush the w3tc browser cache to fetch the new css
            }
        }
    }
    $user_dir = cuttz_get_res('dir');
    if (file_exists($user_dir . 'style.scss')) {
        if (filemtime($user_dir . 'style.scss') > @filemtime($user_dir . 'autogenerated.css')) {
            $css = "@charset \"UTF-8\"; \n\n/*U********************************************************************************\n******************** Make all your changes to style.scss **************************\n**** This file will be overwritten by style.scss and your changes will be lost ****\n**********************************************************************************/\n\n";
            $css .= $scss->compile('@import "' . $user_dir . 'style.scss' . '"');
            file_put_contents($user_dir . 'autogenerated.css', $css);
            if (function_exists('w3tc_browsercache_flush')) {
                //check if W3Total cache is installed and active
                w3tc_browsercache_flush();
                //flush the w3tc browser cache to fetch the new css
            }
        }
    }
}
 /**
  * Flush browsers cache
  */
 function flush_browser_cache()
 {
     _doing_it_wrong('flush_browser_cache', 'This function is deprecated. Use w3tc_browsercache_flush() instead.', '0.9.3');
     w3tc_browsercache_flush();
 }
 function save($newsettings, $oldsettings)
 {
     $newsettings['cuttz-web-fonts'] = $this->cuttz_get_fonts_url($newsettings);
     cuttz_generate_css($newsettings);
     if (function_exists('w3tc_browsercache_flush')) {
         //check if W3Total cache is installed and active
         w3tc_browsercache_flush();
         //flush the w3tc browser cache to fetch the new settings.css
     }
     return $newsettings;
 }