]> source.dussan.org Git - nextcloud-server.git/commitdiff
moving file to the right location
authorThomas Müller <thomas.mueller@tmit.eu>
Sun, 6 Oct 2013 22:32:39 +0000 (00:32 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Sun, 6 Oct 2013 22:32:39 +0000 (00:32 +0200)
lib/apphelper.php [deleted file]
lib/l10n/factory.php [deleted file]
lib/private/apphelper.php [new file with mode: 0644]
lib/private/l10n/factory.php [new file with mode: 0644]
lib/private/urlgenerator.php [new file with mode: 0644]
lib/urlgenerator.php [deleted file]

diff --git a/lib/apphelper.php b/lib/apphelper.php
deleted file mode 100644 (file)
index bd02f3a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- *
- */
-
-namespace OC;
-
-/**
- * TODO: Description
- */
-class AppHelper implements \OCP\IHelper {
-       /**
-        * Gets the content of an URL by using CURL or a fallback if it is not
-        * installed
-        * @param string $url the url that should be fetched
-        * @return string the content of the webpage
-        */
-       public function getUrlContent($url) {
-               return \OC_Util::getUrlContent($url);
-       }
-}
diff --git a/lib/l10n/factory.php b/lib/l10n/factory.php
deleted file mode 100644 (file)
index ba16887..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- *
- */
-
-namespace OC\L10N;
-
-/**
- * TODO: Description
- */
-class Factory {
-       /**
-        * cached instances
-        */
-       protected $instances = array();
-
-       /**
-        * get an L10N instance
-        * @param $app string
-        * @param $lang string|null
-        * @return OC_L10N
-        */
-       public function get($app) {
-               if (!isset($this->instances[$app])) {
-                       $this->instances[$app] = new \OC_L10N($app);
-               }
-               return $this->instances[$app];
-       }
-
-}
diff --git a/lib/private/apphelper.php b/lib/private/apphelper.php
new file mode 100644 (file)
index 0000000..bd02f3a
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ */
+
+namespace OC;
+
+/**
+ * TODO: Description
+ */
+class AppHelper implements \OCP\IHelper {
+       /**
+        * Gets the content of an URL by using CURL or a fallback if it is not
+        * installed
+        * @param string $url the url that should be fetched
+        * @return string the content of the webpage
+        */
+       public function getUrlContent($url) {
+               return \OC_Util::getUrlContent($url);
+       }
+}
diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php
new file mode 100644 (file)
index 0000000..8c65f36
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ */
+
+namespace OC\L10N;
+
+/**
+ * TODO: Description
+ */
+class Factory {
+       /**
+        * cached instances
+        */
+       protected $instances = array();
+
+       /**
+        * get an L10N instance
+        * @param $app string
+        * @param $lang string|null
+        * @return \OC_L10N
+        */
+       public function get($app) {
+               if (!isset($this->instances[$app])) {
+                       $this->instances[$app] = new \OC_L10N($app);
+               }
+               return $this->instances[$app];
+       }
+
+}
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
new file mode 100644 (file)
index 0000000..5c1d9d8
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ */
+
+namespace OC;
+use OCP\IURLGenerator;
+use RuntimeException;
+
+/**
+ * Class to generate URLs
+ */
+class URLGenerator implements IURLGenerator {
+       /**
+        * @brief Creates an url using a defined route
+        * @param $route
+        * @param array $parameters
+        * @return
+        * @internal param array $args with param=>value, will be appended to the returned url
+        * @returns string the url
+        *
+        * Returns a url to the given app and file.
+        */
+       public function linkToRoute($route, $parameters = array()) {
+               $urlLinkTo = \OC::getRouter()->generate($route, $parameters);
+               return $urlLinkTo;
+       }
+
+       /**
+        * @brief Creates an url
+        * @param string $app app
+        * @param string $file file
+        * @param array $args array with param=>value, will be appended to the returned url
+        *    The value of $args will be urlencoded
+        * @return string the url
+        *
+        * Returns a url to the given app and file.
+        */
+       public function linkTo( $app, $file, $args = array() ) {
+               if( $app != '' ) {
+                       $app_path = \OC_App::getAppPath($app);
+                       // Check if the app is in the app folder
+                       if ($app_path && file_exists($app_path . '/' . $file)) {
+                               if (substr($file, -3) == 'php' || substr($file, -3) == 'css') {
+                                       $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app;
+                                       $urlLinkTo .= ($file != 'index.php') ? '/' . $file : '';
+                               } else {
+                                       $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file;
+                               }
+                       } else {
+                               $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file;
+                       }
+               } else {
+                       if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) {
+                               $urlLinkTo = \OC::$WEBROOT . '/core/' . $file;
+                       } else {
+                               $urlLinkTo = \OC::$WEBROOT . '/' . $file;
+                       }
+               }
+
+               if ($args && $query = http_build_query($args, '', '&')) {
+                       $urlLinkTo .= '?' . $query;
+               }
+
+               return $urlLinkTo;
+       }
+
+       /**
+        * @brief Creates path to an image
+        * @param string $app app
+        * @param string $image image name
+        * @return string the url
+        *
+        * Returns the path to the image.
+        */
+       public function imagePath($app, $image) {
+               // Read the selected theme from the config file
+               $theme = \OC_Util::getTheme();
+
+               // Check if the app is in the app folder
+               if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
+                       return \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image";
+               } elseif (file_exists(\OC_App::getAppPath($app) . "/img/$image")) {
+                       return \OC_App::getAppWebPath($app) . "/img/$image";
+               } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) {
+                       return \OC::$WEBROOT . "/themes/$theme/$app/img/$image";
+               } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) {
+                       return \OC::$WEBROOT . "/$app/img/$image";
+               } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) {
+                       return \OC::$WEBROOT . "/themes/$theme/core/img/$image";
+               } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) {
+                       return \OC::$WEBROOT . "/core/img/$image";
+               } else {
+                       throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT);
+               }
+       }
+
+
+       /**
+        * Makes an URL absolute
+        * @param string $url the url in the owncloud host
+        * @return string the absolute version of the url
+        */
+       public function getAbsoluteURL($url) {
+               return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . $url;
+       }
+}
diff --git a/lib/urlgenerator.php b/lib/urlgenerator.php
deleted file mode 100644 (file)
index 1db4c36..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- *
- */
-
-namespace OC;
-
-/**
- * Class to generate URLs
- */
-class URLGenerator {
-       /**
-        * @brief Creates an url using a defined route
-        * @param $route
-        * @param array $parameters
-        * @return
-        * @internal param array $args with param=>value, will be appended to the returned url
-        * @returns the url
-        *
-        * Returns a url to the given app and file.
-        */
-       public function linkToRoute($route, $parameters = array()) {
-               $urlLinkTo = \OC::getRouter()->generate($route, $parameters);
-               return $urlLinkTo;
-       }
-
-       /**
-        * @brief Creates an url
-        * @param string $app app
-        * @param string $file file
-        * @param array $args array with param=>value, will be appended to the returned url
-        *    The value of $args will be urlencoded
-        * @return string the url
-        *
-        * Returns a url to the given app and file.
-        */
-       public function linkTo( $app, $file, $args = array() ) {
-               if( $app != '' ) {
-                       $app_path = \OC_App::getAppPath($app);
-                       // Check if the app is in the app folder
-                       if ($app_path && file_exists($app_path . '/' . $file)) {
-                               if (substr($file, -3) == 'php' || substr($file, -3) == 'css') {
-                                       $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app;
-                                       $urlLinkTo .= ($file != 'index.php') ? '/' . $file : '';
-                               } else {
-                                       $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file;
-                               }
-                       } else {
-                               $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file;
-                       }
-               } else {
-                       if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) {
-                               $urlLinkTo = \OC::$WEBROOT . '/core/' . $file;
-                       } else {
-                               $urlLinkTo = \OC::$WEBROOT . '/' . $file;
-                       }
-               }
-
-               if ($args && $query = http_build_query($args, '', '&')) {
-                       $urlLinkTo .= '?' . $query;
-               }
-
-               return $urlLinkTo;
-       }
-
-       /**
-        * @brief Creates path to an image
-        * @param string $app app
-        * @param string $image image name
-        * @return string the url
-        *
-        * Returns the path to the image.
-        */
-       public function imagePath($app, $image) {
-               // Read the selected theme from the config file
-               $theme = \OC_Util::getTheme();
-
-               // Check if the app is in the app folder
-               if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
-                       return \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image";
-               } elseif (file_exists(\OC_App::getAppPath($app) . "/img/$image")) {
-                       return \OC_App::getAppWebPath($app) . "/img/$image";
-               } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) {
-                       return \OC::$WEBROOT . "/themes/$theme/$app/img/$image";
-               } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) {
-                       return \OC::$WEBROOT . "/$app/img/$image";
-               } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) {
-                       return \OC::$WEBROOT . "/themes/$theme/core/img/$image";
-               } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) {
-                       return \OC::$WEBROOT . "/core/img/$image";
-               } else {
-                       throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT);
-               }
-       }
-
-       /**
-        * @brief Makes an $url absolute
-        * @param string $url the url
-        * @return string the absolute url
-        *
-        * Returns a absolute url to the given app and file.
-        */
-       public function makeURLAbsolute($url) {
-               return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . $url;
-       }
-
-}