You are here

function _spamicide_set_css_file in Spamicide 5

Same name and namespace in other branches
  1. 6 spamicide.module \_spamicide_set_css_file()
  2. 7 spamicide.inc \_spamicide_set_css_file()
2 calls to _spamicide_set_css_file()
spamicide_admin_add_form_id_submit in ./spamicide.module
Implementation of hook_form_submit
spamicide_admin_form_submit in ./spamicide.module
Implementation of hook_form_submit

File

./spamicide.module, line 480
This module provides yet another tool to eliminate spam.

Code

function _spamicide_set_css_file($form_field) {
  $spam_path = file_directory_path() . "/spamicide";
  if (!file_check_directory($spam_path)) {
    mkdir($spam_path);
  }
  $css_file = $spam_path . '/' . $form_field . '.css';
  $path = file_create_path($css_file);
  if (!file_exists($path)) {

    // or !is_file or !file_exists or !file_check_location
    $css = "#edit-" . str_replace("_", "-", $form_field) . "-wrapper\n{\n  display: none;\n}\n";
    file_save_data($css, $css_file, FILE_EXISTS_REPLACE);
  }
}