diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 15:36:04 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 15:36:04 +0100 |
commit | 1990517b2263a080946853ed697a6d687262ae80 (patch) | |
tree | 8f676a051a25c65bf2130235e6b30e3f53030154 | |
parent | c3235553ddc2bb5965f6fe00e750cfe4aac9ccdf (diff) | |
download | wallabag-1990517b2263a080946853ed697a6d687262ae80.tar.gz wallabag-1990517b2263a080946853ed697a6d687262ae80.tar.zst wallabag-1990517b2263a080946853ed697a6d687262ae80.zip |
remove Acme and AppBundle
32 files changed, 0 insertions, 788 deletions
diff --git a/src/Acme/DemoBundle/AcmeDemoBundle.php b/src/Acme/DemoBundle/AcmeDemoBundle.php deleted file mode 100644 index 269fc1e0..00000000 --- a/src/Acme/DemoBundle/AcmeDemoBundle.php +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle; | ||
4 | |||
5 | use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
6 | |||
7 | class AcmeDemoBundle extends Bundle | ||
8 | { | ||
9 | } | ||
diff --git a/src/Acme/DemoBundle/Command/HelloWorldCommand.php b/src/Acme/DemoBundle/Command/HelloWorldCommand.php deleted file mode 100644 index 998cbcdf..00000000 --- a/src/Acme/DemoBundle/Command/HelloWorldCommand.php +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Command; | ||
4 | |||
5 | use Symfony\Component\Console\Command\Command; | ||
6 | use Symfony\Component\Console\Input\InputArgument; | ||
7 | use Symfony\Component\Console\Input\InputInterface; | ||
8 | use Symfony\Component\Console\Output\OutputInterface; | ||
9 | |||
10 | /** | ||
11 | * Hello World command for demo purposes. | ||
12 | * | ||
13 | * You could also extend from Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand | ||
14 | * to get access to the container via $this->getContainer(). | ||
15 | * | ||
16 | * @author Tobias Schultze <http://tobion.de> | ||
17 | */ | ||
18 | class HelloWorldCommand extends Command | ||
19 | { | ||
20 | /** | ||
21 | * {@inheritdoc} | ||
22 | */ | ||
23 | protected function configure() | ||
24 | { | ||
25 | $this | ||
26 | ->setName('acme:hello') | ||
27 | ->setDescription('Hello World example command') | ||
28 | ->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World') | ||
29 | ->setHelp(<<<EOF | ||
30 | The <info>%command.name%</info> command greets somebody or everybody: | ||
31 | |||
32 | <info>php %command.full_name%</info> | ||
33 | |||
34 | The optional argument specifies who to greet: | ||
35 | |||
36 | <info>php %command.full_name%</info> Fabien | ||
37 | EOF | ||
38 | ); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * {@inheritdoc} | ||
43 | */ | ||
44 | protected function execute(InputInterface $input, OutputInterface $output) | ||
45 | { | ||
46 | $output->writeln(sprintf('Hello <comment>%s</comment>!', $input->getArgument('who'))); | ||
47 | } | ||
48 | } | ||
diff --git a/src/Acme/DemoBundle/Controller/DemoController.php b/src/Acme/DemoBundle/Controller/DemoController.php deleted file mode 100644 index a99de891..00000000 --- a/src/Acme/DemoBundle/Controller/DemoController.php +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Controller; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
6 | use Symfony\Component\HttpFoundation\RedirectResponse; | ||
7 | use Symfony\Component\HttpFoundation\Request; | ||
8 | use Acme\DemoBundle\Form\ContactType; | ||
9 | |||
10 | // these import the "@Route" and "@Template" annotations | ||
11 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
12 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
13 | |||
14 | class DemoController extends Controller | ||
15 | { | ||
16 | /** | ||
17 | * @Route("/", name="_demo") | ||
18 | * @Template() | ||
19 | */ | ||
20 | public function indexAction() | ||
21 | { | ||
22 | return array(); | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * @Route("/hello/{name}", name="_demo_hello") | ||
27 | * @Template() | ||
28 | */ | ||
29 | public function helloAction($name) | ||
30 | { | ||
31 | return array('name' => $name); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * @Route("/contact", name="_demo_contact") | ||
36 | * @Template() | ||
37 | */ | ||
38 | public function contactAction(Request $request) | ||
39 | { | ||
40 | $form = $this->createForm(new ContactType()); | ||
41 | $form->handleRequest($request); | ||
42 | |||
43 | if ($form->isValid()) { | ||
44 | $mailer = $this->get('mailer'); | ||
45 | |||
46 | // .. setup a message and send it | ||
47 | // http://symfony.com/doc/current/cookbook/email.html | ||
48 | |||
49 | $request->getSession()->getFlashBag()->set('notice', 'Message sent!'); | ||
50 | |||
51 | return new RedirectResponse($this->generateUrl('_demo')); | ||
52 | } | ||
53 | |||
54 | return array('form' => $form->createView()); | ||
55 | } | ||
56 | } | ||
diff --git a/src/Acme/DemoBundle/Controller/SecuredController.php b/src/Acme/DemoBundle/Controller/SecuredController.php deleted file mode 100644 index d1499e39..00000000 --- a/src/Acme/DemoBundle/Controller/SecuredController.php +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Controller; | ||
4 | |||
5 | use Symfony\Component\HttpFoundation\Request; | ||
6 | use Symfony\Component\Security\Core\SecurityContext; | ||
7 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
10 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; | ||
11 | |||
12 | /** | ||
13 | * @Route("/demo/secured") | ||
14 | */ | ||
15 | class SecuredController extends Controller | ||
16 | { | ||
17 | /** | ||
18 | * @Route("/login", name="_demo_login") | ||
19 | * @Template() | ||
20 | */ | ||
21 | public function loginAction(Request $request) | ||
22 | { | ||
23 | if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { | ||
24 | $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); | ||
25 | } else { | ||
26 | $error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR); | ||
27 | } | ||
28 | |||
29 | return array( | ||
30 | 'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME), | ||
31 | 'error' => $error, | ||
32 | ); | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * @Route("/login_check", name="_demo_security_check") | ||
37 | */ | ||
38 | public function securityCheckAction() | ||
39 | { | ||
40 | // The security layer will intercept this request | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * @Route("/logout", name="_demo_logout") | ||
45 | */ | ||
46 | public function logoutAction() | ||
47 | { | ||
48 | // The security layer will intercept this request | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @Route("/hello", defaults={"name"="World"}), | ||
53 | * @Route("/hello/{name}", name="_demo_secured_hello") | ||
54 | * @Template() | ||
55 | */ | ||
56 | public function helloAction($name) | ||
57 | { | ||
58 | return array('name' => $name); | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin") | ||
63 | * @Security("is_granted('ROLE_ADMIN')") | ||
64 | * @Template() | ||
65 | */ | ||
66 | public function helloadminAction($name) | ||
67 | { | ||
68 | return array('name' => $name); | ||
69 | } | ||
70 | } | ||
diff --git a/src/Acme/DemoBundle/Controller/WelcomeController.php b/src/Acme/DemoBundle/Controller/WelcomeController.php deleted file mode 100644 index 884f95bb..00000000 --- a/src/Acme/DemoBundle/Controller/WelcomeController.php +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Controller; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
6 | |||
7 | class WelcomeController extends Controller | ||
8 | { | ||
9 | public function indexAction() | ||
10 | { | ||
11 | /* | ||
12 | * The action's view can be rendered using render() method | ||
13 | * or @Template annotation as demonstrated in DemoController. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | return $this->render('AcmeDemoBundle:Welcome:index.html.twig'); | ||
18 | } | ||
19 | } | ||
diff --git a/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php b/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php deleted file mode 100644 index 6dfcc822..00000000 --- a/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\DependencyInjection; | ||
4 | |||
5 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
6 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; | ||
7 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
8 | use Symfony\Component\Config\FileLocator; | ||
9 | |||
10 | class AcmeDemoExtension extends Extension | ||
11 | { | ||
12 | public function load(array $configs, ContainerBuilder $container) | ||
13 | { | ||
14 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
15 | $loader->load('services.xml'); | ||
16 | } | ||
17 | |||
18 | public function getAlias() | ||
19 | { | ||
20 | return 'acme_demo'; | ||
21 | } | ||
22 | } | ||
diff --git a/src/Acme/DemoBundle/EventListener/ControllerListener.php b/src/Acme/DemoBundle/EventListener/ControllerListener.php deleted file mode 100644 index aa117d74..00000000 --- a/src/Acme/DemoBundle/EventListener/ControllerListener.php +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\EventListener; | ||
4 | |||
5 | use Symfony\Component\HttpKernel\HttpKernelInterface; | ||
6 | use Symfony\Component\HttpKernel\Event\FilterControllerEvent; | ||
7 | use Acme\DemoBundle\Twig\Extension\DemoExtension; | ||
8 | |||
9 | class ControllerListener | ||
10 | { | ||
11 | protected $extension; | ||
12 | |||
13 | public function __construct(DemoExtension $extension) | ||
14 | { | ||
15 | $this->extension = $extension; | ||
16 | } | ||
17 | |||
18 | public function onKernelController(FilterControllerEvent $event) | ||
19 | { | ||
20 | if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { | ||
21 | $this->extension->setController($event->getController()); | ||
22 | } | ||
23 | } | ||
24 | } | ||
diff --git a/src/Acme/DemoBundle/Form/ContactType.php b/src/Acme/DemoBundle/Form/ContactType.php deleted file mode 100644 index 2c76cdb2..00000000 --- a/src/Acme/DemoBundle/Form/ContactType.php +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Form; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | ||
7 | |||
8 | class ContactType extends AbstractType | ||
9 | { | ||
10 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
11 | { | ||
12 | $builder->add('email', 'email'); | ||
13 | $builder->add('message', 'textarea'); | ||
14 | } | ||
15 | |||
16 | public function getName() | ||
17 | { | ||
18 | return 'contact'; | ||
19 | } | ||
20 | } | ||
diff --git a/src/Acme/DemoBundle/Resources/config/routing.yml b/src/Acme/DemoBundle/Resources/config/routing.yml deleted file mode 100644 index 06291a23..00000000 --- a/src/Acme/DemoBundle/Resources/config/routing.yml +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | _welcome: | ||
2 | path: / | ||
3 | defaults: { _controller: AcmeDemoBundle:Welcome:index } | ||
4 | |||
5 | _demo_secured: | ||
6 | resource: "@AcmeDemoBundle/Controller/SecuredController.php" | ||
7 | type: annotation | ||
8 | |||
9 | _demo: | ||
10 | resource: "@AcmeDemoBundle/Controller/DemoController.php" | ||
11 | type: annotation | ||
12 | prefix: /demo | ||
diff --git a/src/Acme/DemoBundle/Resources/config/services.xml b/src/Acme/DemoBundle/Resources/config/services.xml deleted file mode 100644 index d6274ce9..00000000 --- a/src/Acme/DemoBundle/Resources/config/services.xml +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | |||
3 | <container xmlns="http://symfony.com/schema/dic/services" | ||
4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
5 | xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
6 | |||
7 | <services> | ||
8 | <service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false"> | ||
9 | <tag name="twig.extension" /> | ||
10 | <argument type="service" id="twig.loader" /> | ||
11 | </service> | ||
12 | |||
13 | <service id="acme.demo.listener" class="Acme\DemoBundle\EventListener\ControllerListener"> | ||
14 | <tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" /> | ||
15 | <argument type="service" id="twig.extension.acme.demo" /> | ||
16 | </service> | ||
17 | </services> | ||
18 | </container> | ||
diff --git a/src/Acme/DemoBundle/Resources/public/css/demo.css b/src/Acme/DemoBundle/Resources/public/css/demo.css deleted file mode 100644 index 4dd2f16c..00000000 --- a/src/Acme/DemoBundle/Resources/public/css/demo.css +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | body { | ||
2 | font-size: 14px; | ||
3 | font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; | ||
4 | } | ||
5 | h1.title { | ||
6 | font-size: 45px; | ||
7 | padding-bottom: 30px; | ||
8 | } | ||
9 | .sf-reset h2 { | ||
10 | font-weight: bold; | ||
11 | color: #FFFFFF; | ||
12 | /* Font is duplicated of body (sans-serif) */ | ||
13 | font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; | ||
14 | |||
15 | margin-bottom: 10px; | ||
16 | background-color: #aacd4e; | ||
17 | padding: 2px 4px; | ||
18 | display: inline-block; | ||
19 | text-transform: uppercase; | ||
20 | |||
21 | } | ||
22 | p { | ||
23 | line-height: 20px; | ||
24 | padding-bottom: 20px; | ||
25 | } | ||
26 | ul#demo-list a { | ||
27 | background: url(../images/blue-arrow.png) no-repeat right 6px; | ||
28 | padding-right: 10px; | ||
29 | margin-right: 30px; | ||
30 | } | ||
31 | #symfony-header { | ||
32 | position: relative; | ||
33 | padding: 30px 30px 20px 30px; | ||
34 | } | ||
35 | .sf-reset .symfony-blocks-welcome { | ||
36 | overflow: hidden; | ||
37 | } | ||
38 | .sf-reset .symfony-blocks-welcome > div { | ||
39 | background-color: whitesmoke; | ||
40 | float: left; | ||
41 | width: 240px; | ||
42 | margin-right: 14px; | ||
43 | text-align: center; | ||
44 | padding: 26px 20px; | ||
45 | } | ||
46 | .sf-reset .symfony-blocks-welcome > div.block-demo { | ||
47 | margin-right: 0; | ||
48 | } | ||
49 | .sf-reset .symfony-blocks-welcome .illustration { | ||
50 | padding-bottom: 20px; | ||
51 | } | ||
52 | .sf-reset .symfony-blocks-help { | ||
53 | overflow: hidden; | ||
54 | } | ||
55 | .sf-reset .symfony-blocks-help { | ||
56 | margin-top: 30px; | ||
57 | padding: 18px; | ||
58 | border: 1px solid #E6E6E6; | ||
59 | } | ||
60 | .sf-reset .symfony-blocks-help > div { | ||
61 | width: 254px; | ||
62 | float: left; | ||
63 | } | ||
64 | .flash-message { | ||
65 | padding: 10px; | ||
66 | margin: 5px; | ||
67 | margin-top: 15px; | ||
68 | background-color: #ffe; | ||
69 | } | ||
70 | .sf-reset .error { | ||
71 | color: red; | ||
72 | } | ||
73 | #login label, #contact_form label { | ||
74 | display: block; | ||
75 | float: left; | ||
76 | width: 90px; | ||
77 | } | ||
78 | .sf-reset ul#menu { | ||
79 | float: right; | ||
80 | margin-bottom: 20px; | ||
81 | padding-left: 0; | ||
82 | } | ||
83 | .sf-reset #menu li { | ||
84 | padding-left: 0; | ||
85 | margin-right: 10px; | ||
86 | display: inline; | ||
87 | } | ||
88 | .sf-reset a, | ||
89 | .sf-reset li a { | ||
90 | color: #08C; | ||
91 | text-decoration: none; | ||
92 | } | ||
93 | .sf-reset a:hover, | ||
94 | .sf-reset li a:hover { | ||
95 | color: #08C; | ||
96 | text-decoration: underline; | ||
97 | } | ||
98 | .sf-reset .symfony-content pre { | ||
99 | white-space: pre; | ||
100 | font-family: monospace; | ||
101 | } | ||
diff --git a/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png b/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png deleted file mode 100644 index fa82d4b4..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/field-background.gif b/src/Acme/DemoBundle/Resources/public/images/field-background.gif deleted file mode 100644 index 7c0efc10..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/field-background.gif +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/logo.gif b/src/Acme/DemoBundle/Resources/public/images/logo.gif deleted file mode 100644 index 703cf45f..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/logo.gif +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/search.png b/src/Acme/DemoBundle/Resources/public/images/search.png deleted file mode 100644 index 3c88b6a4..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/search.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif deleted file mode 100644 index 931179a7..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif deleted file mode 100644 index 0623de54..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif deleted file mode 100644 index b9018b11..00000000 --- a/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig deleted file mode 100644 index e5b7523b..00000000 --- a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title "Symfony - Contact form" %} | ||
4 | |||
5 | {% block content %} | ||
6 | <form action="{{ path('_demo_contact') }}" method="POST" id="contact_form"> | ||
7 | {{ form_errors(form) }} | ||
8 | |||
9 | {{ form_row(form.email) }} | ||
10 | {{ form_row(form.message) }} | ||
11 | |||
12 | {{ form_rest(form) }} | ||
13 | <input type="submit" value="Send" class="symfony-button-grey" /> | ||
14 | </form> | ||
15 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig deleted file mode 100644 index 3997ff60..00000000 --- a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title "Hello " ~ name %} | ||
4 | |||
5 | {% block content %} | ||
6 | <h1>Hello {{ name }}!</h1> | ||
7 | {% endblock %} | ||
8 | |||
9 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig deleted file mode 100644 index 454a3203..00000000 --- a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title "Symfony - Demos" %} | ||
4 | |||
5 | {% block content_header '' %} | ||
6 | |||
7 | {% block content %} | ||
8 | <h1 class="title">Available demos</h1> | ||
9 | <ul id="demo-list"> | ||
10 | <li><a href="{{ path('_demo_hello', {'name': 'World'}) }}">Hello World</a></li> | ||
11 | <li><a href="{{ path('_demo_secured_hello', {'name': 'World'}) }}">Access the secured area</a> <a href="{{ path('_demo_login') }}">Go to the login page</a></li> | ||
12 | {# <li><a href="{{ path('_demo_contact') }}">Send a Message</a></li> #} | ||
13 | </ul> | ||
14 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig deleted file mode 100644 index faf95cf8..00000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | {% extends "AcmeDemoBundle:Secured:layout.html.twig" %} | ||
2 | |||
3 | {% block title "Hello " ~ name %} | ||
4 | |||
5 | {% block content %} | ||
6 | <h1 class="title">Hello {{ name }}!</h1> | ||
7 | |||
8 | <a href="{{ path('_demo_secured_hello_admin', { 'name': name }) }}">Hello resource secured for <strong>admin</strong> only.</a> | ||
9 | {% endblock %} | ||
10 | |||
11 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig deleted file mode 100644 index 4e3649f7..00000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | {% extends "AcmeDemoBundle:Secured:layout.html.twig" %} | ||
2 | |||
3 | {% block title "Hello " ~ name %} | ||
4 | |||
5 | {% block content %} | ||
6 | <h1 class="title">Hello {{ name }} secured for Admins only!</h1> | ||
7 | {% endblock %} | ||
8 | |||
9 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig deleted file mode 100644 index aeea55c5..00000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block content_header_more %} | ||
4 | {{ parent() }} | ||
5 | <li>logged in as <strong>{{ app.user ? app.user.username : 'Anonymous' }}</strong> - <a href="{{ path('_demo_logout') }}">Logout</a></li> | ||
6 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig deleted file mode 100644 index 3e76d1df..00000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | {% extends 'AcmeDemoBundle::layout.html.twig' %} | ||
2 | |||
3 | {% block content %} | ||
4 | <h1 class="title">Login</h1> | ||
5 | |||
6 | <p> | ||
7 | Choose between two default users: <em>user/userpass</em> <small>(ROLE_USER)</small> or <em>admin/adminpass</em> <small>(ROLE_ADMIN)</small> | ||
8 | </p> | ||
9 | |||
10 | {% if error %} | ||
11 | <div class="error">{{ error.message }}</div> | ||
12 | {% endif %} | ||
13 | |||
14 | <form action="{{ path("_demo_security_check") }}" method="post" id="login"> | ||
15 | <div> | ||
16 | <label for="username">Username</label> | ||
17 | <input type="text" id="username" name="_username" value="{{ last_username }}" /> | ||
18 | </div> | ||
19 | |||
20 | <div> | ||
21 | <label for="password">Password</label> | ||
22 | <input type="password" id="password" name="_password" /> | ||
23 | </div> | ||
24 | |||
25 | <button type="submit" class="sf-button"> | ||
26 | <span class="border-l"> | ||
27 | <span class="border-r"> | ||
28 | <span class="btn-bg">Login</span> | ||
29 | </span> | ||
30 | </span> | ||
31 | </button> | ||
32 | </form> | ||
33 | {% endblock %} | ||
34 | |||
35 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig b/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig deleted file mode 100644 index ea3a7299..00000000 --- a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | {% extends 'AcmeDemoBundle::layout.html.twig' %} | ||
2 | |||
3 | {% block title %}Symfony - Welcome{% endblock %} | ||
4 | |||
5 | {% block content_header '' %} | ||
6 | |||
7 | {% block content %} | ||
8 | {% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%} | ||
9 | |||
10 | <h1 class="title">Welcome!</h1> | ||
11 | |||
12 | <p>Congratulations! You have successfully installed a new Symfony application.</p> | ||
13 | |||
14 | <div class="symfony-blocks-welcome"> | ||
15 | <div class="block-quick-tour"> | ||
16 | <div class="illustration"> | ||
17 | <img src="{{ asset('bundles/acmedemo/images/welcome-quick-tour.gif') }}" alt="Quick tour" /> | ||
18 | </div> | ||
19 | <a href="http://symfony.com/doc/{{ version }}/quick_tour/index.html" class="sf-button sf-button-selected"> | ||
20 | <span class="border-l"> | ||
21 | <span class="border-r"> | ||
22 | <span class="btn-bg">Read the Quick Tour</span> | ||
23 | </span> | ||
24 | </span> | ||
25 | </a> | ||
26 | </div> | ||
27 | {% if app.environment == 'dev' %} | ||
28 | <div class="block-configure"> | ||
29 | <div class="illustration"> | ||
30 | <img src="{{ asset('bundles/acmedemo/images/welcome-configure.gif') }}" alt="Configure your application" /> | ||
31 | </div> | ||
32 | <a href="{{ path('_configurator_home') }}" class="sf-button sf-button-selected"> | ||
33 | <span class="border-l"> | ||
34 | <span class="border-r"> | ||
35 | <span class="btn-bg">Configure</span> | ||
36 | </span> | ||
37 | </span> | ||
38 | </a> | ||
39 | </div> | ||
40 | {% endif %} | ||
41 | <div class="block-demo"> | ||
42 | <div class="illustration"> | ||
43 | <img src="{{ asset('bundles/acmedemo/images/welcome-demo.gif') }}" alt="Demo" /> | ||
44 | </div> | ||
45 | <a href="{{ path('_demo') }}" class="sf-button sf-button-selected"> | ||
46 | <span class="border-l"> | ||
47 | <span class="border-r"> | ||
48 | <span class="btn-bg">Run The Demo</span> | ||
49 | </span> | ||
50 | </span> | ||
51 | </a> | ||
52 | </div> | ||
53 | </div> | ||
54 | |||
55 | <div class="symfony-blocks-help"> | ||
56 | <div class="block-documentation"> | ||
57 | <ul> | ||
58 | <li><strong>Documentation</strong></li> | ||
59 | <li><a href="http://symfony.com/doc/{{ version }}/book/index.html">The Book</a></li> | ||
60 | <li><a href="http://symfony.com/doc/{{ version }}/cookbook/index.html">The Cookbook</a></li> | ||
61 | <li><a href="http://symfony.com/doc/{{ version }}/components/index.html">The Components</a></li> | ||
62 | <li><a href="http://symfony.com/doc/{{ version }}/reference/index.html">Reference</a></li> | ||
63 | <li><a href="http://symfony.com/doc/{{ version }}/glossary.html">Glossary</a></li> | ||
64 | </ul> | ||
65 | </div> | ||
66 | <div class="block-documentation-more"> | ||
67 | <ul> | ||
68 | <li><strong>Sensio</strong></li> | ||
69 | <li><a href="http://trainings.sensiolabs.com">Trainings</a></li> | ||
70 | <li><a href="http://books.sensiolabs.com">Books</a></li> | ||
71 | </ul> | ||
72 | </div> | ||
73 | <div class="block-community"> | ||
74 | <ul> | ||
75 | <li><strong>Community</strong></li> | ||
76 | <li><a href="http://symfony.com/irc">IRC channel</a></li> | ||
77 | <li><a href="http://symfony.com/mailing-lists">Mailing lists</a></li> | ||
78 | <li><a href="http://forum.symfony-project.org">Forum</a></li> | ||
79 | <li><a href="http://symfony.com/doc/{{ version }}/contributing/index.html">Contributing</a></li> | ||
80 | </ul> | ||
81 | </div> | ||
82 | </div> | ||
83 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/layout.html.twig b/src/Acme/DemoBundle/Resources/views/layout.html.twig deleted file mode 100644 index d7e97d56..00000000 --- a/src/Acme/DemoBundle/Resources/views/layout.html.twig +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | {% extends "TwigBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block head %} | ||
4 | <link rel="icon" sizes="16x16" href="{{ asset('favicon.ico') }}" /> | ||
5 | <link rel="stylesheet" href="{{ asset('bundles/acmedemo/css/demo.css') }}" /> | ||
6 | {% endblock %} | ||
7 | |||
8 | {% block title 'Demo Bundle' %} | ||
9 | |||
10 | {% block body %} | ||
11 | {% for flashMessage in app.session.flashbag.get('notice') %} | ||
12 | <div class="flash-message"> | ||
13 | <em>Notice</em>: {{ flashMessage }} | ||
14 | </div> | ||
15 | {% endfor %} | ||
16 | |||
17 | {% block content_header %} | ||
18 | <ul id="menu"> | ||
19 | {% block content_header_more %} | ||
20 | <li><a href="{{ path('_demo') }}">Demo Home</a></li> | ||
21 | {% endblock %} | ||
22 | </ul> | ||
23 | |||
24 | <div style="clear: both"></div> | ||
25 | {% endblock %} | ||
26 | |||
27 | <div class="block"> | ||
28 | {% block content %}{% endblock %} | ||
29 | </div> | ||
30 | |||
31 | {% if code is defined %} | ||
32 | <h2>Code behind this page</h2> | ||
33 | <div class="block"> | ||
34 | <div class="symfony-content">{{ code|raw }}</div> | ||
35 | </div> | ||
36 | {% endif %} | ||
37 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php b/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php deleted file mode 100644 index d2176897..00000000 --- a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Tests\Controller; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
6 | |||
7 | class DemoControllerTest extends WebTestCase | ||
8 | { | ||
9 | public function testIndex() | ||
10 | { | ||
11 | $client = static::createClient(); | ||
12 | |||
13 | $crawler = $client->request('GET', '/demo/hello/Fabien'); | ||
14 | |||
15 | $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count()); | ||
16 | } | ||
17 | |||
18 | public function testSecureSection() | ||
19 | { | ||
20 | $client = static::createClient(); | ||
21 | |||
22 | // goes to the secure page | ||
23 | $crawler = $client->request('GET', '/demo/secured/hello/World'); | ||
24 | |||
25 | // redirects to the login page | ||
26 | $crawler = $client->followRedirect(); | ||
27 | |||
28 | // submits the login form | ||
29 | $form = $crawler->selectButton('Login')->form(array('_username' => 'admin', '_password' => 'adminpass')); | ||
30 | $client->submit($form); | ||
31 | |||
32 | // redirect to the original page (but now authenticated) | ||
33 | $crawler = $client->followRedirect(); | ||
34 | |||
35 | // check that the page is the right one | ||
36 | $this->assertCount(1, $crawler->filter('h1.title:contains("Hello World!")')); | ||
37 | |||
38 | // click on the secure link | ||
39 | $link = $crawler->selectLink('Hello resource secured')->link(); | ||
40 | $crawler = $client->click($link); | ||
41 | |||
42 | // check that the page is the right one | ||
43 | $this->assertCount(1, $crawler->filter('h1.title:contains("secured for Admins only!")')); | ||
44 | } | ||
45 | } | ||
diff --git a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php b/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php deleted file mode 100644 index e6ce94f6..00000000 --- a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Twig\Extension; | ||
4 | |||
5 | use CG\Core\ClassUtils; | ||
6 | |||
7 | class DemoExtension extends \Twig_Extension | ||
8 | { | ||
9 | protected $loader; | ||
10 | protected $controller; | ||
11 | |||
12 | public function __construct(\Twig_LoaderInterface $loader) | ||
13 | { | ||
14 | $this->loader = $loader; | ||
15 | } | ||
16 | |||
17 | public function setController($controller) | ||
18 | { | ||
19 | $this->controller = $controller; | ||
20 | } | ||
21 | |||
22 | /** | ||
23 | * {@inheritdoc} | ||
24 | */ | ||
25 | public function getFunctions() | ||
26 | { | ||
27 | return array( | ||
28 | new \Twig_SimpleFunction('code', array($this, 'getCode'), array('is_safe' => array('html'))), | ||
29 | ); | ||
30 | } | ||
31 | |||
32 | public function getCode($template) | ||
33 | { | ||
34 | // highlight_string highlights php code only if '<?php' tag is present. | ||
35 | $controller = highlight_string("<?php".$this->getControllerCode(), true); | ||
36 | $controller = str_replace('<span style="color: #0000BB"><?php </span>', ' ', $controller); | ||
37 | |||
38 | $template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8'); | ||
39 | |||
40 | // remove the code block | ||
41 | $template = str_replace('{% set code = code(_self) %}', '', $template); | ||
42 | |||
43 | return <<<EOF | ||
44 | <p><strong>Controller Code</strong></p> | ||
45 | <pre>$controller</pre> | ||
46 | |||
47 | <p><strong>Template Code</strong></p> | ||
48 | <pre>$template</pre> | ||
49 | EOF; | ||
50 | } | ||
51 | |||
52 | protected function getControllerCode() | ||
53 | { | ||
54 | $class = get_class($this->controller[0]); | ||
55 | if (class_exists('CG\Core\ClassUtils')) { | ||
56 | $class = ClassUtils::getUserClass($class); | ||
57 | } | ||
58 | |||
59 | $r = new \ReflectionClass($class); | ||
60 | $m = $r->getMethod($this->controller[1]); | ||
61 | |||
62 | $code = file($r->getFilename()); | ||
63 | |||
64 | return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1)); | ||
65 | } | ||
66 | |||
67 | protected function getTemplateCode($template) | ||
68 | { | ||
69 | return $this->loader->getSource($template->getTemplateName()); | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * Returns the name of the extension. | ||
74 | * | ||
75 | * @return string The extension name | ||
76 | */ | ||
77 | public function getName() | ||
78 | { | ||
79 | return 'demo'; | ||
80 | } | ||
81 | } | ||
diff --git a/src/AppBundle/AppBundle.php b/src/AppBundle/AppBundle.php deleted file mode 100644 index 05123b67..00000000 --- a/src/AppBundle/AppBundle.php +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace AppBundle; | ||
4 | |||
5 | use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
6 | |||
7 | class AppBundle extends Bundle | ||
8 | { | ||
9 | } | ||
diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php deleted file mode 100644 index 541a7688..00000000 --- a/src/AppBundle/Controller/DefaultController.php +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace AppBundle\Controller; | ||
4 | |||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
7 | |||
8 | class DefaultController extends Controller | ||
9 | { | ||
10 | /** | ||
11 | * @Route("/app/example", name="homepage") | ||
12 | */ | ||
13 | public function indexAction() | ||
14 | { | ||
15 | return $this->render('default/index.html.twig'); | ||
16 | } | ||
17 | } | ||
diff --git a/src/AppBundle/Tests/Controller/DefaultControllerTest.php b/src/AppBundle/Tests/Controller/DefaultControllerTest.php deleted file mode 100644 index f35af752..00000000 --- a/src/AppBundle/Tests/Controller/DefaultControllerTest.php +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace AppBundle\Tests\Controller; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
6 | |||
7 | class DefaultControllerTest extends WebTestCase | ||
8 | { | ||
9 | public function testIndex() | ||
10 | { | ||
11 | $client = static::createClient(); | ||
12 | |||
13 | $crawler = $client->request('GET', '/app/example'); | ||
14 | |||
15 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
16 | $this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0); | ||
17 | } | ||
18 | } | ||