mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/16737] Twig improvements, phpdoc and fix variable
PHPBB3-16737
This commit is contained in:
parent
e5d5c0e29f
commit
a168c0f545
3 changed files with 42 additions and 48 deletions
|
@ -20,7 +20,7 @@
|
|||
|
||||
<p>{{ lang('ACP_SEARCH_INDEX_EXPLAIN') }}</p>
|
||||
|
||||
{% for backend in loops.backend %}
|
||||
{% for backend in backends %}
|
||||
|
||||
{% if backend.S_STATS is not empty %}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
{{ backend.S_HIDDEN_FIELDS }}
|
||||
|
||||
<legend>{{ lang('INDEX_STATS') }}{{ lang('COLON') }} {{ backend.NAME }} {% if backend.S_ACTIVE %}({{ lang('ACTIVE') }}) {% endif %}</legend>
|
||||
<legend>{{ lang('INDEX_STATS') ~ lang('COLON') }} {{ backend.NAME }} {% if backend.S_ACTIVE %}({{ lang('ACTIVE') }}) {% endif %}</legend>
|
||||
|
||||
<table class="table1">
|
||||
<caption>{{ backend.NAME }} {% if backend.S_ACTIVE %}({{ lang('ACTIVE') }}) {% endif %}</caption>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<tr>
|
||||
{% for key, value in stat %}
|
||||
{% if value is not empty %}
|
||||
<td>{{ key }}{{ lang('COLON') }}</td>
|
||||
<td>{{ key ~ lang('COLON') }}</td>
|
||||
<td>{{ value }}</td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
|
|
|
@ -11,28 +11,28 @@
|
|||
<fieldset>
|
||||
<legend>{{ lang('GENERAL_SEARCH_SETTINGS') }}</legend>
|
||||
<dl>
|
||||
<dt><label for="load_search">{{ lang('YES_SEARCH') }}{{ lang('COLON') }}</label><br /><span>{{ lang('YES_SEARCH_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="load_search">{{ lang('YES_SEARCH') ~ lang('COLON') }}</label><br /><span>{{ lang('YES_SEARCH_EXPLAIN') }}</span></dt>
|
||||
<dd><label><input type="radio" class="radio" id="load_search" name="config[load_search]" value="1"{% if S_YES_SEARCH %} checked="checked"{% endif %} /> {{ lang('YES') }}</label>
|
||||
<label><input type="radio" class="radio" name="config[load_search]" value="0"{% if not S_YES_SEARCH %} checked="checked"{% endif %} /> {{ lang('NO') }}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="search_interval">{{ lang('SEARCH_INTERVAL') }}{{ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_INTERVAL_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="search_interval">{{ lang('SEARCH_INTERVAL') ~ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_INTERVAL_EXPLAIN') }}</span></dt>
|
||||
<dd><input id="search_interval" type="number" min="0" max="9999" name="config[search_interval]" value="{{ SEARCH_INTERVAL }}" /> {{ lang('SECONDS') }}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="search_anonymous_interval">{{ lang('SEARCH_GUEST_INTERVAL') }}{{ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_GUEST_INTERVAL_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="search_anonymous_interval">{{ lang('SEARCH_GUEST_INTERVAL') ~ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_GUEST_INTERVAL_EXPLAIN') }}</span></dt>
|
||||
<dd><input id="search_anonymous_interval" type="number" min="0" max="9999" name="config[search_anonymous_interval]" value="{{ SEARCH_GUEST_INTERVAL }}" /> {{ lang('SECONDS') }}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="limit_search_load">{{ lang('LIMIT_SEARCH_LOAD') }}{{ lang('COLON') }}</label><br /><span>{{ lang('LIMIT_SEARCH_LOAD_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="limit_search_load">{{ lang('LIMIT_SEARCH_LOAD') ~ lang('COLON') }}</label><br /><span>{{ lang('LIMIT_SEARCH_LOAD_EXPLAIN') }}</span></dt>
|
||||
<dd><input id="limit_search_load" type="text" size="4" maxlength="4" name="config[limit_search_load]" value="{{ LIMIT_SEARCH_LOAD }}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="min_search_author_chars">{{ lang('MIN_SEARCH_AUTHOR_CHARS') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MIN_SEARCH_AUTHOR_CHARS_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="min_search_author_chars">{{ lang('MIN_SEARCH_AUTHOR_CHARS') ~ lang('COLON') }}</label><br /><span>{{ lang('MIN_SEARCH_AUTHOR_CHARS_EXPLAIN') }}</span></dt>
|
||||
<dd><input id="min_search_author_chars" type="number" min="0" max="9999" name="config[min_search_author_chars]" value="{{ MIN_SEARCH_AUTHOR_CHARS }}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="max_num_search_keywords">{{ lang('MAX_NUM_SEARCH_KEYWORDS') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MAX_NUM_SEARCH_KEYWORDS_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="max_num_search_keywords">{{ lang('MAX_NUM_SEARCH_KEYWORDS') ~ lang('COLON') }}</label><br /><span>{{ lang('MAX_NUM_SEARCH_KEYWORDS_EXPLAIN') }}</span></dt>
|
||||
<dd><input id="max_num_search_keywords" type="number" min="0" max="9999" name="config[max_num_search_keywords]" value="{{ MAX_NUM_SEARCH_KEYWORDS }}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<dd><input id="default_search_return_chars" name="config[default_search_return_chars]" type="number" value="{{ DEFAULT_SEARCH_RETURN_CHARS }}" min="0" max="9999"></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="search_store_results">{{ lang('SEARCH_STORE_RESULTS') }}{{ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_STORE_RESULTS_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="search_store_results">{{ lang('SEARCH_STORE_RESULTS') ~ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_STORE_RESULTS_EXPLAIN') }}</span></dt>
|
||||
<dd><input id="search_store_results" type="number" min="0" max="999999" name="config[search_store_results]" value="{{ SEARCH_STORE_RESULTS }}" /> {{ lang('SECONDS') }}</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<fieldset>
|
||||
<legend>{{ lang('SEARCH_TYPE') }}</legend>
|
||||
<dl>
|
||||
<dt><label for="search_type">{{ lang('SEARCH_TYPE') }}{{ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_TYPE_EXPLAIN') }}</span></dt>
|
||||
<dt><label for="search_type">{{ lang('SEARCH_TYPE') ~ lang('COLON') }}</label><br /><span>{{ lang('SEARCH_TYPE_EXPLAIN') }}</span></dt>
|
||||
<dd><select id="search_type" name="config[search_type]" data-togglable-settings="true">{{ S_SEARCH_TYPES }}</select></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -39,54 +39,34 @@ class acp_search
|
|||
protected const STATE_ACTION = 1;
|
||||
protected const STATE_POST_COUNTER = 2;
|
||||
|
||||
/**
|
||||
* @var config
|
||||
*/
|
||||
/** @var config */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var language
|
||||
*/
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var log
|
||||
*/
|
||||
/** @var log */
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* @var request
|
||||
*/
|
||||
/** @var request */
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var service_collection
|
||||
*/
|
||||
/** @var service_collection */
|
||||
protected $search_backend_collection;
|
||||
|
||||
/**
|
||||
* @var search_backend_factory
|
||||
*/
|
||||
/** @var search_backend_factory */
|
||||
protected $search_backend_factory;
|
||||
|
||||
/**
|
||||
* @var template
|
||||
*/
|
||||
/** @var template */
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var user
|
||||
*/
|
||||
/** @var user */
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string */
|
||||
protected $phpbb_admin_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string */
|
||||
protected $php_ex;
|
||||
|
||||
public function __construct($p_master)
|
||||
|
@ -127,6 +107,12 @@ class acp_search
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings page
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $mode
|
||||
*/
|
||||
public function settings(string $id, string $mode): void
|
||||
{
|
||||
$submit = $this->request->is_set_post('submit');
|
||||
|
@ -181,9 +167,9 @@ class acp_search
|
|||
$cfg_array = (isset($_REQUEST['config'])) ? $this->request->variable('config', ['' => ''], true) : [];
|
||||
$updated = $this->request->variable('updated', false);
|
||||
|
||||
foreach ($settings as $this->config_name => $var_type)
|
||||
foreach ($settings as $config_name => $var_type)
|
||||
{
|
||||
if (!isset($cfg_array[$this->config_name]))
|
||||
if (!isset($cfg_array[$config_name]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -191,7 +177,7 @@ class acp_search
|
|||
// e.g. integer:4:12 (min 4, max 12)
|
||||
$var_type = explode(':', $var_type);
|
||||
|
||||
$this->config_value = $cfg_array[$this->config_name];
|
||||
$this->config_value = $cfg_array[$config_name];
|
||||
settype($this->config_value, $var_type[0]);
|
||||
|
||||
if (isset($var_type[1]))
|
||||
|
@ -205,9 +191,9 @@ class acp_search
|
|||
}
|
||||
|
||||
// only change config if anything was actually changed
|
||||
if ($submit && ($this->config[$this->config_name] != $this->config_value))
|
||||
if ($submit && ($this->config[$config_name] != $this->config_value))
|
||||
{
|
||||
$this->config->set($this->config_name, $this->config_value);
|
||||
$this->config->set($config_name, $this->config_value);
|
||||
$updated = true;
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +263,7 @@ class acp_search
|
|||
}
|
||||
|
||||
/**
|
||||
* Execute action
|
||||
* Execute action depending on the action and state
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $mode
|
||||
|
@ -338,7 +324,7 @@ class acp_search
|
|||
|
||||
foreach ($this->search_backend_collection as $search)
|
||||
{
|
||||
$this->template->assign_block_vars('backend', [
|
||||
$this->template->assign_block_vars('backends', [
|
||||
'NAME' => $search->get_name(),
|
||||
'TYPE' => $search->get_type(),
|
||||
|
||||
|
@ -376,6 +362,14 @@ class acp_search
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress that do the indexing/index removal, updating the page continuously until is finished
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $mode
|
||||
* @param string $action
|
||||
* @param array $state
|
||||
*/
|
||||
private function index_action(string $id, string $mode, string $action, array $state): void
|
||||
{
|
||||
// For some this may be of help...
|
||||
|
|
Loading…
Add table
Reference in a new issue