]> git.mxchange.org Git - simple-upload.git/commitdiff
Function names should be like someFoo() as by a very common naming
authorRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2016 12:21:28 +0000 (14:21 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2016 12:21:28 +0000 (14:21 +0200)
convention, SomeFoo is for classes/interfaces and SOO_FOO for constants.

index.php

index c1606d151cff401a4d8751bf4e8e8ca52c1badc1..a75b12c07f1e663ac176f79277e1b19f7b4c8910 100644 (file)
--- a/index.php
+++ b/index.php
        }
 
        // Format file size
-       function FormatSize ($bytes) {
+       function formatSize ($bytes) {
                $units = array('B', 'KB', 'MB', 'GB', 'TB');
 
                $bytes = max($bytes, 0);
        }
 
        // Rotating a two-dimensional array
-       function DiverseArray ($vector) {
+       function diverseArray ($vector) {
                $result = array();
                foreach ($vector as $key1 => $value1)
                        foreach ($value1 as $key2 => $value2)
        }
 
        // Handling file upload
-       function UploadFile ($file_data) {
+       function uploadFile ($file_data) {
                global $settings;
                global $data;
                global $_SESSION;
        if (isset($_FILES['file'])) {
                header('Content-type: text/plain');
                if (is_array($_FILES['file'])) {
-                       $file_array = DiverseArray($_FILES['file']);
+                       $file_array = diverseArray($_FILES['file']);
                        foreach ($file_array as $file_data)
-                               UploadFile($file_data);
+                               uploadFile($file_data);
                } else
-                       UploadFile($_FILES['file']);
+                       uploadFile($_FILES['file']);
                exit;
        }
 
        }
 
        // List files in a given directory, excluding certain files
-       function ListFiles ($dir, $exclude) {
+       function listFiles ($dir, $exclude) {
                $file_array = array();
                $dh = opendir($dir);
                        while (false !== ($filename = readdir($dh)))
                return $file_array;
        }
 
-       $file_array = ListFiles($settings['uploaddir'], $data['ignores']);
+       $file_array = listFiles($settings['uploaddir'], $data['ignores']);
 
        // Removing old files
        foreach ($file_array as $file)
                if ($settings['time_limit'] < time() - filemtime($file))
                        unlink($file);
 
-       $file_array = ListFiles($settings['uploaddir'], $data['ignores']);
+       $file_array = listFiles($settings['uploaddir'], $data['ignores']);
 
 ?>
 <!DOCTYPE html>
                                                $file_private = $filename[0] === '.';
 
                                                if ($settings['listfiles_size'])
-                                                       $file_info[] = FormatSize(filesize($filename));
+                                                       $file_info[] = formatSize(filesize($filename));
 
                                                if ($settings['listfiles_size'])
                                                        $file_info[] = date($settings['listfiles_date_format'], $mtime);