You are here

function local_fonts_fontyourface_delete in @font-your-face 6.2

Implements hook_fontyourface_delete(). Removes directory of deleted font.

File

modules/local_fonts/local_fonts.module, line 400

Code

function local_fonts_fontyourface_delete($font) {
  $metadata = unserialize($font->metadata);
  $directory = dirname($metadata['path']);

  // Delete all the files.
  $files = scandir($directory);
  foreach ($files as $file) {
    if ($file != '.' && $file != '..') {
      unlink($directory . '/' . $file);
    }

    // if
  }

  // foreach
  // Delete the directory.
  rmdir($directory);
  return TRUE;
}