diff options
author | Individual IT Services <info@individual-it.net> | 2015-09-17 12:59:04 +0545 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-23 11:57:10 +0200 |
commit | bf1cb20e908d6cc6d84be733f7137a6edf92697b (patch) | |
tree | ab92da0889ed2cf76909954a619db59f76ac2fbc /lib/private/util.php | |
parent | d0b17ec8d68396268d880b8e2d163f65da447c77 (diff) | |
download | nextcloud-server-bf1cb20e908d6cc6d84be733f7137a6edf92697b.tar.gz nextcloud-server-bf1cb20e908d6cc6d84be733f7137a6edf92697b.zip |
do not load unnecessary code in case of webdav
changing from "protected static" to "protected"
as suggested by @nickvergessen
https://github.com/owncloud/core/pull/19114#discussion_r39719851
moving initTemplate() into template constr.
reduce to move initTemplate only
cleanup spaces
Diffstat (limited to 'lib/private/util.php')
-rw-r--r-- | lib/private/util.php | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index eb1de5be5a4..117e57f66d7 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -439,16 +439,22 @@ class OC_Util { * * @param string $application application id * @param string|null $file filename + * @param bool $prepend prepend the Script to the beginning of the list * @return void */ - public static function addScript($application, $file = null) { + public static function addScript($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'js', $file); if (!in_array($path, self::$scripts)) { // core js files need separate handling if ($application !== 'core' && $file !== null) { self::addTranslations($application); } - self::$scripts[] = $path; + if ($prepend===true) { + array_unshift(self::$scripts, $path); + } + else { + self::$scripts[] = $path; + } } } @@ -457,12 +463,17 @@ class OC_Util { * * @param string $application application id * @param string|null $file filename + * @param bool $prepend prepend the Script to the beginning of the list * @return void */ - public static function addVendorScript($application, $file = null) { + public static function addVendorScript($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'vendor', $file); - if (!in_array($path, self::$scripts)) { - self::$scripts[] = $path; + if (! in_array ( $path, self::$scripts )) { + if ($prepend === true) { + array_unshift ( self::$scripts, $path ); + } else { + self::$scripts [] = $path; + } } } @@ -471,8 +482,9 @@ class OC_Util { * * @param string $application application id * @param string $languageCode language code, defaults to the current language + * @param bool $prepend prepend the Script to the beginning of the list */ - public static function addTranslations($application, $languageCode = null) { + public static function addTranslations($application, $languageCode = null, $prepend = false) { if (is_null($languageCode)) { $languageCode = \OC_L10N::findLanguage($application); } @@ -482,7 +494,11 @@ class OC_Util { $path = "l10n/$languageCode"; } if (!in_array($path, self::$scripts)) { - self::$scripts[] = $path; + if ($prepend === true) { + array_unshift ( self::$scripts, $path ); + } else { + self::$scripts [] = $path; + } } } |