Skip to content
Browse files

initial commit

  • Loading branch information...
0 parents commit da8096386cc878280557f6740771ad84b73fe495 @jaytaph committed
Showing with 17,678 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +10 −0 .travis.yml
  3. +24 −0 LICENSE
  4. +2 −0 README.md
  5. +1 −0 app/.htaccess
  6. +9 −0 app/AppCache.php
  7. +44 −0 app/AppKernel.php
  8. +129 −0 app/Resources/views/base.html.twig
  9. +16 −0 app/Resources/views/flash_message.html.twig
  10. +95 −0 app/Resources/views/knp_menu.html.twig
  11. +638 −0 app/SymfonyRequirements.php
  12. +16 −0 app/autoload.php
  13. +55 −0 app/check.php
  14. +67 −0 app/config/config.yml
  15. +26 −0 app/config/config_dev.yml
  16. +19 −0 app/config/config_prod.yml
  17. +14 −0 app/config/config_test.yml
  18. +15 −0 app/config/parameters.yml
  19. +15 −0 app/config/parameters.yml.dist
  20. +20 −0 app/config/routing.yml
  21. +14 −0 app/config/routing_dev.yml
  22. +43 −0 app/config/security.yml
  23. +22 −0 app/console
  24. +41 −0 app/phpunit.xml.dist
  25. +47 −0 composer.json
  26. +1,588 −0 composer.lock
  27. BIN composer.phar
  28. +5 −0 installdb.sh
  29. +1 −0 public
  30. +1 −0 src/.htaccess
  31. +13 −0 src/Saffire/BadgeBundle/Controller/DefaultController.php
  32. +50 −0 src/Saffire/BadgeBundle/DataFixtures/ORM/BadgeCategoryFixtures.php
  33. +195 −0 src/Saffire/BadgeBundle/DataFixtures/ORM/BadgeFixtures.php
  34. +29 −0 src/Saffire/BadgeBundle/DependencyInjection/Configuration.php
  35. +28 −0 src/Saffire/BadgeBundle/DependencyInjection/SaffireBadgeExtension.php
  36. +176 −0 src/Saffire/BadgeBundle/Entity/Badge.php
  37. +130 −0 src/Saffire/BadgeBundle/Entity/Badge.php~
  38. +86 −0 src/Saffire/BadgeBundle/Entity/BadgeCategory.php
  39. +30 −0 src/Saffire/BadgeBundle/Entity/BadgeCategory.php~
  40. +19 −0 src/Saffire/BadgeBundle/Repository/BadgeRepository.php
  41. +3 −0 src/Saffire/BadgeBundle/Resources/config/routing.yml
  42. +7 −0 src/Saffire/BadgeBundle/Resources/config/services.yml
  43. 0 src/Saffire/BadgeBundle/Resources/doc/index.rst
  44. +11 −0 src/Saffire/BadgeBundle/Resources/translations/messages.fr.xlf
  45. +1 −0 src/Saffire/BadgeBundle/Resources/views/Default/index.html.twig
  46. +9 −0 src/Saffire/BadgeBundle/SaffireBadgeBundle.php
  47. +17 −0 src/Saffire/BadgeBundle/Tests/Controller/DefaultControllerTest.php
  48. +13 −0 src/Saffire/GroupBundle/Controller/DefaultController.php
  49. +32 −0 src/Saffire/GroupBundle/DataFixtures/ORM/GroupFixtures.php
  50. +29 −0 src/Saffire/GroupBundle/DependencyInjection/Configuration.php
  51. +28 −0 src/Saffire/GroupBundle/DependencyInjection/SaffireGroupExtension.php
  52. +157 −0 src/Saffire/GroupBundle/Entity/Group.php
  53. +130 −0 src/Saffire/GroupBundle/Entity/Group.php~
  54. +19 −0 src/Saffire/GroupBundle/Repository/GroupRepository.php
  55. +3 −0 src/Saffire/GroupBundle/Resources/config/routing.yml
  56. +7 −0 src/Saffire/GroupBundle/Resources/config/services.yml
  57. 0 src/Saffire/GroupBundle/Resources/doc/index.rst
  58. +11 −0 src/Saffire/GroupBundle/Resources/translations/messages.fr.xlf
  59. +1 −0 src/Saffire/GroupBundle/Resources/views/Default/index.html.twig
  60. +9 −0 src/Saffire/GroupBundle/SaffireGroupBundle.php
  61. +17 −0 src/Saffire/GroupBundle/Tests/Controller/DefaultControllerTest.php
  62. +13 −0 src/Saffire/HomeBundle/Controller/DefaultController.php
  63. +35 −0 src/Saffire/HomeBundle/Controller/WidgetController.php
  64. +29 −0 src/Saffire/HomeBundle/DependencyInjection/Configuration.php
  65. +28 −0 src/Saffire/HomeBundle/DependencyInjection/SaffireHomeExtension.php
  66. +11 −0 src/Saffire/HomeBundle/Resources/config/routing.yml
  67. +7 −0 src/Saffire/HomeBundle/Resources/config/services.yml
  68. 0 src/Saffire/HomeBundle/Resources/doc/index.rst
  69. +11 −0 src/Saffire/HomeBundle/Resources/translations/messages.fr.xlf
  70. +31 −0 src/Saffire/HomeBundle/Resources/views/Default/index.html.twig
  71. +18 −0 src/Saffire/HomeBundle/Resources/views/Widget/new.html.twig
  72. +4 −0 src/Saffire/HomeBundle/Resources/views/Widget/tip.html.twig
  73. +9 −0 src/Saffire/HomeBundle/SaffireHomeBundle.php
  74. +17 −0 src/Saffire/HomeBundle/Tests/Controller/DefaultControllerTest.php
  75. +13 −0 src/Saffire/UserBundle/Controller/DefaultController.php
  76. +40 −0 src/Saffire/UserBundle/DataFixtures/ORM/UserFixtures.php
  77. +29 −0 src/Saffire/UserBundle/DependencyInjection/Configuration.php
  78. +28 −0 src/Saffire/UserBundle/DependencyInjection/SaffireUserExtension.php
  79. +293 −0 src/Saffire/UserBundle/Entity/User.php
  80. +270 −0 src/Saffire/UserBundle/Entity/User.php~
  81. +19 −0 src/Saffire/UserBundle/Repository/UserRepository.php
  82. +11 −0 src/Saffire/UserBundle/Resources/config/routing.yml
  83. +7 −0 src/Saffire/UserBundle/Resources/config/services.yml
  84. 0 src/Saffire/UserBundle/Resources/doc/index.rst
  85. +11 −0 src/Saffire/UserBundle/Resources/translations/messages.fr.xlf
  86. +7 −0 src/Saffire/UserBundle/Resources/views/Default/index.html.twig
  87. +9 −0 src/Saffire/UserBundle/SaffireUserBundle.php
  88. +17 −0 src/Saffire/UserBundle/Tests/Controller/DefaultControllerTest.php
  89. +10 −0 web/.htaccess
  90. +24 −0 web/app.php
  91. +20 −0 web/app_dev.php
  92. BIN web/apple-touch-icon.png
  93. +815 −0 web/assets/bootstrap/css/bootstrap-responsive.css
  94. +4,914 −0 web/assets/bootstrap/css/bootstrap.css
  95. +727 −0 web/assets/bootstrap/css/bootstrap.min.css
  96. BIN web/assets/bootstrap/img/glyphicons-halflings-white.png
  97. BIN web/assets/bootstrap/img/glyphicons-halflings.png
  98. +90 −0 web/assets/bootstrap/js/bootstrap-alert.js
  99. +96 −0 web/assets/bootstrap/js/bootstrap-button.js
  100. +169 −0 web/assets/bootstrap/js/bootstrap-carousel.js
  101. +157 −0 web/assets/bootstrap/js/bootstrap-collapse.js
  102. +100 −0 web/assets/bootstrap/js/bootstrap-dropdown.js
  103. +218 −0 web/assets/bootstrap/js/bootstrap-modal.js
  104. +98 −0 web/assets/bootstrap/js/bootstrap-popover.js
  105. +151 −0 web/assets/bootstrap/js/bootstrap-scrollspy.js
  106. +135 −0 web/assets/bootstrap/js/bootstrap-tab.js
  107. +275 −0 web/assets/bootstrap/js/bootstrap-tooltip.js
  108. +61 −0 web/assets/bootstrap/js/bootstrap-transition.js
  109. +285 −0 web/assets/bootstrap/js/bootstrap-typeahead.js
  110. +1,836 −0 web/assets/bootstrap/js/bootstrap.js
  111. +7 −0 web/assets/bootstrap/js/bootstrap.min.js
  112. +4 −0 web/assets/bootstrap/js/jquery.js
  113. +85 −0 web/assets/fancybox/css/jquery.fancybox-buttons.css
  114. +54 −0 web/assets/fancybox/css/jquery.fancybox-thumbs.css
  115. +234 −0 web/assets/fancybox/css/jquery.fancybox.css
  116. BIN web/assets/fancybox/img/blank.gif
  117. BIN web/assets/fancybox/img/fancybox_buttons.png
  118. BIN web/assets/fancybox/img/fancybox_loading.gif
  119. BIN web/assets/fancybox/img/fancybox_sprite.png
  120. +115 −0 web/assets/fancybox/js/jquery.fancybox-buttons.js
  121. +157 −0 web/assets/fancybox/js/jquery.fancybox-thumbs.js
  122. +1,463 −0 web/assets/fancybox/js/jquery.fancybox.js
  123. +35 −0 web/assets/fancybox/js/jquery.fancybox.pack.js
  124. +13 −0 web/assets/fancybox/js/jquery.mousewheel-3.0.6.pack.js
  125. +4 −0 web/assets/jquery/jquery-1.7.2.min.js
  126. +13 −0 web/assets/jquery/jquery.mousewheel-3.0.6.pack.js
  127. +98 −0 web/config.php
  128. BIN web/favicon.ico
  129. BIN web/img/badges/._001.jpg
  130. BIN web/img/badges/._002.jpg
  131. BIN web/img/badges/._003.jpg
  132. BIN web/img/badges/._004.jpg
  133. BIN web/img/badges/._005.jpg
  134. BIN web/img/badges/._006.jpg
  135. BIN web/img/badges/._007.jpg
  136. BIN web/img/badges/._008.jpg
  137. BIN web/img/badges/._009.jpg
  138. BIN web/img/badges/._010.jpg
  139. BIN web/img/badges/._011.jpg
  140. BIN web/img/badges/._012.jpg
  141. BIN web/img/badges/._013.jpg
  142. BIN web/img/badges/._014.jpg
  143. BIN web/img/badges/._015.jpg
  144. BIN web/img/badges/._016.jpg
  145. BIN web/img/badges/._017.jpg
  146. BIN web/img/badges/._018.jpg
  147. BIN web/img/badges/._019.jpg
  148. BIN web/img/badges/._020.jpg
  149. BIN web/img/badges/001.jpg
  150. BIN web/img/badges/002.jpg
  151. BIN web/img/badges/003.jpg
  152. BIN web/img/badges/004.jpg
  153. BIN web/img/badges/005.jpg
  154. BIN web/img/badges/006.jpg
  155. BIN web/img/badges/007.jpg
  156. BIN web/img/badges/008.jpg
  157. BIN web/img/badges/009.jpg
  158. BIN web/img/badges/010.jpg
  159. BIN web/img/badges/011.jpg
  160. BIN web/img/badges/012.jpg
  161. BIN web/img/badges/013.jpg
  162. BIN web/img/badges/014.jpg
  163. BIN web/img/badges/015.jpg
  164. BIN web/img/badges/016.jpg
  165. BIN web/img/badges/017.jpg
  166. BIN web/img/badges/018.jpg
  167. BIN web/img/badges/019.jpg
  168. BIN web/img/badges/020.jpg
  169. BIN web/img/beta_ribbon.png
  170. BIN web/img/groups/._core.jpg
  171. BIN web/img/groups/core.jpg
  172. BIN web/img/icon-github.png
  173. BIN web/img/logo_bootstrap.png
  174. BIN web/img/logo_noxlogic.jpg
  175. BIN web/img/logo_php.gif
  176. BIN web/img/logo_symfony.png
  177. BIN web/img/logo_travis.png
  178. BIN web/img/saffire-logo.png
  179. +4 −0 web/robots.txt
