Move service model to handlers
This commit is contained in:
parent
2b71bbf126
commit
8fa6d65614
@ -1,28 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Model\Service;
|
||||
namespace Handler\Service;
|
||||
|
||||
use Model\Config;
|
||||
use Model\Item;
|
||||
use PicoFeed\Client\Client;
|
||||
use PicoFeed\Client\ClientException;
|
||||
use Model\Config;
|
||||
use Model\Item;
|
||||
|
||||
// Sync the item to an external service
|
||||
function push($item_id)
|
||||
function sync($item_id)
|
||||
{
|
||||
$item = Item\get($item_id);
|
||||
|
||||
if ((bool) Config\get('pinboard_enabled')) {
|
||||
pinboard_add($item);
|
||||
pinboard_sync($item);
|
||||
}
|
||||
|
||||
if ((bool) Config\get('instapaper_enabled')) {
|
||||
instapaper_add($item);
|
||||
instapaper_sync($item);
|
||||
}
|
||||
}
|
||||
|
||||
// Send item to Instapaper
|
||||
function instapaper_add(array $item)
|
||||
function instapaper_sync(array $item)
|
||||
{
|
||||
$params = array(
|
||||
'username' => Config\get('instapaper_username'),
|
||||
@ -42,8 +40,7 @@ function instapaper_add(array $item)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add a Pinboard bookmark
|
||||
function pinboard_add(array $item)
|
||||
function pinboard_sync(array $item)
|
||||
{
|
||||
$params = array(
|
||||
'auth_token' => Config\get('pinboard_token'),
|
||||
@ -65,7 +62,6 @@ function pinboard_add(array $item)
|
||||
return false;
|
||||
}
|
||||
|
||||
// HTTP client
|
||||
function api_call($url)
|
||||
{
|
||||
try {
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Model\Bookmark;
|
||||
|
||||
use Model\Config;
|
||||
use Model\Service;
|
||||
use PicoDb\Database;
|
||||
use Handler\Service;
|
||||
use Model\Config;
|
||||
|
||||
function count_items($feed_ids = array())
|
||||
{
|
||||
@ -50,7 +50,7 @@ function get_all_items($offset = null, $limit = null, $feed_ids = array())
|
||||
function set_flag($id, $value)
|
||||
{
|
||||
if ($value == 1) {
|
||||
Service\push($id);
|
||||
Service\sync($id);
|
||||
}
|
||||
|
||||
return Database::getInstance('db')
|
||||
|
@ -39,9 +39,9 @@
|
||||
"app/core/session.php",
|
||||
"app/core/template.php",
|
||||
"app/handlers/scraper.php",
|
||||
"app/handlers/service.php",
|
||||
"app/handlers/proxy.php",
|
||||
"app/models/config.php",
|
||||
"app/models/service.php",
|
||||
"app/models/search.php",
|
||||
"app/models/user.php",
|
||||
"app/models/feed.php",
|
||||
|
@ -4,7 +4,6 @@ require __DIR__.'/../app/common.php';
|
||||
|
||||
use Model\Feed;
|
||||
use Model\Group;
|
||||
use Model\Service;
|
||||
use PicoDb\Database;
|
||||
|
||||
// Route handler
|
||||
@ -255,7 +254,7 @@ route('write_items', function () {
|
||||
->eq('rowid', $_POST['id'])
|
||||
->findOneColumn('id');
|
||||
|
||||
Service\push($item_id);
|
||||
Handler\Service\sync($item_id);
|
||||
} elseif ($_POST['as'] === 'unsaved') {
|
||||
$query->update(array('bookmark' => 0));
|
||||
} elseif ($_POST['as'] === 'read') {
|
||||
|
2
vendor/composer/autoload_files.php
vendored
2
vendor/composer/autoload_files.php
vendored
@ -20,9 +20,9 @@ return array(
|
||||
'98faa6699f100c5ddb2013d85f9dfabb' => $baseDir . '/app/core/session.php',
|
||||
'93228d441890e5962b0566344884332c' => $baseDir . '/app/core/template.php',
|
||||
'9de087554be89ca71a2ed558a4e35fde' => $baseDir . '/app/handlers/scraper.php',
|
||||
'45d63f4d04cfb927b889e126b91aa553' => $baseDir . '/app/handlers/service.php',
|
||||
'081a26ac825aa2a7e4cb00c18e0510d5' => $baseDir . '/app/handlers/proxy.php',
|
||||
'bc98222aedc910930f5b76b8c84f334e' => $baseDir . '/app/models/config.php',
|
||||
'c3080c7edf4a590ce36fc4f3561968dc' => $baseDir . '/app/models/service.php',
|
||||
'b59348c9973f21f2c58eb493d9fea5be' => $baseDir . '/app/models/search.php',
|
||||
'73671a34a21e27508f85cea36a9837de' => $baseDir . '/app/models/user.php',
|
||||
'e8bcd5701df9db676003b87e27b091c9' => $baseDir . '/app/models/feed.php',
|
||||
|
2
vendor/composer/autoload_static.php
vendored
2
vendor/composer/autoload_static.php
vendored
@ -21,9 +21,9 @@ class ComposerStaticInitfd7e8d436e1dc450edc3153ac8bc31b4
|
||||
'98faa6699f100c5ddb2013d85f9dfabb' => __DIR__ . '/../..' . '/app/core/session.php',
|
||||
'93228d441890e5962b0566344884332c' => __DIR__ . '/../..' . '/app/core/template.php',
|
||||
'9de087554be89ca71a2ed558a4e35fde' => __DIR__ . '/../..' . '/app/handlers/scraper.php',
|
||||
'45d63f4d04cfb927b889e126b91aa553' => __DIR__ . '/../..' . '/app/handlers/service.php',
|
||||
'081a26ac825aa2a7e4cb00c18e0510d5' => __DIR__ . '/../..' . '/app/handlers/proxy.php',
|
||||
'bc98222aedc910930f5b76b8c84f334e' => __DIR__ . '/../..' . '/app/models/config.php',
|
||||
'c3080c7edf4a590ce36fc4f3561968dc' => __DIR__ . '/../..' . '/app/models/service.php',
|
||||
'b59348c9973f21f2c58eb493d9fea5be' => __DIR__ . '/../..' . '/app/models/search.php',
|
||||
'73671a34a21e27508f85cea36a9837de' => __DIR__ . '/../..' . '/app/models/user.php',
|
||||
'e8bcd5701df9db676003b87e27b091c9' => __DIR__ . '/../..' . '/app/models/feed.php',
|
||||
|
Loading…
Reference in New Issue
Block a user