summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-03-13 17:25:34 +0100
committerJakob Sack <kde@jakobsack.de>2011-03-13 17:25:34 +0100
commita3070405d94621d01cc97ca10cc9cdf220e14064 (patch)
tree0dc39fc6e2a62cefaa954c92f5b7144ffc533872 /lib/helper.php
parent59847bb90161badcd17397a147bd0a9ddddcb376 (diff)
downloadnextcloud-server-a3070405d94621d01cc97ca10cc9cdf220e14064.tar.gz
nextcloud-server-a3070405d94621d01cc97ca10cc9cdf220e14064.zip
OC_HELPER, OC_LOG and OC_TEMPLATE prepared for refactoring
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php85
1 files changed, 43 insertions, 42 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 5999c33a458..a10697c3933 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -1,64 +1,62 @@
<?php
/**
-* ownCloud
-*
-* @author Frank Karlitschek
-* @copyright 2010 Frank Karlitschek karlitschek@kde.org
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @author Jakob Sack
+ * @copyright 2010 Frank Karlitschek karlitschek@kde.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
/**
- * Class for utility functions
- *
+ * Collection of useful functions
*/
class OC_HELPER {
/**
- * Create an url
+ * @brief Creates an url
+ * @param $app app
+ * @param $file file
+ * @returns the url
*
- * @param string $application
- * @param string $file
+ * Returns a url to the given app and file.
*/
- public static function linkTo( $application, $file = null ){
+ public static function linkTo( $app, $file ){
global $WEBROOT;
- if( is_null( $file )){
- $file = $application;
- $application = "";
- }
- return "$WEBROOT/$application/$file";
+ return "$WEBROOT/$app/$file";
}
/**
- * Create an image link
+ * @brief Creates path to an image
+ * @param $app app
+ * @param $image image name
+ * @returns the url
*
- * @param string $application
- * @param string $file
+ * Returns the path to the image.
*/
- public static function imagePath( $application, $file = null ){
+ public static function imagePath( $app, $image ){
global $WEBROOT;
- if( is_null( $file )){
- $file = $application;
- $application = "";
- }
- return "$WEBROOT/$application/img/$file";
+ return "$WEBROOT/$app/img/$image";
}
/**
- * show an icon for a filetype
+ * @brief get path to icon of mime type
+ * @param $mimetype mimetype
+ * @returns the url
*
+ * Returns the path to the image of this mime type.
*/
public static function mimetypeIcon( $mimetype ){
global $SERVERROOT;
@@ -81,8 +79,11 @@ class OC_HELPER {
}
/**
- * Human filesize (1 kB for 1024 etc. )
+ * @brief Make a human file size
+ * @param $bytes file size in bytes
+ * @returns a human readable file size
*
+ * Makes 2048 to 2 kB.
*/
public static function humanFileSize( $bytes ){
if( $bytes < 1024 ){