7 .gitignore
@@ -0,0 +1,7 @@
+/web/bundles/
+/app/bootstrap*
+/app/cache/*
+/app/logs/*
+/vendor/
+/app/config/parameters.ini
+.idea
10 .travis.yml
@@ -0,0 +1,10 @@
+language: php
+
+php:
+ - 5.3.3
+ - 5.3
+ - 5.4
+
+before_script: composer install
+
+script: phpunit -c app
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2012, The Saffire Group
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 README.md
@@ -0,0 +1,2 @@
+Saffire Connect
+===============
1 app/.htaccess
@@ -0,0 +1 @@
+deny from all
9 app/AppCache.php
@@ -0,0 +1,9 @@
+<?php
+
+require_once __DIR__.'/AppKernel.php';
+
+use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
+
+class AppCache extends HttpCache
+{
+}
44 app/AppKernel.php
@@ -0,0 +1,44 @@
+<?php
+
+use Symfony\Component\HttpKernel\Kernel;
+use Symfony\Component\Config\Loader\LoaderInterface;
+
+class AppKernel extends Kernel
+{
+ public function registerBundles()
+ {
+ $bundles = array(
+ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
+ new Symfony\Bundle\SecurityBundle\SecurityBundle(),
+ new Symfony\Bundle\TwigBundle\TwigBundle(),
+ new Symfony\Bundle\MonologBundle\MonologBundle(),
+ new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
+ new Symfony\Bundle\AsseticBundle\AsseticBundle(),
+ new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
+ new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+ new JMS\AopBundle\JMSAopBundle(),
+ new JMS\DiExtraBundle\JMSDiExtraBundle($this),
+ new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
+ new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
+ new Ornicar\GravatarBundle\OrnicarGravatarBundle(),
+ new Knp\Bundle\MenuBundle\KnpMenuBundle(),
+ new Saffire\BadgeBundle\SaffireBadgeBundle(),
+ new Saffire\UserBundle\SaffireUserBundle(),
+ new Saffire\HomeBundle\SaffireHomeBundle(),
+ new Saffire\GroupBundle\SaffireGroupBundle(),
+ );
+
+ if (in_array($this->getEnvironment(), array('dev', 'test'))) {
+ $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
+ $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
+ $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
+ }
+
+ return $bundles;
+ }
+
+ public function registerContainerConfiguration(LoaderInterface $loader)
+ {
+ $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
+ }
+}
129 app/Resources/views/base.html.twig
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>{% block title %}Welcome!{% endblock %}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="">
+ <meta name="author" content="">
+
+ {% block stylesheets %}{% endblock %}
+ <link href="/assets/bootstrap/css/bootstrap.css" rel="stylesheet">
+ <link href="/assets/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
+ <link rel="stylesheet" href="/assets/fancybox/css/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" />
+ <style type="text/css">
+ body {
+ padding-top: 60px;
+ padding-bottom: 40px;
+ }
+
+ .inactive {
+ opacity:0.4;
+ filter:alpha(opacity=40);
+ }
+ </style>
+
+ <script type="text/javascript" src="/assets/jquery/jquery-1.7.2.min.js"></script>
+
+
+ <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le fav and touch icons -->
+ <link rel="shortcut icon" href="/assets/bootstrap/ico/favicon.ico">
+ <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/bootstrap/ico/apple-touch-icon-144-precomposed.png">
+ <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/assets/bootstrap/ico/apple-touch-icon-114-precomposed.png">
+ <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/assets/bootstrap/ico/apple-touch-icon-72-precomposed.png">
+ <link rel="apple-touch-icon-precomposed" href="/assets/bootstrap/ico/apple-touch-icon-57-precomposed.png">
+ </head>
+
+ <body>
+
+{% if not app.request.get('standalone') %}
+ {# Remove me when we are not in beta anymore #}
+ <img style="z-index: 5000; position: fixed; top: 0; left: 0; border: 0;" src="/img/beta_ribbon.png" alt="This site beta">
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </a>
+ <a class="brand" href="/">connect.saffire-lang.org</a>
+ <div class="nav-collapse">
+ {#{{ knp_menu_render('BoxConfigDefaultBundle:Builder:mainMenu', {'currentClass': 'active'}) }}#}
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+ </div>
+{% endif %}
+
+
+ <div class="container">
+ {% include "::flash_message.html.twig" %}
+
+ {% block body %}{% endblock %}
+
+{% if not app.request.get('standalone') %}
+ {% block widget %}{% endblock %}
+ <hr>
+ <footer>
+ <p>
+ <img height="20" style='padding-bottom: 6px' title="Created by NoxLogic" src="/img/logo_noxlogic.jpg"> &copy; NoxLogic - {{ "now" | date("Y")}} - All rights reserved.
+
+ <img height="20" style='padding-bottom: 6px' class="pull-right" title="Created with the Symfony2 framework" src="/img/logo_symfony.png">
+ <img height="20" style='padding-bottom: 6px; padding-right: 10px' class="pull-right" title="Source hosted on Github" src="/img/icon-github.png">
+ <img height="20" style='padding-bottom: 6px; padding-right: 10px' class="pull-right" title="Created with Bootstrap" src="/img/logo_bootstrap.png">
+ <img height="20" style='padding-bottom: 6px; padding-right: 10px' class="pull-right" title="Tested with Travis" src="/img/logo_travis.png">
+ <img height="20" style='padding-bottom: 6px; padding-right: 10px' class="pull-right" title="Written in PHP" src="/img/logo_php.gif">
+ </p>
+ </footer>
+{% endif %}
+
+ </div>
+
+ {% block javascripts %}{% endblock %}
+
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $(".fancybox").fancybox({
+ autoScale : false,
+ autoSize : false,
+ height : '75%',
+ width : '75%',
+ openEffect : 'fade',
+ helpers : {
+ overlay : {
+ opacity: 0.6,
+ css : {
+ 'background-color' : '#000'
+ }
+ }
+ }
+ });
+ });
+ </script>
+
+ <script src="/assets/fancybox/js/jquery.mousewheel-3.0.6.pack.js"></script>
+ <script src="/assets/fancybox/js/jquery.fancybox.pack.js?v=2.0.6"></script>
+
+ <script src="/assets/bootstrap/js/bootstrap-transition.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-alert.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-modal.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-dropdown.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-scrollspy.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-tab.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-tooltip.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-popover.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-button.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-collapse.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-carousel.js"></script>
+ <script src="/assets/bootstrap/js/bootstrap-typeahead.js"></script>
+
+ </body>
+</html>
+207.97.227.243
16 app/Resources/views/flash_message.html.twig
@@ -0,0 +1,16 @@
+{% for key, flash in app.session.getFlashes() %}
+{# fos flash banners are done through the fos layouts, since they need translations #}
+{% if key|slice(0, 4) != "fos_" %}
+ <div class="alert alert-{{ key }}">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ {% if key == "success" %}
+ <h4 class="alert-heading">Well done!</h4>
+ {% elseif key == "error" %}
+ <h4 class="alert-heading">Oh snap!</h4>
+ {% elseif key == "info" %}
+ <h4 class="alert-heading">Heads up!</h4>
+ {% endif %}
+ {{ flash }}
+ </div>
+{% endif %}
+{% endfor %}
95 app/Resources/views/knp_menu.html.twig
@@ -0,0 +1,95 @@
+{% extends 'knp_menu.html.twig' %}
+
+{% block item %}
+{% import "knp_menu.html.twig" as macros %}
+{% if item.displayed %}
+ {%- set attributes = item.attributes|default({}) %}
+ {%- set is_raw = attributes.raw|default(false) %}
+ {%- set is_dropdown = attributes.dropdown|default(false) %}
+ {%- set divider_prepend = attributes.divider_prepend|default(false) %}
+ {%- set divider_append = attributes.divider_append|default(false) %}
+
+{# unset bootstrap specific attributes #}
+ {%- set attributes = attributes|merge({'raw': null, 'dropdown': null, 'divider_prepend': null, 'divider_append': null }) %}
+
+ {%- if divider_prepend %}
+ {{ block('dividerElement') }}
+ {%- endif %}
+
+{# building the class of the item #}
+ {%- set classes = item.attribute('class') is not empty ? [item.attribute('class')] : [] %}
+ {%- if item.current %}
+ {%- set classes = classes|merge([options.currentClass]) %}
+ {%- elseif item.currentAncestor %}
+ {%- set classes = classes|merge([options.ancestorClass]) %}
+ {%- endif %}
+ {%- if item.actsLikeFirst %}
+ {%- set classes = classes|merge([options.firstClass]) %}
+ {%- endif %}
+ {%- if item.actsLikeLast %}
+ {%- set classes = classes|merge([options.lastClass]) %}
+ {%- endif %}
+
+{# building the class of the children #}
+ {%- set childrenClasses = item.childrenAttribute('class') is not empty ? [item.childrenAttribute('class')] : [] %}
+ {%- set childrenClasses = childrenClasses|merge(['menu_level_' ~ item.level]) %}
+
+{# adding classes for dropdown #}
+ {%- if is_dropdown %}
+ {%- set classes = classes|merge(['dropdown']) %}
+ {%- set childrenClasses = childrenClasses|merge(['dropdown-menu']) %}
+ {%- endif %}
+
+{# putting classes together #}
+ {%- if classes is not empty %}
+ {%- set attributes = attributes|merge({'class': classes|join(' ')}) %}
+ {%- endif %}
+ {%- set listAttributes = item.childrenAttributes|merge({'class': childrenClasses|join(' ') }) %}
+
+{# displaying the item #}
+ <li{{ macros.attributes(attributes) }}>
+ {%- if is_dropdown %}
+ {{ block('dropdownElement') }}
+ {%- elseif item.uri is not empty and (not item.current or options.currentAsLink) %}
+ {{ block('linkElement') }}
+ {%- elseif is_raw %}
+ {{ block('spanElementRaw') }}
+ {% else %}
+ {{ block('spanElement') }}
+ {%- endif %}
+{# render the list of children#}
+ {{ block('list') }}
+ </li>
+
+ {%- if divider_append %}
+ {{ block('dividerElement') }}
+ {%- endif %}
+{% endif %}
+{% endblock %}
+
+{% block dividerElement %}
+{% if item.level == 1 %}
+ <li class="divider-vertical"></li>
+{% else %}
+ <li class="divider"></li>
+{% endif %}
+{% endblock %}
+
+{% block dropdownElement %}
+ {%- set classes = item.linkAttribute('class') is not empty ? [item.linkAttribute('class')] : [] %}
+ {%- set classes = classes|merge(['dropdown-toggle']) %}
+ {%- set attributes = item.linkAttributes|default({}) %}
+ {%- set attributes = attributes|merge({'class': classes|join(' ')}) %}
+ {%- set attributes = attributes|merge({'data-toggle': 'dropdown'}) %}
+ <a href="#"{{ macros.attributes(attributes) }}>{{ block('label') }} <b class="caret"></b></a>
+{% endblock %}
+
+{# Label RAW and psanElementRaw are there so we can do RAW items (like the gravatar) #}
+{# it uses ->setAttribute('raw', true) in addChild() #}
+{% block label %}{{ item.label|trans }}{% endblock %}
+{% block labelraw %}{{ item.label|trans|raw }}{% endblock %}
+
+{% block linkElement %}<a href="{{ item.uri }}">{{ block('labelraw') }}</a>{% endblock %}
+
+{% block spanElement %}<p class="navbar-text">{{ block('label') }}</p>{% endblock %}
+{% block spanElementRaw %}<p class="navbar-text">{{ block('labelraw') }}</p>{% endblock %}
638 app/SymfonyRequirements.php
@@ -0,0 +1,638 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/*
+ * Users of PHP 5.2 should be able to run the requirements checks.
+ * This is why the file and all classes must be compatible with PHP 5.2+
+ * (e.g. not using namespaces and closures).
+ *
+ * ************** CAUTION **************
+ *
+ * DO NOT EDIT THIS FILE as it will be overriden by Composer as part of
+ * the installation/update process. The original file resides in the
+ * SensioDistributionBundle.
+ *
+ * ************** CAUTION **************
+ */
+
+/**
+ * Represents a single PHP requirement, e.g. an installed extension.
+ * It can be a mandatory requirement or an optional recommendation.
+ * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
+ *
+ * @author Tobias Schultze <http://tobion.de>
+ */
+class Requirement
+{
+ private $fulfilled;
+ private $testMessage;
+ private $helpText;
+ private $helpHtml;
+ private $optional;
+
+ /**
+ * Constructor that initializes the requirement.
+ *
+ * @param Boolean $fulfilled Whether the requirement is fulfilled
+ * @param string $testMessage The message for testing the requirement
+ * @param string $helpHtml The help text formatted in HTML for resolving the problem
+ * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
+ * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
+ */
+ public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
+ {
+ $this->fulfilled = (Boolean) $fulfilled;
+ $this->testMessage = (string) $testMessage;
+ $this->helpHtml = (string) $helpHtml;
+ $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
+ $this->optional = (Boolean) $optional;
+ }
+
+ /**
+ * Returns whether the requirement is fulfilled.
+ *
+ * @return Boolean true if fulfilled, otherwise false
+ */
+ public function isFulfilled()
+ {
+ return $this->fulfilled;
+ }
+
+ /**
+ * Returns the message for testing the requirement.
+ *
+ * @return string The test message
+ */
+ public function getTestMessage()
+ {
+ return $this->testMessage;
+ }
+
+ /**
+ * Returns the help text for resolving the problem
+ *
+ * @return string The help text
+ */
+ public function getHelpText()
+ {
+ return $this->helpText;
+ }
+
+ /**
+ * Returns the help text formatted in HTML.
+ *
+ * @return string The HTML help
+ */
+ public function getHelpHtml()
+ {
+ return $this->helpHtml;
+ }
+
+ /**
+ * Returns whether this is only an optional recommendation and not a mandatory requirement.
+ *
+ * @return Boolean true if optional, false if mandatory
+ */
+ public function isOptional()
+ {
+ return $this->optional;
+ }
+}
+
+/**
+ * Represents a PHP requirement in form of a php.ini configuration.
+ *
+ * @author Tobias Schultze <http://tobion.de>
+ */
+class PhpIniRequirement extends Requirement
+{
+ /**
+ * Constructor that initializes the requirement.
+ *
+ * @param string $cfgName The configuration name used for ini_get()
+ * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
+ or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
+ * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
+ This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
+ Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
+ * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
+ * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
+ * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
+ * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
+ */
+ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
+ {
+ $cfgValue = ini_get($cfgName);
+
+ if (is_callable($evaluation)) {
+ if (null === $testMessage || null === $helpHtml) {
+ throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
+ }
+
+ $fulfilled = call_user_func($evaluation, $cfgValue);
+ } else {
+ if (null === $testMessage) {
+ $testMessage = sprintf('%s %s be %s in php.ini',
+ $cfgName,
+ $optional ? 'should' : 'must',
+ $evaluation ? 'enabled' : 'disabled'
+ );
+ }
+
+ if (null === $helpHtml) {
+ $helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
+ $cfgName,
+ $evaluation ? 'on' : 'off'
+ );
+ }
+
+ $fulfilled = $evaluation == $cfgValue;
+ }
+
+ parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
+ }
+}
+
+/**
+ * A RequirementCollection represents a set of Requirement instances.
+ *
+ * @author Tobias Schultze <http://tobion.de>
+ */
+class RequirementCollection implements IteratorAggregate
+{
+ private $requirements = array();
+
+ /**
+ * Gets the current RequirementCollection as an Iterator.
+ *
+ * @return Traversable A Traversable interface
+ */
+ public function getIterator()
+ {
+ return new ArrayIterator($this->requirements);
+ }
+
+ /**
+ * Adds a Requirement.
+ *
+ * @param Requirement $requirement A Requirement instance
+ */
+ public function add(Requirement $requirement)
+ {
+ $this->requirements[] = $requirement;
+ }
+
+ /**
+ * Adds a mandatory requirement.
+ *
+ * @param Boolean $fulfilled Whether the requirement is fulfilled
+ * @param string $testMessage The message for testing the requirement
+ * @param string $helpHtml The help text formatted in HTML for resolving the problem
+ * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
+ */
+ public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
+ {
+ $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
+ }
+
+ /**
+ * Adds an optional recommendation.
+ *
+ * @param Boolean $fulfilled Whether the recommendation is fulfilled
+ * @param string $testMessage The message for testing the recommendation
+ * @param string $helpHtml The help text formatted in HTML for resolving the problem
+ * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
+ */
+ public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
+ {
+ $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
+ }
+
+ /**
+ * Adds a mandatory requirement in form of a php.ini configuration.
+ *
+ * @param string $cfgName The configuration name used for ini_get()
+ * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
+ or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
+ * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
+ This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
+ Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
+ * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
+ * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
+ * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
+ */
+ public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
+ {
+ $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
+ }
+
+ /**
+ * Adds an optional recommendation in form of a php.ini configuration.
+ *
+ * @param string $cfgName The configuration name used for ini_get()
+ * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
+ or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
+ * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
+ This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
+ Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
+ * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
+ * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
+ * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
+ */
+ public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
+ {
+ $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
+ }
+
+ /**
+ * Adds a requirement collection to the current set of requirements.
+ *
+ * @param RequirementCollection $collection A RequirementCollection instance
+ */
+ public function addCollection(RequirementCollection $collection)
+ {
+ $this->requirements = array_merge($this->requirements, $collection->all());
+ }
+
+ /**
+ * Returns both requirements and recommendations.
+ *
+ * @return array Array of Requirement instances
+ */
+ public function all()
+ {
+ return $this->requirements;
+ }
+
+ /**
+ * Returns all mandatory requirements.
+ *
+ * @return array Array of Requirement instances
+ */
+ public function getRequirements()
+ {
+ $array = array();
+ foreach ($this->requirements as $req) {
+ if (!$req->isOptional()) {
+ $array[] = $req;
+ }
+ }
+
+ return $array;
+ }
+
+ /**
+ * Returns the mandatory requirements that were not met.
+ *
+ * @return array Array of Requirement instances
+ */
+ public function getFailedRequirements()
+ {
+ $array = array();
+ foreach ($this->requirements as $req) {
+ if (!$req->isFulfilled() && !$req->isOptional()) {
+ $array[] = $req;
+ }
+ }
+
+ return $array;
+ }
+
+ /**
+ * Returns all optional recommmendations.
+ *
+ * @return array Array of Requirement instances
+ */
+ public function getRecommendations()
+ {
+ $array = array();
+ foreach ($this->requirements as $req) {
+ if ($req->isOptional()) {
+ $array[] = $req;
+ }
+ }
+
+ return $array;
+ }
+
+ /**
+ * Returns the recommendations that were not met.
+ *
+ * @return array Array of Requirement instances
+ */
+ public function getFailedRecommendations()
+ {
+ $array = array();
+ foreach ($this->requirements as $req) {
+ if (!$req->isFulfilled() && $req->isOptional()) {
+ $array[] = $req;
+ }
+ }
+
+ return $array;
+ }
+
+ /**
+ * Returns whether a php.ini configuration is not correct.
+ *
+ * @return Boolean php.ini configuration problem?
+ */
+ public function hasPhpIniConfigIssue()
+ {
+ foreach ($this->requirements as $req) {
+ if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the PHP configuration file (php.ini) path.
+ *
+ * @return string|false php.ini file path
+ */
+ public function getPhpIniConfigPath()
+ {
+ return get_cfg_var('cfg_file_path');
+ }
+}
+
+/**
+ * This class specifies all requirements and optional recommendations that
+ * are necessary to run the Symfony Standard Edition.
+ *
+ * @author Tobias Schultze <http://tobion.de>
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class SymfonyRequirements extends RequirementCollection
+{
+ const REQUIRED_PHP_VERSION = '5.3.3';
+
+ /**
+ * Constructor that initializes the requirements.
+ */
+ public function __construct()
+ {
+ /* mandatory requirements follow */
+
+ $installedPhpVersion = phpversion();
+
+ $this->addRequirement(
+ version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
+ sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
+ sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
+ Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
+ $installedPhpVersion, self::REQUIRED_PHP_VERSION),
+ sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
+ );
+
+ $this->addRequirement(
+ version_compare($installedPhpVersion, '5.3.16', '!='),
+ 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
+ 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)'
+ );
+
+ $this->addRequirement(
+ is_dir(__DIR__.'/../vendor/composer'),
+ 'Vendor libraries must be installed',
+ 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
+ 'Then run "<strong>php composer.phar install</strong>" to install them.'
+ );
+
+ $baseDir = basename(__DIR__);
+
+ $this->addRequirement(
+ is_writable(__DIR__.'/cache'),
+ "$baseDir/cache/ directory must be writable",
+ "Change the permissions of the \"<strong>$baseDir/cache/</strong>\" directory so that the web server can write into it."
+ );
+
+ $this->addRequirement(
+ is_writable(__DIR__.'/logs'),
+ "$baseDir/logs/ directory must be writable",
+ "Change the permissions of the \"<strong>$baseDir/logs/</strong>\" directory so that the web server can write into it."
+ );
+
+ $this->addPhpIniRequirement(
+ 'date.timezone', true, false,
+ 'date.timezone setting must be set',
+ 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
+ );
+
+ if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
+ $this->addRequirement(
+ (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())),
+ sprintf('Configured default timezone "%s" must be supported by your installation of PHP', date_default_timezone_get()),
+ 'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
+ );
+ }
+
+ $this->addRequirement(
+ function_exists('json_encode'),
+ 'json_encode() must be available',
+ 'Install and enable the <strong>JSON</strong> extension.'
+ );
+
+ $this->addRequirement(
+ function_exists('session_start'),
+ 'session_start() must be available',
+ 'Install and enable the <strong>session</strong> extension.'
+ );
+
+ $this->addRequirement(
+ function_exists('ctype_alpha'),
+ 'ctype_alpha() must be available',
+ 'Install and enable the <strong>ctype</strong> extension.'
+ );
+
+ $this->addRequirement(
+ function_exists('token_get_all'),
+ 'token_get_all() must be available',
+ 'Install and enable the <strong>Tokenizer</strong> extension.'
+ );
+
+ $this->addRequirement(
+ function_exists('simplexml_import_dom'),
+ 'simplexml_import_dom() must be available',
+ 'Install and enable the <strong>SimpleXML</strong> extension.'
+ );
+
+ if (function_exists('apc_store') && ini_get('apc.enabled')) {
+ $this->addRequirement(
+ version_compare(phpversion('apc'), '3.0.17', '>='),
+ 'APC version must be at least 3.0.17',
+ 'Upgrade your <strong>APC</strong> extension (3.0.17+).'
+ );
+ }
+
+ $this->addPhpIniRequirement('detect_unicode', false);
+
+ if (extension_loaded('suhosin')) {
+ $this->addPhpIniRequirement(
+ 'suhosin.executor.include.whitelist',
+ create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
+ false,
+ 'suhosin.executor.include.whitelist must be configured correctly in php.ini',
+ 'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
+ );
+ }
+
+ if (extension_loaded('xdebug')) {
+ $this->addPhpIniRequirement(
+ 'xdebug.show_exception_trace', false, true
+ );
+
+ $this->addPhpIniRequirement(
+ 'xdebug.scream', false, true
+ );
+ }
+
+ $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
+
+ $this->addRequirement(
+ null !== $pcreVersion && $pcreVersion > 8.0,
+ sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'),
+ 'Upgrade your <strong>PCRE</strong> extension (8.0+).'
+ );
+
+ /* optional recommendations follow */
+
+ $this->addRecommendation(
+ file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
+ 'Requirements file should be up-to-date',
+ 'Your requirements file is outdated. Run composer install and re-check your configuration.'
+ );
+
+ $this->addRecommendation(
+ version_compare($installedPhpVersion, '5.3.4', '>='),
+ 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions',
+ 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.'
+ );
+
+ $this->addRecommendation(
+ version_compare($installedPhpVersion, '5.3.8', '>='),
+ 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156',
+ 'Install PHP 5.3.8 or newer if your project uses annotations.'
+ );
+
+ $this->addRecommendation(
+ version_compare($installedPhpVersion, '5.4.0', '!='),
+ 'You should not use PHP 5.4.0 due to the PHP bug #61453',
+ 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.'
+ );
+
+ $this->addRecommendation(
+ class_exists('DomDocument'),
+ 'PHP-XML module should be installed',
+ 'Install and enable the <strong>PHP-XML</strong> module.'
+ );
+
+ $this->addRecommendation(
+ function_exists('mb_strlen'),
+ 'mb_strlen() should be available',
+ 'Install and enable the <strong>mbstring</strong> extension.'
+ );
+
+ $this->addRecommendation(
+ function_exists('iconv'),
+ 'iconv() should be available',
+ 'Install and enable the <strong>iconv</strong> extension.'
+ );
+
+ $this->addRecommendation(
+ function_exists('utf8_decode'),
+ 'utf8_decode() should be available',
+ 'Install and enable the <strong>XML</strong> extension.'
+ );
+
+ if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
+ $this->addRecommendation(
+ function_exists('posix_isatty'),
+ 'posix_isatty() should be available',
+ 'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
+ );
+ }
+
+ $this->addRecommendation(
+ class_exists('Locale'),
+ 'intl extension should be available',
+ 'Install and enable the <strong>intl</strong> extension (used for validators).'
+ );
+
+ if (class_exists('Collator')) {
+ $this->addRecommendation(
+ null !== new Collator('fr_FR'),
+ 'intl extension should be correctly configured',
+ 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
+ );
+ }
+
+ if (class_exists('Locale')) {
+ if (defined('INTL_ICU_VERSION')) {
+ $version = INTL_ICU_VERSION;
+ } else {
+ $reflector = new ReflectionExtension('intl');
+
+ ob_start();
+ $reflector->info();
+ $output = strip_tags(ob_get_clean());
+
+ preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
+ $version = $matches[1];
+ }
+
+ $this->addRecommendation(
+ version_compare($version, '4.0', '>='),
+ 'intl ICU version should be at least 4+',
+ 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
+ );
+ }
+
+ $accelerator =
+ (function_exists('apc_store') && ini_get('apc.enabled'))
+ ||
+ function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
+ ||
+ function_exists('xcache_set')
+ ;
+
+ $this->addRecommendation(
+ $accelerator,
+ 'a PHP accelerator should be installed',
+ 'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'
+ );
+
+ $this->addPhpIniRecommendation('short_open_tag', false);
+
+ $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
+
+ $this->addPhpIniRecommendation('register_globals', false, true);
+
+ $this->addPhpIniRecommendation('session.auto_start', false);
+
+ $this->addRecommendation(
+ class_exists('PDO'),
+ 'PDO should be installed',
+ 'Install <strong>PDO</strong> (mandatory for Doctrine).'
+ );
+
+ if (class_exists('PDO')) {
+ $drivers = PDO::getAvailableDrivers();
+ $this->addRecommendation(
+ count($drivers),
+ sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
+ 'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
+ );
+ }
+ }
+}
16 app/autoload.php
@@ -0,0 +1,16 @@
+<?php
+
+use Doctrine\Common\Annotations\AnnotationRegistry;
+
+$loader = require __DIR__.'/../vendor/autoload.php';
+
+// intl
+if (!function_exists('intl_get_error_code')) {
+ require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
+
+ $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
+}
+
+AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
+
+return $loader;
55 app/check.php
@@ -0,0 +1,55 @@
+<?php
+
+require_once dirname(__FILE__).'/SymfonyRequirements.php';
+
+$symfonyRequirements = new SymfonyRequirements();
+
+$iniPath = $symfonyRequirements->getPhpIniConfigPath();
+
+echo "********************************\n";
+echo "* *\n";
+echo "* Symfony requirements check *\n";
+echo "* *\n";
+echo "********************************\n\n";
+
+echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
+
+echo "** ATTENTION **\n";
+echo "* The PHP CLI can use a different php.ini file\n";
+echo "* than the one used with your web server.\n";
+if ('\\' == DIRECTORY_SEPARATOR) {
+ echo "* (especially on the Windows platform)\n";
+}
+echo "* To be on the safe side, please also launch the requirements check\n";
+echo "* from your web server using the web/config.php script.\n";
+
+echo_title('Mandatory requirements');
+
+foreach ($symfonyRequirements->getRequirements() as $req) {
+ echo_requirement($req);
+}
+
+echo_title('Optional recommendations');
+
+foreach ($symfonyRequirements->getRecommendations() as $req) {
+ echo_requirement($req);
+}
+
+/**
+ * Prints a Requirement instance
+ */
+function echo_requirement(Requirement $requirement)
+{
+ $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
+ echo ' ' . str_pad($result, 9);
+ echo $requirement->getTestMessage() . "\n";
+
+ if (!$requirement->isFulfilled()) {
+ echo sprintf(" %s\n\n", $requirement->getHelpText());
+ }
+}
+
+function echo_title($title)
+{
+ echo "\n** $title **\n\n";
+}
67 app/config/config.yml
@@ -0,0 +1,67 @@
+imports:
+ - { resource: parameters.yml }
+ - { resource: security.yml }
+
+framework:
+ #esi: ~
+ #translator: { fallback: %locale% }
+ secret: %secret%
+ router:
+ resource: "%kernel.root_dir%/config/routing.yml"
+ strict_requirements: %kernel.debug%
+ form: true
+ csrf_protection: true
+ validation: { enable_annotations: true }
+ templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
+ default_locale: %locale%
+ trust_proxy_headers: false # Whether or not the Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
+ session: ~
+
+# Twig Configuration
+twig:
+ debug: %kernel.debug%
+ strict_variables: %kernel.debug%
+
+# Assetic Configuration
+assetic:
+ debug: %kernel.debug%
+ use_controller: false
+ bundles: [ ]
+ #java: /usr/bin/java
+ filters:
+ cssrewrite: ~
+ #closure:
+ # jar: %kernel.root_dir%/Resources/java/compiler.jar
+ #yui_css:
+ # jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
+
+# Doctrine Configuration
+doctrine:
+ dbal:
+ driver: %database_driver%
+ host: %database_host%
+ port: %database_port%
+ dbname: %database_name%
+ user: %database_user%
+ password: %database_password%
+ charset: UTF8
+
+ orm:
+ auto_generate_proxy_classes: %kernel.debug%
+ auto_mapping: true
+
+# Swiftmailer Configuration
+swiftmailer:
+ transport: %mailer_transport%
+ host: %mailer_host%
+ username: %mailer_user%
+ password: %mailer_password%
+ spool: { type: memory }
+
+mopa_bootstrap:
+ form:
+ show_legend: false
+ show_child_legend: false
+ error_type: block
+
+ornicar_gravatar: ~
26 app/config/config_dev.yml
@@ -0,0 +1,26 @@
+imports:
+ - { resource: config.yml }
+
+framework:
+ router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
+ profiler: { only_exceptions: false }
+
+web_profiler:
+ toolbar: true
+ intercept_redirects: false
+
+monolog:
+ handlers:
+ main:
+ type: stream
+ path: %kernel.logs_dir%/%kernel.environment%.log
+ level: debug
+ firephp:
+ type: firephp
+ level: info
+
+assetic:
+ use_controller: true
+
+#swiftmailer:
+# delivery_address: me@example.com
19 app/config/config_prod.yml
@@ -0,0 +1,19 @@
+imports:
+ - { resource: config.yml }
+
+#doctrine:
+# orm:
+# metadata_cache_driver: apc
+# result_cache_driver: apc
+# query_cache_driver: apc
+
+monolog:
+ handlers:
+ main:
+ type: fingers_crossed
+ action_level: error
+ handler: nested
+ nested:
+ type: stream
+ path: %kernel.logs_dir%/%kernel.environment%.log
+ level: debug
14 app/config/config_test.yml
@@ -0,0 +1,14 @@
+imports:
+ - { resource: config_dev.yml }
+
+framework:
+ test: ~
+ session:
+ storage_id: session.storage.mock_file
+
+web_profiler:
+ toolbar: false
+ intercept_redirects: false
+
+swiftmailer:
+ disable_delivery: true
15 app/config/parameters.yml
@@ -0,0 +1,15 @@
+parameters:
+ database_driver: pdo_mysql
+ database_host: localhost
+ database_port: ~
+ database_name: connect
+ database_user: connect
+ database_password: connect
+
+ mailer_transport: smtp
+ mailer_host: localhost
+ mailer_user: ~
+ mailer_password: ~
+
+ locale: en
+ secret: ThisTokenIsNotSoSecretChangeIt
15 app/config/parameters.yml.dist
@@ -0,0 +1,15 @@
+parameters:
+ database_driver: pdo_mysql
+ database_host: localhost
+ database_port: ~
+ database_name: symfony
+ database_user: root
+ database_password: ~
+
+ mailer_transport: smtp
+ mailer_host: localhost
+ mailer_user: ~
+ mailer_password: ~
+
+ locale: en
+ secret: ThisTokenIsNotSoSecretChangeIt
20 app/config/routing.yml
@@ -0,0 +1,20 @@
+saffire_group:
+ resource: "@SaffireGroupBundle/Resources/config/routing.yml"
+ prefix: /
+
+saffire_home:
+ resource: "@SaffireHomeBundle/Resources/config/routing.yml"
+ prefix: /
+
+saffire_user:
+ resource: "@SaffireUserBundle/Resources/config/routing.yml"
+ prefix: /user
+
+saffire_badge:
+ resource: "@SaffireBadgeBundle/Resources/config/routing.yml"
+ prefix: /badge
+
+# Internal routing configuration to handle ESI
+#_internal:
+# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
+# prefix: /_internal
14 app/config/routing_dev.yml
@@ -0,0 +1,14 @@
+_wdt:
+ resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
+ prefix: /_wdt
+
+_profiler:
+ resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
+ prefix: /_profiler
+
+_configurator:
+ resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
+ prefix: /_configurator
+
+_main:
+ resource: routing.yml
43 app/config/security.yml
@@ -0,0 +1,43 @@
+jms_security_extra:
+ secure_all_services: false
+ expressions: true
+
+security:
+ encoders:
+ Symfony\Component\Security\Core\User\User: plaintext
+
+ role_hierarchy:
+ ROLE_ADMIN: ROLE_USER
+ ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
+
+ providers:
+ in_memory:
+ memory:
+ users:
+ user: { password: userpass, roles: [ 'ROLE_USER' ] }
+ admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
+
+ firewalls:
+ dev:
+ pattern: ^/(_(profiler|wdt)|css|images|js)/
+ security: false
+
+ login:
+ pattern: ^/demo/secured/login$
+ security: false
+
+ secured_area:
+ pattern: ^/demo/secured/
+ form_login:
+ check_path: /demo/secured/login_check
+ login_path: /demo/secured/login
+ logout:
+ path: /demo/secured/logout
+ target: /demo/
+ #anonymous: ~
+ #http_basic:
+ # realm: "Secured Demo Area"
+
+ access_control:
+ #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
+ #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
22 app/console
@@ -0,0 +1,22 @@
+#!/usr/bin/env php
+<?php
+
+// if you don't want to setup permissions the proper way, just uncomment the following PHP line
+// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
+//umask(0000);
+
+set_time_limit(0);
+
+require_once __DIR__.'/bootstrap.php.cache';
+require_once __DIR__.'/AppKernel.php';
+
+use Symfony\Bundle\FrameworkBundle\Console\Application;
+use Symfony\Component\Console\Input\ArgvInput;
+
+$input = new ArgvInput();
+$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
+$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
+
+$kernel = new AppKernel($env, $debug);
+$application = new Application($kernel);
+$application->run($input);
41 app/phpunit.xml.dist
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
+<phpunit
+ backupGlobals = "false"
+ backupStaticAttributes = "false"
+ colors = "true"
+ convertErrorsToExceptions = "true"
+ convertNoticesToExceptions = "true"
+ convertWarningsToExceptions = "true"
+ processIsolation = "false"
+ stopOnFailure = "false"
+ syntaxCheck = "false"
+ bootstrap = "bootstrap.php.cache" >
+
+ <testsuites>
+ <testsuite name="Project Test Suite">
+ <directory>../src/*/*Bundle/Tests</directory>
+ <directory>../src/*/Bundle/*Bundle/Tests</directory>
+ </testsuite>
+ </testsuites>
+
+ <!--
+ <php>
+ <server name="KERNEL_DIR" value="/path/to/your/app/" />
+ </php>
+ -->
+
+ <filter>
+ <whitelist>
+ <directory>../src</directory>
+ <exclude>
+ <directory>../src/*/*Bundle/Resources</directory>
+ <directory>../src/*/*Bundle/Tests</directory>
+ <directory>../src/*/Bundle/*Bundle/Resources</directory>
+ <directory>../src/*/Bundle/*Bundle/Tests</directory>
+ </exclude>
+ </whitelist>
+ </filter>
+
+</phpunit>
47 composer.json
@@ -0,0 +1,47 @@
+{
+ "name": "symfony/framework-standard-edition",
+ "description": "The \"Symfony Standard Edition\" distribution",
+ "autoload": {
+ "psr-0": { "": "src/" }
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "symfony/symfony": "2.1.*",
+ "doctrine/orm": ">=2.2.3,<2.4-dev",
+ "doctrine/doctrine-bundle": "1.0.*",
+ "twig/extensions": "1.0.*",
+ "symfony/assetic-bundle": "2.1.*",
+ "symfony/swiftmailer-bundle": "2.1.*",
+ "symfony/monolog-bundle": "2.1.*",
+ "sensio/distribution-bundle": "2.1.*",
+ "sensio/framework-extra-bundle": "2.1.*",
+ "sensio/generator-bundle": "2.1.*",
+ "jms/security-extra-bundle": "1.2.*",
+ "jms/di-extra-bundle": "1.1.*",
+ "mopa/bootstrap-bundle": "dev-master",
+ "ornicar/gravatar-bundle" : "dev-master",
+ "knplabs/knp-menu-bundle":"dev-master",
+ "doctrine/doctrine-fixtures-bundle": "dev-master"
+ },
+ "scripts": {
+ "post-install-cmd": [
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
+ ],
+ "post-update-cmd": [
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
+ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
+ ]
+ },
+ "minimum-stability": "dev",
+ "extra": {
+ "symfony-app-dir": "app",
+ "symfony-web-dir": "web"
+ }
+
+
+}
1,588 composer.lock
1,588 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
BIN composer.phar
Binary file not shown.
5 installdb.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+php app/console doctrine:database:drop --force
+php app/console doctrine:database:create
+php app/console doctrine:schema:create
+php app/console doctrine:fixtures:load
1 public
1 src/.htaccess
@@ -0,0 +1 @@
+deny from all
13 src/Saffire/BadgeBundle/Controller/DefaultController.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Saffire\BadgeBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+
+class DefaultController extends Controller
+{
+ public function indexAction($name)
+ {
+ return $this->render('SaffireBadgeBundle:Default:index.html.twig', array('name' => $name));
+ }
+}
50 src/Saffire/BadgeBundle/DataFixtures/ORM/BadgeCategoryFixtures.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Saffire\BadgeBundle\DataFixtures\ORM;
+
+use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Common\DataFixtures\AbstractFixture;
+use Saffire\BadgeBundle\Entity\Badge;
+
+class BadgeCategoryFixtureLoader extends AbstractFixture implements OrderedFixtureInterface {
+
+ public function load(ObjectManager $manager)
+ {
+ $cat_community = new BadgeCategory();
+ $cat_community->setName("Community");
+ $cat_community->setDescription("Community badges");
+ $manager->persist($cat_community);
+ $this->addReference("cat_community", $cat_community);
+
+ $cat_development = new BadgeCategory();
+ $cat_development->setName("Community");
+ $cat_development->setDescription("Development badges");
+ $manager->persist($cat_development);
+ $this->addReference("cat_development", $cat_development);
+
+ $cat_meetup = new BadgeCategory();
+ $cat_meetup->setName("Meetups");
+ $cat_meetup->setDescription("Meetup badges");
+ $manager->persis($cat_meetup);
+ $this->addReference("cat_meetup", $cat_meetup);
+
+ $cat_time = new BadgeCategory();
+ $cat_time->setName("Time");
+ $cat_time->setDescription("Time badges");
+ $manager->persis($cat_time);
+ $this->addReference("cat_time", $cat_time);
+
+ $cat_special = new BadgeCategory();
+ $cat_special->setName("Specials");
+ $cat_special->setDescription("Special badges");
+ $manager->persis($cat_special);
+ $this->addReference("cat_special", $cat_special);
+ }
+
+ public function getOrder()
+ {
+ return 10;
+ }
+
+}
195 src/Saffire/BadgeBundle/DataFixtures/ORM/BadgeFixtures.php
@@ -0,0 +1,195 @@
+<?php
+
+namespace Saffire\BadgeBundle\DataFixtures\ORM;
+
+use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Common\DataFixtures\AbstractFixture;
+use Saffire\BadgeBundle\Entity\Badge;
+
+class BadgeFixtureLoader extends AbstractFixture implements OrderedFixtureInterface {
+
+ public function load(ObjectManager $manager)
+ {
+ $badge = new Badge();
+ $badge->setName("Community");
+ $badge->setDescription("Received upon registration on the site.");
+ $badge->setImage("001.jpg");
+ $badge->setCategory($this->getReference("cat_community"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Well Connected");
+ $badge->setDescription("Over 50 connections on the site.");
+ $badge->setImage("002.jpg");
+ $badge->setCategory($this->getReference("cat_community"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Groupie");
+ $badge->setDescription("Part of at least 10 groups.");
+ $badge->setImage("003.jpg");
+ $badge->setCategory($this->getReference("cat_community"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Early Adopter");
+ $badge->setDescription("First 50 community users.");
+ $badge->setImage("004.jpg");
+ $badge->setCategory($this->getReference("cat_community"));
+ $manager->persist($badge);
+
+
+
+
+ $badge = new Badge();
+ $badge->setName("Core Development");
+ $badge->setDescription("Core contributer.");
+ $badge->setImage("006.jpg");
+ $badge->setCategory($this->getReference("cat_development"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Contributor");
+ $badge->setDescription("Contributed to the Saffire language.");
+ $badge->setImage("007.jpg");
+ $badge->setCategory($this->getReference("cat_development"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Documentor");
+ $badge->setDescription("Contributed to the documentation.");
+ $badge->setImage("008.jpg");
+ $badge->setCategory($this->getReference("cat_development"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Bug reporter");
+ $badge->setDescription("Added a bug in the Saffire bugtracker.");
+ $badge->setImage("009.jpg");
+ $badge->setCategory($this->getReference("cat_development"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("RFC Contributor");
+ $badge->setDescription("Contributed to saffire RFCs.");
+ $badge->setImage("010.jpg");
+ $badge->setCategory($this->getReference("cat_development"));
+ $manager->persist($badge);
+
+
+
+
+ $badge = new Badge();
+ $badge->setName("Inaugeral Meetup");
+ $badge->setDescription("Attended the first ever meetup.");
+ $badge->setImage("011.jpg");
+ $badge->setCategory($this->getReference("cat_meetup"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Meetup Attendees");
+ $badge->setDescription("Attended a meetup.");
+ $badge->setImage("012.jpg");
+ $badge->setCategory($this->getReference("cat_meetup"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Conference Attendee");
+ $badge->setDescription("Attended a conference.");
+ $badge->setImage("013.jpg");
+ $badge->setCategory($this->getReference("cat_meetup"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Meetup Speaker");
+ $badge->setDescription("Spoke at a meetup.");
+ $badge->setImage("014.jpg");
+ $badge->setCategory($this->getReference("cat_meetup"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Conference Speaker");
+ $badge->setDescription("Spoke at a conference.");
+ $badge->setImage("015.jpg");
+ $badge->setCategory($this->getReference("cat_meetup"));
+ $manager->persist($badge);
+
+
+
+
+ $badge = new Badge();
+ $badge->setName("1 Year Member");
+ $badge->setDescription("Registered one year ago.");
+ $badge->setImage("016.jpg");
+ $badge->setCategory($this->getReference("cat_time"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("2 Year Member");
+ $badge->setDescription("Registered two years ago.");
+ $badge->setImage("017.jpg");
+ $badge->setCategory($this->getReference("cat_time"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("3 Year Member");
+ $badge->setDescription("Registered three years ago.");
+ $badge->setImage("018.jpg");
+ $badge->setCategory($this->getReference("cat_time"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("4 Year Member");
+ $badge->setDescription("Registered four years ago.");
+ $badge->setImage("019.jpg");
+ $badge->setCategory($this->getReference("cat_time"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("5 Year Member");
+ $badge->setDescription("Registered five years ago.");
+ $badge->setImage("020.jpg");
+ $badge->setCategory($this->getReference("cat_time"));
+ $manager->persist($badge);
+
+
+
+ $badge = new Badge();
+ $badge->setName("Evangelist");
+ $badge->setDescription("Given to those who are really involved in getting Saffire out there.");
+ $badge->setImage("001.jpg");
+ $badge->setCategory($this->getReference("cat_special"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Saffire Birthstone");
+ $badge->setDescription("Born in September.");
+ $badge->setImage("002.jpg");
+ $badge->setCategory($this->getReference("cat_special"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Exceeded Expectations");
+ $badge->setDescription("Given for those who stands out on Saffire.");
+ $badge->setImage("003.jpg");
+ $badge->setCategory($this->getReference("cat_special"));
+ $manager->persist($badge);
+
+ $badge = new Badge();
+ $badge->setName("Blogger");
+ $badge->setDescription("Blogged about Saffire.");
+ $badge->setImage("005.jpg");
+ $badge->setCategory($this->getReference("cat_special"));
+ $manager->persist($badge);
+
+
+ $manager->flush();
+ }
+
+ public function getOrder()
+ {
+ return 20;
+ }
+
+}
29 src/Saffire/BadgeBundle/DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Saffire\BadgeBundle\DependencyInjection;
+
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * This is the class that validates and merges configuration from your app/config files
+ *
+ * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
+ */
+class Configuration implements ConfigurationInterface
+{
+ /**
+ * {@inheritDoc}
+ */
+ public function getConfigTreeBuilder()
+ {
+ $treeBuilder = new TreeBuilder();
+ $rootNode = $treeBuilder->root('saffire_badge');
+
+ // Here you should define the parameters that are allowed to
+ // configure your bundle. See the documentation linked above for
+ // more information on that topic.
+
+ return $treeBuilder;
+ }
+}
28 src/Saffire/BadgeBundle/DependencyInjection/SaffireBadgeExtension.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Saffire\BadgeBundle\DependencyInjection;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\DependencyInjection\Loader;
+
+/**
+ * This is the class that loads and manages your bundle configuration
+ *
+ * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
+ */
+class SaffireBadgeExtension extends Extension
+{
+ /**
+ * {@inheritDoc}
+ */
+ public function load(array $configs, ContainerBuilder $container)
+ {
+ $configuration = new Configuration();
+ $config = $this->processConfiguration($configuration, $configs);
+
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
+ }
+}
176 src/Saffire/BadgeBundle/Entity/Badge.php
@@ -0,0 +1,176 @@
+<?php
+
+namespace Saffire\BadgeBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * @ORM\Table(name="badges")
+ * @ORM\Entity(repositoryClass="Saffire\BadgeBundle\Repository\BadgeRepository")
+ */
+class Badge {
+
+ /**
+ * @ORM\Column(name="id", type="integer", nullable=false)
+ * @ORM\Id
+ * @ORM\GeneratedValue(strategy="AUTO")
+ */
+ protected $id;
+
+ /**
+ * @ORM\Column(type="string", length=255)
+ */
+ protected $name;
+