Merge pull request #5653 from owncloud/fix-api-documentation

fix documentation stuff
This commit is contained in:
Morris Jobke 2013-11-01 02:56:03 -07:00
commit f5b42c63d4
8 changed files with 413 additions and 417 deletions

View File

@ -44,7 +44,7 @@ use \OC\BackgroundJob\JobList;
*/ */
class BackgroundJob { class BackgroundJob {
/** /**
* @brief get the execution type of background jobs * get the execution type of background jobs
* @return string * @return string
* *
* This method returns the type how background jobs are executed. If the user * This method returns the type how background jobs are executed. If the user
@ -55,7 +55,7 @@ class BackgroundJob {
} }
/** /**
* @brief sets the background jobs execution type * sets the background jobs execution type
* @param string $type execution type * @param string $type execution type
* @return boolean * @return boolean
* *
@ -77,7 +77,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief creates a regular task * creates a regular task
* @param string $klass class name * @param string $klass class name
* @param string $method method name * @param string $method method name
* @return true * @return true
@ -89,7 +89,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief gets all regular tasks * gets all regular tasks
* @return associative array * @return associative array
* *
* key is string "$klass-$method", value is array( $klass, $method ) * key is string "$klass-$method", value is array( $klass, $method )
@ -109,7 +109,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief Gets one queued task * Gets one queued task
* @param int $id ID of the task * @param int $id ID of the task
* @return associative array * @return associative array
*/ */
@ -120,7 +120,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief Gets all queued tasks * Gets all queued tasks
* @return array with associative arrays * @return array with associative arrays
*/ */
public static function allQueuedTasks() { public static function allQueuedTasks() {
@ -139,7 +139,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief Gets all queued tasks of a specific app * Gets all queued tasks of a specific app
* @param string $app app name * @param string $app app name
* @return array with associative arrays * @return array with associative arrays
*/ */
@ -161,7 +161,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief queues a task * queues a task
* @param string $app app name * @param string $app app name
* @param string $class class name * @param string $class class name
* @param string $method method name * @param string $method method name
@ -175,7 +175,7 @@ class BackgroundJob {
/** /**
* @deprecated * @deprecated
* @brief deletes a queued task * deletes a queued task
* @param int $id id of task * @param int $id id of task
* @return bool * @return bool
* *

View File

@ -27,7 +27,7 @@
*/ */
/** /**
* @brief use OCP namespace for all classes that are considered public. * Use OCP namespace for all classes that are considered public.
* *
* Classes that use this namespace are for use by apps, and not for use by internal * Classes that use this namespace are for use by apps, and not for use by internal
* OC classes * OC classes

View File

@ -15,7 +15,7 @@ interface IPreview
{ {
/** /**
* @brief return a preview of a file * Return a preview of a file
* @param string $file The path to the file where you want a thumbnail from * @param string $file The path to the file where you want a thumbnail from
* @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
@ -26,7 +26,7 @@ interface IPreview
/** /**
* @brief returns true if the passed mime type is supported * Returns true if the passed mime type is supported
* @param string $mimeType * @param string $mimeType
* @return boolean * @return boolean
*/ */

View File

@ -22,7 +22,7 @@ interface IUserSession {
public function login($user, $password); public function login($user, $password);
/** /**
* @brief Logs the user out including all the session data * Logs the user out including all the session data
* Logout, destroys session * Logout, destroys session
*/ */
public function logout(); public function logout();

View File

@ -35,7 +35,7 @@ namespace OCP;
*/ */
class JSON { class JSON {
/** /**
* @brief Encode and print $data in JSON format * Encode and print $data in JSON format
* @param array $data The data to use * @param array $data The data to use
* @param string $setContentType the optional content type * @param string $setContentType the optional content type
* @return string json formatted string. * @return string json formatted string.
@ -123,7 +123,7 @@ class JSON {
} }
/** /**
* @brief set Content-Type header to jsonrequest * Set Content-Type header to jsonrequest
* @param array $type The contwnt type header * @param array $type The contwnt type header
* @return string json formatted string. * @return string json formatted string.
*/ */

View File

@ -1,24 +1,24 @@
<?php <?php
/** /**
* ownCloud * ownCloud
* *
* @author Frank Karlitschek * @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org * @copyright 2012 Frank Karlitschek frank@owncloud.org
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 3 of the License, or any later version. * version 3 of the License, or any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
* *
* You should have received a copy of the GNU Affero General Public * 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/>. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/** /**
* Public interface of ownCloud for apps to use. * Public interface of ownCloud for apps to use.

View File

@ -1,32 +1,32 @@
<?php <?php
/** /**
* ownCloud * ownCloud
* *
* @author Michael Gapczynski * @author Michael Gapczynski
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com * @copyright 2012 Michael Gapczynski mtgap@owncloud.com
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 3 of the License, or any later version. * version 3 of the License, or any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
* *
* You should have received a copy of the GNU Affero General Public * 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/>. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/ */
namespace OCP; namespace OCP;
/** /**
* This class provides the ability for apps to share their content between users. * This class provides the ability for apps to share their content between users.
* Apps must create a backend class that implements OCP\Share_Backend and register it with this class. * Apps must create a backend class that implements OCP\Share_Backend and register it with this class.
* *
* It provides the following hooks: * It provides the following hooks:
* - post_shared * - post_shared
*/ */
class Share { class Share {
const SHARE_TYPE_USER = 0; const SHARE_TYPE_USER = 0;
@ -108,6 +108,7 @@ class Share {
/** /**
* Prepare a path to be passed to DB as file_target * Prepare a path to be passed to DB as file_target
* @param string $path path
* @return string Prepared path * @return string Prepared path
*/ */
public static function prepFileTarget( $path ) { public static function prepFileTarget( $path ) {
@ -310,6 +311,8 @@ class Share {
* @param string Item type * @param string Item type
* @param string Item source * @param string Item source
* @param int Format (optional) Format type must be defined by the backend * @param int Format (optional) Format type must be defined by the backend
* @param mixed Parameters
* @param bool include collections
* @return Return depends on format * @return Return depends on format
*/ */
public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
@ -382,7 +385,9 @@ class Share {
* Get the shared items of item type owned by the current user * Get the shared items of item type owned by the current user
* @param string Item type * @param string Item type
* @param int Format (optional) Format type must be defined by the backend * @param int Format (optional) Format type must be defined by the backend
* @param mixed Parameters
* @param int Number of items to return (optional) Returns all by default * @param int Number of items to return (optional) Returns all by default
* @param bool include collections
* @return Return depends on format * @return Return depends on format
*/ */
public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null,
@ -396,6 +401,8 @@ class Share {
* @param string Item type * @param string Item type
* @param string Item source * @param string Item source
* @param int Format (optional) Format type must be defined by the backend * @param int Format (optional) Format type must be defined by the backend
* @param mixed Parameters
* @param bool include collections
* @return Return depends on format * @return Return depends on format
*/ */
public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
@ -683,7 +690,6 @@ class Share {
* @return Returns true on success or false on failure * @return Returns true on success or false on failure
* *
* Unsharing from self is not allowed for items inside collections * Unsharing from self is not allowed for items inside collections
*
*/ */
public static function unshareFromSelf($itemType, $itemTarget) { public static function unshareFromSelf($itemType, $itemTarget) {
if ($item = self::getItemSharedWith($itemType, $itemTarget)) { if ($item = self::getItemSharedWith($itemType, $itemTarget)) {
@ -733,8 +739,6 @@ class Share {
if($result === false) { if($result === false) {
\OC_Log::write('OCP\Share', 'Couldn\'t set send mail status', \OC_Log::ERROR); \OC_Log::write('OCP\Share', 'Couldn\'t set send mail status', \OC_Log::ERROR);
} }
} }
/** /**
@ -821,6 +825,13 @@ class Share {
throw new \Exception($message); throw new \Exception($message);
} }
/**
* Set expiration date for a share
* @param string $itemType
* @param string $itemSource
* @param string $date expiration date
* @return Share_Backend
*/
public static function setExpirationDate($itemType, $itemSource, $date) { public static function setExpirationDate($itemType, $itemSource, $date) {
if ($items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), if ($items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(),
self::FORMAT_NONE, null, -1, false)) { self::FORMAT_NONE, null, -1, false)) {
@ -875,7 +886,6 @@ class Share {
* @return Returns true if allowed or false * @return Returns true if allowed or false
* *
* Resharing is allowed by default if not configured * Resharing is allowed by default if not configured
*
*/ */
private static function isResharingAllowed() { private static function isResharingAllowed() {
if (!isset(self::$isResharingAllowed)) { if (!isset(self::$isResharingAllowed)) {
@ -1752,6 +1762,9 @@ class Share {
* Hook Listeners * Hook Listeners
*/ */
/**
* @param array arguments
*/
public static function post_deleteUser($arguments) { public static function post_deleteUser($arguments) {
// Delete any items shared with the deleted user // Delete any items shared with the deleted user
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share`' $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share`'
@ -1765,6 +1778,9 @@ class Share {
} }
} }
/**
* @param array arguments
*/
public static function post_addToGroup($arguments) { public static function post_addToGroup($arguments) {
// Find the group shares and check if the user needs a unique target // Find the group shares and check if the user needs a unique target
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?'); $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?');
@ -1795,6 +1811,9 @@ class Share {
} }
} }
/**
* @param array arguments
*/
public static function post_removeFromGroup($arguments) { public static function post_removeFromGroup($arguments) {
// TODO Don't call if user deleted? // TODO Don't call if user deleted?
$sql = 'SELECT `id`, `share_type` FROM `*PREFIX*share`' $sql = 'SELECT `id`, `share_type` FROM `*PREFIX*share`'
@ -1811,6 +1830,9 @@ class Share {
} }
} }
/**
* @param array arguments
*/
public static function post_deleteGroup($arguments) { public static function post_deleteGroup($arguments) {
$sql = 'SELECT `id` FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?'; $sql = 'SELECT `id` FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?';
$result = \OC_DB::executeAudited($sql, array(self::SHARE_TYPE_GROUP, $arguments['gid'])); $result = \OC_DB::executeAudited($sql, array(self::SHARE_TYPE_GROUP, $arguments['gid']));
@ -1822,8 +1844,8 @@ class Share {
} }
/** /**
* Interface that apps must implement to share content. * Interface that apps must implement to share content.
*/ */
interface Share_Backend { interface Share_Backend {
/** /**
@ -1877,9 +1899,9 @@ interface Share_Backend {
} }
/** /**
* Interface for share backends that share content that is dependent on files. * Interface for share backends that share content that is dependent on files.
* Extends the Share_Backend interface. * Extends the Share_Backend interface.
*/ */
interface Share_Backend_File_Dependent extends Share_Backend { interface Share_Backend_File_Dependent extends Share_Backend {
/** /**
@ -1890,9 +1912,9 @@ interface Share_Backend_File_Dependent extends Share_Backend {
} }
/** /**
* Interface for collections of of items implemented by another share backend. * Interface for collections of of items implemented by another share backend.
* Extends the Share_Backend interface. * Extends the Share_Backend interface.
*/ */
interface Share_Backend_Collection extends Share_Backend { interface Share_Backend_Collection extends Share_Backend {
/** /**

View File

@ -42,7 +42,7 @@ class Util {
const FATAL=4; const FATAL=4;
/** /**
* @brief get the current installed version of ownCloud * get the current installed version of ownCloud
* @return array * @return array
*/ */
public static function getVersion() { public static function getVersion() {
@ -50,7 +50,7 @@ class Util {
} }
/** /**
* @brief send an email * send an email
* @param string $toaddress * @param string $toaddress
* @param string $toname * @param string $toname
* @param string $subject * @param string $subject
@ -58,6 +58,10 @@ class Util {
* @param string $fromaddress * @param string $fromaddress
* @param string $fromname * @param string $fromname
* @param bool $html * @param bool $html
* @param string $altbody
* @param string $ccaddress
* @param string $ccname
* @param string $bcc
*/ */
public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname,
$html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') { $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') {
@ -67,7 +71,7 @@ class Util {
} }
/** /**
* @brief write a message in the log * write a message in the log
* @param string $app * @param string $app
* @param string $message * @param string $message
* @param int $level * @param int $level
@ -78,8 +82,9 @@ class Util {
} }
/** /**
* @brief write exception into the log. Include the stack trace * write exception into the log. Include the stack trace
* if DEBUG mode is enabled * if DEBUG mode is enabled
* @param string $app app name
* @param Exception $ex exception to log * @param Exception $ex exception to log
*/ */
public static function logException( $app, \Exception $ex ) { public static function logException( $app, \Exception $ex ) {
@ -111,8 +116,8 @@ class Util {
} }
/** /**
* @brief get l10n object * get l10n object
* @param string $app * @param string $application
* @return OC_L10N * @return OC_L10N
*/ */
public static function getL10N( $application ) { public static function getL10N( $application ) {
@ -120,15 +125,16 @@ class Util {
} }
/** /**
* @brief add a css file * add a css file
* @param string $url * @param string $application
* @param string $file
*/ */
public static function addStyle( $application, $file = null ) { public static function addStyle( $application, $file = null ) {
\OC_Util::addStyle( $application, $file ); \OC_Util::addStyle( $application, $file );
} }
/** /**
* @brief add a javascript file * add a javascript file
* @param string $application * @param string $application
* @param string $file * @param string $file
*/ */
@ -137,7 +143,7 @@ class Util {
} }
/** /**
* @brief Add a custom element to the header * Add a custom element to the header
* @param string $tag tag name of the element * @param string $tag tag name of the element
* @param array $attributes array of attributes for the element * @param array $attributes array of attributes for the element
* @param string $text the text content for the element * @param string $text the text content for the element
@ -147,7 +153,7 @@ class Util {
} }
/** /**
* @brief formats a timestamp in the "right" way * formats a timestamp in the "right" way
* @param int $timestamp $timestamp * @param int $timestamp $timestamp
* @param bool $dateOnly option to omit time from the result * @param bool $dateOnly option to omit time from the result
*/ */
@ -156,7 +162,7 @@ class Util {
} }
/** /**
* @brief check if some encrypted files are stored * check if some encrypted files are stored
* @return bool * @return bool
*/ */
public static function encryptedFiles() { public static function encryptedFiles() {
@ -164,85 +170,70 @@ class Util {
} }
/** /**
* @brief Creates an absolute url * Creates an absolute url to the given app and file.
* @param string $app app * @param string $app app
* @param string $file file * @param string $file file
* @param array $args array with param=>value, will be appended to the returned url * @param array $args array with param=>value, will be appended to the returned url
* The value of $args will be urlencoded * The value of $args will be urlencoded
* @returns string the url * @return string the url
*
* Returns a absolute url to the given app and file.
*/ */
public static function linkToAbsolute( $app, $file, $args = array() ) { public static function linkToAbsolute( $app, $file, $args = array() ) {
return(\OC_Helper::linkToAbsolute( $app, $file, $args )); return(\OC_Helper::linkToAbsolute( $app, $file, $args ));
} }
/** /**
* @brief Creates an absolute url for remote use * Creates an absolute url for remote use.
* @param string $service id * @param string $service id
* @returns string the url * @return string the url
*
* Returns a absolute url to the given app and file.
*/ */
public static function linkToRemote( $service ) { public static function linkToRemote( $service ) {
return(\OC_Helper::linkToRemote( $service )); return(\OC_Helper::linkToRemote( $service ));
} }
/** /**
* @brief Creates an absolute url for public use * Creates an absolute url for public use
* @param string $service id * @param string $service id
* @returns string the url * @return string the url
*
* Returns a absolute url to the given app and file.
*/ */
public static function linkToPublic($service) { public static function linkToPublic($service) {
return \OC_Helper::linkToPublic($service); return \OC_Helper::linkToPublic($service);
} }
/** /**
* @brief Creates an url using a defined route * Creates an url using a defined route
* @param $route * @param $route
* @param array $parameters * @param array $parameters
* @return * @return
* @internal param array $args with param=>value, will be appended to the returned url * @internal param array $args with param=>value, will be appended to the returned url
* @returns the url * @return the url
*
* Returns a url to the given app and file.
*/ */
public static function linkToRoute( $route, $parameters = array() ) { public static function linkToRoute( $route, $parameters = array() ) {
return \OC_Helper::linkToRoute($route, $parameters); return \OC_Helper::linkToRoute($route, $parameters);
} }
/** /**
* @brief Creates an url * Creates an url to the given app and file
* @param string $app app * @param string $app app
* @param string $file file * @param string $file file
* @param array $args array with param=>value, will be appended to the returned url * @param array $args array with param=>value, will be appended to the returned url
* The value of $args will be urlencoded * The value of $args will be urlencoded
* @returns string the url * @return string the url
*
* Returns a url to the given app and file.
*/ */
public static function linkTo( $app, $file, $args = array() ) { public static function linkTo( $app, $file, $args = array() ) {
return(\OC_Helper::linkTo( $app, $file, $args )); return(\OC_Helper::linkTo( $app, $file, $args ));
} }
/** /**
* @brief Returns the server host * Returns the server host, even if the website uses one or more reverse proxy
* @returns string the server host * @return string the server host
*
* Returns the server host, even if the website uses one or more
* reverse proxies
*/ */
public static function getServerHost() { public static function getServerHost() {
return(\OC_Request::serverHost()); return(\OC_Request::serverHost());
} }
/** /**
* @brief returns the server hostname
* @returns string the server hostname
*
* Returns the server host name without an eventual port number * Returns the server host name without an eventual port number
* @return string the server hostname
*/ */
public static function getServerHostName() { public static function getServerHostName() {
$host_name = self::getServerHost(); $host_name = self::getServerHost();
@ -255,9 +246,9 @@ class Util {
} }
/** /**
* @brief Returns the default email address * Returns the default email address
* @param string $user_part the user part of the address * @param string $user_part the user part of the address
* @returns string the default email address * @return string the default email address
* *
* Assembles a default email address (using the server hostname * Assembles a default email address (using the server hostname
* and the given user part, and returns it * and the given user part, and returns it
@ -279,66 +270,54 @@ class Util {
} }
/** /**
* @brief Returns the server protocol
* @returns string the server protocol
*
* Returns the server protocol. It respects reverse proxy servers and load balancers * Returns the server protocol. It respects reverse proxy servers and load balancers
* @return string the server protocol
*/ */
public static function getServerProtocol() { public static function getServerProtocol() {
return(\OC_Request::serverProtocol()); return(\OC_Request::serverProtocol());
} }
/** /**
* @brief Returns the request uri * Returns the request uri, even if the website uses one or more reverse proxies
* @returns the request uri
* *
* Returns the request uri, even if the website uses one or more * @return the request uri
* reverse proxies
*/ */
public static function getRequestUri() { public static function getRequestUri() {
return(\OC_Request::requestUri()); return(\OC_Request::requestUri());
} }
/** /**
* @brief Returns the script name * Returns the script name, even if the website uses one or more reverse proxies
* @returns the script name
* *
* Returns the script name, even if the website uses one or more * @return the script name
* reverse proxies
*/ */
public static function getScriptName() { public static function getScriptName() {
return(\OC_Request::scriptName()); return(\OC_Request::scriptName());
} }
/** /**
* @brief Creates path to an image * Creates path to an image
* @param string $app app * @param string $app app
* @param string $image image name * @param string $image image name
* @returns string the url * @return string the url
*
* Returns the path to the image.
*/ */
public static function imagePath( $app, $image ) { public static function imagePath( $app, $image ) {
return(\OC_Helper::imagePath( $app, $image )); return(\OC_Helper::imagePath( $app, $image ));
} }
/** /**
* @brief Make a human file size * Make a human file size (2048 to 2 kB)
* @param int $bytes file size in bytes * @param int $bytes file size in bytes
* @returns string a human readable file size * @return string a human readable file size
*
* Makes 2048 to 2 kB.
*/ */
public static function humanFileSize( $bytes ) { public static function humanFileSize( $bytes ) {
return(\OC_Helper::humanFileSize( $bytes )); return(\OC_Helper::humanFileSize( $bytes ));
} }
/** /**
* @brief Make a computer file size * Make a computer file size (2 kB to 2048)
* @param string $str file size in a fancy format * @param string $str file size in a fancy format
* @returns int a file size in bytes * @return int a file size in bytes
*
* Makes 2kB to 2048.
* *
* Inspired by: http://www.php.net/manual/en/function.filesize.php#92418 * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418
*/ */
@ -347,12 +326,12 @@ class Util {
} }
/** /**
* @brief connects a function to a hook * connects a function to a hook
* @param string $signalclass class name of emitter * @param string $signalclass class name of emitter
* @param string $signalname name of signal * @param string $signalname name of signal
* @param string $slotclass class name of slot * @param string $slotclass class name of slot
* @param string $slotname name of slot * @param string $slotname name of slot
* @returns bool * @return bool
* *
* This function makes it very easy to connect to use hooks. * This function makes it very easy to connect to use hooks.
* *
@ -363,13 +342,11 @@ class Util {
} }
/** /**
* @brief emitts a signal * Emits a signal. To get data from the slot use references!
* @param string $signalclass class name of emitter * @param string $signalclass class name of emitter
* @param string $signalname name of signal * @param string $signalname name of signal
* @param string $params defautl: array() array with additional data * @param string $params defautl: array() array with additional data
* @returns bool true if slots exists or false if not * @return bool true if slots exists or false if not
*
* Emits a signal. To get data from the slot use references!
* *
* TODO: write example * TODO: write example
*/ */
@ -394,7 +371,7 @@ class Util {
} }
/** /**
* @brief Used to sanitize HTML * Used to sanitize HTML
* *
* This function is used to sanitize HTML and should be applied on any * This function is used to sanitize HTML and should be applied on any
* string or array of strings before displaying it on a web page. * string or array of strings before displaying it on a web page.
@ -407,7 +384,7 @@ class Util {
} }
/** /**
* @brief Public function to encode url parameters * Public function to encode url parameters
* *
* This function is used to encode path to file before output. * This function is used to encode path to file before output.
* Encoding is done according to RFC 3986 with one exception: * Encoding is done according to RFC 3986 with one exception:
@ -421,36 +398,33 @@ class Util {
} }
/** /**
* @brief Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is. * Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
* *
* @param array $input The array to work on * @param array $input The array to work on
* @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default) * @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return array * @return array
*
*
*/ */
public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') { public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding)); return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding));
} }
/** /**
* @brief replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement. * replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.
* *
* @param string $input The input string. .Opposite to the PHP build-in function does not accept an array. * @param string $string The input string. Opposite to the PHP build-in function does not accept an array.
* @param string $replacement The replacement string. * @param string $replacement The replacement string.
* @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string. * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
* @param int $length Length of the part to be replaced * @param int $length Length of the part to be replaced
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return string * @return string
*
*/ */
public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') { public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
return(\OC_Helper::mb_substr_replace($string, $replacement, $start, $length, $encoding)); return(\OC_Helper::mb_substr_replace($string, $replacement, $start, $length, $encoding));
} }
/** /**
* @brief Replace all occurrences of the search string with the replacement string * Replace all occurrences of the search string with the replacement string
* *
* @param string $search The value being searched for, otherwise known as the needle. String. * @param string $search The value being searched for, otherwise known as the needle. String.
* @param string $replace The replacement string. * @param string $replace The replacement string.
@ -458,14 +432,14 @@ class Util {
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param int $count If passed, this will be set to the number of replacements performed. * @param int $count If passed, this will be set to the number of replacements performed.
* @return string * @return string
*
*/ */
public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) { public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
return(\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count)); return(\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count));
} }
/** /**
* @brief performs a search in a nested array * performs a search in a nested array
*
* @param array $haystack the array to be searched * @param array $haystack the array to be searched
* @param string $needle the search string * @param string $needle the search string
* @param int $index optional, only search this key name * @param int $index optional, only search this key name
@ -476,7 +450,7 @@ class Util {
} }
/** /**
* @brief calculates the maximum upload size respecting system settings, free space and user quota * calculates the maximum upload size respecting system settings, free space and user quota
* *
* @param $dir the current folder where the user currently operates * @param $dir the current folder where the user currently operates
* @return number of bytes representing * @return number of bytes representing