1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-23 17:42:15 -05:00

Merge pull request #705 from tcitworld/v2-silex

[V2] changed everything from Poche to Wallabag
This commit is contained in:
Nicolas Lœuillet 2014-05-29 21:27:09 +02:00
commit 7f665638d0
40 changed files with 113 additions and 113 deletions

4
.gitignore vendored
View File

@ -2,8 +2,8 @@ assets/*
cache/*
composer.phar
composer.lock
poche.db
poche_test.db
wallabag.db
wallabag_test.db
vendor/atoum
vendor/bin
vendor/autoload.php

View File

@ -1,6 +1,6 @@
# Poche v2 [![Build Status](https://travis-ci.org/inthepoche/poche.png?branch=v2-silex)](https://travis-ci.org/inthepoche/poche)
# wallabag v2 [![Build Status](https://api.travis-ci.org/wallabag/wallabag.png?branch=v2-silex)](https://travis-ci.org/wallabag/wallabag)
This is a Proof of Concept of Poche v2 using the PHP micro-framework [Silex](http://silex.sensiolabs.org).
This is a Proof of Concept of wallabag v2 using the PHP micro-framework [Silex](http://silex.sensiolabs.org).
# Installation
@ -11,11 +11,11 @@ Get Composer and install Silex:
Then configure your webserver to point to the `web/` directory. Some documentation is available on the [Silex documentation page](http://silex.sensiolabs.org/doc/web_servers.html).
If you are using PHP 5.4 you can run Poche v2 by using the embedded webserver:
If you are using PHP 5.4 you can run wallabag v2 by using the embedded webserver:
php -S localhost:8080 -t web web/index.php
Poche should now be running at [http://localhost:8080](http://localhost:8080).
wallabag should now be running at [http://localhost:8080](http://localhost:8080).
Then you should initialize your database by running:

View File

@ -1,9 +1,9 @@
<?php
use Knp\Provider\ConsoleServiceProvider;
use Poche\Api\EntryApi;
use Poche\Api\ContentFullTextRssApi;
use Poche\Repository\EntryRepository;
use Poche\Twig;
use Wallabag\Api\EntryApi;
use Wallabag\Api\ContentFullTextRssApi;
use Wallabag\Repository\EntryRepository;
use Wallabag\Twig;
use Symfony\Component\Translation\Loader\PoFileLoader;
use Silex\Provider\SessionServiceProvider;
@ -23,22 +23,22 @@ $app->before(function () use ($app) {
});
$app['twig'] = $app->share($app->extend('twig', function($twig) {
$twig->addFilter(new Twig_SimpleFilter('getDomain', 'Poche\Twig\Filter::getDomain'));
$twig->addFilter(new Twig_SimpleFilter('getDomain', 'Wallabag\Twig\Filter::getDomain'));
return $twig;
}));
$app['twig'] = $app->share($app->extend('twig', function($twig) {
$twig->addFilter(new Twig_SimpleFilter('getReadingTime', 'Poche\Twig\Filter::getReadingTime'));
$twig->addFilter(new Twig_SimpleFilter('getReadingTime', 'Wallabag\Twig\Filter::getReadingTime'));
return $twig;
}));
$app['twig'] = $app->share($app->extend('twig', function($twig) {
$twig->addFilter(new Twig_SimpleFilter('getPicture', 'Poche\Twig\Filter::getPicture'));
$twig->addFilter(new Twig_SimpleFilter('getPicture', 'Wallabag\Twig\Filter::getPicture'));
return $twig;
}));
$app->register(new ConsoleServiceProvider(), [
'console.name' => 'Poche console',
'console.name' => 'Wallabag console',
'console.version' => '0.1',
'console.project_directory' => __DIR__.'/..',
]);
@ -46,7 +46,7 @@ $app->register(new ConsoleServiceProvider(), [
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => array(
'driver' => 'pdo_sqlite',
'path' => __DIR__.'/../poche.db',
'path' => __DIR__.'/../wallabag.db',
),
));
@ -67,7 +67,7 @@ $app->register(new SecurityServiceProvider(), array(
'form' => array('login_path' => '/', 'check_path' => 'login'),
'logout' => array('logout_path' => '/logout'),
'users' => $app->share(function() use ($app) {
return new Poche\User\UserProvider($app['db']);
return new Wallabag\User\UserProvider($app['db']);
}),
),
),

View File

@ -1,34 +1,34 @@
<?php
use Poche\Model\Entry;
use Poche\Controller;
use Wallabag\Model\Entry;
use Wallabag\Controller;
use Symfony\Component\HttpFoundation\Request;
$front = $app['controllers_factory'];
// entry
$front->get('/', 'Poche\Controller\EntryController::indexAction');
$front->get('/view/{id}', 'Poche\Controller\EntryController::showAction')
$front->get('/', 'Wallabag\Controller\EntryController::indexAction');
$front->get('/view/{id}', 'Wallabag\Controller\EntryController::showAction')
->bind('view_entry');
$front->match('/add', 'Poche\Controller\EntryController::addAction')
$front->match('/add', 'Wallabag\Controller\EntryController::addAction')
->bind('add');
$front->get('/remove/{id}', 'Poche\Controller\EntryController::removeAction')
$front->get('/remove/{id}', 'Wallabag\Controller\EntryController::removeAction')
->bind('remove_entry');
$front->get('/restore/{id}', 'Poche\Controller\EntryController::restoreAction')
$front->get('/restore/{id}', 'Wallabag\Controller\EntryController::restoreAction')
->bind('restore_entry');
// bookmarks
$front->get('/bookmarks', 'Poche\Controller\BookmarkController::indexAction');
$front->match('/star/{id}', 'Poche\Controller\BookmarkController::addAction')
$front->get('/bookmarks', 'Wallabag\Controller\BookmarkController::indexAction');
$front->match('/star/{id}', 'Wallabag\Controller\BookmarkController::addAction')
->bind('star_entry');
$front->match('/unstar/{id}', 'Poche\Controller\BookmarkController::removeAction')
$front->match('/unstar/{id}', 'Wallabag\Controller\BookmarkController::removeAction')
->bind('unstar_entry');
// archive
$front->get('/archive', 'Poche\Controller\ArchiveController::indexAction');
$front->match('/mark-read/{id}', 'Poche\Controller\ArchiveController::readAction')
$front->get('/archive', 'Wallabag\Controller\ArchiveController::indexAction');
$front->match('/mark-read/{id}', 'Wallabag\Controller\ArchiveController::readAction')
->bind('mark_entry_read');
$front->match('/mark-unread/{id}', 'Poche\Controller\ArchiveController::unreadAction')
$front->match('/mark-unread/{id}', 'Wallabag\Controller\ArchiveController::unreadAction')
->bind('mark_entry_unread');
return $front;

View File

@ -1,3 +1,3 @@
<footer role="contentinfo">
<p>powered by <a href="http://www.inthepoche.com">poche</a></p>
<p>powered by <a href="http://wallabag.org/">wallabag</a></p>
</footer>

View File

@ -2,7 +2,7 @@
<div class="alert alert-error" >{{ error }}</div>
{% endif %}
<form action="{{ path('login') }}" method="post">
<p><label for="username">{{ 'username'|trans }}: </label><input id="username" type="text" name="_username" value="poche"></p>
<p><label for="username">{{ 'username'|trans }}: </label><input id="username" type="text" name="_username" value="wallabag"></p>
<p><label for="password">{{ 'password'|trans }}: </label><input id="password" type="password" name="_password" value="password"></p>
<p><input type="submit" value="{{ 'login'|trans }}"></p>
</form>

View File

@ -3,7 +3,7 @@
{% endif %}
<header>
<nav role="navigation">
<a class="logo" href="/">poche</a>
<a class="logo" href="/">wallabag</a>
<ul>
<li {% if app.request.requesturi == '/' %}class="active"{% endif %}><a href="/">{{ 'unread'|trans }}</a>{% if app.request.requesturi == '/' %} (<span id="counter">{{count}}</span>){% endif %}</li>
<li {% if app.request.requesturi == '/bookmarks' %}class="active"{% endif %}><a href="/bookmarks">{{ 'bookmarks'|trans }}</a></li>

View File

@ -10,7 +10,7 @@
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<![endif]-->
<title>{% block title %}{% endblock %} poche</title>
<title>{% block title %}{% endblock %} wallabag</title>
<link rel="stylesheet" href="/assets/css/reset.css" media="all">
<link rel="stylesheet" href="/assets/css/tinytypo.css" media="all">
<link rel="stylesheet" href="/assets/css/typo.css" media="all">

View File

@ -15,6 +15,6 @@
"symfony/security": "2.3.*@dev"
},
"autoload": {
"psr-0": { "Poche\\": "src/" }
"psr-0": { "Wallabag\\": "src/" }
}
}

View File

@ -7,7 +7,7 @@ require_once __DIR__.'/app/app.php';
$console = $app['console'];
$console->add(new Poche\Command\UnitTestsCommand());
$console->add(new Poche\Command\CreateSchemaCommand());
$console->add(new Wallabag\Command\UnitTestsCommand());
$console->add(new Wallabag\Command\CreateSchemaCommand());
$console->run();

View File

@ -11,7 +11,7 @@
bootstrap="tests/functionals/bootstrap.php"
>
<testsuites>
<testsuite name="Poche Test Suite">
<testsuite name="Wallabag Test Suite">
<directory>./tests/functionals/</directory>
</testsuite>
</testsuites>

View File

@ -1,8 +1,8 @@
<?php
namespace Poche\Api;
namespace Wallabag\Api;
use Poche\Util\Url;
use Wallabag\Util\Url;
class ContentFullTextRssApi
{

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Api;
namespace Wallabag\Api;
class EntryApi
{

View File

@ -1,11 +1,11 @@
<?php
namespace Poche\Command;
namespace Wallabag\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Knp\Command\Command as BaseCommand;
use Poche\Schema;
use Wallabag\Schema;
/**
* Application aware command

View File

@ -1,5 +1,5 @@
<?php
namespace Poche\Command;
namespace Wallabag\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Controller;
namespace Wallabag\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Controller;
namespace Wallabag\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Controller;
namespace Wallabag\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Model;
namespace Wallabag\Model;
class Entry
{

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Repository;
namespace Wallabag\Repository;
class EntryRepository
{

View File

@ -1,7 +1,7 @@
<?php
namespace Poche;
namespace Wallabag;
use Poche\Util\Token;
use Wallabag\Util\Token;
class Schema
{
@ -34,7 +34,7 @@ class Schema
$db->query("
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE,
username TEXT DEFAULT 'poche',
username TEXT DEFAULT 'wallabag',
password TEXT,
roles TEXT DEFAULT '',
email TEXT,

View File

@ -1,14 +1,14 @@
<?php
/**
* poche, a read it later open source system
* wallabag, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <support@inthepoche.com>
* @category wallabag
* @author Nicolas Lœuillet <hello@wallabag.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
namespace Poche\Twig;
namespace Wallabag\Twig;
class Filter
{

View File

@ -1,5 +1,5 @@
<?php
namespace Poche\User;
namespace Wallabag\User;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;

View File

@ -1,5 +1,5 @@
<?php
namespace Poche\Util;
namespace Wallabag\Util;
class DummySingleItem {
public $url;

View File

@ -1,5 +1,5 @@
<?php
namespace Poche\Util;
namespace Wallabag\Util;
class DummySingleItemFeed {
public $item;

View File

@ -7,7 +7,7 @@
* @example http://www.framework2.com.ar/dzone/forceUTF8-es/
*/
namespace Poche\Util;
namespace Wallabag\Util;
class Encoding {

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Util;
namespace Wallabag\Util;
class Token
{

View File

@ -1,14 +1,14 @@
<?php
/**
* poche, a read it later open source system
* wallabag, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <support@inthepoche.com>
* @category wallabag
* @author Nicolas Lœuillet <hello@wallabag.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
namespace Poche\Util;
namespace Wallabag\Util;
class Url
{
@ -357,7 +357,7 @@ class Url
}
if (isset($splink)) {
// Build DOM tree from HTML
$readability = new PocheReadability($html, $url);
$readability = new WallabagReadability($html, $url);
$xpath = new DOMXPath($readability->dom);
// Loop through single_page_link xpath expressions
$single_page_url = null;

View File

@ -1,8 +1,8 @@
<?php
namespace Poche\Util;
namespace Wallabag\Util;
class PocheReadability extends Readability
class WallabagReadability extends Readability
{
/**
* Get the article title as an H1.

View File

@ -1,8 +1,8 @@
<?php
namespace Poche\Tests\Functionals;
use Poche\Tests\Functionals\Fixtures;
namespace Wallabag\Tests\Functionals;
use Wallabag\Tests\Functionals\Fixtures;
class ApiTest extends PocheWebTestCase
class ApiTest extends WallabagWebTestCase
{
public function testEmptyGetEntries()
{

View File

@ -1,12 +1,12 @@
<?php
namespace Poche\Tests\Functionals;
namespace Wallabag\Tests\Functionals;
class Fixtures
{
public static function loadUsers($db) {
$db->query("INSERT INTO users (id, username) values (1, 'poche_test');");
$db->query("INSERT INTO users (id, username) values (1, 'wallabag_test');");
}

View File

@ -1,13 +1,13 @@
<?php
namespace Poche\Tests\Functionals;
namespace Wallabag\Tests\Functionals;
use Poche\Tests\Functionals\Fixtures;
use Wallabag\Tests\Functionals\Fixtures;
use Silex\WebTestCase;
use Poche\Schema;
use Wallabag\Schema;
class PocheWebTestCase extends WebTestCase
class WallabagWebTestCase extends WebTestCase
{
protected $app;
@ -18,7 +18,7 @@ class PocheWebTestCase extends WebTestCase
$app['db.options'] = array(
'driver' => 'pdo_sqlite',
'path' => __DIR__.'/poche_test.db'
'path' => __DIR__.'/wallabag_test.db'
);
$app['debug'] = true;

View File

@ -2,4 +2,4 @@
require __DIR__.'/../../vendor/autoload.php';
require __DIR__.'/../../vendor/full-text-rss/autoload.php';
require __DIR__.'/Fixtures.php';
require __DIR__.'/PocheWebTestCase.php';
require __DIR__.'/WallabagWebTestCase.php';

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Model\tests\units;
namespace Wallabag\Model\tests\units;
use \atoum;
@ -8,7 +8,7 @@ class Entry extends atoum
{
public function testGetId()
{
$entry = new \Poche\Model\Entry(1, "Titre test");
$entry = new \Wallabag\Model\Entry(1, "Titre test");
$this
->integer($entry->getId())

View File

@ -1,6 +1,6 @@
<?php
namespace Poche\Util\tests\units;
namespace Wallabag\Util\tests\units;
use \atoum;
@ -9,7 +9,7 @@ class Token extends atoum
public function testTokenSize()
{
$this
->integer(strlen(\Poche\Util\Token::generateToken()))
->integer(strlen(\Wallabag\Util\Token::generateToken()))
->isEqualTo(15)
;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,11 +1,11 @@
var poche = {};
var wallabag = {};
poche.App = (function() {
wallabag.App = (function() {
return {
Run: function() {
// poche.Event.ListenKeyboardEvents();
poche.Event.ListenMouseEvents();
// wallabag.Event.ListenKeyboardEvents();
wallabag.Event.ListenMouseEvents();
},
}

View File

@ -1,4 +1,4 @@
poche.Event = (function() {
wallabag.Event = (function() {
var queue = [];
@ -14,26 +14,26 @@ poche.Event = (function() {
switch (action) {
case 'mark_entry_read':
e.preventDefault();
poche.Item.MarkAsRead(e.target.getAttribute("data-entry-id"));
wallabag.Item.MarkAsRead(e.target.getAttribute("data-entry-id"));
break;
case 'mark_entry_unread':
e.preventDefault();
poche.Item.MarkAsUnread(e.target.getAttribute("data-entry-id"));
wallabag.Item.MarkAsUnread(e.target.getAttribute("data-entry-id"));
break;
case 'unstar_entry':
e.preventDefault();
poche.Item.MarkAsUnstarred(e.target.getAttribute("data-entry-id"));
wallabag.Item.MarkAsUnstarred(e.target.getAttribute("data-entry-id"));
break;
case 'star_entry':
e.preventDefault();
poche.Item.MarkAsStarred(e.target.getAttribute("data-entry-id"));
wallabag.Item.MarkAsStarred(e.target.getAttribute("data-entry-id"));
break;
// case 'original-link':
// poche.Item.OpenOriginal(e.target.getAttribute("data-entry-id"));
// wallabag.Item.OpenOriginal(e.target.getAttribute("data-entry-id"));
// break;
// case 'mark-all-read':
// e.preventDefault();
// poche.Item.MarkListingAsRead("?action=unread");
// wallabag.Item.MarkListingAsRead("?action=unread");
// break;
}
}
@ -81,36 +81,36 @@ poche.Event = (function() {
switch (e.keyCode || e.which) {
case 100: // d
poche.Item.DownloadContent(poche.Nav.GetCurrentItemId());
wallabag.Item.DownloadContent(wallabag.Nav.GetCurrentItemId());
break;
case 112: // p
case 107: // k
poche.Nav.SelectPreviousItem();
wallabag.Nav.SelectPreviousItem();
break;
case 110: // n
case 106: // j
poche.Nav.SelectNextItem();
wallabag.Nav.SelectNextItem();
break;
case 118: // v
poche.Item.OpenOriginal(poche.Nav.GetCurrentItemId());
wallabag.Item.OpenOriginal(wallabag.Nav.GetCurrentItemId());
break;
case 111: // o
poche.Item.Show(poche.Nav.GetCurrentItemId());
wallabag.Item.Show(wallabag.Nav.GetCurrentItemId());
break;
case 109: // m
poche.Item.SwitchStatus(poche.Nav.GetCurrentItem());
wallabag.Item.SwitchStatus(wallabag.Nav.GetCurrentItem());
break;
case 102: // f
poche.Item.SwitchBookmark(poche.Nav.GetCurrentItem());
wallabag.Item.SwitchBookmark(wallabag.Nav.GetCurrentItem());
break;
case 104: // h
poche.Nav.OpenPreviousPage();
wallabag.Nav.OpenPreviousPage();
break
case 108: // l
poche.Nav.OpenNextPage();
wallabag.Nav.OpenNextPage();
break;
case 63: // ?
poche.Nav.ShowHelp();
wallabag.Nav.ShowHelp();
break;
}
}

View File

@ -1,4 +1,4 @@
poche.Item = (function() {
wallabag.Item = (function() {
function getItem(item_id)
{
@ -25,7 +25,7 @@ poche.Item = (function() {
// function showItemBookmarked(item_id, item)
// {
// if (! poche.Nav.IsListing()) {
// if (! wallabag.Nav.IsListing()) {
// var link = document.getElementById("bookmark-" + item_id);
// if (link) link.innerHTML = "★";
@ -47,7 +47,7 @@ poche.Item = (function() {
function hideItemBookmarked(item_id, item)
{
if (! poche.Nav.IsListing()) {
if (! wallabag.Nav.IsListing()) {
var link = document.getElementById("bookmark-" + item_id);
if (link) link.innerHTML = "☆";
@ -147,7 +147,7 @@ poche.Item = (function() {
counter = parseInt(container.textContent.trim(), 10) - 1;
container.textContent = counter;
document.title = "unread (" + counter + ") poche";
document.title = "unread (" + counter + ") wallabag";
}
}
@ -155,7 +155,7 @@ poche.Item = (function() {
{
var request = new XMLHttpRequest();
request.onload = function() {
if (poche.Nav.IsListing()) showItemAsStarred(item_id);
if (wallabag.Nav.IsListing()) showItemAsStarred(item_id);
};
request.open("POST", "star/" + item_id, true);
request.send();
@ -165,7 +165,7 @@ poche.Item = (function() {
{
var request = new XMLHttpRequest();
request.onload = function() {
if (poche.Nav.IsListing()) showItemAsUnstarred(item_id);
if (wallabag.Nav.IsListing()) showItemAsUnstarred(item_id);
};
request.open("POST", "unstar/" + item_id, true);
request.send();
@ -175,7 +175,7 @@ poche.Item = (function() {
{
var request = new XMLHttpRequest();
request.onload = function() {
if (poche.Nav.IsListing()) showItemAsRead(item_id);
if (wallabag.Nav.IsListing()) showItemAsRead(item_id);
};
request.open("POST", "mark-read/" + item_id, true);
request.send();
@ -185,7 +185,7 @@ poche.Item = (function() {
{
var request = new XMLHttpRequest();
request.onload = function() {
if (poche.Nav.IsListing()) showItemAsUnread(item_id);
if (wallabag.Nav.IsListing()) showItemAsUnread(item_id);
};
request.open("POST", "mark-unread/" + item_id, true);
request.send();
@ -287,4 +287,4 @@ poche.Item = (function() {
})();
poche.App.Run();
wallabag.App.Run();

View File

@ -1,4 +1,4 @@
poche.Nav = (function() {
wallabag.Nav = (function() {
// function scrollPageTo(item)
// {