Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 3f7054...c9d2a6 )
by Sebastian
18s queued 13s
created

Classes/Plugin/Tools/FulltextDownloadTool.php (2 issues)

1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Plugin\Tools;
14
15
use Kitodo\Dlf\Common\Helper;
16
17
/**
18
 * Fulltext Download tool for the plugin 'Toolbox' of the 'dlf' extension
19
 *
20
 * @author Beatrycze Volk <[email protected]>
21
 * @package TYPO3
22
 * @subpackage dlf
23
 * @access public
24
 */
25
class FulltextDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin
26
{
27
    public $scriptRelPath = 'Classes/Plugin/Tools/FulltextDownloadTool.php';
28
29
    /**
30
     * The main method of the PlugIn
31
     *
32
     * @access public
33
     *
34
     * @param string $content: The PlugIn content
35
     * @param array $conf: The PlugIn configuration
36
     *
37
     * @return string The content that is displayed on the website
38
     */
39
    public function main($content, $conf)
40
    {
41
        $this->init($conf);
42
        // Merge configuration with conf array of toolbox.
43
        if (!empty($this->cObj->data['conf'])) {
44
            $this->conf = Helper::mergeRecursiveWithOverrule($this->cObj->data['conf'], $this->conf);
0 ignored issues
show
Bug Best Practice introduced by
The property conf does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
45
        }
46
        // Load current document.
47
        $this->loadDocument();
48
        if (
49
            $this->doc === null
50
            || $this->doc->numPages < 1
51
            || empty($this->conf['fileGrpFulltext'])
52
        ) {
53
            // Quit without doing anything if required variables are not set.
54
            return $content;
55
        } else {
56
            if (!empty($this->piVars['logicalPage'])) {
57
                $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
0 ignored issues
show
Bug Best Practice introduced by
The property piVars does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
58
                // The logical page parameter should not appear again
59
                unset($this->piVars['logicalPage']);
60
            }
61
            // Set default values if not set.
62
            // $this->piVars['page'] may be integer or string (physical structure @ID)
63
            if (
64
                (int) $this->piVars['page'] > 0
65
                || empty($this->piVars['page'])
66
            ) {
67
                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
68
            } else {
69
                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
70
            }
71
            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
72
        }
73
        // Load template file.
74
        $this->getTemplate();
75
        // Get text download.
76
        $fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
77
        if (!empty($fullTextFile)) {
78
            $markerArray['###FULLTEXT_DOWNLOAD###'] = '<a href="#" id="tx-dlf-tools-fulltextdownload" title="' . htmlspecialchars($this->pi_getLL('download-current-page', '')) . '">' . htmlspecialchars($this->pi_getLL('download-current-page', '')) . '</a>';
79
        } else {
80
            $markerArray['###FULLTEXT_DOWNLOAD###'] = '<span class="no-fulltext">' . htmlspecialchars($this->pi_getLL('fulltext-not-available', '')) . '</span>';
81
        }
82
        $content .= $this->templateService->substituteMarkerArray($this->template, $markerArray);
83
        return $this->pi_wrapInBaseClass($content);
84
    }
85
86
}
87