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.

Issues (1881)

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.

freemius/includes/class-fs-admin-notices.php (14 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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 18 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
    /**
3
     * @package     Freemius
4
     * @copyright   Copyright (c) 2015, Freemius, Inc.
5
     * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
     * @since       2.0.0
7
     */
8
9
    if ( ! defined( 'ABSPATH' ) ) {
10
        exit;
11
    }
12
13
    /**
14
     * WP Admin notices manager both for site level and network level.
15
     *
16
     * Class FS_Admin_Notices
17
     */
18
    class FS_Admin_Notices {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
19
        /**
20
         * @since 1.2.2
21
         *
22
         * @var string
23
         */
24
        protected $_module_unique_affix;
25
        /**
26
         * @var string
27
         */
28
        protected $_id;
29
        /**
30
         * @var string
31
         */
32
        protected $_title;
33
        /**
34
         * @var FS_Admin_Notice_Manager
35
         */
36
        protected $_notices;
37
        /**
38
         * @var FS_Admin_Notice_Manager
39
         */
40
        protected $_network_notices;
41
        /**
42
         * @var int The ID of the blog that is associated with the current site level options.
43
         */
44
        private $_blog_id = 0;
45
        /**
46
         * @var bool
47
         */
48
        private $_is_multisite;
49
        /**
50
         * @var FS_Admin_Notices[]
51
         */
52
        private static $_instances = array();
53
54
        /**
55
         * @param string $id
56
         * @param string $title
57
         * @param string $module_unique_affix
58
         * @param bool   $is_network_and_blog_admins Whether or not the message should be shown both on network and
59
         *                                           blog admin pages.
60
         *
61
         * @return FS_Admin_Notices
62
         */
63
        static function instance( $id, $title = '', $module_unique_affix = '', $is_network_and_blog_admins = false ) {
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...
64
            if ( ! isset( self::$_instances[ $id ] ) ) {
65
                self::$_instances[ $id ] = new FS_Admin_Notices( $id, $title, $module_unique_affix, $is_network_and_blog_admins );
66
            }
67
68
            return self::$_instances[ $id ];
69
        }
70
71
        /**
72
         * @param string $id
73
         * @param string $title
74
         * @param string $module_unique_affix
75
         * @param bool   $is_network_and_blog_admins Whether or not the message should be shown both on network and
76
         *                                           blog admin pages.
77
         */
78
        protected function __construct( $id, $title = '', $module_unique_affix = '', $is_network_and_blog_admins = false ) {
79
            $this->_id                  = $id;
80
            $this->_title               = $title;
81
            $this->_module_unique_affix = $module_unique_affix;
82
            $this->_is_multisite        = is_multisite();
83
84
            if ( $this->_is_multisite ) {
85
                $this->_blog_id = get_current_blog_id();
86
87
                $this->_network_notices = FS_Admin_Notice_Manager::instance(
88
                    $id,
89
                    $title,
90
                    $module_unique_affix,
91
                    $is_network_and_blog_admins,
92
                    true
93
                );
94
            }
95
96
            $this->_notices = FS_Admin_Notice_Manager::instance(
97
                $id,
98
                $title,
99
                $module_unique_affix,
100
                false,
101
                $this->_blog_id
102
            );
103
        }
104
105
        /**
106
         * Add admin message to admin messages queue, and hook to admin_notices / all_admin_notices if not yet hooked.
107
         *
108
         * @author Vova Feldman (@svovaf)
109
         * @since  1.0.4
110
         *
111
         * @param string   $message
112
         * @param string   $title
113
         * @param string   $type
114
         * @param bool     $is_sticky
115
         * @param string   $id Message ID
116
         * @param bool     $store_if_sticky
117
         * @param int|null $network_level_or_blog_id
118
         *
119
         * @uses   add_action()
120
         */
121
        function add(
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...
122
            $message,
123
            $title = '',
124
            $type = 'success',
125
            $is_sticky = false,
126
            $id = '',
127
            $store_if_sticky = true,
128
            $network_level_or_blog_id = null
129
        ) {
130
            if ( $this->should_use_network_notices( $id, $network_level_or_blog_id ) ) {
131
                $notices = $this->_network_notices;
132
            } else {
133
                $notices = $this->get_site_notices( $network_level_or_blog_id );
134
            }
135
136
            $notices->add(
137
                $message,
138
                $title,
139
                $type,
140
                $is_sticky,
141
                $id,
142
                $store_if_sticky
143
            );
144
        }
145
146
        /**
147
         * @author Vova Feldman (@svovaf)
148
         * @since  1.0.7
149
         *
150
         * @param string|string[] $ids
151
         * @param int|null        $network_level_or_blog_id
152
         */
153
        function remove_sticky( $ids, $network_level_or_blog_id = null ) {
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...
154
            if ( ! is_array( $ids ) ) {
155
                $ids = array( $ids );
156
            }
157
158
            if ( $this->should_use_network_notices( $ids[0], $network_level_or_blog_id ) ) {
159
                $notices = $this->_network_notices;
160
            } else {
161
                $notices = $this->get_site_notices( $network_level_or_blog_id );
162
            }
163
164
            return $notices->remove_sticky( $ids );
165
        }
166
167
        /**
168
         * Check if sticky message exists by id.
169
         *
170
         * @author Vova Feldman (@svovaf)
171
         * @since  1.0.9
172
         *
173
         * @param string   $id
174
         * @param int|null $network_level_or_blog_id
175
         *
176
         * @return bool
177
         */
178
        function has_sticky( $id, $network_level_or_blog_id = null ) {
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...
179
            if ( $this->should_use_network_notices( $id, $network_level_or_blog_id ) ) {
180
                $notices = $this->_network_notices;
181
            } else {
182
                $notices = $this->get_site_notices( $network_level_or_blog_id );
183
            }
184
185
            return $notices->has_sticky( $id );
186
        }
187
188
        /**
189
         * Adds sticky admin notification.
190
         *
191
         * @author Vova Feldman (@svovaf)
192
         * @since  1.0.7
193
         *
194
         * @param string      $message
195
         * @param string      $id Message ID
196
         * @param string      $title
197
         * @param string      $type
198
         * @param int|null    $network_level_or_blog_id
199
         * @param number|null $wp_user_id
200
         * @param string|null $plugin_title
201
         * @param bool        $is_network_and_blog_admins Whether or not the message should be shown both on network and
202
         *                                                blog admin pages.
203
         */
204
        function add_sticky(
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...
205
            $message,
206
            $id,
207
            $title = '',
208
            $type = 'success',
209
            $network_level_or_blog_id = null,
210
            $wp_user_id = null,
211
            $plugin_title = null,
212
            $is_network_and_blog_admins = false
213
        ) {
214
            if ( $this->should_use_network_notices( $id, $network_level_or_blog_id ) ) {
215
                $notices = $this->_network_notices;
216
            } else {
217
                $notices = $this->get_site_notices( $network_level_or_blog_id );
218
            }
219
220
            $notices->add_sticky( $message, $id, $title, $type, $wp_user_id, $plugin_title, $is_network_and_blog_admins );
221
        }
222
223
        /**
224
         * Clear all sticky messages.
225
         *
226
         * @author Vova Feldman (@svovaf)
227
         * @since  2.0.0
228
         *
229
         * @param int|null $network_level_or_blog_id
230
         */
231
        function clear_all_sticky( $network_level_or_blog_id = null ) {
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...
232
            if ( ! $this->_is_multisite ||
233
                 false === $network_level_or_blog_id ||
234
                 0 == $network_level_or_blog_id ||
0 ignored issues
show
It seems like you are loosely comparing $network_level_or_blog_id of type integer|null to 0; this is ambiguous as not only 0 == 0 is true, but null == 0 is true, too. Consider using a strict comparison ===.
Loading history...
235
                 is_null( $network_level_or_blog_id )
236
            ) {
237
                $notices = $this->get_site_notices( $network_level_or_blog_id );
238
                $notices->clear_all_sticky();
239
            }
240
241
            if ( $this->_is_multisite &&
242
                 ( true === $network_level_or_blog_id || is_null( $network_level_or_blog_id ) )
243
            ) {
244
                $this->_network_notices->clear_all_sticky();
245
            }
246
        }
247
248
        /**
249
         * Add admin message to all admin messages queue, and hook to all_admin_notices if not yet hooked.
250
         *
251
         * @author Vova Feldman (@svovaf)
252
         * @since  1.0.4
253
         *
254
         * @param string $message
255
         * @param string $title
256
         * @param string $type
257
         * @param bool   $is_sticky
258
         * @param string $id Message ID
259
         */
260
        function add_all( $message, $title = '', $type = 'success', $is_sticky = false, $id = '' ) {
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...
261
            $this->add( $message, $title, $type, $is_sticky, true, $id );
0 ignored issues
show
true is of type boolean, but the function expects a string.

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...
$id is of type string, but the function expects a boolean.

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...
262
        }
263
264
        #--------------------------------------------------------------------------------
265
        #region Helper Methods
266
        #--------------------------------------------------------------------------------
267
268
        /**
269
         * @author Vova Feldman (@svovaf)
270
         * @since  2.0.0
271
         *
272
         * @param int $blog_id
273
         *
274
         * @return FS_Admin_Notice_Manager
275
         */
276
        private function get_site_notices( $blog_id = 0 ) {
277
            if ( 0 == $blog_id || $blog_id == $this->_blog_id ) {
278
                return $this->_notices;
279
            }
280
281
            return FS_Admin_Notice_Manager::instance(
282
                $this->_id,
283
                $this->_title,
284
                $this->_module_unique_affix,
285
                false,
286
                $blog_id
0 ignored issues
show
$blog_id is of type integer, but the function expects a boolean.

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...
287
            );
288
        }
289
290
        /**
291
         * Check if the network notices should be used.
292
         *
293
         * @author Vova Feldman (@svovaf)
294
         * @since  2.0.0
295
         *
296
         * @param string        $id
297
         * @param null|bool|int $network_level_or_blog_id When an integer, use the given blog storage. When `true` use the multisite notices (if there's a network). When `false`, use the current context blog notices. When `null`, the decision which notices manager to use (MS vs. Current S) will be handled internally and determined based on the $id and the context admin (blog admin vs. network level admin).
298
         *
299
         * @return bool
300
         */
301
        private function should_use_network_notices( $id = '', $network_level_or_blog_id = null ) {
0 ignored issues
show
The parameter $id 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...
302
            if ( ! $this->_is_multisite ) {
303
                // Not a multisite environment.
304
                return false;
305
            }
306
307
            if ( is_numeric( $network_level_or_blog_id ) ) {
308
                // Explicitly asked to use a specified blog storage.
309
                return false;
310
            }
311
312
            if ( is_bool( $network_level_or_blog_id ) ) {
313
                // Explicitly specified whether should use the network or blog level storage.
314
                return $network_level_or_blog_id;
315
            }
316
317
            return fs_is_network_admin();
318
        }
319
320
        #endregion
321
    }