You are here

function _google_fonts_cache_css in Google Fonts 6.2

Create the CSS file and store it locally.

2 calls to _google_fonts_cache_css()
google_fonts_admin_settings_form_submit in ./google_fonts.admin.inc
Submit handler of the admin settings form Saves the fonts, CSS code and settings
_google_fonts_add_custom_css in ./google_fonts.module

File

./google_fonts.module, line 200
This module enables Google Fonts on your website.

Code

function _google_fonts_cache_css($file_contents, $reset = FALSE) {
  $directory = file_directory_path() . '/google_fonts';
  $file_destination = $directory . '/google_fonts.css';
  if (!file_exists($file_destination) || $reset) {

    // Check that the files directory is writable
    if (file_check_directory($directory, FILE_CREATE_DIRECTORY)) {
      cache_clear_all();
      return file_save_data($file_contents, $file_destination, FILE_EXISTS_REPLACE);
    }
  }
  else {
    return $file_destination;
  }
}