Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 32
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialCollaborationKitIcons
0.00% covered (danger)
0.00%
0 / 32
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 31
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3/**
4 * Special page that generates a list of icons and corresponding icon names.
5 *
6 * @file
7 */
8
9class SpecialCollaborationKitIcons extends IncludableSpecialPage {
10
11    public function __construct() {
12        parent::__construct( 'CollaborationKitIcons' );
13    }
14
15    /**
16     * @param string $par
17     */
18    public function execute( $par ) {
19        $output = $this->getOutput();
20        $output->addModuleStyles( [
21            'ext.CollaborationKit.hub.styles',
22            'ext.CollaborationKit.icons',
23            'ext.CollaborationKit.blots'
24        ] );
25        $this->setHeaders();
26
27        $icons = CollaborationKitImage::getCannedIcons();
28
29        // Intro
30        $wikitext = $this->msg( 'collaborationkit-iconlist-intro' )->plain();
31        $wikitext .= "\n";
32
33        // Table header
34        $wikitext .= "{| class='wikitable'\n";
35        $wikitext .= "|-\n";
36        $wikitext .= '! ' .
37                     $this->msg( 'collaborationkit-iconlist-columnheader-icon' )->plain() .
38                     "\n";
39        $wikitext .= '! ' .
40                     $this->msg( 'collaborationkit-iconlist-columnheader-iconname' )->plain() .
41                     "\n";
42        $wikitext .= "|-\n";
43
44        // Iterate through each icon and generate a row
45        $iconCount = count( $icons );
46        for ( $i = 0; $i < $iconCount; $i++ ) {
47            $imageCode = CollaborationKitImage::makeImage(
48                $icons[$i],
49                60,
50                [ 'renderAsWikitext' => true, 'link' => false ]
51            );
52            $wikitext .= '| ' . $imageCode . "\n";
53            $wikitext .= '| ' . $icons[$i] . "\n";
54            $wikitext .= "|-\n";
55        }
56
57        // End table
58        $wikitext .= '|}';
59
60        $output->addWikiTextAsInterface( $wikitext );
61    }
62}