Refacto all project #1

Merged
Xefir merged 18 commits from test into master 2023-06-17 23:48:37 +00:00
33 changed files with 1518 additions and 1165 deletions
Showing only changes of commit e896016ff9 - Show all commits

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.idea
*.iml
/vendor/
/build/
node_modules/
/.php-cs-fixer.cache
js/*hot-update.*

18
.php-cs-fixer.dist.php Normal file
View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
require_once './vendor/autoload.php';
use Nextcloud\CodingStandard\Config;
$config = new Config();
$config
->getFinder()
->ignoreVCSIgnored(true)
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;

View File

@ -12,7 +12,6 @@
namespace OCA\Epubreader\AppInfo;
use OCP\AppFramework\App;
use OCP\Util;
$l = \OC::$server->getL10N('epubreader');

View File

@ -29,7 +29,7 @@ See [README] for more exhaustive information on features and potential misfeatur
[README]: https://github.com/e-alfred/epubreader/blob/master/epubreader/README.md
]]>
</description>
<version>1.4.7</version>
<version>1.4.8</version>
<licence>agpl</licence>
<author>Frank de Lange</author>
<author>e-alfred</author>
@ -46,7 +46,7 @@ See [README] for more exhaustive information on features and potential misfeatur
<screenshot>https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-00.jpg?raw=true</screenshot>
<screenshot>https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-02.jpg?raw=true</screenshot>
<dependencies>
<nextcloud min-version="21" max-version="23"/>
<nextcloud min-version="21" max-version="27"/>
</dependencies>
<settings>
<personal>OCA\Epubreader\Settings\Personal</personal>

View File

@ -38,4 +38,3 @@ return ['routes' => [
// User Settings
['name' => 'settings#setPreference', 'url' => '/settings/set', 'verb' => 'POST'],
]];

30
composer.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "nextcloud/epubreader",
"description": "EPUB/CBZ/PDF ebook reader",
"version": "1.4.8",
"type": "project",
"license": "AGPL-3.0-or-later",
"require-dev": {
"nextcloud/ocp": "^21.0.0",
"psalm/phar": "^5.12.0",
"nextcloud/coding-standard": "^1.1.1"
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"psalm": "psalm.phar --threads=1 --no-cache",
"psalm:fix": "psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
},
"autoload": {
"psr-4": {
"OCA\\Epubreader\\": "lib/",
"OC\\": "stubs/oc/"
}
},
"config": {
"platform": {
"php": "7.4"
}
}
}

189
composer.lock generated Normal file
View File

@ -0,0 +1,189 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6684feffdd51c1ea6c0f31066f3e5560",
"packages": [],
"packages-dev": [
{
"name": "nextcloud/coding-standard",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/coding-standard.git",
"reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb",
"reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb",
"shasum": ""
},
"require": {
"php": "^7.3|^8.0",
"php-cs-fixer/shim": "^3.17"
},
"type": "library",
"autoload": {
"psr-4": {
"Nextcloud\\CodingStandard\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Wurst",
"email": "christoph@winzerhof-wurst.at"
}
],
"description": "Nextcloud coding standards for the php cs fixer",
"support": {
"issues": "https://github.com/nextcloud/coding-standard/issues",
"source": "https://github.com/nextcloud/coding-standard/tree/v1.1.1"
},
"time": "2023-06-01T12:05:01+00:00"
},
{
"name": "nextcloud/ocp",
"version": "v21.0.0",
"source": {
"type": "git",
"url": "https://github.com/nextcloud-deps/ocp.git",
"reference": "41e1476b4aed5bce7371895054049eca353729c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/41e1476b4aed5bce7371895054049eca353729c5",
"reference": "41e1476b4aed5bce7371895054049eca353729c5",
"shasum": ""
},
"require": {
"php": "^7.3 || ~8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "21.0.0-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"AGPL-3.0-or-later"
],
"authors": [
{
"name": "Christoph Wurst",
"email": "christoph@winzerhof-wurst.at"
}
],
"description": "Composer package containing Nextcloud's public API (classes, interfaces)",
"support": {
"source": "https://github.com/nextcloud-deps/ocp/tree/v21.0.0"
},
"time": "2021-03-01T08:42:25+00:00"
},
{
"name": "php-cs-fixer/shim",
"version": "v3.17.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f",
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.4 || ^8.0"
},
"replace": {
"friendsofphp/php-cs-fixer": "self.version"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters."
},
"bin": [
"php-cs-fixer",
"php-cs-fixer.phar"
],
"type": "application",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.17.0"
},
"time": "2023-05-22T20:00:38+00:00"
},
{
"name": "psalm/phar",
"version": "5.12.0",
"source": {
"type": "git",
"url": "https://github.com/psalm/phar.git",
"reference": "e7f9306ec83c706b4dba451f6adfb865ce4688e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/psalm/phar/zipball/e7f9306ec83c706b4dba451f6adfb865ce4688e4",
"reference": "e7f9306ec83c706b4dba451f6adfb865ce4688e4",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"vimeo/psalm": "*"
},
"bin": [
"psalm.phar"
],
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Composer-based Psalm Phar",
"support": {
"issues": "https://github.com/psalm/phar/issues",
"source": "https://github.com/psalm/phar/tree/5.12.0"
},
"time": "2023-05-22T21:30:41+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "7.4"
},
"plugin-api-version": "2.3.0"
}

View File

@ -10,12 +10,11 @@
namespace OCA\Epubreader\Controller;
use OCP\IRequest;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCA\Epubreader\Service\BookmarkService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
class BookmarkController extends Controller {

View File

@ -10,10 +10,10 @@
namespace OCA\Epubreader\Controller;
use OCP\IRequest;
use OCA\Epubreader\Service\MetadataService;
use OCP\AppFramework\Controller;
use OCA\Epubreader\Service\MetadataService;
use OCP\IRequest;
class MetadataController extends Controller {

View File

@ -10,19 +10,18 @@
namespace OCA\Epubreader\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\Files\IRootFolder;
use OCP\Share\IManager;
use OCP\Files\FileInfo;
use OCP\Files\NotFoundException;
use OCA\Epubreader\Service\BookmarkService;
use OCA\Epubreader\Service\MetadataService;
use OCA\Epubreader\Service\PreferenceService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\Share\IManager;
class PageController extends Controller {
@ -87,14 +86,14 @@ class PageController extends Controller {
* fileType => null
* ];
*/
$fileInfo = $this->getFileInfo($this->request->get['file']);
$fileInfo = $this->getFileInfo($this->request->getParam('file'));
$fileId = $fileInfo['fileId'];
$type = $this->request->get["type"];
$type = $this->request->getParam('type');
$scope = $template = $templates[$type];
$params = [
'urlGenerator' => $this->urlGenerator,
'downloadLink' => $this->request->get['file'],
'downloadLink' => $this->request->getParam('file'),
'scope' => $scope,
'fileId' => $fileInfo['fileId'],
'fileName' => $fileInfo['fileName'],
@ -102,7 +101,6 @@ class PageController extends Controller {
'cursor' => $this->toJson($this->bookmarkService->getCursor($fileId)),
'defaults' => $this->toJson($this->preferenceService->getDefault($scope)),
'preferences' => $this->toJson($this->preferenceService->get($scope, $fileId)),
'defaults' => $this->toJson($this->preferenceService->getDefault($scope)),
'metadata' => $this->toJson($this->metadataService->get($fileId)),
'annotations' => $this->toJson($this->bookmarkService->get($fileId))
];
@ -159,8 +157,7 @@ class PageController extends Controller {
} else {
$filePath = $path;
$fileId = $this->rootFolder->getUserFolder($this->userId)
->get(preg_replace("/.*\/remote.php\/webdav(.*)/", "$1", rawurldecode($this->request->get['file'])))
->getFileInfo()
->get(preg_replace("/.*\/remote.php\/webdav(.*)/", "$1", rawurldecode($this->request->getParam('file'))))
->getId();
}

View File

@ -10,12 +10,11 @@
namespace OCA\Epubreader\Controller;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\AppFramework\Http;
use OCP\AppFramework\Controller;
use OCA\Epubreader\Service\PreferenceService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
use OCP\IURLGenerator;
class PreferenceController extends Controller {

View File

@ -11,13 +11,13 @@
*/
namespace OCA\Epubreader\Controller;
use OCA\Epubreader\Config;
use OCA\Epubreader\Service\PreferenceService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\AppFramework\Http;
use OCP\AppFramework\Controller;
use OCA\Epubreader\Service\PreferenceService;
use OCA\Epubreader\Config;
use OCP\AppFramework\Http\JSONResponse;
class SettingsController extends Controller {
@ -46,12 +46,12 @@ class SettingsController extends Controller {
* @NoAdminRequired
*
* @param int $EpubEnable
* @param int $EpubEnable
* @param int $PdfEnable
* @param int $CbxEnable
*
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
public function setPreference(string $EpubEnable, string $PdfEnable, string $CbxEnable) {
public function setPreference(int $EpubEnable, int $PdfEnable, int $CbxEnable) {
$l = \OC::$server->getL10N('epubreader');

View File

@ -10,8 +10,6 @@
namespace OCA\Epubreader\Db;
use OCP\AppFramework\Db\Entity;
class Bookmark extends ReaderEntity implements \JsonSerializable {
protected $userId; // user
@ -22,7 +20,7 @@ class Bookmark extends ReaderEntity implements \JsonSerializable {
protected $content; // bookmark content (annotations etc), can be empty
protected $lastModified; // modification timestamp
public function jsonSerialize() {
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),
@ -44,5 +42,60 @@ class Bookmark extends ReaderEntity implements \JsonSerializable {
'lastModified' => $this->getLastModified(),
];
}
public function getUserId() {
return $this->userId;
}
public function setUserId($userId) {
$this->userId = $userId;
}
public function getFileId() {
return $this->fileId;
}
public function setFileId($fileId) {
$this->fileId = $fileId;
}
public function getType() {
return $this->type;
}
public function setType($type) {
$this->type = $type;
}
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
}
public function getValue() {
return $this->value;
}
public function setValue($value) {
$this->value = $value;
}
public function getContent() {
return $this->content;
}
public function setContent($content) {
$this->content = $content;
}
public function getLastModified() {
return $this->lastModified;
}
public function setLastModified($lastModified) {
$this->lastModified = $lastModified;
}
}

View File

@ -10,11 +10,10 @@
namespace OCA\Epubreader\Db;
use OCA\Epubreader\Utility\Time;
use OCP\IDBConnection;
use OCA\Epubreader\Utility\Time;
class BookmarkMapper extends ReaderMapper {
private $userId;
@ -36,7 +35,7 @@ class BookmarkMapper extends ReaderMapper {
* @param string $name
* @return array
*/
public function get($fileId, $name, $type = null) {
public function get(int $fileId, $name, $type = null) {
$query = $this->db->getQueryBuilder();
$query->select('*')
->from($this->getTableName())
@ -98,27 +97,4 @@ class BookmarkMapper extends ReaderMapper {
return $bookmark;
}
/* currently not used */
public function deleteForFileId($fileId) {
$sql = "SELECT * FROM `*PREFIX*reader_bookmarks` WHERE file_id=?";
$args = [ $fileId ];
array_map(
function($entity) {
$this->delete($entity);
}, $this->findEntities($sql, $args)
);
}
/* currently not used */
public function deleteForUserId($userId) {
$sql = "SELECT * FROM `*PREFIX*reader_bookmarks` WHERE user_id=?";
$args = [ $userId ];
array_map(
function($entity) {
$this->delete($entity);
}, $this->findEntities($sql, $args)
);
}
}

View File

@ -10,8 +10,6 @@
namespace OCA\Epubreader\Db;
use OCP\AppFramework\Db\Entity;
class Preference extends ReaderEntity implements \JsonSerializable {
protected $userId; // user for whom this preference is valid
@ -21,7 +19,7 @@ class Preference extends ReaderEntity implements \JsonSerializable {
protected $value; // preference value
protected $lastModified; // modification timestamp
public function jsonSerialize() {
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'scope' => $this->getScope(),
@ -38,5 +36,52 @@ class Preference extends ReaderEntity implements \JsonSerializable {
'value' => $this->conditional_json_decode($this->getValue()),
];
}
public function getUserId() {
return $this->userId;
}
public function setUserId($userId) {
$this->userId = $userId;
}
public function getScope() {
return $this->scope;
}
public function setScope($scope) {
$this->scope = $scope;
}
public function getFileId() {
return $this->fileId;
}
public function setFileId($fileId) {
$this->fileId = $fileId;
}
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
}
public function getValue() {
return $this->value;
}
public function setValue($value) {
$this->value = $value;
}
public function getLastModified() {
return $this->lastModified;
}
public function setLastModified($lastModified) {
$this->lastModified = $lastModified;
}
}

View File

@ -10,12 +10,13 @@
namespace OCA\Epubreader\Db;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCA\Epubreader\Utility\Time;
use OCP\IDBConnection;
class PreferenceMapper extends ReaderMapper {
private $userId;
public function __construct(IDBConnection $db, $UserId, Time $time) {
parent::__construct($db, 'reader_prefs', Preference::class, $time);
$this->userId = $UserId;
@ -77,26 +78,4 @@ class PreferenceMapper extends ReaderMapper {
return $preference;
}
/* currently not used*/
public function deleteForFileId($fileId) {
$sql = "SELECT * FROM `*PREFIX*reader_prefs` WHERE file_id=?";
$args = [ $fileId ];
array_map(
function($entity) {
$this->delete($entity);
}, $this->findEntities($sql, $args)
);
}
/* currently not used*/
public function deleteForUserId($userId) {
$sql = "SELECT * FROM `*PREFIX*reader_prefs` WHERE user_id=?";
$args = [ $userId ];
array_map(
function($entity) {
$this->delete($entity);
}, $this->findEntities($sql, $args)
);
}
}

View File

@ -14,6 +14,8 @@ use OCP\AppFramework\Db\Entity;
class ReaderEntity extends Entity {
private $lastModified;
/* returns decoded json if input is json, otherwise returns input */
public static function conditional_json_decode($el) {
$result = json_decode($el);
@ -24,16 +26,12 @@ class ReaderEntity extends Entity {
}
}
/*
public function toService() {
return [
'name' => $this->getName(),
'type' => $this->getType(),
'value' => $this->conditional_json_decode($this->getValue()),
'content' => $this->conditional_json_decode($this->getContent()),
'lastModified' => $this->getLastModified(),
];
}
*/
public function getLastModified() {
return $this->lastModified;
}
public function setLastModified($lastModified) {
$this->lastModified = $lastModified;
}
}

View File

@ -10,12 +10,15 @@
namespace OCA\Epubreader\Db;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;
use OCP\AppFramework\Db\Entity;
use OCA\Epubreader\Utility\Time;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection;
/**
* @template-extends QBMapper<ReaderEntity>
*/
abstract class ReaderMapper extends QBMapper {
/**

View File

@ -10,11 +10,10 @@
namespace OCA\Epubreader;
use OCP\IDBConnection;
use OCP\Files\Node;
use OCP\IUser;
use OCP\Util;
use \OC\User\User as User;
use OCP\Files\Node;
use OCP\IDBConnection;
use OCP\Util;
class Hooks {

View File

@ -10,14 +10,13 @@
namespace OCA\Epubreader\Service;
use OCA\Epubreader\Db\BookmarkMapper;
class BookmarkService extends Service {
// "bookmark" name to use for the cursor (current reading position)
const CURSOR = '__CURSOR__';
const bookmark_type = 'bookmark';
public const CURSOR = '__CURSOR__';
public const bookmark_type = 'bookmark';
private $bookmarkMapper;
private $userId;
@ -110,4 +109,3 @@ class BookmarkService extends Service {
$this->delete($fileId, static::CURSOR, static::bookmark_type);
}
}

View File

@ -32,16 +32,6 @@ class MetadataService {
* @return array
*/
public function get($fileId, $name = null) {
if ($this->appManager->isInstalled('files_opds')) {
if ($meta = \OCA\Files_Opds\Meta::get($fileId)) {
if (!empty($name) && array_key_exists($name, $meta)) {
return [$item => $meta[$name]];
} else {
return $meta;
}
}
}
return [];
}
@ -72,4 +62,3 @@ class MetadataService {
return [];
}
}

View File

@ -16,7 +16,7 @@ class PreferenceService extends Service {
// (ab)use the fact that $fileId never goes below 1 by using the
// value 0 to indicate a default preference
const DEFAULTS = 0;
public const DEFAULTS = 0;
private $preferenceMapper;

View File

@ -20,6 +20,3 @@ abstract class Service {
$this->mapper = $mapper;
}
}

View File

@ -12,11 +12,10 @@
namespace OCA\Epubreader\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Settings\ISettings;
use OCP\IConfig;
use OCP\Settings\ISettings;
class Personal implements ISettings
{
class Personal implements ISettings {
private $userId;
private $configManager;
@ -24,8 +23,7 @@ class Personal implements ISettings
public function __construct(
$userId,
IConfig $configManager
)
{
) {
$this->userId = $userId;
$this->configManager = $configManager;
}
@ -34,8 +32,7 @@ class Personal implements ISettings
* @return TemplateResponse returns the instance with all parameters set, ready to be rendered
* @since 9.1
*/
public function getForm()
{
public function getForm() {
$parameters = [
'EpubEnable' => $this->configManager->getUserValue($this->userId, 'epubreader', 'epub_enable'),
@ -50,8 +47,7 @@ class Personal implements ISettings
*
* @return TemplateResponse
*/
public function getPanel()
{
public function getPanel() {
return $this->getForm();
}
@ -59,8 +55,7 @@ class Personal implements ISettings
* @return string the section ID, e.g. 'sharing'
* @since 9.1
*/
public function getSection()
{
public function getSection() {
return 'epubreader';
}
@ -69,8 +64,7 @@ class Personal implements ISettings
*
* @return string
*/
public function getSectionID()
{
public function getSectionID() {
return 'epubreader';
}
@ -82,8 +76,7 @@ class Personal implements ISettings
* E.g.: 70
* @since 9.1
*/
public function getPriority()
{
public function getPriority() {
return 10;
}
}

View File

@ -15,15 +15,13 @@ use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
class PersonalSection implements IIconSection
{
class PersonalSection implements IIconSection {
/** @var IURLGenerator */
private $urlGenerator;
/** @var IL10N */
private $l;
public function __construct(IURLGenerator $urlGenerator, IL10N $l)
{
public function __construct(IURLGenerator $urlGenerator, IL10N $l) {
$this->urlGenerator = $urlGenerator;
$this->l = $l;
}
@ -33,8 +31,7 @@ class PersonalSection implements IIconSection
*
* @returns string
*/
public function getIcon()
{
public function getIcon() {
return $this->urlGenerator->imagePath('epubreader', 'app.svg');
}
@ -43,8 +40,7 @@ class PersonalSection implements IIconSection
*
* @returns string
*/
public function getID()
{
public function getID() {
return 'epubreader';
}
@ -53,8 +49,7 @@ class PersonalSection implements IIconSection
*
* @return string
*/
public function getName()
{
public function getName() {
return $this->l->t('EPUB/CBZ/PDF ebook reader');
}
@ -63,8 +58,7 @@ class PersonalSection implements IIconSection
*
* @return int
*/
public function getPriority()
{
public function getPriority() {
return 20;
}
}

View File

@ -16,10 +16,9 @@ class Time {
}
/**
*
* @return int the current unix time in miliseconds
* @return string the current unix time in miliseconds
*/
public function getMicroTime() {
public function getMicroTime(): string {
list($millisecs, $secs) = explode(" ", microtime());
return $secs . substr($millisecs, 2, 6);
}

View File

@ -15,8 +15,7 @@ namespace OCA\Epubreader;
/**
* Config class for Reader
*/
class Config
{
class Config {
/**
* @brief get user config value
*

35
psalm.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="lib" />
<directory name="stubs" />
</projectFiles>
<extraFiles>
<directory name="vendor" />
<ignoreFiles>
<directory name="vendor/psalm" />
</ignoreFiles>
</extraFiles>
<issueHandlers>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="OC\AppFramework\OCS\BaseResponse" />
<referencedClass name="Doctrine\DBAL\Schema\Schema" />
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
</errorLevel>
</UndefinedDocblockClass>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="OC" />
</errorLevel>
</UndefinedClass>
</issueHandlers>
</psalm>

View File

@ -0,0 +1,53 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\Hooks;
/**
* Class Emitter
*
* interface for all classes that are able to emit events
*
* @package OC\Hooks
* @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service
*/
interface Emitter {
/**
* @param string $scope
* @param string $method
* @param callable $callback
* @return void
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
*/
public function listen($scope, $method, callable $callback);
/**
* @param string $scope optional
* @param string $method optional
* @param callable $callback optional
* @return void
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
*/
public function removeListener($scope = null, $method = null, callable $callback = null);
}

View File

@ -19,7 +19,9 @@ style('epubreader', 'settings');
<p>
<input type="checkbox" name="EpubEnable" id="EpubEnable" class="checkbox"
value="1" <?php if ($_['EpubEnable'] === "true") print_unescaped('checked="checked"'); ?> />
value="1" <?php if ($_['EpubEnable'] === "true") {
print_unescaped('checked="checked"');
} ?> />
<label for="EpubEnable">
<?php p($l->t('Epub'));?>
</label>
@ -27,14 +29,18 @@ style('epubreader', 'settings');
<p>
<input type="checkbox" name="PdfEnable" id="PdfEnable" class="checkbox"
value="1" <?php if ($_['PdfEnable'] === "true") print_unescaped('checked="checked"'); ?> />
value="1" <?php if ($_['PdfEnable'] === "true") {
print_unescaped('checked="checked"');
} ?> />
<label for="PdfEnable">
<?php p($l->t('PDF'));?>
</label><br/>
</p>
<p>
<input type="checkbox" name="CbxEnable" id="CbxEnable" class="checkbox"
value="1" <?php if ($_['CbxEnable'] === "true") print_unescaped('checked="checked"'); ?> />
value="1" <?php if ($_['CbxEnable'] === "true") {
print_unescaped('checked="checked"');
} ?> />
<label for="CbxEnable">
<?php p($l->t('CBR/CBZ'));?>
</label><br/>