@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | <meta charset="utf-8"> |
| 5 | 5 | <title> |
| 6 | 6 | <?php |
| 7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
| 7 | + p(!empty($_['application']) ? $_['application'].' - ' : ''); |
|
| 8 | 8 | p($theme->getTitle()); |
| 9 | 9 | ?> |
| 10 | 10 | </title> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | <meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>"> |
| 15 | 15 | <meta name="apple-mobile-web-app-capable" content="yes"> |
| 16 | 16 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| 17 | - <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>"> |
|
| 17 | + <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files') ? $_['application'] : $theme->getTitle()); ?>"> |
|
| 18 | 18 | <meta name="mobile-web-app-capable" content="yes"> |
| 19 | 19 | <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>"> |
| 20 | 20 | <link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>"> |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <?php emit_script_loading_tags($_); ?> |
| 26 | 26 | <?php print_unescaped($_['headers']); ?> |
| 27 | 27 | </head> |
| 28 | - <body id="<?php p($_['bodyid']);?>"> |
|
| 28 | + <body id="<?php p($_['bodyid']); ?>"> |
|
| 29 | 29 | <?php include('layout.noscript.warning.php'); ?> |
| 30 | 30 | <div id="notification-container"> |
| 31 | 31 | <div id="notification"></div> |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | <a href="#" class="header-appname-container menutoggle" tabindex="2"> |
| 45 | 45 | <h1 class="header-appname"> |
| 46 | - <?php p(!empty($_['application'])?$_['application']: $l->t('Apps')); ?> |
|
| 46 | + <?php p(!empty($_['application']) ? $_['application'] : $l->t('Apps')); ?> |
|
| 47 | 47 | </h1> |
| 48 | 48 | <div class="icon-caret"></div> |
| 49 | 49 | </a> |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | <a href="<?php print_unescaped($entry['href']); ?>" |
| 55 | 55 | tabindex="3" |
| 56 | 56 | <?php if ($entry['active']): ?> class="active"<?php endif; ?>> |
| 57 | - <img src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" |
|
| 57 | + <img src="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>" |
|
| 58 | 58 | class="app-icon"/> |
| 59 | 59 | <div class="icon-loading-small-dark" |
| 60 | 60 | style="display:none;"></div> |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | <div id="navigation" style="display: none;"> |
| 77 | 77 | <div id="apps"> |
| 78 | 78 | <ul> |
| 79 | - <?php foreach($_['navigation'] as $entry): ?> |
|
| 79 | + <?php foreach ($_['navigation'] as $entry): ?> |
|
| 80 | 80 | <li data-id="<?php p($entry['id']); ?>"> |
| 81 | 81 | <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3" |
| 82 | - <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>> |
|
| 82 | + <?php if ($entry['active']): ?> class="active"<?php endif; ?>> |
|
| 83 | 83 | <svg width="16" height="16" viewBox="0 0 16 16"> |
| 84 | 84 | <defs><filter id="invert-<?php p($entry['id']); ?>"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs> |
| 85 | - <image x="0" y="0" width="16" height="16" preserveAspectRatio="xMinYMin meet" filter="url(#invert-<?php p($entry['id']); ?>)" xlink:href="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" class="app-icon"></image> |
|
| 85 | + <image x="0" y="0" width="16" height="16" preserveAspectRatio="xMinYMin meet" filter="url(#invert-<?php p($entry['id']); ?>)" xlink:href="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>" class="app-icon"></image> |
|
| 86 | 86 | </svg> |
| 87 | 87 | <div class="icon-loading-small-dark" style="display:none;"></div> |
| 88 | 88 | <span><?php p($entry['name']); ?></span> |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | <div id="header-right"> |
| 100 | 100 | <form class="searchbox" action="#" method="post" role="search" novalidate> |
| 101 | 101 | <label for="searchbox" class="hidden-visually"> |
| 102 | - <?php p($l->t('Search'));?> |
|
| 102 | + <?php p($l->t('Search')); ?> |
|
| 103 | 103 | </label> |
| 104 | 104 | <input id="searchbox" type="search" name="query" |
| 105 | 105 | value="" required |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | <div class="avatardiv<?php if ($_['userAvatarSet']) { print_unescaped(' avatardiv-shown'); } else { print_unescaped('" style="display: none'); } ?>"> |
| 116 | 116 | <?php if ($_['userAvatarSet']): ?> |
| 117 | 117 | <img alt="" width="32" height="32" |
| 118 | - src="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 32, 'v' => $_['userAvatarVersion']]));?>" |
|
| 119 | - srcset="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 64, 'v' => $_['userAvatarVersion']]));?> 2x, <?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 128, 'v' => $_['userAvatarVersion']]));?> 4x" |
|
| 118 | + src="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 32, 'v' => $_['userAvatarVersion']])); ?>" |
|
| 119 | + srcset="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 64, 'v' => $_['userAvatarVersion']])); ?> 2x, <?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 128, 'v' => $_['userAvatarVersion']])); ?> 4x" |
|
| 120 | 120 | > |
| 121 | 121 | <?php endif; ?> |
| 122 | 122 | </div> |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | </div> |
| 125 | 125 | <div id="expanddiv" style="display:none;"> |
| 126 | 126 | <ul> |
| 127 | - <?php foreach($_['settingsnavigation'] as $entry):?> |
|
| 127 | + <?php foreach ($_['settingsnavigation'] as $entry):?> |
|
| 128 | 128 | <li> |
| 129 | 129 | <a href="<?php print_unescaped($entry['href']); ?>" |
| 130 | - <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>> |
|
| 131 | - <img alt="" src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>"> |
|
| 130 | + <?php if ($entry["active"]): ?> class="active"<?php endif; ?>> |
|
| 131 | + <img alt="" src="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>"> |
|
| 132 | 132 | <?php p($entry['name']) ?> |
| 133 | 133 | </a> |
| 134 | 134 | </li> |
@@ -17,18 +17,18 @@ |
||
| 17 | 17 | <?php emit_script_loading_tags($_); ?> |
| 18 | 18 | <?php print_unescaped($_['headers']); ?> |
| 19 | 19 | </head> |
| 20 | - <body id="<?php p($_['bodyid']);?>"> |
|
| 20 | + <body id="<?php p($_['bodyid']); ?>"> |
|
| 21 | 21 | <?php include('layout.noscript.warning.php'); ?> |
| 22 | 22 | <div class="wrapper"> |
| 23 | 23 | <div class="v-align"> |
| 24 | - <?php if ($_['bodyid'] === 'body-login' ): ?> |
|
| 24 | + <?php if ($_['bodyid'] === 'body-login'): ?> |
|
| 25 | 25 | <header role="banner"> |
| 26 | 26 | <div id="header"> |
| 27 | 27 | <div class="logo"> |
| 28 | 28 | <h1 class="hidden-visually"> |
| 29 | 29 | <?php p($theme->getName()); ?> |
| 30 | 30 | </h1> |
| 31 | - <?php if(\OC::$server->getConfig()->getSystemValue('installed', false) |
|
| 31 | + <?php if (\OC::$server->getConfig()->getSystemValue('installed', false) |
|
| 32 | 32 | && \OC::$server->getConfig()->getAppValue('theming', 'logoMime', false)): ?> |
| 33 | 33 | <img src="<?php p($theme->getLogo()); ?>"/> |
| 34 | 34 | <?php endif; ?> |
@@ -72,7 +72,6 @@ discard block |
||
| 72 | 72 | * Prints a <script> tag with nonce and defer depending on config |
| 73 | 73 | * @param string $src the source URL, ignored when empty |
| 74 | 74 | * @param string $script_content the inline script content, ignored when empty |
| 75 | - * @param bool $defer_flag deferred loading or not |
|
| 76 | 75 | */ |
| 77 | 76 | function emit_script_tag($src, $script_content='') { |
| 78 | 77 | $defer_str=' defer'; |
@@ -107,7 +106,7 @@ discard block |
||
| 107 | 106 | /** |
| 108 | 107 | * Prints an unsanitized string - usage of this function may result into XSS. |
| 109 | 108 | * Consider using p() instead. |
| 110 | - * @param string|array $string the string which will be printed as it is |
|
| 109 | + * @param string $string the string which will be printed as it is |
|
| 111 | 110 | */ |
| 112 | 111 | function print_unescaped($string) { |
| 113 | 112 | print($string); |
@@ -250,7 +249,7 @@ discard block |
||
| 250 | 249 | * make preview_icon available as a simple function |
| 251 | 250 | * Returns the path to the preview of the image. |
| 252 | 251 | * @param string $path path of file |
| 253 | - * @return link to the preview |
|
| 252 | + * @return string to the preview |
|
| 254 | 253 | */ |
| 255 | 254 | function preview_icon( $path ) { |
| 256 | 255 | return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); |
@@ -258,6 +257,7 @@ discard block |
||
| 258 | 257 | |
| 259 | 258 | /** |
| 260 | 259 | * @param string $path |
| 260 | + * @param string $token |
|
| 261 | 261 | */ |
| 262 | 262 | function publicPreview_icon ( $path, $token ) { |
| 263 | 263 | return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param string $string the string which will be escaped and printed |
| 36 | 36 | */ |
| 37 | 37 | function p($string) { |
| 38 | - print(\OCP\Util::sanitizeHTML($string)); |
|
| 38 | + print(\OCP\Util::sanitizeHTML($string)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | * @param string $opts, additional optional options |
| 46 | 46 | */ |
| 47 | 47 | function emit_css_tag($href, $opts = '') { |
| 48 | - $s='<link rel="stylesheet"'; |
|
| 49 | - if (!empty($href)) { |
|
| 50 | - $s.=' href="' . $href .'"'; |
|
| 51 | - } |
|
| 52 | - if (!empty($opts)) { |
|
| 53 | - $s.=' '.$opts; |
|
| 54 | - } |
|
| 55 | - print_unescaped($s.">\n"); |
|
| 48 | + $s='<link rel="stylesheet"'; |
|
| 49 | + if (!empty($href)) { |
|
| 50 | + $s.=' href="' . $href .'"'; |
|
| 51 | + } |
|
| 52 | + if (!empty($opts)) { |
|
| 53 | + $s.=' '.$opts; |
|
| 54 | + } |
|
| 55 | + print_unescaped($s.">\n"); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | * @param hash $obj all the script information from template |
| 61 | 61 | */ |
| 62 | 62 | function emit_css_loading_tags($obj) { |
| 63 | - foreach($obj['cssfiles'] as $css) { |
|
| 64 | - emit_css_tag($css); |
|
| 65 | - } |
|
| 66 | - foreach($obj['printcssfiles'] as $css) { |
|
| 67 | - emit_css_tag($css, 'media="print"'); |
|
| 68 | - } |
|
| 63 | + foreach($obj['cssfiles'] as $css) { |
|
| 64 | + emit_css_tag($css); |
|
| 65 | + } |
|
| 66 | + foreach($obj['printcssfiles'] as $css) { |
|
| 67 | + emit_css_tag($css, 'media="print"'); |
|
| 68 | + } |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | * @param bool $defer_flag deferred loading or not |
| 76 | 76 | */ |
| 77 | 77 | function emit_script_tag($src, $script_content='') { |
| 78 | - $defer_str=' defer'; |
|
| 79 | - $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; |
|
| 80 | - if (!empty($src)) { |
|
| 81 | - // emit script tag for deferred loading from $src |
|
| 82 | - $s.=$defer_str.' src="' . $src .'">'; |
|
| 83 | - } else if (!empty($script_content)) { |
|
| 84 | - // emit script tag for inline script from $script_content without defer (see MDN) |
|
| 85 | - $s.=">\n".$script_content."\n"; |
|
| 86 | - } else { |
|
| 87 | - // no $src nor $src_content, really useless empty tag |
|
| 88 | - $s.='>'; |
|
| 89 | - } |
|
| 90 | - $s.='</script>'; |
|
| 91 | - print_unescaped($s."\n"); |
|
| 78 | + $defer_str=' defer'; |
|
| 79 | + $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; |
|
| 80 | + if (!empty($src)) { |
|
| 81 | + // emit script tag for deferred loading from $src |
|
| 82 | + $s.=$defer_str.' src="' . $src .'">'; |
|
| 83 | + } else if (!empty($script_content)) { |
|
| 84 | + // emit script tag for inline script from $script_content without defer (see MDN) |
|
| 85 | + $s.=">\n".$script_content."\n"; |
|
| 86 | + } else { |
|
| 87 | + // no $src nor $src_content, really useless empty tag |
|
| 88 | + $s.='>'; |
|
| 89 | + } |
|
| 90 | + $s.='</script>'; |
|
| 91 | + print_unescaped($s."\n"); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | * @param hash $obj all the script information from template |
| 97 | 97 | */ |
| 98 | 98 | function emit_script_loading_tags($obj) { |
| 99 | - if (!empty($obj['inline_ocjs'])) { |
|
| 100 | - emit_script_tag('', $obj['inline_ocjs']); |
|
| 101 | - } |
|
| 102 | - foreach($obj['jsfiles'] as $jsfile) { |
|
| 103 | - emit_script_tag($jsfile, ''); |
|
| 104 | - } |
|
| 99 | + if (!empty($obj['inline_ocjs'])) { |
|
| 100 | + emit_script_tag('', $obj['inline_ocjs']); |
|
| 101 | + } |
|
| 102 | + foreach($obj['jsfiles'] as $jsfile) { |
|
| 103 | + emit_script_tag($jsfile, ''); |
|
| 104 | + } |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param string|array $string the string which will be printed as it is |
| 111 | 111 | */ |
| 112 | 112 | function print_unescaped($string) { |
| 113 | - print($string); |
|
| 113 | + print($string); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | * if an array is given it will add all scripts |
| 121 | 121 | */ |
| 122 | 122 | function script($app, $file = null) { |
| 123 | - if(is_array($file)) { |
|
| 124 | - foreach($file as $f) { |
|
| 125 | - OC_Util::addScript($app, $f); |
|
| 126 | - } |
|
| 127 | - } else { |
|
| 128 | - OC_Util::addScript($app, $file); |
|
| 129 | - } |
|
| 123 | + if(is_array($file)) { |
|
| 124 | + foreach($file as $f) { |
|
| 125 | + OC_Util::addScript($app, $f); |
|
| 126 | + } |
|
| 127 | + } else { |
|
| 128 | + OC_Util::addScript($app, $file); |
|
| 129 | + } |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | * if an array is given it will add all scripts |
| 137 | 137 | */ |
| 138 | 138 | function vendor_script($app, $file = null) { |
| 139 | - if(is_array($file)) { |
|
| 140 | - foreach($file as $f) { |
|
| 141 | - OC_Util::addVendorScript($app, $f); |
|
| 142 | - } |
|
| 143 | - } else { |
|
| 144 | - OC_Util::addVendorScript($app, $file); |
|
| 145 | - } |
|
| 139 | + if(is_array($file)) { |
|
| 140 | + foreach($file as $f) { |
|
| 141 | + OC_Util::addVendorScript($app, $f); |
|
| 142 | + } |
|
| 143 | + } else { |
|
| 144 | + OC_Util::addVendorScript($app, $file); |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -152,13 +152,13 @@ discard block |
||
| 152 | 152 | * if an array is given it will add all styles |
| 153 | 153 | */ |
| 154 | 154 | function style($app, $file = null) { |
| 155 | - if(is_array($file)) { |
|
| 156 | - foreach($file as $f) { |
|
| 157 | - OC_Util::addStyle($app, $f); |
|
| 158 | - } |
|
| 159 | - } else { |
|
| 160 | - OC_Util::addStyle($app, $file); |
|
| 161 | - } |
|
| 155 | + if(is_array($file)) { |
|
| 156 | + foreach($file as $f) { |
|
| 157 | + OC_Util::addStyle($app, $f); |
|
| 158 | + } |
|
| 159 | + } else { |
|
| 160 | + OC_Util::addStyle($app, $file); |
|
| 161 | + } |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | * if an array is given it will add all styles |
| 169 | 169 | */ |
| 170 | 170 | function vendor_style($app, $file = null) { |
| 171 | - if(is_array($file)) { |
|
| 172 | - foreach($file as $f) { |
|
| 173 | - OC_Util::addVendorStyle($app, $f); |
|
| 174 | - } |
|
| 175 | - } else { |
|
| 176 | - OC_Util::addVendorStyle($app, $file); |
|
| 177 | - } |
|
| 171 | + if(is_array($file)) { |
|
| 172 | + foreach($file as $f) { |
|
| 173 | + OC_Util::addVendorStyle($app, $f); |
|
| 174 | + } |
|
| 175 | + } else { |
|
| 176 | + OC_Util::addVendorStyle($app, $file); |
|
| 177 | + } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * if an array is given it will add all styles |
| 184 | 184 | */ |
| 185 | 185 | function translation($app) { |
| 186 | - OC_Util::addTranslations($app); |
|
| 186 | + OC_Util::addTranslations($app); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | * if an array is given it will add all components |
| 194 | 194 | */ |
| 195 | 195 | function component($app, $file) { |
| 196 | - if(is_array($file)) { |
|
| 197 | - foreach($file as $f) { |
|
| 198 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
| 199 | - OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
| 200 | - } |
|
| 201 | - } else { |
|
| 202 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
| 203 | - OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
| 204 | - } |
|
| 196 | + if(is_array($file)) { |
|
| 197 | + foreach($file as $f) { |
|
| 198 | + $url = link_to($app, 'component/' . $f . '.html'); |
|
| 199 | + OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
| 200 | + } |
|
| 201 | + } else { |
|
| 202 | + $url = link_to($app, 'component/' . $file . '.html'); |
|
| 203 | + OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
| 204 | + } |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * For further information have a look at \OCP\IURLGenerator::linkTo |
| 215 | 215 | */ |
| 216 | 216 | function link_to( $app, $file, $args = array() ) { |
| 217 | - return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
|
| 217 | + return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @return string url to the online documentation |
| 223 | 223 | */ |
| 224 | 224 | function link_to_docs($key) { |
| 225 | - return \OC::$server->getURLGenerator()->linkToDocs($key); |
|
| 225 | + return \OC::$server->getURLGenerator()->linkToDocs($key); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * For further information have a look at \OCP\IURLGenerator::imagePath |
| 235 | 235 | */ |
| 236 | 236 | function image_path( $app, $image ) { |
| 237 | - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
| 237 | + return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @return string link to the image |
| 244 | 244 | */ |
| 245 | 245 | function mimetype_icon( $mimetype ) { |
| 246 | - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
| 246 | + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | * @return link to the preview |
| 254 | 254 | */ |
| 255 | 255 | function preview_icon( $path ) { |
| 256 | - return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); |
|
| 256 | + return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * @param string $path |
| 261 | 261 | */ |
| 262 | 262 | function publicPreview_icon ( $path, $token ) { |
| 263 | - return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); |
|
| 263 | + return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * For further information have a look at OC_Helper::humanFileSize |
| 272 | 272 | */ |
| 273 | 273 | function human_file_size( $bytes ) { |
| 274 | - return OC_Helper::humanFileSize( $bytes ); |
|
| 274 | + return OC_Helper::humanFileSize( $bytes ); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | * @return $timestamp without time value |
| 281 | 281 | */ |
| 282 | 282 | function strip_time($timestamp){ |
| 283 | - $date = new \DateTime("@{$timestamp}"); |
|
| 284 | - $date->setTime(0, 0, 0); |
|
| 285 | - return intval($date->format('U')); |
|
| 283 | + $date = new \DateTime("@{$timestamp}"); |
|
| 284 | + $date->setTime(0, 0, 0); |
|
| 285 | + return intval($date->format('U')); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -294,39 +294,39 @@ discard block |
||
| 294 | 294 | * @return string timestamp |
| 295 | 295 | */ |
| 296 | 296 | function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) { |
| 297 | - /** @var \OC\DateTimeFormatter $formatter */ |
|
| 298 | - $formatter = \OC::$server->query('DateTimeFormatter'); |
|
| 297 | + /** @var \OC\DateTimeFormatter $formatter */ |
|
| 298 | + $formatter = \OC::$server->query('DateTimeFormatter'); |
|
| 299 | 299 | |
| 300 | - if ($dateOnly){ |
|
| 301 | - return $formatter->formatDateSpan($timestamp, $fromTime); |
|
| 302 | - } |
|
| 303 | - return $formatter->formatTimeSpan($timestamp, $fromTime); |
|
| 300 | + if ($dateOnly){ |
|
| 301 | + return $formatter->formatDateSpan($timestamp, $fromTime); |
|
| 302 | + } |
|
| 303 | + return $formatter->formatTimeSpan($timestamp, $fromTime); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | function html_select_options($options, $selected, $params=array()) { |
| 307 | - if (!is_array($selected)) { |
|
| 308 | - $selected=array($selected); |
|
| 309 | - } |
|
| 310 | - if (isset($params['combine']) && $params['combine']) { |
|
| 311 | - $options = array_combine($options, $options); |
|
| 312 | - } |
|
| 313 | - $value_name = $label_name = false; |
|
| 314 | - if (isset($params['value'])) { |
|
| 315 | - $value_name = $params['value']; |
|
| 316 | - } |
|
| 317 | - if (isset($params['label'])) { |
|
| 318 | - $label_name = $params['label']; |
|
| 319 | - } |
|
| 320 | - $html = ''; |
|
| 321 | - foreach($options as $value => $label) { |
|
| 322 | - if ($value_name && is_array($label)) { |
|
| 323 | - $value = $label[$value_name]; |
|
| 324 | - } |
|
| 325 | - if ($label_name && is_array($label)) { |
|
| 326 | - $label = $label[$label_name]; |
|
| 327 | - } |
|
| 328 | - $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
|
| 329 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
| 330 | - } |
|
| 331 | - return $html; |
|
| 307 | + if (!is_array($selected)) { |
|
| 308 | + $selected=array($selected); |
|
| 309 | + } |
|
| 310 | + if (isset($params['combine']) && $params['combine']) { |
|
| 311 | + $options = array_combine($options, $options); |
|
| 312 | + } |
|
| 313 | + $value_name = $label_name = false; |
|
| 314 | + if (isset($params['value'])) { |
|
| 315 | + $value_name = $params['value']; |
|
| 316 | + } |
|
| 317 | + if (isset($params['label'])) { |
|
| 318 | + $label_name = $params['label']; |
|
| 319 | + } |
|
| 320 | + $html = ''; |
|
| 321 | + foreach($options as $value => $label) { |
|
| 322 | + if ($value_name && is_array($label)) { |
|
| 323 | + $value = $label[$value_name]; |
|
| 324 | + } |
|
| 325 | + if ($label_name && is_array($label)) { |
|
| 326 | + $label = $label[$label_name]; |
|
| 327 | + } |
|
| 328 | + $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
|
| 329 | + $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
| 330 | + } |
|
| 331 | + return $html; |
|
| 332 | 332 | } |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | * @param string $opts, additional optional options |
| 46 | 46 | */ |
| 47 | 47 | function emit_css_tag($href, $opts = '') { |
| 48 | - $s='<link rel="stylesheet"'; |
|
| 48 | + $s = '<link rel="stylesheet"'; |
|
| 49 | 49 | if (!empty($href)) { |
| 50 | - $s.=' href="' . $href .'"'; |
|
| 50 | + $s .= ' href="'.$href.'"'; |
|
| 51 | 51 | } |
| 52 | 52 | if (!empty($opts)) { |
| 53 | - $s.=' '.$opts; |
|
| 53 | + $s .= ' '.$opts; |
|
| 54 | 54 | } |
| 55 | 55 | print_unescaped($s.">\n"); |
| 56 | 56 | } |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * @param hash $obj all the script information from template |
| 61 | 61 | */ |
| 62 | 62 | function emit_css_loading_tags($obj) { |
| 63 | - foreach($obj['cssfiles'] as $css) { |
|
| 63 | + foreach ($obj['cssfiles'] as $css) { |
|
| 64 | 64 | emit_css_tag($css); |
| 65 | 65 | } |
| 66 | - foreach($obj['printcssfiles'] as $css) { |
|
| 66 | + foreach ($obj['printcssfiles'] as $css) { |
|
| 67 | 67 | emit_css_tag($css, 'media="print"'); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -74,20 +74,20 @@ discard block |
||
| 74 | 74 | * @param string $script_content the inline script content, ignored when empty |
| 75 | 75 | * @param bool $defer_flag deferred loading or not |
| 76 | 76 | */ |
| 77 | -function emit_script_tag($src, $script_content='') { |
|
| 78 | - $defer_str=' defer'; |
|
| 79 | - $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; |
|
| 77 | +function emit_script_tag($src, $script_content = '') { |
|
| 78 | + $defer_str = ' defer'; |
|
| 79 | + $s = '<script nonce="'.\OC::$server->getContentSecurityPolicyNonceManager()->getNonce().'"'; |
|
| 80 | 80 | if (!empty($src)) { |
| 81 | 81 | // emit script tag for deferred loading from $src |
| 82 | - $s.=$defer_str.' src="' . $src .'">'; |
|
| 82 | + $s .= $defer_str.' src="'.$src.'">'; |
|
| 83 | 83 | } else if (!empty($script_content)) { |
| 84 | 84 | // emit script tag for inline script from $script_content without defer (see MDN) |
| 85 | - $s.=">\n".$script_content."\n"; |
|
| 85 | + $s .= ">\n".$script_content."\n"; |
|
| 86 | 86 | } else { |
| 87 | 87 | // no $src nor $src_content, really useless empty tag |
| 88 | - $s.='>'; |
|
| 88 | + $s .= '>'; |
|
| 89 | 89 | } |
| 90 | - $s.='</script>'; |
|
| 90 | + $s .= '</script>'; |
|
| 91 | 91 | print_unescaped($s."\n"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if (!empty($obj['inline_ocjs'])) { |
| 100 | 100 | emit_script_tag('', $obj['inline_ocjs']); |
| 101 | 101 | } |
| 102 | - foreach($obj['jsfiles'] as $jsfile) { |
|
| 102 | + foreach ($obj['jsfiles'] as $jsfile) { |
|
| 103 | 103 | emit_script_tag($jsfile, ''); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | * if an array is given it will add all scripts |
| 121 | 121 | */ |
| 122 | 122 | function script($app, $file = null) { |
| 123 | - if(is_array($file)) { |
|
| 124 | - foreach($file as $f) { |
|
| 123 | + if (is_array($file)) { |
|
| 124 | + foreach ($file as $f) { |
|
| 125 | 125 | OC_Util::addScript($app, $f); |
| 126 | 126 | } |
| 127 | 127 | } else { |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * if an array is given it will add all scripts |
| 137 | 137 | */ |
| 138 | 138 | function vendor_script($app, $file = null) { |
| 139 | - if(is_array($file)) { |
|
| 140 | - foreach($file as $f) { |
|
| 139 | + if (is_array($file)) { |
|
| 140 | + foreach ($file as $f) { |
|
| 141 | 141 | OC_Util::addVendorScript($app, $f); |
| 142 | 142 | } |
| 143 | 143 | } else { |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * if an array is given it will add all styles |
| 153 | 153 | */ |
| 154 | 154 | function style($app, $file = null) { |
| 155 | - if(is_array($file)) { |
|
| 156 | - foreach($file as $f) { |
|
| 155 | + if (is_array($file)) { |
|
| 156 | + foreach ($file as $f) { |
|
| 157 | 157 | OC_Util::addStyle($app, $f); |
| 158 | 158 | } |
| 159 | 159 | } else { |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * if an array is given it will add all styles |
| 169 | 169 | */ |
| 170 | 170 | function vendor_style($app, $file = null) { |
| 171 | - if(is_array($file)) { |
|
| 172 | - foreach($file as $f) { |
|
| 171 | + if (is_array($file)) { |
|
| 172 | + foreach ($file as $f) { |
|
| 173 | 173 | OC_Util::addVendorStyle($app, $f); |
| 174 | 174 | } |
| 175 | 175 | } else { |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | * if an array is given it will add all components |
| 194 | 194 | */ |
| 195 | 195 | function component($app, $file) { |
| 196 | - if(is_array($file)) { |
|
| 197 | - foreach($file as $f) { |
|
| 198 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
| 196 | + if (is_array($file)) { |
|
| 197 | + foreach ($file as $f) { |
|
| 198 | + $url = link_to($app, 'component/'.$f.'.html'); |
|
| 199 | 199 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
| 200 | 200 | } |
| 201 | 201 | } else { |
| 202 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
| 202 | + $url = link_to($app, 'component/'.$file.'.html'); |
|
| 203 | 203 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * |
| 214 | 214 | * For further information have a look at \OCP\IURLGenerator::linkTo |
| 215 | 215 | */ |
| 216 | -function link_to( $app, $file, $args = array() ) { |
|
| 216 | +function link_to($app, $file, $args = array()) { |
|
| 217 | 217 | return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * For further information have a look at \OCP\IURLGenerator::imagePath |
| 235 | 235 | */ |
| 236 | -function image_path( $app, $image ) { |
|
| 237 | - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
| 236 | +function image_path($app, $image) { |
|
| 237 | + return \OC::$server->getURLGenerator()->imagePath($app, $image); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | * @param string $mimetype mimetype |
| 243 | 243 | * @return string link to the image |
| 244 | 244 | */ |
| 245 | -function mimetype_icon( $mimetype ) { |
|
| 246 | - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
| 245 | +function mimetype_icon($mimetype) { |
|
| 246 | + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | * @param string $path path of file |
| 253 | 253 | * @return link to the preview |
| 254 | 254 | */ |
| 255 | -function preview_icon( $path ) { |
|
| 255 | +function preview_icon($path) { |
|
| 256 | 256 | return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * @param string $path |
| 261 | 261 | */ |
| 262 | -function publicPreview_icon ( $path, $token ) { |
|
| 262 | +function publicPreview_icon($path, $token) { |
|
| 263 | 263 | return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * For further information have a look at OC_Helper::humanFileSize |
| 272 | 272 | */ |
| 273 | -function human_file_size( $bytes ) { |
|
| 274 | - return OC_Helper::humanFileSize( $bytes ); |
|
| 273 | +function human_file_size($bytes) { |
|
| 274 | + return OC_Helper::humanFileSize($bytes); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @param int $timestamp UNIX timestamp to strip |
| 280 | 280 | * @return $timestamp without time value |
| 281 | 281 | */ |
| 282 | -function strip_time($timestamp){ |
|
| 282 | +function strip_time($timestamp) { |
|
| 283 | 283 | $date = new \DateTime("@{$timestamp}"); |
| 284 | 284 | $date->setTime(0, 0, 0); |
| 285 | 285 | return intval($date->format('U')); |
@@ -297,15 +297,15 @@ discard block |
||
| 297 | 297 | /** @var \OC\DateTimeFormatter $formatter */ |
| 298 | 298 | $formatter = \OC::$server->query('DateTimeFormatter'); |
| 299 | 299 | |
| 300 | - if ($dateOnly){ |
|
| 300 | + if ($dateOnly) { |
|
| 301 | 301 | return $formatter->formatDateSpan($timestamp, $fromTime); |
| 302 | 302 | } |
| 303 | 303 | return $formatter->formatTimeSpan($timestamp, $fromTime); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | -function html_select_options($options, $selected, $params=array()) { |
|
| 306 | +function html_select_options($options, $selected, $params = array()) { |
|
| 307 | 307 | if (!is_array($selected)) { |
| 308 | - $selected=array($selected); |
|
| 308 | + $selected = array($selected); |
|
| 309 | 309 | } |
| 310 | 310 | if (isset($params['combine']) && $params['combine']) { |
| 311 | 311 | $options = array_combine($options, $options); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $label_name = $params['label']; |
| 319 | 319 | } |
| 320 | 320 | $html = ''; |
| 321 | - foreach($options as $value => $label) { |
|
| 321 | + foreach ($options as $value => $label) { |
|
| 322 | 322 | if ($value_name && is_array($label)) { |
| 323 | 323 | $value = $label[$value_name]; |
| 324 | 324 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $label = $label[$label_name]; |
| 327 | 327 | } |
| 328 | 328 | $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
| 329 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
| 329 | + $html .= '<option value="'.\OCP\Util::sanitizeHTML($value).'"'.$select.'>'.\OCP\Util::sanitizeHTML($label).'</option>'."\n"; |
|
| 330 | 330 | } |
| 331 | 331 | return $html; |
| 332 | 332 | } |