Completed
Pull Request — master (#575)
by Richard
06:57
created

PmPreload   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 80
rs 10
wmc 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A eventCoreViewpmsgStart() 0 4 2
A eventCoreReadpmsgStart() 0 4 2
A eventCoreClassSmartyXoops_pluginsXoinboxcount() 0 3 1
A eventSystemBlocksSystem_blocksUsershow() 0 3 1
A eventCorePmliteStart() 0 4 2
A eventCoreServiceLocateUserMessage() 0 7 2
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
use Xoops\Core\PreloadItem;
13
use Xoops\Core\Service\Provider;
14
15
/**
16
 * Private Messages preloads
17
 *
18
 * @package   Pm
19
 * @author    trabis <[email protected]>
20
 * @copyright 2011-2016 XOOPS Project (http://xoops.org)
21
 * @license   GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
22
 * @link      http://xoops.org
23
 * @since     2.4.0
24
 */
25
class PmPreload extends PreloadItem
26
{
27
28
    /**
29
     * core.pmlite.start
30
     *
31
     * @param array $args
32
     *
33
     * @return void
34
     */
35
    public static function eventCorePmliteStart($args)
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public static function eventCorePmliteStart(/** @scrutinizer ignore-unused */ $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
    {
37
        header("location: ./modules/pm/pmlite.php" . (empty($_SERVER['QUERY_STRING']) ? "" : "?" . $_SERVER['QUERY_STRING']));
38
        exit();
39
    }
40
41
    /**
42
     * core.readpmsg.start
43
     *
44
     * @param array $args
45
     *
46
     * @return void
47
     */
48
    public static function eventCoreReadpmsgStart($args)
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
    public static function eventCoreReadpmsgStart(/** @scrutinizer ignore-unused */ $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
    {
50
        header("location: ./modules/pm/readpmsg.php" . (empty($_SERVER['QUERY_STRING']) ? "" : "?" . $_SERVER['QUERY_STRING']));
51
        exit();
52
    }
53
54
    /**
55
     * core.viewpmsg.start
56
     *
57
     * @param array $args
58
     *
59
     * @return void
60
     */
61
    public static function eventCoreViewpmsgStart($args)
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

61
    public static function eventCoreViewpmsgStart(/** @scrutinizer ignore-unused */ $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
62
    {
63
        header("location: ./modules/pm/viewpmsg.php" . (empty($_SERVER['QUERY_STRING']) ? "" : "?" . $_SERVER['QUERY_STRING']));
64
        exit();
65
    }
66
67
    /**
68
     * core.Class.smarty.xoops_plugins.xoinboxcount
69
     *
70
     * @param array $args
71
     *
72
     * @return void
73
     */
74
    public static function eventCoreClassSmartyXoops_pluginsXoinboxcount($args)
75
    {
76
        $args[0] = Xoops::getInstance()->getModuleHandler('message', 'pm');
77
    }
78
79
    /**
80
     * system.blocks.system_blocks.usershow
81
     *
82
     * @param array $args
83
     *
84
     * @return void
85
     */
86
    public static function eventSystemBlocksSystem_blocksUsershow($args)
87
    {
88
        $args[0] = Xoops::getInstance()->getModuleHandler('message', 'pm');
89
    }
90
91
    /**
92
     * listen for core.service.locate.usermessage event
93
     *
94
     * @param Provider $provider - provider object for requested service
95
     *
96
     * @return void
97
     */
98
    public static function eventCoreServiceLocateUserMessage(Provider $provider)
99
    {
100
        if (is_a($provider, '\Xoops\Core\Service\Provider')) {
101
            $path = dirname(__DIR__) . '/class/PMProvider.php';
102
            require $path;
103
            $object = new PMProvider();
104
            $provider->register($object);
105
        }
106
    }
107
}
108