mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/16955] Clean up storage and template classes
PHPBB3-16955
This commit is contained in:
parent
077ceba2a9
commit
60c165c3d0
13 changed files with 20 additions and 43 deletions
|
@ -278,7 +278,7 @@ class attachment extends controller
|
|||
$response->headers->set('Content-Disposition', $disposition);
|
||||
|
||||
// Set expires header for browser cache
|
||||
$time = new \Datetime();
|
||||
$time = new \DateTime();
|
||||
$response->setExpires($time->modify('+1 year'));
|
||||
|
||||
return parent::handle($attachment['physical_filename']);
|
||||
|
|
|
@ -107,7 +107,7 @@ class avatar extends controller
|
|||
|
||||
$response->headers->set('Content-Disposition', $disposition);
|
||||
|
||||
$time = new \Datetime();
|
||||
$time = new \DateTime();
|
||||
$response->setExpires($time->modify('+1 year'));
|
||||
|
||||
parent::prepare($response, $file);
|
||||
|
|
|
@ -43,7 +43,7 @@ class file_info
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $adapter
|
||||
* @param adapter_interface $adapter
|
||||
* @param string $path
|
||||
*/
|
||||
public function __construct(adapter_interface $adapter, $path)
|
||||
|
|
|
@ -403,7 +403,7 @@ class storage
|
|||
*
|
||||
* @param string $path The file
|
||||
*
|
||||
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
||||
* @throws \phpbb\storage\exception\exception When the adapter doesnt implement the method
|
||||
* When the file doesn't exist
|
||||
*
|
||||
* @return \phpbb\storage\file_info Returns file_info object
|
||||
|
|
|
@ -15,14 +15,6 @@ namespace phpbb\template;
|
|||
|
||||
interface template
|
||||
{
|
||||
|
||||
/**
|
||||
* Clear the cache
|
||||
*
|
||||
* @return \phpbb\template\template
|
||||
*/
|
||||
public function clear_cache();
|
||||
|
||||
/**
|
||||
* Sets the template filenames for handles.
|
||||
*
|
||||
|
|
|
@ -53,7 +53,7 @@ class extension extends \Twig\Extension\AbstractExtension
|
|||
/**
|
||||
* Returns the token parser instance to add to the existing list.
|
||||
*
|
||||
* @return array An array of \Twig\TokenParser\AbstractTokenParser instances
|
||||
* @return \Twig\TokenParser\TokenParserInterface[] An array of \Twig\TokenParser\AbstractTokenParser instances
|
||||
*/
|
||||
public function getTokenParsers()
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ class extension extends \Twig\Extension\AbstractExtension
|
|||
/**
|
||||
* Returns a list of filters to add to the existing list.
|
||||
*
|
||||
* @return array An array of filters
|
||||
* @return \Twig\TwigFilter[] An array of filters
|
||||
*/
|
||||
public function getFilters()
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ class extension extends \Twig\Extension\AbstractExtension
|
|||
/**
|
||||
* Returns a list of global functions to add to the existing list.
|
||||
*
|
||||
* @return array An array of global functions
|
||||
* @return \Twig\TwigFunction[] An array of global functions
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ class extension extends \Twig\Extension\AbstractExtension
|
|||
/**
|
||||
* Returns a list of operators to add to the existing list.
|
||||
*
|
||||
* @return array An array of operators
|
||||
* @return array[] An array of operators
|
||||
*/
|
||||
public function getOperators()
|
||||
{
|
||||
|
|
|
@ -30,9 +30,9 @@ class avatar extends AbstractExtension
|
|||
/**
|
||||
* Returns a list of global functions to add to the existing list.
|
||||
*
|
||||
* @return array An array of global functions
|
||||
* @return \Twig\TwigFunction[] An array of global functions
|
||||
*/
|
||||
public function getFunctions()
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return array(
|
||||
new \Twig\TwigFunction('avatar', array($this, 'get_avatar')),
|
||||
|
|
|
@ -43,9 +43,9 @@ class config extends AbstractExtension
|
|||
/**
|
||||
* Returns a list of global functions to add to the existing list.
|
||||
*
|
||||
* @return array An array of global functions
|
||||
* @return \Twig\TwigFunction[] An array of global functions
|
||||
*/
|
||||
public function getFunctions()
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return array(
|
||||
new \Twig\TwigFunction('config', array($this, 'get_config')),
|
||||
|
|
|
@ -22,7 +22,7 @@ use Twig\TwigFunction;
|
|||
|
||||
class routing extends AbstractExtension
|
||||
{
|
||||
/** @var \phpbb\controller\helper */
|
||||
/** @var \phpbb\routing\helper */
|
||||
protected $helper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,14 +28,12 @@ class username extends AbstractExtension
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a list of global functions to add to the existing list.
|
||||
*
|
||||
* @return array An array of global functions
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
new \Twig\TwigFunction('username', array($this, 'get_username')),
|
||||
new \Twig\TwigFunction('username', [$this, 'get_username']),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class event extends \Twig\Node\Node
|
|||
*/
|
||||
protected $listener_directory = 'event/';
|
||||
|
||||
/** @var \Twig\Environment */
|
||||
/** @var \phpbb\template\twig\environment */
|
||||
protected $environment;
|
||||
|
||||
public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
|
||||
|
|
|
@ -23,7 +23,7 @@ class defineparser extends \Twig\TokenParser\AbstractTokenParser
|
|||
*
|
||||
* @return \Twig\Node\Node A Twig\Node instance
|
||||
* @throws \Twig\Error\SyntaxError
|
||||
* @throws \phpbb\template\twig\node\definenode
|
||||
* @returns \phpbb\template\twig\node\definenode
|
||||
*/
|
||||
public function parse(\Twig\Token $token)
|
||||
{
|
||||
|
|
|
@ -92,27 +92,14 @@ class twig extends \phpbb\template\base
|
|||
}
|
||||
|
||||
// Add admin namespace
|
||||
if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/'))
|
||||
if ($this->path_helper->get_adm_relative_path() !== null
|
||||
&& is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')
|
||||
&& $this->loader instanceof \Twig\Loader\FilesystemLoader)
|
||||
{
|
||||
$this->loader->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cache
|
||||
*
|
||||
* @return \phpbb\template\template
|
||||
*/
|
||||
public function clear_cache()
|
||||
{
|
||||
if (is_dir($this->cachepath))
|
||||
{
|
||||
$this->twig->clearCacheFiles();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style tree of the style preferred by the current user
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue