aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/template
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/legacy/template
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/legacy/template')
-rw-r--r--lib/private/legacy/template/functions.php32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php
index 83751db1e31..e2a1c476433 100644
--- a/lib/private/legacy/template/functions.php
+++ b/lib/private/legacy/template/functions.php
@@ -62,10 +62,10 @@ function emit_css_tag($href, $opts = '') {
* @param array $obj all the script information from template
*/
function emit_css_loading_tags($obj) {
- foreach($obj['cssfiles'] as $css) {
+ foreach ($obj['cssfiles'] as $css) {
emit_css_tag($css);
}
- foreach($obj['printcssfiles'] as $css) {
+ foreach ($obj['printcssfiles'] as $css) {
emit_css_tag($css, 'media="print"');
}
}
@@ -79,7 +79,7 @@ function emit_script_tag($src, $script_content='') {
$defer_str=' defer';
$s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"';
if (!empty($src)) {
- // emit script tag for deferred loading from $src
+ // emit script tag for deferred loading from $src
$s.=$defer_str.' src="' . $src .'">';
} elseif (!empty($script_content)) {
// emit script tag for inline script from $script_content without defer (see MDN)
@@ -97,7 +97,7 @@ function emit_script_tag($src, $script_content='') {
* @param array $obj all the script information from template
*/
function emit_script_loading_tags($obj) {
- foreach($obj['jsfiles'] as $jsfile) {
+ foreach ($obj['jsfiles'] as $jsfile) {
emit_script_tag($jsfile, '');
}
if (!empty($obj['inline_ocjs'])) {
@@ -121,8 +121,8 @@ function print_unescaped($string) {
* if an array is given it will add all scripts
*/
function script($app, $file = null) {
- if(is_array($file)) {
- foreach($file as $f) {
+ if (is_array($file)) {
+ foreach ($file as $f) {
OC_Util::addScript($app, $f);
}
} else {
@@ -137,8 +137,8 @@ function script($app, $file = null) {
* if an array is given it will add all scripts
*/
function vendor_script($app, $file = null) {
- if(is_array($file)) {
- foreach($file as $f) {
+ if (is_array($file)) {
+ foreach ($file as $f) {
OC_Util::addVendorScript($app, $f);
}
} else {
@@ -153,8 +153,8 @@ function vendor_script($app, $file = null) {
* if an array is given it will add all styles
*/
function style($app, $file = null) {
- if(is_array($file)) {
- foreach($file as $f) {
+ if (is_array($file)) {
+ foreach ($file as $f) {
OC_Util::addStyle($app, $f);
}
} else {
@@ -169,8 +169,8 @@ function style($app, $file = null) {
* if an array is given it will add all styles
*/
function vendor_style($app, $file = null) {
- if(is_array($file)) {
- foreach($file as $f) {
+ if (is_array($file)) {
+ foreach ($file as $f) {
OC_Util::addVendorStyle($app, $f);
}
} else {
@@ -194,8 +194,8 @@ function translation($app) {
* if an array is given it will add all components
*/
function component($app, $file) {
- if(is_array($file)) {
- foreach($file as $f) {
+ if (is_array($file)) {
+ foreach ($file as $f) {
$url = link_to($app, 'component/' . $f . '.html');
OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]);
}
@@ -300,7 +300,7 @@ function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false)
/** @var \OC\DateTimeFormatter $formatter */
$formatter = \OC::$server->query('DateTimeFormatter');
- if ($dateOnly){
+ if ($dateOnly) {
return $formatter->formatDateSpan($timestamp, $fromTime);
}
return $formatter->formatTimeSpan($timestamp, $fromTime);
@@ -321,7 +321,7 @@ function html_select_options($options, $selected, $params=[]) {
$label_name = $params['label'];
}
$html = '';
- foreach($options as $value => $label) {
+ foreach ($options as $value => $label) {
if ($value_name && is_array($label)) {
$value = $label[$value_name];
}