Skip to content

Commit

Permalink
cleanup formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
30equals committed Oct 10, 2011
1 parent 90d6f0d commit b066e77
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions pclzip_d7.module
Expand Up @@ -14,18 +14,18 @@ function pclzip_d7_help($path, $arg) {
}

/**
* Implementation of hook_menu
* Implements hook_menu().
*/
function pclzip_d7_menu() {
$items = array();

$items['admin/settings/pclzip'] = array(
'title' => 'Pclzip',
'description' => 'Settings for the pclzip module.',
'page callback' => 'drupal_get_form',
'page arguments' => array('pclzip_d7_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'title' => 'Pclzip',
'description' => 'Settings for the pclzip module.',
'page callback' => 'drupal_get_form',
'page arguments' => array('pclzip_d7_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
);

return $items;
Expand All @@ -39,52 +39,52 @@ function pclzip_d7_settings() {
//drupal_set_message(t('Library is installed'));
$form = array();

// get field names
$form['pclzip_fields_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Available fields'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['pclzip_fields_fieldset']['pclzip_available_fields'] = array(
'#type' => 'textfield',
'#title' => t('Available fields.'),
'#default_value' => variable_get('pclzip_field_types', "'image','file'"),
'#description' => t("Enter the fields to use with pclzip sub modules. Separate with a comma, use ' or \" and remove white spaces. Default value is : <strong>'image','file'</strong>"),
);
// get field names
$form['pclzip_fields_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Available fields'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['pclzip_fields_fieldset']['pclzip_available_fields'] = array(
'#type' => 'textfield',
'#title' => t('Available fields.'),
'#default_value' => variable_get('pclzip_field_types', "'image','file'"),
'#description' => t("Enter the fields to use with pclzip sub modules. Separate with a comma, use ' or \" and remove white spaces. Default value is : <strong>'image','file'</strong>"),
);
}
if (count($form)) {
return system_settings_form($form);
}
if (count($form)) {
return system_settings_form($form);
}
}

/**
* Check if the library exists
* Check if the library exists.
*/
function pclzip_library_exists() {
$pclzip_path = drupal_get_path('module', 'pclzip_d7') . '/pclzip/pclzip.lib.php';
if (!is_file($pclzip_path)) {
drupal_set_message(t("Could not find the PclZip library file : @pclzip_path", array('@pclzip_path' => $pclzip_path)), 'error');
drupal_set_message(t('Could not find the PclZip library file : @pclzip_path', array('@pclzip_path' => $pclzip_path)), 'error');
return FALSE;
}
return TRUE;
}

/*
* Get extra fields form
* Get extra fields form.
*/
function pclzip_get_fields() {
// get the fields names
$fields_names = array();
$result = db_query("SELECT field_name FROM {field_config} WHERE type IN (" . variable_get('pclzip_field_types', "'image','file'") . ")");
$result = db_query("SELECT field_name FROM {field_config} WHERE type IN (:files)",array(':files' => variable_get('pclzip_field_types', "'image','file'")));
foreach ($result as $field) {
$fields_names[$field->field_name] = $field->field_name;
}
return $fields_names;
}

/*
* Build archive
* Build archive.
*/
function pclzip_build_archive($filename) {
// get the temp file
Expand All @@ -96,13 +96,13 @@ function pclzip_build_archive($filename) {
}

/**
* Send the file
* Send the file.
*/
function pclzip_send_file($filename) {
global $_pclzip_temp_file;
// send the file
header('Content-Type: application/zip') ;
header('Content-Disposition: inline; filename=' . $filename) ;
header('Content-Type: application/zip');
header('Content-Disposition: inline; filename=' . $filename);
header("Content-Transfer-Encoding: binary");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
Expand Down

0 comments on commit b066e77

Please sign in to comment.