You are here

protected function AvailabilityCalendarsCssGenerator::writeCss in Availability Calendars 6.2

Same name and namespace in other branches
  1. 7.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 489

Class

AvailabilityCalendarsCssGenerator

Code

protected function writeCss($css) {
  $result = false;
  $path = file_directory_path() . '/availability_calendars';
  if ($result = file_check_directory($path, FILE_CREATE_DIRECTORY)) {
    $file = $path . '/' . 'availability_calendars.css';
    if ($result = file_save_data($css, $file, FILE_EXISTS_REPLACE) === $file) {

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