summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2016-02-08 13:16:00 +0000
committerRobin McCorkell <robin@mccorkell.me.uk>2016-05-03 11:30:02 +0100
commitde98a6e54cd2d732e0b7c1297e8da43e53bb97c7 (patch)
treed181a50261fea23ee4366bb70da0f6d02c03d834 /apps/files_external/lib
parent06293783e0d291a5595b55a3268d8bc0704277db (diff)
downloadnextcloud-server-de98a6e54cd2d732e0b7c1297e8da43e53bb97c7.tar.gz
nextcloud-server-de98a6e54cd2d732e0b7c1297e8da43e53bb97c7.zip
Allow multiple custom JS files
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/auth/oauth1/oauth1.php2
-rw-r--r--apps/files_external/lib/auth/oauth2/oauth2.php2
-rw-r--r--apps/files_external/lib/auth/publickey/rsa.php2
-rw-r--r--apps/files_external/lib/backend/legacybackend.php2
-rw-r--r--apps/files_external/lib/frontenddefinitiontrait.php22
5 files changed, 19 insertions, 11 deletions
diff --git a/apps/files_external/lib/auth/oauth1/oauth1.php b/apps/files_external/lib/auth/oauth1/oauth1.php
index dd83c9a6a69..808681530ea 100644
--- a/apps/files_external/lib/auth/oauth1/oauth1.php
+++ b/apps/files_external/lib/auth/oauth1/oauth1.php
@@ -46,7 +46,7 @@ class OAuth1 extends AuthMechanism {
(new DefinitionParameter('token_secret', 'token_secret'))
->setType(DefinitionParameter::VALUE_HIDDEN),
])
- ->setCustomJs('oauth1')
+ ->addCustomJs('oauth1')
;
}
diff --git a/apps/files_external/lib/auth/oauth2/oauth2.php b/apps/files_external/lib/auth/oauth2/oauth2.php
index c89007b52ba..d4bba8ef0eb 100644
--- a/apps/files_external/lib/auth/oauth2/oauth2.php
+++ b/apps/files_external/lib/auth/oauth2/oauth2.php
@@ -44,7 +44,7 @@ class OAuth2 extends AuthMechanism {
(new DefinitionParameter('token', 'token'))
->setType(DefinitionParameter::VALUE_HIDDEN),
])
- ->setCustomJs('oauth2')
+ ->addCustomJs('oauth2')
;
}
diff --git a/apps/files_external/lib/auth/publickey/rsa.php b/apps/files_external/lib/auth/publickey/rsa.php
index 9045f6818f9..7732beeddf8 100644
--- a/apps/files_external/lib/auth/publickey/rsa.php
+++ b/apps/files_external/lib/auth/publickey/rsa.php
@@ -52,7 +52,7 @@ class RSA extends AuthMechanism {
(new DefinitionParameter('private_key', 'private_key'))
->setType(DefinitionParameter::VALUE_HIDDEN),
])
- ->setCustomJs('public_key')
+ ->addCustomJs('public_key')
;
}
diff --git a/apps/files_external/lib/backend/legacybackend.php b/apps/files_external/lib/backend/legacybackend.php
index 084758ff78a..752c501e1ec 100644
--- a/apps/files_external/lib/backend/legacybackend.php
+++ b/apps/files_external/lib/backend/legacybackend.php
@@ -84,7 +84,7 @@ class LegacyBackend extends Backend {
$this->setPriority($definition['priority']);
}
if (isset($definition['custom'])) {
- $this->setCustomJs($definition['custom']);
+ $this->addCustomJs($definition['custom']);
}
if (isset($definition['has_dependencies']) && $definition['has_dependencies']) {
$this->hasDependencies = true;
diff --git a/apps/files_external/lib/frontenddefinitiontrait.php b/apps/files_external/lib/frontenddefinitiontrait.php
index 9f2b7c40f7f..ccc2a75fd1b 100644
--- a/apps/files_external/lib/frontenddefinitiontrait.php
+++ b/apps/files_external/lib/frontenddefinitiontrait.php
@@ -36,8 +36,8 @@ trait FrontendDefinitionTrait {
/** @var DefinitionParameter[] parameters for mechanism */
private $parameters = [];
- /** @var string|null custom JS */
- private $customJs = null;
+ /** @var string[] custom JS */
+ private $customJs = [];
/**
* @return string
@@ -92,7 +92,7 @@ trait FrontendDefinitionTrait {
}
/**
- * @return string|null
+ * @return string[]
*/
public function getCustomJs() {
return $this->customJs;
@@ -102,8 +102,18 @@ trait FrontendDefinitionTrait {
* @param string $custom
* @return self
*/
+ public function addCustomJs($custom) {
+ $this->customJs[] = $custom;
+ return $this;
+ }
+
+ /**
+ * @param string $custom
+ * @return self
+ * @deprecated 9.1.0, use addCustomJs() instead
+ */
public function setCustomJs($custom) {
- $this->customJs = $custom;
+ $this->customJs = [$custom];
return $this;
}
@@ -121,10 +131,8 @@ trait FrontendDefinitionTrait {
$data = [
'name' => $this->getText(),
'configuration' => $configuration,
+ 'custom' => $this->getCustomJs(),
];
- if (isset($this->customJs)) {
- $data['custom'] = $this->getCustomJs();
- }
return $data;
}