You are here

protected function AvailabilityCalendarsCssGenerator::writeCss in Availability Calendars 7.2

Same name and namespace in other branches
  1. 6.2 availability_calendars.styles.inc \AvailabilityCalendarsCssGenerator::writeCss()

Writes the created CSS to a file.

Parameters

string $css:

Return value

boolean Whether the generation was successful.

1 call to AvailabilityCalendarsCssGenerator::writeCss()
AvailabilityCalendarsCssGenerator::exec in ./availability_calendars.styles.inc
Creates and writes the CSS file for Availability Calendars.

File

./availability_calendars.styles.inc, line 506

Class

AvailabilityCalendarsCssGenerator

Code

protected function writeCss($css) {
  $result = false;
  $path = 'public://availability_calendars';
  if ($result = file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
    $file = $path . '/' . 'availability_calendars.css';
    if ($result = file_save_data($css, $file, FILE_EXISTS_REPLACE) !== FALSE) {

      // Set file permissions for webserver-generated files. I use 0666 as often,
      // the ftp account is not the webserver user nor in its group.
      drupal_chmod($file, 0666);
    }
  }
  return $result;
}