public function implode_frontend_css($travis_test = false)
{
$do_implode = true;
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
$do_implode = false;
}
/**
* Allow CSS to be concatenated into a single jetpack.css file.
*
* @since 3.2.0
*
* @param bool $do_implode Should CSS be concatenated? Default to true.
*/
$do_implode = apply_filters('jetpack_implode_frontend_css', $do_implode);
// Do not use the imploded file when default behaviour was altered through the filter
if (!$do_implode) {
return;
}
// We do not want to use the imploded file in dev mode, or if not connected
if (Jetpack::is_development_mode() || !self::is_active()) {
if (!$travis_test) {
return;
}
}
// Do not use the imploded file if sharing css was dequeued via the sharing settings screen
if (get_option('sharedaddy_disable_resources')) {
return;
}
/*
* Now we assume Jetpack is connected and able to serve the single
* file.
*
* In the future there will be a check here to serve the file locally
* or potentially from the Jetpack CDN
*
* For now:
* - Enqueue a single imploded css file
* - Zero out the style_loader_tag for the bundled ones
* - Be happy, drink scotch
*/
add_filter('style_loader_tag', array($this, 'concat_remove_style_loader_tag'), 10, 2);
$version = Jetpack::is_development_version() ? filemtime(JETPACK__PLUGIN_DIR . 'css/jetpack.css') : JETPACK__VERSION;
wp_enqueue_style('jetpack_css', plugins_url('css/jetpack.css', __FILE__), array(), $version);
wp_style_add_data('jetpack_css', 'rtl', 'replace');
}