summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Petsovits2008-06-28 06:57:07 (GMT)
committer Jakob Petsovits2008-06-28 06:57:07 (GMT)
commit0da420f9109ed083ba060896a8d19113d2e9eb84 (patch)
tree1c43bfed60b92bbb271565c33d365eac8d66b636
parentb85662ff3c30ace80ab63440b168d2f214a80046 (diff)
Make Coder happy. Style fixes all over the place.
-rw-r--r--field_file.inc22
-rw-r--r--filefield.install19
-rw-r--r--filefield.module27
-rw-r--r--filefield_meta/filefield_meta.install4
-rw-r--r--filefield_meta/filefield_meta.module7
5 files changed, 41 insertions, 38 deletions
diff --git a/field_file.inc b/field_file.inc
index 3491198..7d8d834 100644
--- a/field_file.inc
+++ b/field_file.inc
@@ -1,5 +1,9 @@
<?php
// $Id$
+/**
+ * @file
+ * Common functionality for file handling CCK field modules.
+ */
/**
* Load a file object from the database.
@@ -34,7 +38,7 @@ function field_file_load($fid, $reset = NULL) {
return array();
}
- foreach(module_implements('file') as $module) {
+ foreach (module_implements('file') as $module) {
$function = $module .'_file';
$function('load', $file);
}
@@ -82,7 +86,7 @@ function field_file_save_upload($source, $validators = array(), $dest = FALSE, $
return 0;
}
// Let modules add additional properties to the yet barebone file object.
- foreach(module_implements('file') as $module) {
+ foreach (module_implements('file') as $module) {
$function = $module .'_file';
$function('insert', $file);
}
@@ -122,7 +126,7 @@ function field_file_save($node, &$file) {
}
// Let modules update their additional file properties too.
- foreach(module_implements('file') as $module) {
+ foreach (module_implements('file') as $module) {
$function = $module .'_file';
$function('update', $file);
}
@@ -134,11 +138,11 @@ function field_file_save($node, &$file) {
/**
* Delete a field file and its database record.
*
- * @param $path
+ * @param $path
* A file object.
* @param $force
* Force File Deletion ignoring reference counting.
- * @return mixed
+ * @return mixed
* TRUE for success, Array for reference count block, or FALSE in the event of an error.
*/
function field_file_delete($file, $force = FALSE) {
@@ -153,7 +157,7 @@ function field_file_delete($file, $force = FALSE) {
// Let other modules clean up on delete.
module_invoke_all('file', 'delete', $file, $field);
- // Make sure the file is deleted before removing its row from the
+ // Make sure the file is deleted before removing its row from the
// database, so UIs can still find the file in the database.
if (file_delete($file->filepath)) {
db_query('DELETE FROM {files} WHERE fid = %d', $file->fid);
@@ -253,9 +257,9 @@ function field_file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
*/
function field_file_strip_path($path) {
$dirpath = file_directory_path();
- $dirlen = strlen($dirpath);
- if (substr($path, 0, $dirlen + 1) == $dirpath .'/') {
- $path = substr($path, $dirlen + 1);
+ $dirlen = drupal_strlen($dirpath);
+ if (drupal_substr($path, 0, $dirlen + 1) == $dirpath .'/') {
+ $path = drupal_substr($path, $dirlen + 1);
}
return $path;
}
diff --git a/filefield.install b/filefield.install
index 223038c..8a7ae68 100644
--- a/filefield.install
+++ b/filefield.install
@@ -1,5 +1,12 @@
<?php
// $Id$
+/**
+ * @file
+ * FileField: Defines a CCK file field type.
+ *
+ * Uses content.module to store the fid and field specific metadata,
+ * and Drupal's {files} table to store the actual file data.
+ */
include_once(drupal_get_path('module', 'filefield') .'/field_file.inc');
@@ -11,22 +18,22 @@ function filefield_install() {
}
/**
-* Implementation of hook_uninstall().
-*/
+ * Implementation of hook_uninstall().
+ */
function filefield_uninstall() {
content_notify('uninstall', 'filefield');
}
/**
-* Implementation of hook_enable().
-*/
+ * Implementation of hook_enable().
+ */
function filefield_enable() {
content_notify('enable', 'filefield');
}
/**
-* Implementation of hook_disable().
-*/
+ * Implementation of hook_disable().
+ */
function filefield_disable() {
content_notify('disable', 'filefield');
}
diff --git a/filefield.module b/filefield.module
index 0f74bdf..ba26722 100644
--- a/filefield.module
+++ b/filefield.module
@@ -1,9 +1,8 @@
<?php
// $Id$
-
/**
* @file
- * Defines a file field type.
+ * FileField: Defines a CCK file field type.
*
* Uses content.module to store the fid and field specific metadata,
* and Drupal's {files} table to store the actual file data.
@@ -294,7 +293,7 @@ function filefield_widget_settings($op, $widget) {
switch ($op) {
case 'form':
$form = array();
- $form['file_extensions'] = array (
+ $form['file_extensions'] = array(
'#type' => 'textfield',
'#title' => t('Permitted upload file extensions'),
'#default_value' => is_string($widget['file_extensions']) ? $widget['file_extensions'] : 'txt',
@@ -435,7 +434,7 @@ function filefield_file_upload_process($element, $edit, &$form_state, $form) {
'!size' => format_size(file_upload_max_size()),
));
if (!empty($field['widget']['file_extensions'])) {
- $upload_description .= ' ' . t('Allowed extensions: %ext.', array(
+ $upload_description .= ' '. t('Allowed extensions: %ext.', array(
'%ext' => $field['widget']['file_extensions'],
));
}
@@ -965,9 +964,9 @@ function filefield_generic_edit_process($element, $edit, &$form_state, $form) {
);
$element['description'] = array(
'#type' => 'textfield',
- '#default_value' => (strlen($file->description))
- ? $file->description
- : $file->filename,
+ '#default_value' => empty($file->description)
+ ? $file->filename
+ : $file->description,
'#maxlength' => 256,
'#description' => t('Size: !size. Filename: !link', array(
'!size' => format_size($file->filesize),
@@ -987,18 +986,6 @@ function theme_filefield_generic_edit($element) {
return theme('form_element', $element, $element['#children']);
}
-/* @todo: do we still need those labels?
- kinda cumbersome with CCK controlling all of our multiple-value stuff.
-function _filefield_widget_form($node, $field, &$items) {
- $form[$field_name] = array(
- '#type' => 'fieldset',
- '#title' => t($field['widget']['label']),
- '#description' => t('Changes made to the attachments are not permanent until you save this post.'),
- );
- return $form;
-}
-*/
-
/**
* Implementation of hook_field_formatter_info().
@@ -1035,7 +1022,7 @@ function theme_filefield($field, $file) {
if (!filefield_view_access($field['field_name'])) {
return '';
}
- if($field['force_list']) {
+ if ($field['force_list']) {
$file['list'] = 1; // always show the files if that option is enabled
}
if (empty($file['list'])) {
diff --git a/filefield_meta/filefield_meta.install b/filefield_meta/filefield_meta.install
index 8d45e77..755cfb3 100644
--- a/filefield_meta/filefield_meta.install
+++ b/filefield_meta/filefield_meta.install
@@ -1,5 +1,9 @@
<?php
// $Id$
+/**
+ * @file
+ * FileField Meta: Add Video Support to File Field.
+ */
/**
* Implementation of hook_install().
diff --git a/filefield_meta/filefield_meta.module b/filefield_meta/filefield_meta.module
index 732e6c8..759ef72 100644
--- a/filefield_meta/filefield_meta.module
+++ b/filefield_meta/filefield_meta.module
@@ -1,7 +1,8 @@
-<?php // $Id$
-
+<?php
+// $Id$
/**
- * Add Video Support to File Field.
+ * @file
+ * FileField Meta: Add Video Support to File Field.
*/
/**