function cpn_save_file in Code per Node 6
Same name and namespace in other branches
- 7 cpn.module \cpn_save_file()
 
Saves CSS & JavaScript in the file system (but only if not empty).
4 calls to cpn_save_file()
- cpn_block_submit in ./
cpn.module  - Block submit callback.
 - cpn_nodeapi in ./
cpn.module  - Implementation of hook_nodeapi().
 - cpn_node_type_submit in ./
cpn.module  - Node type submit callback.
 - cpn_settings_submit in ./
cpn.admin.inc  - FormAPI submit callback for the CPN form.
 
File
- ./
cpn.module, line 427  - Primary hook implementations.
 
Code
function cpn_save_file($data, $filename) {
  if (!drupal_strlen(trim($data))) {
    return FALSE;
  }
  $path = file_create_path(variable_get('cpn_path', 'cpn'));
  if (empty($path)) {
    return FALSE;
  }
  file_check_directory($path, FILE_CREATE_DIRECTORY) or mkdir($path, 0755, TRUE);
  return file_save_data($data, $path . '/' . $filename, FILE_EXISTS_REPLACE);
}