Failed Conditions
Pull Request — master (#222)
by
unknown
14:39 queued 09:48
created

smarty-plugins/function.defaultsort.php (1 issue)

Labels
Severity
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 * ACC Development Team. Please see team.json for a list of contributors.     *
5
 *                                                                            *
6
 * This is free and unencumbered software released into the public domain.    *
7
 * Please see LICENSE.md for the full licencing statement.                    *
8
 ******************************************************************************/
9
10
/**
11
 * Sets up the cookie-based default sorting on request tables
12
 *
13
 * @param                          $params
14
 * @param Smarty_Internal_Template $template
15
 *
16
 * @return string
17
 */
18
function smarty_function_defaultsort($params, Smarty_Internal_Template $template)
0 ignored issues
show
The type Smarty_Internal_Template was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
{
20
    if (empty($params['id'])) {
21
        return "";
22
    }
23
24
    $attr = 'data-sortname="' . htmlspecialchars($params['id'], ENT_QUOTES) . '"';
25
26
    if (empty($params['req'])) {
27
        return $attr;
28
    }
29
30
    if ($params['dir'] !== 'asc' && $params['dir'] !== 'desc') {
31
        $params['dir'] = 'asc';
32
    }
33
34
    $sort = '';
35
    if ($params['req'] === $params['id']) {
36
        $sort = ' data-defaultsort="' . htmlspecialchars($params['dir'], ENT_QUOTES) . '"';
37
    }
38
39
    return $attr . $sort;
40
}