These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Handles replacing `dms_document_link` shortcodes with links to the actual |
||
5 | * document. |
||
6 | * |
||
7 | * @package dms |
||
8 | */ |
||
9 | class DMSShortcodeHandler |
||
10 | { |
||
11 | public static function handle($arguments, $content, ShortcodeParser $parser, $tag, array $extra = array()) |
||
0 ignored issues
–
show
|
|||
12 | { |
||
13 | if (!empty($arguments['id'])) { |
||
14 | $document = DMSDocument::get()->byID($arguments['id']); |
||
15 | |||
16 | if ($document && !$document->isHidden()) { |
||
17 | if ($content) { |
||
18 | return sprintf( |
||
19 | '<a href="%s">%s</a>', |
||
20 | $document->Link(), |
||
21 | $parser->parse($content) |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | if (isset($extra['element'])) { |
||
26 | $extra['element']->setAttribute('data-ext', $document->getExtension()); |
||
27 | $extra['element']->setAttribute('data-size', $document->getFileSizeFormatted()); |
||
28 | } |
||
29 | |||
30 | return $document->Link(); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | $error = ErrorPage::get()->filter('ErrorCode', '404')->First(); |
||
35 | |||
36 | if ($error) { |
||
37 | return $error->Link(); |
||
38 | } |
||
39 | |||
40 | return ''; |
||
41 | } |
||
42 | } |
||
43 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.