These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\Modules\CallHome; |
||
3 | |||
4 | use Redaxscript\Filter; |
||
5 | use Redaxscript\Head; |
||
6 | use Redaxscript\Module; |
||
7 | use Redaxscript\Reader; |
||
8 | |||
9 | /** |
||
10 | * provide version and news updates |
||
11 | * |
||
12 | * @since 2.2.0 |
||
13 | * |
||
14 | * @package Redaxscript |
||
15 | * @category Modules |
||
16 | * @author Henry Ruhs |
||
17 | */ |
||
18 | |||
19 | class CallHome extends Module\Notification |
||
20 | { |
||
21 | /** |
||
22 | * array of the module |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | |||
27 | protected static $_moduleArray = |
||
28 | [ |
||
29 | 'name' => 'Call Home', |
||
30 | 'alias' => 'CallHome', |
||
31 | 'author' => 'Redaxmedia', |
||
32 | 'description' => 'Provide version and news updates', |
||
33 | 'version' => '4.0.0' |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * renderStart |
||
38 | * |
||
39 | * @since 3.0.0 |
||
40 | */ |
||
41 | |||
42 | public function renderStart() : void |
||
43 | { |
||
44 | if ($this->_registry->get('loggedIn') === $this->_registry->get('token') && $this->_registry->get('firstParameter') === 'admin') |
||
45 | { |
||
46 | $script = Head\Script::getInstance(); |
||
47 | $script |
||
48 | ->init('foot') |
||
49 | ->appendFile( |
||
50 | [ |
||
51 | 'https://google-analytics.com/analytics.js', |
||
52 | 'modules/CallHome/assets/scripts/init.js', |
||
53 | 'modules/CallHome/dist/scripts/call-home.min.js' |
||
54 | ]); |
||
55 | } |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * adminNotification |
||
60 | * |
||
61 | * @since 3.0.1 |
||
62 | * |
||
63 | * @return array|null |
||
64 | */ |
||
65 | |||
66 | public function adminNotification() : ?array |
||
67 | { |
||
68 | $reader = new Reader(); |
||
69 | $reader->init(); |
||
70 | $aliasFilter = new Filter\Alias(); |
||
71 | $version = $aliasFilter->sanitize($this->_language->get('version', '_package')); |
||
0 ignored issues
–
show
|
|||
72 | |||
73 | /* load result */ |
||
74 | |||
75 | $urlVersion = 'https://service.redaxscript.com/version/' . $version; |
||
76 | $urlNews = 'https://service.redaxscript.com/news/' . $version; |
||
77 | $versionArray = $reader->loadJSON($urlVersion)->getArray(); |
||
78 | $newsArray = $reader->loadJSON($urlNews)->getArray(); |
||
79 | |||
80 | /* process version */ |
||
81 | |||
82 | foreach ($versionArray as $version) |
||
83 | { |
||
84 | foreach ($version as $type => $message) |
||
85 | { |
||
86 | $this->setNotification($type, $message); |
||
87 | } |
||
88 | } |
||
89 | |||
90 | /* process news */ |
||
91 | |||
92 | foreach ($newsArray as $news) |
||
93 | { |
||
94 | foreach ($news as $type => $message) |
||
95 | { |
||
96 | $this->setNotification($type, $message); |
||
97 | } |
||
98 | } |
||
99 | return $this->getNotification(); |
||
100 | } |
||
101 | } |
||
102 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.