diff options
61 files changed, 1147 insertions, 473 deletions
diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ead3dd199..d343f1edc 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -27,3 +27,5 @@ checks: # this is not working properly with core exceptions catch_class_exists: false avoid_tab_indentation: true + line_length: + max_length: '80' diff --git a/appinfo/application.php b/appinfo/application.php index 8a1f02a4c..5b76680c4 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -72,7 +72,7 @@ foreach ($thirdPartyLibs as $class => $path) { class Application extends App { - public function __construct(array $urlParams=array()){ + public function __construct(array $urlParams=[]) { parent::__construct('news', $urlParams); $container = $this->getContainer(); @@ -323,7 +323,8 @@ class Application extends App { }); $container->registerService('DatabaseType', function($c) { - return $c->query('ServerContainer')->getConfig()->getSystemValue('dbtype'); + return $c->query('ServerContainer') + ->getConfig()->getSystemValue('dbtype'); }); @@ -354,8 +355,8 @@ class Application extends App { }); $container->registerService('simplePieCacheDirectory', function($c) { - $directory = $c->query('CoreConfig')->getSystemValue('datadirectory') . - '/news/cache/simplepie'; + $directory = $c->query('CoreConfig') + ->getSystemValue('datadirectory') . '/news/cache/simplepie'; if(!is_dir($directory)) { mkdir($directory, 0770, true); @@ -364,8 +365,8 @@ class Application extends App { }); $container->registerService('HTMLPurifier', function($c) { - $directory = $c->query('CoreConfig')->getSystemValue('datadirectory') . - '/news/cache/purifier'; + $directory = $c->query('CoreConfig') + ->getSystemValue('datadirectory') . '/news/cache/purifier'; if(!is_dir($directory)) { mkdir($directory, 0770, true); @@ -394,7 +395,8 @@ class Application extends App { __DIR__ . '/../articleenhancer/xpathenhancers.json' ); - foreach(json_decode($xpathEnhancerConfig, true) as $feed => $config) { + $xpathEnhancerConfig = json_decode($xpathEnhancerConfig, true); + foreach($xpathEnhancerConfig as $feed => $config) { $articleEnhancer = new XPathArticleEnhancer( $c->query('SimplePieAPIFactory'), $config, @@ -406,14 +408,18 @@ class Application extends App { $regexEnhancerConfig = file_get_contents( __DIR__ . '/../articleenhancer/regexenhancers.json' ); - foreach(json_decode($regexEnhancerConfig, true) as $feed => $config) { + $regexEnhancerConfig = json_decode($regexEnhancerConfig, true); + foreach($regexEnhancerConfig as $feed => $config) { foreach ($config as $matchArticleUrl => $regex) { - $articleEnhancer = new RegexArticleEnhancer($matchArticleUrl, $regex); + $articleEnhancer = + new RegexArticleEnhancer($matchArticleUrl, $regex); $enhancer->registerEnhancer($feed, $articleEnhancer); } } - $enhancer->registerGlobalEnhancer($c->query('GlobalArticleEnhancer')); + $enhancer->registerGlobalEnhancer( + $c->query('GlobalArticleEnhancer') + ); return $enhancer; }); diff --git a/appinfo/routes.php b/appinfo/routes.php index 4287bd4a9..ac309a5ea 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -18,81 +18,317 @@ use \OCA\News\AppInfo\Application; $application = new Application(); $application->registerRoutes($this, ['routes' => [ // page - ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], - ['name' => 'page#settings', 'url' => '/settings', 'verb' => 'GET'], - ['name' => 'page#update_settings', 'url' => '/settings', 'verb' => 'PUT'], - ['name' => 'page#manifest', 'url' => '/manifest.webapp', 'verb' => 'GET'], + [ + 'name' => 'page#index', + 'url' => '/', + 'verb' => 'GET' + ], + [ + 'name' => 'page#settings', + 'url' => '/settings', + 'verb' => 'GET' + ], + [ + 'name' => 'page#update_settings', + 'url' => '/settings', + 'verb' => 'PUT' + ], + [ + 'name' => 'page#manifest', + 'url' => '/manifest.webapp', + 'verb' => 'GET' + ], // admin - ['name' => 'admin#update', 'url' => '/admin', 'verb' => 'PUT'], + [ + 'name' => 'admin#update', + 'url' => '/admin', + 'verb' => 'PUT' + ], // folders - ['name' => 'folder#index', 'url' => '/folders', 'verb' => 'GET'], - ['name' => 'folder#create', 'url' => '/folders', 'verb' => 'POST'], - ['name' => 'folder#delete', 'url' => '/folders/{folderId}', 'verb' => 'DELETE'], - ['name' => 'folder#restore', 'url' => '/folders/{folderId}/restore', 'verb' => 'POST'], - ['name' => 'folder#rename', 'url' => '/folders/{folderId}/rename', 'verb' => 'POST'], - ['name' => 'folder#read', 'url' => '/folders/{folderId}/read', 'verb' => 'POST'], - ['name' => 'folder#open', 'url' => '/folders/{folderId}/open', 'verb' => 'POST'], + [ + 'name' => 'folder#index', + 'url' => '/folders', + 'verb' => 'GET' + ], + [ + 'name' => 'folder#create', + 'url' => '/folders', + 'verb' => 'POST' + ], + [ + 'name' => 'folder#delete', + 'url' => '/folders/{folderId}', + 'verb' => 'DELETE' + ], + [ + 'name' => 'folder#restore', + 'url' => '/folders/{folderId}/restore', + 'verb' => 'POST' + ], + [ + 'name' => 'folder#rename', + 'url' => '/folders/{folderId}/rename', + 'verb' => 'POST' + ], + [ + 'name' => 'folder#read', + 'url' => '/folders/{folderId}/read', + 'verb' => 'POST' + ], + [ + 'name' => 'folder#open', + 'url' => '/folders/{folderId}/open', + 'verb' => 'POST' + ], // feeds - ['name' => 'feed#index', 'url' => '/feeds', 'verb' => 'GET'], - ['name' => 'feed#create', 'url' => '/feeds', 'verb' => 'POST'], - ['name' => 'feed#delete', 'url' => '/feeds/{feedId}', 'verb' => 'DELETE'], - ['name' => 'feed#restore', 'url' => '/feeds/{feedId}/restore', 'verb' => 'POST'], - ['name' => 'feed#move', 'url' => '/feeds/{feedId}/move', 'verb' => 'POST'], - ['name' => 'feed#rename', 'url' => '/feeds/{feedId}/rename', 'verb' => 'POST'], - ['name' => 'feed#read', 'url' => '/feeds/{feedId}/read', 'verb' => 'POST'], - ['name' => 'feed#update', 'url' => '/feeds/{feedId}/update', 'verb' => 'POST'], - ['name' => 'feed#active', 'url' => '/feeds/active', 'verb' => 'GET'], - ['name' => 'feed#import', 'url' => '/feeds/import/articles', 'verb' => 'POST'], + [ + 'name' => 'feed#index', + 'url' => '/feeds', + 'verb' => 'GET' + ], + [ + 'name' => 'feed#create', + 'url' => '/feeds', + 'verb' => 'POST' + ], + [ + 'name' => 'feed#delete', + 'url' => '/feeds/{feedId}', + 'verb' => 'DELETE' + ], + [ + 'name' => 'feed#restore', + 'url' => '/feeds/{feedId}/restore', + 'verb' => 'POST' + ], + [ + 'name' => 'feed#move', + 'url' => '/feeds/{feedId}/move', + 'verb' => 'POST' + ], + [ + 'name' => 'feed#rename', + 'url' => '/feeds/{feedId}/rename', + 'verb' => 'POST' + ], + [ + 'name' => 'feed#read', + 'url' => '/feeds/{feedId}/read', + 'verb' => 'POST' + ], + [ + 'name' => 'feed#update', + 'url' => '/feeds/{feedId}/update', + 'verb' => 'POST' + ], + [ + 'name' => 'feed#active', + 'url' => '/feeds/active', + 'verb' => 'GET' + ], + [ + 'name' => 'feed#import', + 'url' => '/feeds/import/articles', + 'verb' => 'POST' + ], // items - ['name' => 'item#index', 'url' => '/items', 'verb' => 'GET'], - ['name' => 'item#new_items', 'url' => '/items/new', 'verb' => 'GET'], - ['name' => 'item#readAll', 'url' => '/items/read', 'verb' => 'POST'], - ['name' => 'item#read', 'url' => '/items/{itemId}/read', 'verb' => 'POST'], - ['name' => 'item#read_multiple', 'url' => '/items/read/multiple', 'verb' => 'POST'], - ['name' => 'item#star', 'url' => '/items/{feedId}/{guidHash}/star', 'verb' => 'POST'], + [ + 'name' => 'item#index', + 'url' => '/items', + 'verb' => 'GET' + ], + [ + 'name' => 'item#new_items', + 'url' => '/items/new', + 'verb' => 'GET' + ], + [ + 'name' => 'item#readAll', + 'url' => '/items/read', + 'verb' => 'POST' + ], + [ + 'name' => 'item#read', + 'url' => '/items/{itemId}/read', + 'verb' => 'POST' + ], + [ + 'name' => 'item#read_multiple', + 'url' => '/items/read/multiple', + 'verb' => 'POST' + ], + [ + 'name' => 'item#star', + 'url' => '/items/{feedId}/{guidHash}/star', + 'verb' => 'POST' + ], // export - ['name' => 'export#opml', 'url' => '/export/opml', 'verb' => 'GET'], - ['name' => 'export#articles', 'url' => '/export/articles', 'verb' => 'GET'], + [ + 'name' => 'export#opml', + 'url' => '/export/opml', + 'verb' => 'GET' + ], + [ + 'name' => 'export#articles', + 'url' => '/export/articles', + 'verb' => 'GET' + ], // API 1.2 - ['name' => 'utility_api#version', 'url' => '/api/v1-2/version', 'verb' => 'GET'], - ['name' => 'utility_api#before_update', 'url' => '/api/v1-2/cleanup/before-update', 'verb' => 'GET'], - ['name' => 'utility_api#after_update', 'url' => '/api/v1-2/cleanup/after-update', 'verb' => 'GET'], - ['name' => 'utility_api#preflighted_cors', 'url' => '/api/v1-2/{path}', 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], + [ + 'name' => 'utility_api#version', + 'url' => '/api/v1-2/version', + 'verb' => 'GET' + ], + [ + 'name' => 'utility_api#before_update', + 'url' => '/api/v1-2/cleanup/before-update', + 'verb' => 'GET' + ], + [ + 'name' => 'utility_api#after_update', + 'url' => '/api/v1-2/cleanup/after-update', + 'verb' => 'GET' + ], + [ + 'name' => 'utility_api#preflighted_cors', + 'url' => '/api/v1-2/{path}', + 'verb' => 'OPTIONS' + , 'requirements' => ['path' => '.+']], // folders - ['name' => 'folder_api#index', 'url' => '/api/v1-2/folders', 'verb' => 'GET'], - ['name' => 'folder_api#create', 'url' => '/api/v1-2/folders', 'verb' => 'POST'], - ['name' => 'folder_api#update', 'url' => '/api/v1-2/folders/{folderId}', 'verb' => 'PUT'], - ['name' => 'folder_api#delete', 'url' => '/api/v1-2/folders/{folderId}', 'verb' => 'DELETE'], - ['name' => 'folder_api#read', 'url' => '/api/v1-2/folders/{folderId}/read', 'verb' => 'PUT'], // FIXME: POST would be more correct + [ + 'name' => 'folder_api#index', + 'url' => '/api/v1-2/folders', + 'verb' => 'GET' + ], + [ + 'name' => 'folder_api#create', + 'url' => '/api/v1-2/folders', + 'verb' => 'POST' + ], + [ + 'name' => 'folder_api#update', + 'url' => '/api/v1-2/folders/{folderId}', + 'verb' => 'PUT' + ], + [ + 'name' => 'folder_api#delete', + 'url' => '/api/v1-2/folders/{folderId}', + 'verb' => 'DELETE' + ], + [ + 'name' => 'folder_api#read', + 'url' => '/api/v1-2/folders/{folderId}/read', + 'verb' => 'PUT' + ], // FIXME: POST would be more correct // feeds - ['name' => 'feed_api#index', 'url' => '/api/v1-2/feeds', 'verb' => 'GET'], - ['name' => 'feed_api#create', 'url' => '/api/v1-2/feeds', 'verb' => 'POST'], - ['name' => 'feed_api#update', 'url' => '/api/v1-2/feeds/{feedId}', 'verb' => 'PUT'], - ['name' => 'feed_api#delete', 'url' => '/api/v1-2/feeds/{feedId}', 'verb' => 'DELETE'], - ['name' => 'feed_api#from_all_users', 'url' => '/api/v1-2/feeds/all', 'verb' => 'GET'], - ['name' => 'feed_api#move', 'url' => '/api/v1-2/feeds/{feedId}/move', 'verb' => 'PUT'], // FIXME: POST would be more correct - ['name' => 'feed_api#rename', 'url' => '/api/v1-2/feeds/{feedId}/rename', 'verb' => 'PUT'], // FIXME: POST would be more correct - ['name' => 'feed_api#read', 'url' => '/api/v1-2/feeds/{feedId}/read', 'verb' => 'PUT'], // FIXME: POST would be more correct - ['name' => 'feed_api#update', 'url' => '/api/v1-2/feeds/update', 'verb' => 'GET'], + [ + 'name' => 'feed_api#index', + 'url' => '/api/v1-2/feeds', + 'verb' => 'GET' + ], + [ + 'name' => 'feed_api#create', + 'url' => '/api/v1-2/feeds', + 'verb' => 'POST' + ], + [ + 'name' => 'feed_api#update', + 'url' => '/api/v1-2/feeds/{feedId}', + 'verb' => 'PUT' + ], + [ + 'name' => 'feed_api#delete', + 'url' => '/api/v1-2/feeds/{feedId}', + 'verb' => 'DELETE' + ], + [ + 'name' => 'feed_api#from_all_users', + 'url' => '/api/v1-2/feeds/all', + 'verb' => 'GET' + ], + [ + 'name' => 'feed_api#move', + 'url' => '/api/v1-2/feeds/{feedId}/move', + 'verb' => 'PUT' + ], // FIXME: POST would be more correct + [ + 'name' => 'feed_api#rename', + 'url' => '/api/v1-2/feeds/{feedId}/rename', + 'verb' => 'PUT' + ], // FIXME: POST would be more correct + [ + 'name' => 'feed_api#read', + 'url' => '/api/v1-2/feeds/{feedId}/read', + 'verb' => 'PUT' + ], // FIXME: POST would be more correct + [ + 'name' => 'feed_api#update', + 'url' => '/api/v1-2/feeds/update', + 'verb' => 'GET' + ], |