summaryrefslogtreecommitdiffstats
path: root/lib/preview.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/preview.php')
-rwxr-xr-xlib/preview.php37
1 files changed, 14 insertions, 23 deletions
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);