mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
[ticket/15538] Drop templates and icons folder, twig file extension
PHPBB3-15538
This commit is contained in:
parent
ac2b95c1fa
commit
c47f9d5744
9 changed files with 14 additions and 14 deletions
|
@ -98,9 +98,9 @@ class icon extends \Twig\Extension\AbstractExtension
|
||||||
// Iterate over the user's styles and check for icon existance
|
// Iterate over the user's styles and check for icon existance
|
||||||
foreach ($this->get_style_list() as $style_path)
|
foreach ($this->get_style_list() as $style_path)
|
||||||
{
|
{
|
||||||
if ($filesystem->exists("{$root_path}styles/{$style_path}/theme/icons/png/{$icon}.png"))
|
if ($filesystem->exists("{$root_path}styles/{$style_path}/theme/png/{$icon}.png"))
|
||||||
{
|
{
|
||||||
$source = "{$base_path}styles/{$style_path}/theme/icons/png/{$icon}.png";
|
$source = "{$base_path}styles/{$style_path}/theme/png/{$icon}.png";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ class icon extends \Twig\Extension\AbstractExtension
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Try to load and prepare the SVG icon
|
// Try to load and prepare the SVG icon
|
||||||
$file = $environment->load('icons/svg/' . $icon . '.svg');
|
$file = $environment->load('svg/' . $icon . '.svg');
|
||||||
$source = $this->prepare_svg($file);
|
$source = $this->prepare_svg($file);
|
||||||
}
|
}
|
||||||
catch (\Twig\Error\LoaderError $e)
|
catch (\Twig\Error\LoaderError $e)
|
||||||
|
@ -142,14 +142,14 @@ class icon extends \Twig\Extension\AbstractExtension
|
||||||
$base_path = $board_url ? generate_board_url() . '/' : $environment->get_web_root_path();
|
$base_path = $board_url ? generate_board_url() . '/' : $environment->get_web_root_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
$source = "{$base_path}styles/all/imgs/icons/png/404.png";
|
$source = "{$base_path}styles/all/imgs/png/404.png";
|
||||||
$type = 'png';
|
$type = 'png';
|
||||||
$icon = '404';
|
$icon = '404';
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return $environment->render("macros/icons/{$type}.html", [
|
return $environment->render("macros/icons/{$type}.twig", [
|
||||||
'ATTRIBUTES' => (string) $this->implode_attributes($attributes),
|
'ATTRIBUTES' => (string) $this->implode_attributes($attributes),
|
||||||
'CLASSES' => (string) $classes,
|
'CLASSES' => (string) $classes,
|
||||||
'ICON' => (string) $icon,
|
'ICON' => (string) $icon,
|
||||||
|
|
|
@ -43,11 +43,11 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
$filesystem = $this->createMock('\phpbb\filesystem\filesystem');
|
$filesystem = $this->createMock('\phpbb\filesystem\filesystem');
|
||||||
$filesystem->expects($this->any())
|
$filesystem->expects($this->any())
|
||||||
->method('exists')
|
->method('exists')
|
||||||
->with($this->stringContains('theme/icons/png/'))
|
->with($this->stringContains('theme/png/'))
|
||||||
->will($this->returnValueMap([
|
->will($this->returnValueMap([
|
||||||
['phpBB/styles/chameleon/theme/icons/png/phone.png', true],
|
['phpBB/styles/chameleon/theme/png/phone.png', true],
|
||||||
['phpBB/styles/chameleon/theme/icons/png/pencil.png', true],
|
['phpBB/styles/chameleon/theme/png/pencil.png', true],
|
||||||
['phpBB/styles/chameleon/theme/icons/png/user.png', false],
|
['phpBB/styles/chameleon/theme/png/user.png', false],
|
||||||
]));
|
]));
|
||||||
$request = new phpbb_mock_request;
|
$request = new phpbb_mock_request;
|
||||||
$symfony_request = new \phpbb\symfony_request(
|
$symfony_request = new \phpbb\symfony_request(
|
||||||
|
@ -117,7 +117,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
|
|
||||||
$this->template->set_custom_style('tests', [
|
$this->template->set_custom_style('tests', [
|
||||||
$this->template_path,
|
$this->template_path,
|
||||||
$phpbb_root_path . 'styles/all/templates',
|
$phpbb_root_path . 'styles/all/template',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
[
|
[
|
||||||
'ICON_PHONE' => 'Phone icon',
|
'ICON_PHONE' => 'Phone icon',
|
||||||
],
|
],
|
||||||
'<img class="o-icon o-icon-png png-phone" src="phpBB/styles/chameleon/theme/icons/png/phone.png" alt="Phone icon" />',
|
'<img class="o-icon o-icon-png png-phone" src="phpBB/styles/chameleon/theme/png/phone.png" alt="Phone icon" />',
|
||||||
],
|
],
|
||||||
/** PNG: all options */
|
/** PNG: all options */
|
||||||
[
|
[
|
||||||
|
@ -371,7 +371,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
[
|
[
|
||||||
'ICON_PENCIL' => 'Pencil icon',
|
'ICON_PENCIL' => 'Pencil icon',
|
||||||
],
|
],
|
||||||
'<img class="o-icon o-icon-png png-pencil my-class" src="phpBB/styles/chameleon/theme/icons/png/pencil.png" alt="Pencil icon" data-url="my-test-url/test-page.php?u=2" />',
|
'<img class="o-icon o-icon-png png-pencil my-class" src="phpBB/styles/chameleon/theme/png/pencil.png" alt="Pencil icon" data-url="my-test-url/test-page.php?u=2" />',
|
||||||
],
|
],
|
||||||
/** PNG: Not found */
|
/** PNG: Not found */
|
||||||
[
|
[
|
||||||
|
@ -386,7 +386,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
[
|
[
|
||||||
'ICON_USER' => 'User icon',
|
'ICON_USER' => 'User icon',
|
||||||
],
|
],
|
||||||
'<img class="o-icon o-icon-png png-404 my-class" src="phpBB/styles/all/imgs/icons/png/404.png" alt="User icon" />',
|
'<img class="o-icon o-icon-png png-404 my-class" src="phpBB/styles/all/imgs/png/404.png" alt="User icon" />',
|
||||||
],
|
],
|
||||||
/** SVG: default */
|
/** SVG: default */
|
||||||
[
|
[
|
||||||
|
@ -439,7 +439,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
'attributes' => [],
|
'attributes' => [],
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
'<img class="o-icon o-icon-png png-404" src="phpBB/styles/all/imgs/icons/png/404.png" alt="Just a title" />',
|
'<img class="o-icon o-icon-png png-404" src="phpBB/styles/all/imgs/png/404.png" alt="Just a title" />',
|
||||||
],
|
],
|
||||||
/** SVG: Sanitization */
|
/** SVG: Sanitization */
|
||||||
[
|
[
|
||||||
|
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 425 B |
Loading…
Add table
Reference in a new issue