summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-07-23 21:24:54 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2016-07-23 21:24:54 +0200
commit004fcbbcc7609ca83807f2e38967ef54f469bf72 (patch)
tree49eb99b4ea92b2045793fc567f719b31ec7f9042 /utility
parent60abc0ed4438c9b6fda245b0dc33cb483bc2aeaf (diff)
Move to new directory structure
Diffstat (limited to 'utility')
-rw-r--r--utility/opmlexporter.php91
-rw-r--r--utility/picofeedclientfactory.php40
-rw-r--r--utility/picofeedfaviconfactory.php38
-rw-r--r--utility/proxyconfigparser.php65
-rw-r--r--utility/time.php30
-rw-r--r--utility/updater.php54
6 files changed, 0 insertions, 318 deletions
diff --git a/utility/opmlexporter.php b/utility/opmlexporter.php
deleted file mode 100644
index d786c0c6f..000000000
--- a/utility/opmlexporter.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-namespace OCA\News\Utility;
-
-/**
-* Exports the OPML
-*/
-class OPMLExporter {
-
- /**
- * Generates the OPML for the active user
- *
- * @param \OCA\News\Db\Folder[] $folders
- * @param \OCA\News\Db\Feed[] $feeds
- * @return \DomDocument the document
- */
- public function build($folders, $feeds){
- $document = new \DomDocument('1.0', 'UTF-8');
- $document->formatOutput = true;
-
- $root = $document->createElement('opml');
- $root->setAttribute('version', '2.0');
-
- // head
- $head = $document->createElement('head');
-
- $title = $document->createElement('title', 'Subscriptions');
- $head->appendChild($title);
-
- $root->appendChild($head);
-
- // body
- $body = $document->createElement('body');
-
- // feeds with folders
- foreach($folders as $folder) {
- $folderOutline = $document->createElement('outline');
- $folderOutline->setAttribute('title', $folder->getName());
- $folderOutline->setAttribute('text', $folder->getName());
-
- // feeds in folders
- foreach ($feeds as $feed) {
- if ($feed->getFolderId() === $folder->getId()) {
- $feedOutline = $this->createFeedOutline($feed, $document);
- $folderOutline->appendChild($feedOutline);
- }
- }
-
- $body->appendChild($folderOutline);
- }
-
- // feeds without folders
- foreach ($feeds as $feed) {
- if ($feed->getFolderId() === 0) {
- $feedOutline = $this->createFeedOutline($feed, $document);
- $body->appendChild($feedOutline);
- }
- }
-
- $root->appendChild($body);
-
- $document->appendChild($root);
-
- return $document;
- }
-
-
- protected function createFeedOutline($feed, $document) {
- $feedOutline = $document->createElement('outline');
- $feedOutline->setAttribute('title', $feed->getTitle());
- $feedOutline->setAttribute('text', $feed->getTitle());
- $feedOutline->setAttribute('type', 'rss');
- $feedOutline->setAttribute('xmlUrl', $feed->getUrl());
- $feedOutline->setAttribute('htmlUrl', $feed->getLink());
- return $feedOutline;
- }
-
-
-}
-
diff --git a/utility/picofeedclientfactory.php b/utility/picofeedclientfactory.php
deleted file mode 100644
index a57f7f022..000000000
--- a/utility/picofeedclientfactory.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-
-namespace OCA\News\Utility;
-
-use \PicoFeed\Config\Config;
-use \PicoFeed\Client\Client;
-
-class PicoFeedClientFactory {
-
- private $config;
-
- public function __construct(Config $config) {
- $this->config = $config;
- }
-
-
- /**
- * Returns a new instance of an PicoFeed Http client
- * @return \PicoFeed\Client instance
- */
- public function build() {
- $client = Client::getInstance();
- $client->setConfig($this->config);
- return $client;
- }
-
-
-} \ No newline at end of file
diff --git a/utility/picofeedfaviconfactory.php b/utility/picofeedfaviconfactory.php
deleted file mode 100644
index b3a48747a..000000000
--- a/utility/picofeedfaviconfactory.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-
-namespace OCA\News\Utility;
-
-use \PicoFeed\Config\Config;
-use \PicoFeed\Reader\Favicon;
-
-class PicoFeedFaviconFactory {
-
- private $config;
-
- public function __construct(Config $config) {
- $this->config = $config;
- }
-
-
- /**
- * Returns a new instance of an PicoFeed Http client
- * @return \PicoFeed\Favicon instance
- */
- public function build() {
- return new Favicon($this->config);
- }
-
-
-} \ No newline at end of file
diff --git a/utility/proxyconfigparser.php b/utility/proxyconfigparser.php
deleted file mode 100644
index 4710477e8..000000000
--- a/utility/proxyconfigparser.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-
-namespace OCA\News\Utility;
-
-use \OCP\IConfig;
-
-
-class ProxyConfigParser {
-
- private $config;
-
- public function __construct(IConfig $config) {
- $this->config = $config;
- }
-
-
- /**
- * Parses the config and splits up the port + url
- * @return array
- */
- public function parse() {
- $proxy = $this->config->getSystemValue('proxy');
- $userpasswd = $this->config->getSystemValue('proxyuserpwd');
-
- $result = [
- 'host' => null,
- 'port' => null,
- 'user' => null,
- 'password' => null
- ];
-
- // we need to filter out the port -.-
- $url = new \Net_URL2($proxy);
- $port = $url->getPort();
-
- $url->setPort(false);
- $host = $url->getUrl();
-
-
- $result['host'] = $host;
- $result['port'] = $port;
-
- if ($userpasswd) {
- $auth = explode(':', $userpasswd, 2);
- $result['user'] = $auth[0];
- $result['password'] = $auth[1];
- }
-
- return $result;
- }
-
-
-} \ No newline at end of file
diff --git a/utility/time.php b/utility/time.php
deleted file mode 100644
index e6ea2b470..000000000
--- a/utility/time.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Bernhard Posselt 2016
- */
-
-namespace OCA\News\Utility;
-
-class Time {
- public function getTime() {
- return time();
- }
-
- /**
- * @return int the current unix time in miliseconds
- */
- public function getMicroTime() {
- $utimestamp = microtime(true);
- $timestamp = floor($utimestamp);
- $milliseconds = round(($utimestamp - $timestamp) * 1000000);
- $result = ($timestamp * 1000000) + $milliseconds;
- return $result;
- }
-
-} \ No newline at end of file
diff --git a/utility/updater.php b/utility/updater.php
deleted file mode 100644
index a6f8dc28a..000000000
--- a/utility/updater.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-
-namespace OCA\News\Utility;
-
-use \OCA\News\Service\FolderService;
-use \OCA\News\Service\FeedService;
-use \OCA\News\Service\ItemService;
-
-
-class Updater {
-
-
- private $folderService;
- private $feedService;
- private $itemService;
-
- public function __construct(FolderService $folderService,
- FeedService $feedService,
- ItemService $itemService) {
- $this->folderService = $folderService;
- $this->feedService = $feedService;
- $this->itemService = $itemService;
- }
-
-
- public function beforeUpdate() {
- $this->folderService->purgeDeleted();
- $this->feedService->purgeDeleted();
- }
-
-
- public function update() {
- $this->feedService->updateAll();
- }
-
-
- public function afterUpdate() {
- $this->itemService->autoPurgeOld();
- }
-
-
-} \ No newline at end of file