summaryrefslogtreecommitdiff
path: root/inc/remote.php
diff options
context:
space:
mode:
authorDominik Eckelmann <deckelmann@gmail.com>2012-01-08 18:37:59 +0100
committerDominik Eckelmann <deckelmann@gmail.com>2012-01-08 18:37:59 +0100
commitf95017850a515969190f54df3d57a00449245bb9 (patch)
treedf96b4aded1c318703093cb6b7426a38b0d25ba8 /inc/remote.php
parent1232df5e9480465ff8b2e24ce5760766b3bd908c (diff)
downloadrpg-f95017850a515969190f54df3d57a00449245bb9.tar.gz
rpg-f95017850a515969190f54df3d57a00449245bb9.tar.bz2
delegate file and date transformation to remote library
Diffstat (limited to 'inc/remote.php')
-rw-r--r--inc/remote.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/inc/remote.php b/inc/remote.php
index c18cb3713..71ceb97b5 100644
--- a/inc/remote.php
+++ b/inc/remote.php
@@ -18,9 +18,6 @@ abstract class RemoteDataType {
}
}
-class RemoteDate extends RemoteDataType {}
-class RemoteFile extends RemoteDataType {}
-
/**
* This class provides information about remote access to the wiki.
*
@@ -66,6 +63,14 @@ class RemoteAPI {
*/
private $pluginMethods = null;
+ private $dateTransformation;
+ private $fileTransformation;
+
+ public function __construct() {
+ $this->dateTransformation = array($this, 'dummyTransformation');
+ $this->fileTransformation = array($this, 'dummyTransformation');
+ }
+
/**
* Get all available methods with remote access.
*
@@ -191,11 +196,31 @@ class RemoteAPI {
public function getCoreMethods($apiCore = null) {
if ($this->coreMethods === null) {
if ($apiCore === null) {
- $this->coreMethods = new RemoteAPICore();
+ $this->coreMethods = new RemoteAPICore($this);
} else {
$this->coreMethods = $apiCore;
}
}
return $this->coreMethods->__getRemoteInfo();
}
+
+ public function toFile($data) {
+ return call_user_func($this->fileTransformation, $data);
+ }
+
+ public function toDate($data) {
+ return call_user_func($this->dateTransformation, $data);
+ }
+
+ public function dummyTransformation($data) {
+ return $data;
+ }
+
+ public function setDateTransformation($dateTransformation) {
+ $this->dateTransformation = $dateTransformation;
+ }
+
+ public function setFileTransformation($fileTransformation) {
+ $this->fileTransformation = $fileTransformation;
+ }
} \ No newline at end of file