summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2013-07-29 14:46:20 +0200
committerGeorg Ehrke <developer@georgehrke.com>2013-07-29 14:51:06 +0200
commite01bc7de987ddb7d33feb75ad598bdf97c348105 (patch)
tree02983d5ad08ae4141d890739631a8dc216bd4af5
parent65affdc9b32629ab4692f77ffd4dff77e026b1dc (diff)
downloadnextcloud-server-e01bc7de987ddb7d33feb75ad598bdf97c348105.tar.gz
nextcloud-server-e01bc7de987ddb7d33feb75ad598bdf97c348105.zip
Revert "OC\Preview - outsource static methods"
This reverts commit 14a35267c15115a1e7d2901ddd9b8c5c7e1b9a31.
-rw-r--r--core/routes.php7
-rwxr-xr-xlib/preview.php37
-rw-r--r--lib/preview/images.php2
-rw-r--r--lib/preview/libreoffice-cl.php10
-rw-r--r--lib/preview/movies.php2
-rw-r--r--lib/preview/mp3.php2
-rw-r--r--lib/preview/msoffice.php12
-rw-r--r--lib/preview/pdf.php2
-rw-r--r--lib/preview/svg.php2
-rw-r--r--lib/preview/txt.php6
-rw-r--r--lib/preview/unknown.php2
11 files changed, 37 insertions, 47 deletions
diff --git a/core/routes.php b/core/routes.php
index c0e658b26dc..41e82f8a73d 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -42,13 +42,12 @@ $this->create('js_config', '/core/js/config.js')
// Routing
$this->create('core_ajax_routes', '/core/routes.json')
->action('OC_Router', 'JSRoutes');
-OC::$CLASSPATH['OC\PreviewManager'] = 'lib/preview.php';
$this->create('core_ajax_preview', '/core/preview.png')
- ->action('OC\PreviewManager', 'previewRouter');
+ ->action('OC\Preview', 'previewRouter');
$this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png')
- ->action('OC\PreviewManager', 'trashbinPreviewRouter');
+ ->action('OC\Preview', 'trashbinPreviewRouter');
$this->create('core_ajax_public_preview', '/core/publicpreview.png')
- ->action('OC\PreviewManager', 'publicPreviewRouter');
+ ->action('OC\Preview', 'publicPreviewRouter');
OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php';
$this->create('core_lostpassword_index', '/lostpassword/')
->get()
diff --git a/lib/preview.php b/lib/preview.php
index c570a17e4a7..113b200c29b 100755
--- a/lib/preview.php
+++ b/lib/preview.php
@@ -44,6 +44,10 @@ class Preview {
//preview images object
private $preview;
+ //preview providers
+ static private $providers = array();
+ static private $registeredProviders = array();
+
/**
* @brief check if thumbnail or bigger version of thumbnail of file is cached
* @param string $user userid - if no user is given, OC_User::getUser will be used
@@ -78,13 +82,11 @@ class Preview {
$this->preview = null;
//check if there are preview backends
- $providers = PreviewManager::getProviders();
- if(empty($providers)) {
- PreviewManager::initProviders();
+ if(empty(self::$providers)) {
+ self::initProviders();
}
- $providers = PreviewManager::getProviders();
- if(empty($providers)) {
+ if(empty(self::$providers)) {
\OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR);
throw new \Exception('No preview providers');
}
@@ -384,8 +386,7 @@ class Preview {
$mimetype = $this->fileview->getMimeType($file);
$preview = null;
- $providers = PreviewManager::getProviders();
- foreach($providers as $supportedmimetype => $provider) {
+ foreach(self::$providers as $supportedmimetype => $provider) {
if(!preg_match($supportedmimetype, $mimetype)) {
continue;
}
@@ -549,16 +550,6 @@ class Preview {
return;
}
}
-}
-
-class PreviewManager {
- //preview providers
- static private $providers = array();
- static private $registeredProviders = array();
-
- public static function getProviders() {
- return self::$providers;
- }
/**
* @brief register a new preview provider to be used
@@ -574,7 +565,7 @@ class PreviewManager {
* @brief create instances of all the registered preview providers
* @return void
*/
- public static function initProviders() {
+ private static function initProviders() {
if(count(self::$providers)>0) {
return;
}
@@ -600,8 +591,8 @@ class PreviewManager {
\OC_Util::checkLoggedIn();
$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
- $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44';
- $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44';
+ $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
+ $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
$scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
if($file === '') {
@@ -644,8 +635,8 @@ class PreviewManager {
}
$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
- $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44';
- $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44';
+ $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
+ $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
$scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
$token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : '';
@@ -781,7 +772,7 @@ class PreviewManager {
$preview->deleteAllPreviews();
}
- public static function showErrorPreview() {
+ private static function showErrorPreview() {
$path = \OC::$SERVERROOT . '/core/img/actions/delete.png';
$preview = new \OC_Image($path);
$preview->preciseResize(36, 36);
diff --git a/lib/preview/images.php b/lib/preview/images.php
index 84ab9f1ae43..987aa9aef0a 100644
--- a/lib/preview/images.php
+++ b/lib/preview/images.php
@@ -30,4 +30,4 @@ class Image extends Provider {
}
}
-\OC\PreviewManager::registerProvider('OC\Preview\Image'); \ No newline at end of file
+\OC\Preview::registerProvider('OC\Preview\Image'); \ No newline at end of file
diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php
index ffe8de505f7..2749c4867e9 100644
--- a/lib/preview/libreoffice-cl.php
+++ b/lib/preview/libreoffice-cl.php
@@ -80,7 +80,7 @@ class MSOfficeDoc extends Office {
}
-\OC\PreviewManager::registerProvider('OC\Preview\MSOfficeDoc');
+\OC\Preview::registerProvider('OC\Preview\MSOfficeDoc');
//.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m)
class MSOffice2003 extends Office {
@@ -91,7 +91,7 @@ class MSOffice2003 extends Office {
}
-\OC\PreviewManager::registerProvider('OC\Preview\MSOffice2003');
+\OC\Preview::registerProvider('OC\Preview\MSOffice2003');
//.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx
class MSOffice2007 extends Office {
@@ -102,7 +102,7 @@ class MSOffice2007 extends Office {
}
-\OC\PreviewManager::registerProvider('OC\Preview\MSOffice2007');
+\OC\Preview::registerProvider('OC\Preview\MSOffice2007');
//.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt
class OpenDocument extends Office {
@@ -113,7 +113,7 @@ class OpenDocument extends Office {
}
-\OC\PreviewManager::registerProvider('OC\Preview\OpenDocument');
+\OC\Preview::registerProvider('OC\Preview\OpenDocument');
//.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm
class StarOffice extends Office {
@@ -124,4 +124,4 @@ class StarOffice extends Office {
}
-\OC\PreviewManager::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file
+\OC\Preview::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file
diff --git a/lib/preview/movies.php b/lib/preview/movies.php
index f4452e02fc2..8531050d112 100644
--- a/lib/preview/movies.php
+++ b/lib/preview/movies.php
@@ -39,5 +39,5 @@ if(!is_null(shell_exec('ffmpeg -version'))) {
}
}
- \OC\PreviewManager::registerProvider('OC\Preview\Movie');
+ \OC\Preview::registerProvider('OC\Preview\Movie');
} \ No newline at end of file
diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php
index baa24ad129e..835ff529000 100644
--- a/lib/preview/mp3.php
+++ b/lib/preview/mp3.php
@@ -43,4 +43,4 @@ class MP3 extends Provider {
}
-\OC\PreviewManager::registerProvider('OC\Preview\MP3'); \ No newline at end of file
+\OC\Preview::registerProvider('OC\Preview\MP3'); \ No newline at end of file
diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php
index 9f6ea7f74cf..ccf1d674c7a 100644
--- a/lib/preview/msoffice.php
+++ b/lib/preview/msoffice.php
@@ -20,7 +20,7 @@ class DOC extends Provider {
}
-\OC\PreviewManager::registerProvider('OC\Preview\DOC');
+\OC\Preview::registerProvider('OC\Preview\DOC');
*/
class DOCX extends Provider {
@@ -50,7 +50,7 @@ class DOCX extends Provider {
}
-\OC\PreviewManager::registerProvider('OC\Preview\DOCX');
+\OC\Preview::registerProvider('OC\Preview\DOCX');
class MSOfficeExcel extends Provider {
@@ -95,7 +95,7 @@ class XLS extends MSOfficeExcel {
}
-\OC\PreviewManager::registerProvider('OC\Preview\XLS');
+\OC\Preview::registerProvider('OC\Preview\XLS');
class XLSX extends MSOfficeExcel {
@@ -105,7 +105,7 @@ class XLSX extends MSOfficeExcel {
}
-\OC\PreviewManager::registerProvider('OC\Preview\XLSX');
+\OC\Preview::registerProvider('OC\Preview\XLSX');
/* //There is no (good) php-only solution for converting powerpoint documents to pdfs / pngs ...
class MSOfficePowerPoint extends Provider {
@@ -128,7 +128,7 @@ class PPT extends MSOfficePowerPoint {
}
-\OC\PreviewManager::registerProvider('OC\Preview\PPT');
+\OC\Preview::registerProvider('OC\Preview\PPT');
class PPTX extends MSOfficePowerPoint {
@@ -138,5 +138,5 @@ class PPTX extends MSOfficePowerPoint {
}
-\OC\PreviewManager::registerProvider('OC\Preview\PPTX');
+\OC\Preview::registerProvider('OC\Preview\PPTX');
*/ \ No newline at end of file
diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php
index 0d289e9db94..3eabd201156 100644
--- a/lib/preview/pdf.php
+++ b/lib/preview/pdf.php
@@ -36,5 +36,5 @@ if (extension_loaded('imagick')) {
}
}
- \OC\PreviewManager::registerProvider('OC\Preview\PDF');
+ \OC\Preview::registerProvider('OC\Preview\PDF');
}
diff --git a/lib/preview/svg.php b/lib/preview/svg.php
index 5507686af97..bafaf71b15a 100644
--- a/lib/preview/svg.php
+++ b/lib/preview/svg.php
@@ -39,6 +39,6 @@ if (extension_loaded('imagick')) {
}
}
- \OC\PreviewManager::registerProvider('OC\Preview\SVG');
+ \OC\Preview::registerProvider('OC\Preview\SVG');
} \ No newline at end of file
diff --git a/lib/preview/txt.php b/lib/preview/txt.php
index acbf34c5e42..c7b8fabc6b0 100644
--- a/lib/preview/txt.php
+++ b/lib/preview/txt.php
@@ -46,7 +46,7 @@ class TXT extends Provider {
}
}
-\OC\PreviewManager::registerProvider('OC\Preview\TXT');
+\OC\Preview::registerProvider('OC\Preview\TXT');
class PHP extends TXT {
@@ -56,7 +56,7 @@ class PHP extends TXT {
}
-\OC\PreviewManager::registerProvider('OC\Preview\PHP');
+\OC\Preview::registerProvider('OC\Preview\PHP');
class JavaScript extends TXT {
@@ -66,4 +66,4 @@ class JavaScript extends TXT {
}
-\OC\PreviewManager::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file
+\OC\Preview::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file
diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php
index f9f6fe957b2..a31b365722e 100644
--- a/lib/preview/unknown.php
+++ b/lib/preview/unknown.php
@@ -40,4 +40,4 @@ class Unknown extends Provider {
}
}
-\OC\PreviewManager::registerProvider('OC\Preview\Unknown'); \ No newline at end of file
+\OC\Preview::registerProvider('OC\Preview\Unknown'); \ No newline at end of file