Passed
Branch master (d40980)
by Mark
01:30
created

syntax.php (8 issues)

1
<?php
2
/**
3
 * Description plugin
4
 *
5
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6
 * @author     Matthias Schulte <[email protected]>
7
 */
8
9
// must be run within Dokuwiki
10
if(!defined('DOKU_INC')) die();
11
12
if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
13
if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
14
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
0 ignored issues
show
The constant DOKU_INC was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
15
16
require_once(DOKU_PLUGIN.'syntax.php');
17
18
class syntax_plugin_description extends DokuWiki_Syntax_Plugin {
1 ignored issue
show
The type DokuWiki_Syntax_Plugin 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
    function getType() { return 'substition'; }
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
    function getPType() { return 'block'; }
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
22
    function getSort() { return 98; }
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
24
    function connectTo($mode) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
25
        $this->Lexer->addSpecialPattern('\{\{description>.+?\}\}', $mode, 'plugin_description');
26
    }
27
28
    function handle($match, $state, $pos, Doku_Handler $handler) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
29
        $match = substr($match, 14, -2); // strip markup
30
        $match = hsc($match);
31
        
32
        return array($match);
33
    }            
34
35
    function render($mode, Doku_Renderer $renderer, $data) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
36
        global $conf;
37
        global $ID;       
38
        $description = $data[0];
39
        if(empty($description)) return false;
40
41
        if ($mode == 'metadata') {
42
            $renderer->meta['plugin_description']['keywords'] = $description;
43
            return true;
44
        }
45
        return false;
46
    }
47
}
48
49
// vim:ts=4:sw=4:et: 
50