From 5d55c709dddad44984446efa49ceb7084fc16b3f Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sun, 6 May 2012 22:02:16 +0200 Subject: [PATCH] some more documentation cleanups. much more is needed. And greeting from the Atlanta airport. ;-) --- lib/public/config.php | 2 -- lib/public/db.php | 8 ++++---- lib/public/files.php | 29 ++++++++++---------------- lib/public/json.php | 45 +++++++++++++++++++++++------------------ lib/public/response.php | 24 +++++++++++----------- lib/public/user.php | 12 ++++++++--- lib/public/util.php | 37 +++++++++++++++++---------------- 7 files changed, 79 insertions(+), 78 deletions(-) diff --git a/lib/public/config.php b/lib/public/config.php index 5681f20e3b3..43d97d993b7 100644 --- a/lib/public/config.php +++ b/lib/public/config.php @@ -33,8 +33,6 @@ namespace OCP; class Config { - - /** * @brief Gets a value from config.php * @param $key key diff --git a/lib/public/db.php b/lib/public/db.php index b534756a5a0..7ba98e2851e 100644 --- a/lib/public/db.php +++ b/lib/public/db.php @@ -44,6 +44,7 @@ class DB { return(\OC_DB::prepare($query)); } + /** * @brief gets last value of autoincrement * @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix @@ -59,9 +60,8 @@ class DB { } - /** - * Start a transaction + * @brief Start a transaction */ public static function beginTransaction(){ return(\OC_DB::beginTransaction()); @@ -69,7 +69,7 @@ class DB { /** - * Commit the database changes done during a transaction that is in progress + * @brief Commit the database changes done during a transaction that is in progress */ public static function commit(){ return(\OC_DB::commit()); @@ -77,7 +77,7 @@ class DB { /** - * check if a result is an error, works with MDB2 and PDOException + * @brief check if a result is an error, works with MDB2 and PDOException * @param mixed $result * @return bool */ diff --git a/lib/public/files.php b/lib/public/files.php index f2153f33b90..e11ab81e16f 100644 --- a/lib/public/files.php +++ b/lib/public/files.php @@ -38,7 +38,7 @@ class Files { * @param string $dir path to the folder * */ - static function rmdirr($dir) { + static function rmdirr( $dir ) { \OC_Helper::rmdirr( $dir ); } @@ -49,18 +49,19 @@ class Files { * @return string * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead */ - static function getMimeType($path){ + static function getMimeType( $path ){ return(\OC_Helper::getMimeType( $path )); } + /** * copy the contents of one stream to another * @param resource source * @param resource target * @return int the number of bytes copied */ - public static function streamCopy($source,$target){ - return(\OC_Helper::streamCopy($source,$target)); + public static function streamCopy( $source, $target ){ + return(\OC_Helper::streamCopy( $source, $target )); } @@ -71,10 +72,11 @@ class Files { * * temporary files are automatically cleaned up after the script is finished */ - public static function tmpFile($postfix=''){ - return(\OC_Helper::tmpFile($postfix)); + public static function tmpFile( $postfix='' ){ + return(\OC_Helper::tmpFile( $postfix )); } + /** * create a temporary folder with an unique filename * @return string @@ -85,6 +87,7 @@ class Files { return(\OC_Helper::tmpFolder()); } + /** * Adds a suffix to the name in case the file exists * @@ -92,23 +95,13 @@ class Files { * @param $filename * @return string */ - public static function buildNotExistingFileName($path, $filename){ - return(\OC_Helper::buildNotExistingFileName($path, $filename)); + public static function buildNotExistingFileName( $path, $filename ){ + return(\OC_Helper::buildNotExistingFileName( $path, $filename )); } - - - - - - - - - - } ?> diff --git a/lib/public/json.php b/lib/public/json.php index 36d3bed807f..7fc6a0b01d4 100644 --- a/lib/public/json.php +++ b/lib/public/json.php @@ -33,57 +33,62 @@ namespace OCP; class JSON { - /** - * Encode and print $data in JSON format + * @brief Encode and print $data in JSON format + * @param array $data The data to use + * @param string $setContentType the optional content type */ - public static function encodedPrint($data,$setContentType=true){ - return(\OC_JSON::encodedPrint($data,$setContentType)); + public static function encodedPrint( $data, $setContentType=true ){ + return(\OC_JSON::encodedPrint( $data, $setContentType )); } + /** - * Check if the user is logged in, send json error msg if not + * @brief Check if the user is logged in, send json error msg if not */ public static function checkLoggedIn(){ return(\OC_JSON::checkLoggedIn()); } - /** - * Send json success msg + * @brief Send json success msg + * @param array $data The data to use */ - public static function success($data = array()){ - return(\OC_JSON::success($data)); + public static function success( $data = array() ){ + return(\OC_JSON::success( $data )); } /** - * Send json error msg + * @brief Send json error msg + * @param array $data The data to use */ - public static function error($data = array()){ - return(\OC_JSON::error($data)); + public static function error( $data = array() ){ + return(\OC_JSON::error( $data )); } /** - * set Content-Type header to jsonrequest + * @brief set Content-Type header to jsonrequest + * @param array $type The contwnt type header */ - public static function setContentTypeHeader($type='application/json'){ - return(\OC_JSON::setContentTypeHeader($type)); + public static function setContentTypeHeader( $type='application/json' ){ + return(\OC_JSON::setContentTypeHeader( $type )); } /** - * Check if the app is enabled, send json error msg if not - */ - public static function checkAppEnabled($app){ - return(\OC_JSON::checkAppEnabled($app)); + * @brief Check if the App is enabled and send JSON error message instead + * @param string $app The app to check + */ + public static function checkAppEnabled( $app ){ + return(\OC_JSON::checkAppEnabled( $app )); } /** - * Check if the user is a admin, send json error msg if not + * @brief Check if the user is a admin, send json error msg if not */ public static function checkAdminUser(){ return(\OC_JSON::checkAdminUser()); diff --git a/lib/public/response.php b/lib/public/response.php index 2efa74ef840..5049b0c54cf 100644 --- a/lib/public/response.php +++ b/lib/public/response.php @@ -40,8 +40,8 @@ class Response { * 0 and <0 enable default browser caching * null cache indefinitly */ - static public function enableCaching($cache_time = null) { - return(\OC_Response::enableCaching($cache_time)); + static public function enableCaching( $cache_time = null ) { + return(\OC_Response::enableCaching( $cache_time )); } @@ -50,8 +50,8 @@ class Response { * 'not modified' response * @param $lastModified time when the reponse was last modified */ - static public function setLastModifiedHeader($lastModified) { - return(\OC_Response::setLastModifiedHeader($lastModified)); + static public function setLastModifiedHeader( $lastModified ) { + return(\OC_Response::setLastModifiedHeader( $lastModified )); } @@ -69,8 +69,8 @@ class Response { * 'not modified' response * @param $etag token to use for modification check */ - static public function setETagHeader($etag) { - return(\OC_Response::setETagHeader($etag)); + static public function setETagHeader( $etag ) { + return(\OC_Response::setETagHeader( $etag )); } @@ -78,8 +78,8 @@ class Response { * @brief Send file as response, checking and setting caching headers * @param $filepath of file to send */ - static public function sendFile($filepath) { - return(\OC_Response::sendFile($filepath)); + static public function sendFile( $filepath ) { + return(\OC_Response::sendFile( $filepath )); } /** @@ -88,16 +88,16 @@ class Response { * string for DateInterval from now * DateTime object when to expire response */ - static public function setExpiresHeader($expires) { - return(\OC_Response::setExpiresHeader($expires)); + static public function setExpiresHeader( $expires ) { + return(\OC_Response::setExpiresHeader( $expires )); } /** * @brief Send redirect response * @param $location to redirect to */ - static public function redirect($location) { - return(\OC_Response::redirect($location)); + static public function redirect( $location ) { + return(\OC_Response::redirect( $location )); } diff --git a/lib/public/user.php b/lib/public/user.php index c9f01d4a597..53ff8d25fc5 100644 --- a/lib/public/user.php +++ b/lib/public/user.php @@ -63,15 +63,17 @@ class User { return \OC_USER::isLoggedIn(); } + /** * @brief check if a user exists * @param string $uid the username * @return boolean */ - public static function userExists($uid){ - return \OC_USER::userExists($uid); + public static function userExists( $uid ){ + return \OC_USER::userExists( $uid ); } + /** * @brief Loggs the user out including all the session data * @returns true @@ -82,6 +84,7 @@ class User { return \OC_USER::logout(); } + /** * @brief Check if the password is correct * @param $uid The username @@ -91,9 +94,10 @@ class User { * Check if the password is correct without logging in the user */ public static function checkPassword( $uid, $password ){ - return \OC_USER::checkPassword($uid, $password); + return \OC_USER::checkPassword( $uid, $password ); } + /** * Check if the user is a admin, redirects to home if not */ @@ -101,6 +105,7 @@ class User { \OC_Util::checkAdminUser(); } + /** * Check if the user is logged in, redirects to home if not. With * redirect URL parameter to the request URI. @@ -110,6 +115,7 @@ class User { } + } diff --git a/lib/public/util.php b/lib/public/util.php index f5b8e798bb4..4068d73370d 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -32,6 +32,7 @@ namespace OCP; class Util { + // consts for Logging const DEBUG=0; const INFO=1; @@ -39,8 +40,9 @@ class Util { const ERROR=3; const FATAL=4; + /** - * get the current installed version of ownCloud + * @brief get the current installed version of ownCloud * @return array */ public static function getVersion(){ @@ -49,8 +51,7 @@ class Util { /** - * send an email - * + * @brief send an email * @param string $toaddress * @param string $toname * @param string $subject @@ -59,41 +60,40 @@ class Util { * @param string $fromname * @param bool $html */ - public static function sendMail($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='') { + public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc='') { // call the internal mail class - \OC_MAIL::send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc=''); + \OC_MAIL::send( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc=''); } + /** - * write a message in the log - * + * @brief write a message in the log * @param string $app * @param string $message * @param int level */ - public static function writeLog($app, $message, $level) { + public static function writeLog( $app, $message, $level ) { // call the internal log class - \OC_LOG::write($app, $message, $level); + \OC_LOG::write( $app, $message, $level ); } /** - * add a css file - * + * @brief add a css file * @param url $url */ public static function addStyle( $application, $file = null ){ - \OC_Util::addStyle($application, $file); + \OC_Util::addStyle( $application, $file ); } + /** - * add a javascript file - * + * @brief add a javascript file * @param appid $application * @param filename $file */ public static function addScript( $application, $file = null ){ - \OC_Util::addScript($application, $file); + \OC_Util::addScript( $application, $file ); } /** @@ -103,17 +103,16 @@ class Util { * @param string $text the text content for the element */ public static function addHeader( $tag, $attributes, $text=''){ - \OC_Util::addHeader($tag, $attribute, $text); + \OC_Util::addHeader( $tag, $attribute, $text ); } /** - * formats a timestamp in the "right" way - * + * @brief formats a timestamp in the "right" way * @param int timestamp $timestamp * @param bool dateOnly option to ommit time from the result */ public static function formatDate( $timestamp,$dateOnly=false){ - return(\OC_Util::formatDate($timestamp,$dateOnly)); + return(\OC_Util::formatDate( $timestamp,$dateOnly )); } -- 2.39.5