summaryrefslogtreecommitdiffstats
path: root/lib/public/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/util.php')
-rw-r--r--lib/public/util.php84
1 files changed, 41 insertions, 43 deletions
diff --git a/lib/public/util.php b/lib/public/util.php
index 75ca29f7129..747448e62eb 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -34,8 +34,6 @@ namespace OCP;
* This class provides different helper functions to make the life of a developer easier
*/
class Util {
-
-
// consts for Logging
const DEBUG=0;
const INFO=1;
@@ -43,16 +41,14 @@ class Util {
const ERROR=3;
const FATAL=4;
-
/**
* @brief get the current installed version of ownCloud
* @return array
*/
- public static function getVersion(){
+ public static function getVersion() {
return(\OC_Util::getVersion());
}
-
/**
* @brief send an email
* @param string $toaddress
@@ -68,36 +64,33 @@ class Util {
\OC_MAIL::send( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc='');
}
-
- /**
+ /**
* @brief write a message in the log
* @param string $app
* @param string $message
* @param int level
- */
- public static function writeLog( $app, $message, $level ) {
- // call the internal log class
- \OC_LOG::write( $app, $message, $level );
- }
-
+ */
+ public static function writeLog( $app, $message, $level ) {
+ // call the internal log class
+ \OC_LOG::write( $app, $message, $level );
+ }
/**
* @brief add a css file
* @param url $url
*/
- public static function addStyle( $application, $file = null ){
+ public static function addStyle( $application, $file = null ) {
\OC_Util::addStyle( $application, $file );
- }
-
+ }
/**
* @brief add a javascript file
* @param appid $application
* @param filename $file
*/
- public static function addScript( $application, $file = null ){
+ public static function addScript( $application, $file = null ) {
\OC_Util::addScript( $application, $file );
- }
+ }
/**
* @brief Add a custom element to the header
@@ -105,7 +98,7 @@ class Util {
* @param array $attributes array of attributes for the element
* @param string $text the text content for the element
*/
- public static function addHeader( $tag, $attributes, $text=''){
+ public static function addHeader( $tag, $attributes, $text='') {
\OC_Util::addHeader( $tag, $attributes, $text );
}
@@ -114,25 +107,23 @@ class Util {
* @param int timestamp $timestamp
* @param bool dateOnly option to ommit time from the result
*/
- public static function formatDate( $timestamp,$dateOnly=false){
+ public static function formatDate( $timestamp,$dateOnly=false) {
return(\OC_Util::formatDate( $timestamp,$dateOnly ));
}
-
-
/**
* @brief Creates an absolute url
* @param $app app
* @param $file file
+ * @param $args array with param=>value, will be appended to the returned url
* @returns the url
*
* Returns a absolute url to the given app and file.
*/
- public static function linkToAbsolute( $app, $file ) {
- return(\OC_Helper::linkToAbsolute( $app, $file ));
+ public static function linkToAbsolute( $app, $file, $args = array() ) {
+ return(\OC_Helper::linkToAbsolute( $app, $file, $args ));
}
-
/**
* @brief Creates an absolute url for remote use
* @param $service id
@@ -144,17 +135,28 @@ class Util {
return(\OC_Helper::linkToRemote( $service ));
}
+ /**
+ * @brief Creates an absolute url for public use
+ * @param $service id
+ * @returns the url
+ *
+ * Returns a absolute url to the given app and file.
+ */
+ public static function linkToPublic($service) {
+ return \OC_Helper::linkToPublic($service);
+ }
/**
* @brief Creates an url
* @param $app app
* @param $file file
+ * @param $args array with param=>value, will be appended to the returned url
* @returns the url
*
* Returns a url to the given app and file.
*/
- public static function linkTo( $app, $file ){
- return(\OC_Helper::linkTo( $app, $file ));
+ public static function linkTo( $app, $file, $args = array() ) {
+ return(\OC_Helper::linkTo( $app, $file, $args ));
}
/**
@@ -165,7 +167,7 @@ class Util {
* reverse proxies
*/
public static function getServerHost() {
- return(\OC_Helper::serverHost());
+ return(\OC_Request::serverHost());
}
/**
@@ -175,7 +177,7 @@ class Util {
* Returns the server protocol. It respects reverse proxy servers and load balancers
*/
public static function getServerProtocol() {
- return(\OC_Helper::serverProtocol());
+ return(\OC_Request::serverProtocol());
}
/**
@@ -186,11 +188,10 @@ class Util {
*
* Returns the path to the image.
*/
- public static function imagePath( $app, $image ){
+ public static function imagePath( $app, $image ) {
return(\OC_Helper::imagePath( $app, $image ));
}
-
/**
* @brief Make a human file size
* @param $bytes file size in bytes
@@ -198,7 +199,7 @@ class Util {
*
* Makes 2048 to 2 kB.
*/
- public static function humanFileSize( $bytes ){
+ public static function humanFileSize( $bytes ) {
return(\OC_Helper::humanFileSize( $bytes ));
}
@@ -211,7 +212,7 @@ class Util {
*
* Inspired by: http://www.php.net/manual/en/function.filesize.php#92418
*/
- public static function computerFileSize( $str ){
+ public static function computerFileSize( $str ) {
return(\OC_Helper::computerFileSize( $str ));
}
@@ -227,11 +228,10 @@ class Util {
*
* TODO: write example
*/
- static public function connectHook( $signalclass, $signalname, $slotclass, $slotname ){
+ static public function connectHook( $signalclass, $signalname, $slotclass, $slotname ) {
return(\OC_Hook::connect( $signalclass, $signalname, $slotclass, $slotname ));
}
-
/**
* @brief emitts a signal
* @param $signalclass class name of emitter
@@ -243,25 +243,23 @@ class Util {
*
* TODO: write example
*/
- static public function emitHook( $signalclass, $signalname, $params = array()){
+ static public function emitHook( $signalclass, $signalname, $params = array()) {
return(\OC_Hook::emit( $signalclass, $signalname, $params ));
}
-
/**
- * Register an get/post call. This is important to prevent CSRF attacks
+ * Register an get/post call. This is important to prevent CSRF attacks
* TODO: write example
*/
- public static function callRegister(){
+ public static function callRegister() {
return(\OC_Util::callRegister());
}
-
/**
* Check an ajax get/post call if the request token is valid. exit if not.
* Todo: Write howto
*/
- public static function callCheck(){
+ public static function callCheck() {
return(\OC_Util::callCheck());
}
@@ -273,7 +271,7 @@ class Util {
* @param string or array of strings
* @return array with sanitized strings or a single sinitized string, depends on the input parameter.
*/
- public static function sanitizeHTML( $value ){
+ public static function sanitizeHTML( $value ) {
return(\OC_Util::sanitizeHTML($value));
}
@@ -287,7 +285,7 @@ class Util {
*
*
*/
- 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));
}