fl_file_put_contents( $filename, $css ); } else { FLTheme::update_cached_css( 'editor', $css ); return $css; } // Save the new css key. update_option( $option_name, $new_key ); } /** * Clear any editor stylesheets in the cache directory * * @access public * @return void */ static public function clear_css_cache() { $dir_name = basename( FL_THEME_DIR ); $cache_dir = FLCustomizer::get_cache_dir(); if ( ! empty( $cache_dir['path'] ) && stristr( $cache_dir['path'], $dir_name ) ) { $css = glob( $cache_dir['path'] . self::slug() . '-*' ); foreach ( $css as $file ) { if ( is_file( $file ) ) { unlink( $file ); } } } } /** * Dump any existing editor stylesheets and recompile * * @access public * @return void */ static public function refresh_css() { self::clear_css_cache(); self::compile_css(); } /** * Enqueue the editor stylesheet * * @access public * @return void */ static public function enqueue_styles() { self::refresh_css(); $url = self::css_url(); if ( 'file' == FLTheme::get_asset_enqueue_method() ) { wp_enqueue_style( '1io-editor', $url, array(), FL_THEME_VERSION ); } else { wp_enqueue_style( 'bb-theme-style', get_stylesheet_uri() ); wp_add_inline_style( 'bb-theme-style', FLTheme::get_cached_css( 'editor' ) ); } } } FLWPEditor::init();