-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 2.0: Support Symfony 3.0 (#57)
* Drop support for old versions * Add phpunit-bridge to find deprecations * Replace security.context by security.authentication_checker * Migrate to assets component * Document changes to Security and Asset Extension * Add support for symfony 3 * Composer is the only supported install method * Update CHANGELOG * Remove Symfony\Component\HttpKernel\Log\LoggerInterface * Update installation and intro chapters of documentation * Remove Symfony 2.1 stuff, remove class parameters * Fix copyright year * Asset name generation in different before 1.1.3 * Tests pass with assetic 1.1.3 * Clean up assetic documentation * Boolean referenceType is not supported anymore * Add missing use statements and doc comments * Update documentation * Fix some phpdoc issues * form.csrf_provider is deprecated since sf 2.4 * Enabling the controllers throws an error about MopaBootstrapBundle * Fix code style * Add missing dev packages * Remove deprecated CsrfProviderInterface * Smarty_Internal_Function_Call_Handler is not available after 3.1.27 * Avoid deprecated services
- Loading branch information
1 parent
62af97d
commit 92ad31c
Showing
78 changed files
with
671 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,16 +16,17 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
*/ | ||
|
||
namespace NoiseLabs\Bundle\SmartyBundle\Assetic; | ||
|
||
use Assetic\Factory\AssetFactory; | ||
use Assetic\Factory\Loader\FormulaLoaderInterface; | ||
use Assetic\Factory\Resource\ResourceInterface; | ||
use NoiseLabs\Bundle\SmartyBundle\Extension\AsseticExtension; | ||
|
@@ -38,9 +39,24 @@ | |
*/ | ||
class SmartyFormulaLoader implements FormulaLoaderInterface | ||
{ | ||
/** | ||
* @var SmartyEngine | ||
*/ | ||
protected $engine; | ||
|
||
/** | ||
* @var AsseticExtension | ||
*/ | ||
protected $extension; | ||
|
||
/** | ||
* @var AssetFactory | ||
*/ | ||
protected $factory; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $tags = array(); | ||
|
||
public function __construct(SmartyEngine $engine) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
@@ -64,8 +64,11 @@ public function renderNavbar($name, array $options = array()) | |
$template = $options['template']; | ||
} | ||
|
||
$html = $this->getSmartyEngine()->fetchTemplateFunction($template, $function, | ||
array('navbar' => $navbar)); | ||
$html = $this->getSmartyEngine()->fetchTemplateFunction( | ||
$template, | ||
$function, | ||
array('navbar' => $navbar) | ||
); | ||
|
||
return $html; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [2.0.0] Unreleased | ||
|
||
### Added | ||
- Compatibility with Symfony 3.0 | ||
|
||
### Changed | ||
- AssetsExtension now uses the new [Asset Component](http://symfony.com/doc/current/components/asset/introduction.html) | ||
- SecurityExtension now uses `security.authorization_checker` instead of `security.context` | ||
|
||
### Removed | ||
- Drop Support for Symfony < 2.8 | ||
- `Symfony\Component\HttpKernel\Log\LoggerInterface` as been replaced by `Psr\Log\LoggerInterface` | ||
- Drop Support for PHP < 5.5 | ||
|
||
## [1.3.0] - 2016-03-24 | ||
|
||
### Added | ||
- Compatibility with Symfony 2.8 | ||
|
||
### Removed | ||
- [#50](https://github.com/noiselabs/SmartyBundle/pull/50) Removed support for unsupported versions of Symfony | ||
|
||
### Fixed | ||
- [#51](https://github.com/noiselabs/SmartyBundle/pull/51) fix problem with "plugin tag are already registered" debug messages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,21 +16,21 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
||
namespace NoiseLabs\Bundle\SmartyBundle\CacheWarmer; | ||
|
||
use NoiseLabs\Bundle\SmartyBundle\Exception\RuntimeException as SmartyBundleRuntimeException; | ||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; | ||
|
||
/** | ||
* Generates the Smarty cache for all templates. | ||
|
@@ -40,8 +40,15 @@ | |
*/ | ||
class SmartyCacheWarmer implements CacheWarmerInterface | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
protected $container; | ||
protected $warmer; | ||
|
||
/** | ||
* @var TemplateFinderInterface | ||
*/ | ||
protected $finder; | ||
|
||
/** | ||
* Constructor. | ||
|
@@ -67,7 +74,6 @@ public function __construct(ContainerInterface $container, TemplateFinderInterfa | |
public function warmUp($cacheDir) | ||
{ | ||
$engine = $this->container->get('templating.engine.smarty'); | ||
$smarty = $engine->getSmarty(); | ||
$logger = $this->container->has('logger') ? $this->container->get('logger') : null; | ||
|
||
foreach ($this->finder->findAllTemplates() as $template) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,22 +16,22 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
||
namespace NoiseLabs\Bundle\SmartyBundle\CacheWarmer; | ||
|
||
use Symfony\Component\HttpKernel\KernelInterface; | ||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; | ||
use Symfony\Component\Finder\Finder; | ||
use Symfony\Component\Templating\TemplateNameParserInterface; | ||
use Symfony\Component\HttpKernel\Bundle\BundleInterface; | ||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; | ||
use Symfony\Component\HttpKernel\KernelInterface; | ||
use Symfony\Component\Templating\TemplateNameParserInterface; | ||
|
||
/** | ||
* Finds all the templates. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
@@ -51,12 +51,6 @@ protected function configure() | |
InputArgument::OPTIONAL, | ||
'A bundle name' | ||
) | ||
->addOption( | ||
'force', | ||
null, | ||
InputOption::VALUE_NONE, | ||
'Force the compilation of all templates even if they weren\'t modified' | ||
) | ||
->setHelp(<<<EOF | ||
The following command finds all known Smarty templates and compiles them: | ||
|
@@ -75,10 +69,8 @@ protected function execute(InputInterface $input, OutputInterface $output) | |
{ | ||
$finder = $this->getContainer()->get('smarty.templating.finder'); | ||
$engine = $this->getContainer()->get('templating.engine.smarty'); | ||
$smarty = $engine->getSmarty(); | ||
|
||
$bundleName = $input->getArgument('bundle'); | ||
$force = (boolean) $input->getOption('force'); | ||
$verbose = $input->getOption('verbose'); | ||
|
||
if ($bundleName && (0 === strpos($bundleName, '@'))) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
* @link http://www.noiselabs.org | ||
*/ | ||
|
@@ -81,7 +81,7 @@ public function load(array $configs, ContainerBuilder $container) | |
$loader->load('assetic.xml'); | ||
|
||
// choose dynamic or static | ||
if ($useController = $container->getParameterBag()->resolveValue($container->getParameterBag()->get('assetic.use_controller'))) { | ||
if ($container->getParameterBag()->resolveValue($container->getParameterBag()->get('assetic.use_controller'))) { | ||
$container->getDefinition('smarty.extension.assetic.dynamic')->addTag('smarty.extension', array('alias' => 'assetic')); | ||
$container->removeDefinition('smarty.extension.assetic.static'); | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
* License along with NoiseLabs-SmartyBundle; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright (C) 2011-2015 Vítor Brandão | ||
* Copyright (C) 2011-2016 Vítor Brandão | ||
* | ||
* @category NoiseLabs | ||
* @package SmartyBundle | ||
* @copyright (C) 2011-2014 Vítor Brandão <[email protected]> | ||
* @copyright (C) 2011-2016 Vítor Brandão <[email protected]> | ||
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 | ||
*/ | ||
|
||
|
@@ -51,9 +51,13 @@ class AbstractException extends \Exception | |
* @param Smarty_Internal_Template $template Smarty template | ||
* @param Exception $previous The previous exception | ||
*/ | ||
public function __construct($message, $lineno = -1, $filename = null, | ||
\Smarty_Internal_Template $template = null, \Exception $previous = null) | ||
{ | ||
public function __construct( | ||
$message, | ||
$lineno = -1, | ||
$filename = null, | ||
\Smarty_Internal_Template $template = null, | ||
\Exception $previous = null | ||
) { | ||
if (version_compare(PHP_VERSION, '5.3.0', '<')) { | ||
$this->previous = $previous; | ||
parent::__construct(''); | ||
|
@@ -69,8 +73,11 @@ public function __construct($message, $lineno = -1, $filename = null, | |
$this->guessTemplateInfo(); | ||
} | ||
|
||
$this->rawMessage = str_replace(array('"', '>', '<'), | ||
array('"', '>', '<'), html_entity_decode($message)); | ||
$this->rawMessage = str_replace( | ||
array('"', '>', '<'), | ||
array('"', '>', '<'), | ||
html_entity_decode($message) | ||
); | ||
|
||
$this->updateRepr(); | ||
} | ||
|
@@ -233,7 +240,8 @@ protected function jsonEncode($param) | |
* | ||
* @return array | ||
*/ | ||
function objectToArray($var) { | ||
function objectToArray($var) | ||
{ | ||
$result = array(); | ||
$references = array(); | ||
|
||
|
Oops, something went wrong.