mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 20:08:55 +00:00
Compare commits
1 commit
d4c66c955e
...
31e5c3b97d
Author | SHA1 | Date | |
---|---|---|---|
|
31e5c3b97d |
11 changed files with 7 additions and 183 deletions
|
@ -19,7 +19,7 @@
|
||||||
<form method="post" action="#" id="language_selector">
|
<form method="post" action="#" id="language_selector">
|
||||||
<fieldset class="nobg">
|
<fieldset class="nobg">
|
||||||
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
|
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
|
||||||
<select id="language" name="language">
|
<select id="language" name="language">
|
||||||
<!-- BEGIN language_select_item -->
|
<!-- BEGIN language_select_item -->
|
||||||
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
|
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
|
||||||
<!-- END language_select_item -->
|
<!-- END language_select_item -->
|
||||||
|
|
|
@ -2806,13 +2806,6 @@ ucp_pm_viewmessage_custom_fields_before
|
||||||
* Purpose: Add data before the custom fields on the user profile when viewing
|
* Purpose: Add data before the custom fields on the user profile when viewing
|
||||||
a private message
|
a private message
|
||||||
|
|
||||||
ucp_pm_viewmessage_message_content_before
|
|
||||||
===
|
|
||||||
* Locations:
|
|
||||||
+ styles/prosilver/template/ucp_pm_viewmessage.html
|
|
||||||
* Since: 3.3.16-RC1
|
|
||||||
* Purpose: Add content before the private message text
|
|
||||||
|
|
||||||
ucp_pm_viewmessage_options_before
|
ucp_pm_viewmessage_options_before
|
||||||
===
|
===
|
||||||
* Locations:
|
* Locations:
|
||||||
|
|
|
@ -339,14 +339,6 @@ class helper
|
||||||
protected function render_language_select($selected_language = null)
|
protected function render_language_select($selected_language = null)
|
||||||
{
|
{
|
||||||
$langs = $this->lang_helper->get_available_languages();
|
$langs = $this->lang_helper->get_available_languages();
|
||||||
|
|
||||||
// The first language will be selected by default. Unless a user has consciously included
|
|
||||||
// other languages in the installation process, it will be British English anyway.
|
|
||||||
if ($selected_language === null && count($langs))
|
|
||||||
{
|
|
||||||
$selected_language = $langs[0]['iso'];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($langs as $lang)
|
foreach ($langs as $lang)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('language_select_item', array(
|
$this->template->assign_block_vars('language_select_item', array(
|
||||||
|
|
|
@ -67,20 +67,6 @@ class language_file_helper
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($available_languages, [$this, 'sort_by_local_name']);
|
|
||||||
|
|
||||||
return $available_languages;
|
return $available_languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sorts the languages by their name instead of iso code
|
|
||||||
*
|
|
||||||
* @param mixed $a First language data
|
|
||||||
* @param mixed $b Second language data
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
private static function sort_by_local_name($a, $b): int
|
|
||||||
{
|
|
||||||
return $a['local_name'] <=> $b['local_name'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
to hide visually and `aria-hidden="true"` to hide from screen-readers; using
|
to hide visually and `aria-hidden="true"` to hide from screen-readers; using
|
||||||
`hidden` or `display: none` would prevent the task from running.
|
`hidden` or `display: none` would prevent the task from running.
|
||||||
#}
|
#}
|
||||||
<img class="sr-only" aria-hidden="true" src="{{ CRON_TASK_URL|e('url') }}" width="1" height="1" alt="">
|
<img class="sr-only" aria-hidden="true" src="{{ CRON_TASK_URL|e('html_attr') }}" width="1" height="1" alt="">
|
||||||
|
|
|
@ -130,7 +130,6 @@
|
||||||
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}"<!-- IF bcc_recipient.COLOUR --> style="color:{bcc_recipient.COLOUR};"<!-- ENDIF -->><strong>{bcc_recipient.NAME}</strong></a><!-- ENDIF --> <!-- END bcc_recipient --><!-- ENDIF -->
|
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}"<!-- IF bcc_recipient.COLOUR --> style="color:{bcc_recipient.COLOUR};"<!-- ENDIF -->><strong>{bcc_recipient.NAME}</strong></a><!-- ENDIF --> <!-- END bcc_recipient --><!-- ENDIF -->
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% EVENT ucp_pm_viewmessage_message_content_before %}
|
|
||||||
|
|
||||||
<div class="content">{MESSAGE}</div>
|
<div class="content">{MESSAGE}</div>
|
||||||
|
|
||||||
|
|
|
@ -1,142 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* This file is part of the phpBB Forum Software package.
|
|
||||||
*
|
|
||||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
|
||||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
|
||||||
*
|
|
||||||
* For full copyright and license information, please see
|
|
||||||
* the docs/CREDITS.txt file.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../template/template_test_case.php';
|
|
||||||
|
|
||||||
class phpbb_cron_wrapper_test extends phpbb_template_template_test_case
|
|
||||||
{
|
|
||||||
private $task;
|
|
||||||
private $routing_helper;
|
|
||||||
private $wrapper;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
global $phpbb_root_path;
|
|
||||||
|
|
||||||
// Test the engine can be used
|
|
||||||
$this->setup_engine([], $phpbb_root_path . 'styles/all/template');
|
|
||||||
|
|
||||||
$this->template->clear_cache();
|
|
||||||
|
|
||||||
global $phpbb_filesystem;
|
|
||||||
|
|
||||||
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
|
||||||
|
|
||||||
$this->task = $this->createMock(\phpbb\cron\task\task::class);
|
|
||||||
$this->routing_helper = $this->createMock(\phpbb\routing\helper::class);
|
|
||||||
|
|
||||||
$this->wrapper = new \phpbb\cron\task\wrapper(
|
|
||||||
$this->task,
|
|
||||||
$this->routing_helper,
|
|
||||||
'/phpbb/',
|
|
||||||
'php',
|
|
||||||
$this->template
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_generate_template_pagination()
|
|
||||||
{
|
|
||||||
$this->task = $this->createMock(\phpbb\cron\task\parametrized::class);
|
|
||||||
$this->task->expects($this->any())
|
|
||||||
->method('get_parameters')
|
|
||||||
->willReturn(['f' => '5']);
|
|
||||||
$this->task->expects($this->any())
|
|
||||||
->method('get_name')
|
|
||||||
->willReturn('test_task');
|
|
||||||
$this->routing_helper = $this->createMock(\phpbb\routing\helper::class);
|
|
||||||
$this->routing_helper->expects($this->any())
|
|
||||||
->method('route')
|
|
||||||
->with('phpbb_cron_run', ['cron_type' => 'test_task', 'f' => '5'])
|
|
||||||
->willReturn('app.php/cron/foo?f=5');
|
|
||||||
|
|
||||||
$this->wrapper = new \phpbb\cron\task\wrapper(
|
|
||||||
$this->task,
|
|
||||||
$this->routing_helper,
|
|
||||||
'/phpbb/',
|
|
||||||
'php',
|
|
||||||
$this->template
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertEquals('<img class="sr-only" aria-hidden="true" src="app.php%2Fcron%2Ffoo%3Ff%3D5" width="1" height="1" alt="">', str_replace(["\n", "\t"], '', $this->wrapper->get_html_tag()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_is_parametrized_false()
|
|
||||||
{
|
|
||||||
$this->assertFalse($this->wrapper->is_parametrized());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_is_ready()
|
|
||||||
{
|
|
||||||
$this->task->method('is_runnable')->willReturn(true);
|
|
||||||
$this->task->method('should_run')->willReturn(true);
|
|
||||||
|
|
||||||
$this->assertTrue($this->wrapper->is_ready());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_get_url_non_parametrized()
|
|
||||||
{
|
|
||||||
$this->task->method('get_name')->willReturn('test_task');
|
|
||||||
$this->routing_helper->expects($this->once())
|
|
||||||
->method('route')
|
|
||||||
->with('phpbb_cron_run', ['cron_type' => 'test_task'])
|
|
||||||
->willReturn('/cron/url');
|
|
||||||
|
|
||||||
$this->assertEquals('/cron/url', $this->wrapper->get_url());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_get_html_tag()
|
|
||||||
{
|
|
||||||
$this->template = $this->createMock(\phpbb\template\template::class);
|
|
||||||
$this->wrapper = new \phpbb\cron\task\wrapper(
|
|
||||||
$this->task,
|
|
||||||
$this->routing_helper,
|
|
||||||
'/phpbb/',
|
|
||||||
'php',
|
|
||||||
$this->template
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->template->expects($this->once())
|
|
||||||
->method('set_filenames');
|
|
||||||
$this->template->expects($this->once())
|
|
||||||
->method('assign_var');
|
|
||||||
$this->template->expects($this->once())
|
|
||||||
->method('assign_display')
|
|
||||||
->willReturn('<img src="cron">');
|
|
||||||
|
|
||||||
$this->assertEquals('<img src="cron">', $this->wrapper->get_html_tag());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_call_forwards_to_task()
|
|
||||||
{
|
|
||||||
$this->task = $this->getMockBuilder(\phpbb\cron\task\task::class)
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->setMethods(['get_name', 'run', 'is_runnable', 'should_run', 'some_method'])
|
|
||||||
->getMock();
|
|
||||||
$this->routing_helper = $this->createMock(\phpbb\routing\helper::class);
|
|
||||||
|
|
||||||
$this->wrapper = new \phpbb\cron\task\wrapper(
|
|
||||||
$this->task,
|
|
||||||
$this->routing_helper,
|
|
||||||
'/phpbb/',
|
|
||||||
'php',
|
|
||||||
$this->template
|
|
||||||
);
|
|
||||||
$this->task->expects($this->once())
|
|
||||||
->method('some_method')
|
|
||||||
->with('arg1', 'arg2')
|
|
||||||
->willReturn('result');
|
|
||||||
|
|
||||||
$result = $this->wrapper->some_method('arg1', 'arg2');
|
|
||||||
$this->assertEquals('result', $result);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/template_test_case.php';
|
||||||
|
|
||||||
class phpbb_template_extension_test extends phpbb_template_template_test_case
|
class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
{
|
{
|
||||||
protected function setup_engine(array $new_config = array(), string $template_path = '')
|
protected function setup_engine(array $new_config = array())
|
||||||
{
|
{
|
||||||
global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $parent_template_path;
|
protected $parent_template_path;
|
||||||
|
|
||||||
protected function setup_engine(array $new_config = array(), string $template_path = '')
|
protected function setup_engine(array $new_config = array())
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx, $user;
|
global $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use phpbb\template\twig\twig;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This file is part of the phpBB Forum Software package.
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
@ -17,7 +14,6 @@ use phpbb\template\twig\twig;
|
||||||
class phpbb_template_template_test_case extends phpbb_test_case
|
class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
{
|
{
|
||||||
protected $lang;
|
protected $lang;
|
||||||
/** @var twig */
|
|
||||||
protected $template;
|
protected $template;
|
||||||
protected $template_path;
|
protected $template_path;
|
||||||
protected $user;
|
protected $user;
|
||||||
|
@ -73,7 +69,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
return $defaults;
|
return $defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setup_engine(array $new_config = array(), string $template_path = '')
|
protected function setup_engine(array $new_config = array())
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
@ -96,7 +92,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->template_path = $template_path ?: $this->test_path . '/templates';
|
$this->template_path = $this->test_path . '/templates';
|
||||||
|
|
||||||
$container = new phpbb_mock_container_builder();
|
$container = new phpbb_mock_container_builder();
|
||||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/template_test_case.php';
|
||||||
|
|
||||||
class phpbb_template_template_test_case_with_tree extends phpbb_template_template_test_case
|
class phpbb_template_template_test_case_with_tree extends phpbb_template_template_test_case
|
||||||
{
|
{
|
||||||
protected function setup_engine(array $new_config = array(), string $template_path = '')
|
protected function setup_engine(array $new_config = array())
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx, $user;
|
global $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue