Issues (100)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/WP/ScriptsAndStyles.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * ScriptsAndStyles
4
 *
5
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
 *
8
 * Permission is hereby granted to use or copy this program
9
 * for any purpose, provided the above notices are retained on all copies.
10
 * Permission to modify the code and to distribute modified code is granted,
11
 * provided the above notices are retained, and a notice that the code was
12
 * modified is included with the above copyright notice.
13
 *
14
 * @category  Wp
15
 * @package   Punction
16
 * @author    Andrzej Marcinkowski <[email protected]>
17
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
 * @license   MIT http://opensource.org/licenses/MIT
19
 * @version   1.0  $Format:%H$
20
 * @link      http://
21
 * @since     File available since Release 1.0.0
22
 * PHP Version 5
23
 */
24
namespace Hospitalplugin\WP;
25
26
/**
27
 * ScriptsAndStyles
28
 *
29
 * @category  Wp
30
 * @package   Punction
31
 * @author    Andrzej Marcinkowski <[email protected]>
32
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
33
 * @license   MIT http://opensource.org/licenses/MIT
34
 * @version   1.0 $Format:%H$
35
 * @link      http://
36
 * @since     File available since Release 1.0.0
37
 *
38
 */
39
class ScriptsAndStyles
40
{
41
42
    private $scripts;
43
44
    private $styles;
45
46
    private $pages;
47
48
    private $path;
49
50
    /**
51
     * init
52
     */
53
    public function init($path, $pages, $scripts, $styles, $type = 'admin')
54
    {
55
        if ($type == 'admin') {
56
            $action = 'admin_enqueue_scripts';
57
        } else {
58
            $action = 'wp_enqueue_scripts';
59
        }
60
        $this->path = $path;
61
        $this->pages = $pages;
62
        $this->scripts = $scripts;
63
        $this->styles = $styles;
64
        add_action($action, array(
65
            $this,
66
            'hospitalPluginStyles'
67
        ));
68
        add_action($action, array(
69
            $this,
70
            'hospitalPluginScripts'
71
        ));
72
        add_action($action, array(
73
            $this,
74
            'removeCustomScripts'
75
        ));
76
    }
77
78
    /**
79
     * hospitalRegisterStyle
80
     * @param $file
81
     */
82
    public function hospitalRegisterStyle($file)
83
    {
84
        wp_register_style('hospital_admin_style' . $file, $this->path . '/css/' . $file, array(), '1', 'all');
85
        wp_enqueue_style('hospital_admin_style' . $file);
86
    }
87
88
    /**
89
     * hospitalRegisterScript
90
     * @param unknown $file
91
     * @param unknown $required
92
     */
93
    public function hospitalRegisterScript($file, $required = null, $hook = null)
0 ignored issues
show
The parameter $hook is not used and could be removed.

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

Loading history...
94
    {
95
        wp_enqueue_script('hospital_admin_script' . $file, $this->path . '/js/' . $file, $required);
96
    }
97
98
    /**
99
     * hospitalLocalizeScript
100
     * @param unknown $file
101
     * @param unknown $data
102
     */
103
    public function hospitalLocalizeScript($file, $data)
104
    {
105
        $json_dates = json_encode($data);
106
        $params = array(
107
            'my_arr' => $json_dates
108
        );
109
        wp_localize_script('hospital_admin_script' . $file, 'php_params', $params);
110
    }
111
112
    /**
113
     * hospitalPluginStyles
114
     */
115
    public function hospitalPluginStyles($hook)
116
    {
117
        if (in_array($hook, $this->pages)) {
118
            foreach ($this->styles as $style) {
119
                self::hospitalRegisterStyle($style);
120
            }
121
        }
122
    }
123
124
    /**
125
     * hospitalPluginScripts
126
     * @param string $hook hook to the page
127
     */
128
    public function hospitalPluginScripts($hook)
129
    {
130
        $jQ = array(
131
            'jquery'
132
        );
133
        if (in_array($hook, $this->pages)) {
134
            foreach ($this->scripts as $script) {
135
                self::hospitalRegisterScript($script, $jQ, $hook);
0 ignored issues
show
$jQ is of type array<integer,string,{"0":"string"}>, but the function expects a object<Hospitalplugin\WP\unknown>|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
136
            }
137
        }
138
    }
139
140
    /**
141
     */
142
    public function removeCustomScripts()
143
    {
144
        wp_dequeue_style('google-webfonts');
145
        wp_dequeue_script('wplms-events-gmaps-js');
146
    }
147
}
148
149