Commit 0da420f9 authored by Jakob Petsovits's avatar Jakob Petsovits

Make Coder happy. Style fixes all over the place.

parent b85662ff
<?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;
}
<?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');
}
......
<?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'])) {
......
<?php
// $Id$
/**
* @file
* FileField Meta: Add Video Support to File Field.
*/
/**
* Implementation of hook_install().
......
<?php // $Id$
<?php
// $Id$
/**
* Add Video Support to File Field.
* @file
* FileField Meta: Add Video Support to File Field.
*/
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment