Fix template functions

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-07-19 18:45:40 +02:00 committed by Roeland Jago Douma
parent a4ffbc09ec
commit b53c4c0db9
No known key found for this signature in database
GPG key ID: F941078878347C0C
2 changed files with 22 additions and 3 deletions

View file

@ -250,7 +250,7 @@ function mimetype_icon( $mimetype ) {
* make preview_icon available as a simple function * make preview_icon available as a simple function
* Returns the path to the preview of the image. * Returns the path to the preview of the image.
* @param string $path path of file * @param string $path path of file
* @return link to the preview * @return string link to the preview
*/ */
function preview_icon( $path ) { function preview_icon( $path ) {
return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]);
@ -258,6 +258,8 @@ function preview_icon( $path ) {
/** /**
* @param string $path * @param string $path
* @param string $token
* @return string
*/ */
function publicPreview_icon ( $path, $token ) { function publicPreview_icon ( $path, $token ) {
return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]);
@ -289,8 +291,8 @@ function strip_time($timestamp){
* Formats timestamp relatively to the current time using * Formats timestamp relatively to the current time using
* a human-friendly format like "x minutes ago" or "yesterday" * a human-friendly format like "x minutes ago" or "yesterday"
* @param int $timestamp timestamp to format * @param int $timestamp timestamp to format
* @param int $fromTime timestamp to compare from, defaults to current time * @param int|null $fromTime timestamp to compare from, defaults to current time
* @param bool $dateOnly whether to strip time information * @param bool|null $dateOnly whether to strip time information
* @return string timestamp * @return string timestamp
*/ */
function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) { function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) {

View file

@ -48,6 +48,7 @@ namespace OCP;
* *
* @see \OCP\IURLGenerator::imagePath * @see \OCP\IURLGenerator::imagePath
* @deprecated 8.0.0 Use \OCP\Template::image_path() instead * @deprecated 8.0.0 Use \OCP\Template::image_path() instead
* @suppress PhanDeprecatedFunction
*/ */
function image_path($app, $image) { function image_path($app, $image) {
return \image_path($app, $image); return \image_path($app, $image);
@ -59,6 +60,7 @@ function image_path($app, $image) {
* @param string $mimetype * @param string $mimetype
* @return string to the image of this file type. * @return string to the image of this file type.
* @deprecated 8.0.0 Use \OCP\Template::mimetype_icon() instead * @deprecated 8.0.0 Use \OCP\Template::mimetype_icon() instead
* @suppress PhanDeprecatedFunction
*/ */
function mimetype_icon($mimetype) { function mimetype_icon($mimetype) {
return \mimetype_icon($mimetype); return \mimetype_icon($mimetype);
@ -69,6 +71,7 @@ function mimetype_icon($mimetype) {
* @param string $path path to file * @param string $path path to file
* @return string to the preview of the image * @return string to the preview of the image
* @deprecated 8.0.0 Use \OCP\Template::preview_icon() instead * @deprecated 8.0.0 Use \OCP\Template::preview_icon() instead
* @suppress PhanDeprecatedFunction
*/ */
function preview_icon($path) { function preview_icon($path) {
return \preview_icon($path); return \preview_icon($path);
@ -81,6 +84,7 @@ function preview_icon($path) {
* @param string $token * @param string $token
* @return string link to the preview * @return string link to the preview
* @deprecated 8.0.0 Use \OCP\Template::publicPreview_icon() instead * @deprecated 8.0.0 Use \OCP\Template::publicPreview_icon() instead
* @suppress PhanDeprecatedFunction
*/ */
function publicPreview_icon($path, $token) { function publicPreview_icon($path, $token) {
return \publicPreview_icon($path, $token); return \publicPreview_icon($path, $token);
@ -92,6 +96,7 @@ function publicPreview_icon($path, $token) {
* @param int $bytes in bytes * @param int $bytes in bytes
* @return string size as string * @return string size as string
* @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead * @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead
* @suppress PhanDeprecatedFunction
*/ */
function human_file_size($bytes) { function human_file_size($bytes) {
return \human_file_size($bytes); return \human_file_size($bytes);
@ -105,6 +110,8 @@ function human_file_size($bytes) {
* @return string human readable interpretation of the timestamp * @return string human readable interpretation of the timestamp
* *
* @deprecated 8.0.0 Use \OCP\Template::relative_modified_date() instead * @deprecated 8.0.0 Use \OCP\Template::relative_modified_date() instead
* @suppress PhanDeprecatedFunction
* @suppress PhanTypeMismatchArgument
*/ */
function relative_modified_date($timestamp, $dateOnly = false) { function relative_modified_date($timestamp, $dateOnly = false) {
return \relative_modified_date($timestamp, null, $dateOnly); return \relative_modified_date($timestamp, null, $dateOnly);
@ -116,6 +123,7 @@ function relative_modified_date($timestamp, $dateOnly = false) {
* @param integer $bytes size of a file in byte * @param integer $bytes size of a file in byte
* @return string human readable interpretation of a file size * @return string human readable interpretation of a file size
* @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead * @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead
* @suppress PhanDeprecatedFunction
*/ */
function simple_file_size($bytes) { function simple_file_size($bytes) {
return \human_file_size($bytes); return \human_file_size($bytes);
@ -129,6 +137,7 @@ function simple_file_size($bytes) {
* @param array $params the parameters * @param array $params the parameters
* @return string html options * @return string html options
* @deprecated 8.0.0 Use \OCP\Template::html_select_options() instead * @deprecated 8.0.0 Use \OCP\Template::html_select_options() instead
* @suppress PhanDeprecatedFunction
*/ */
function html_select_options($options, $selected, $params=array()) { function html_select_options($options, $selected, $params=array()) {
return \html_select_options($options, $selected, $params); return \html_select_options($options, $selected, $params);
@ -151,6 +160,7 @@ class Template extends \OC_Template {
* @param string $image * @param string $image
* @return string to the image * @return string to the image
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
*/ */
public static function image_path($app, $image) { public static function image_path($app, $image) {
return \image_path($app, $image); return \image_path($app, $image);
@ -163,6 +173,7 @@ class Template extends \OC_Template {
* @param string $mimetype * @param string $mimetype
* @return string to the image of this file type. * @return string to the image of this file type.
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
*/ */
public static function mimetype_icon($mimetype) { public static function mimetype_icon($mimetype) {
return \mimetype_icon($mimetype); return \mimetype_icon($mimetype);
@ -174,6 +185,7 @@ class Template extends \OC_Template {
* @param string $path path to file * @param string $path path to file
* @return string to the preview of the image * @return string to the preview of the image
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
*/ */
public static function preview_icon($path) { public static function preview_icon($path) {
return \preview_icon($path); return \preview_icon($path);
@ -187,6 +199,7 @@ class Template extends \OC_Template {
* @param string $token * @param string $token
* @return string link to the preview * @return string link to the preview
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
*/ */
public static function publicPreview_icon($path, $token) { public static function publicPreview_icon($path, $token) {
return \publicPreview_icon($path, $token); return \publicPreview_icon($path, $token);
@ -199,6 +212,7 @@ class Template extends \OC_Template {
* @param int $bytes in bytes * @param int $bytes in bytes
* @return string size as string * @return string size as string
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
*/ */
public static function human_file_size($bytes) { public static function human_file_size($bytes) {
return \human_file_size($bytes); return \human_file_size($bytes);
@ -211,6 +225,8 @@ class Template extends \OC_Template {
* @param boolean $dateOnly * @param boolean $dateOnly
* @return string human readable interpretation of the timestamp * @return string human readable interpretation of the timestamp
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
* @suppress PhanTypeMismatchArgument
*/ */
public static function relative_modified_date($timestamp, $dateOnly = false) { public static function relative_modified_date($timestamp, $dateOnly = false) {
return \relative_modified_date($timestamp, null, $dateOnly); return \relative_modified_date($timestamp, null, $dateOnly);
@ -224,6 +240,7 @@ class Template extends \OC_Template {
* @param array $params the parameters * @param array $params the parameters
* @return string html options * @return string html options
* @since 8.0.0 * @since 8.0.0
* @suppress PhanDeprecatedFunction
*/ */
public static function html_select_options($options, $selected, $params=array()) { public static function html_select_options($options, $selected, $params=array()) {
return \html_select_options($options, $selected, $params); return \html_select_options($options, $selected, $params);