Issues (3)

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.

sponsors.php (1 issue)

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
// Avoid direct calls to this file.
4
if ( ! defined( 'ABSPATH' ) ) {
5
    header( 'Status: 403 Forbidden' );
6
    header( 'HTTP/1.1 403 Forbidden' );
7
    exit();
8
}
9
10
/**
11
 * Plugin sponsors.
12
 *
13
 * @version 3.6.8
14
 */
15
class PluginSponsor {
16
    /* Recommend plugins.
17
     *
18
     * @since 3.6.8
19
     */
20
    protected static $sponsors = array(
21
        'mailoptin' => 'mailoptin/mailoptin.php',
22
    );
23
24
    /**
25
     * PluginSponsor constructor.
26
     *
27
     * @since 3.6.8
28
     */
29
    public function __construct() {
30
        // admin notices.
31
        add_action( 'admin_notices', array( $this, 'admin_notice' ) );
32
        add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
33
34
        add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
35
    }
36
37
    /**
38
     * Dismiss admin notice.
39
     *
40
     * @since 3.6.8
41
     * @access public
42
     *
43
     * @return void
44
     */
45
    public function dismiss_admin_notice() {
46
        if ( ! isset( $_GET['mo-adaction'] ) || $_GET['mo-adaction'] != 'mo_dismiss_adnotice' ) {
47
            return;
48
        }
49
50
        $url = admin_url();
51
        update_option( 'mo_dismiss_adnotice', 'true' );
52
53
        wp_redirect( $url );
54
        exit;
55
    }
56
57
    /**
58
     * Add admin notices.
59
     *
60
     * @since 3.6.8
61
     * @access public
62
     *
63
     * @return void
64
     */
65
    public function admin_notice() {
66
        if ( get_option( 'mo_dismiss_adnotice', 'false' ) == 'true' ) {
67
            return;
68
        }
69
70
        if ( $this->is_plugin_installed( 'mailoptin' ) && $this->is_plugin_active( 'mailoptin' ) ) {
71
            return;
72
        }
73
74
        $dismiss_url = esc_url_raw(
75
            add_query_arg(
76
                array(
77
                    'mo-adaction' => 'mo_dismiss_adnotice',
78
                ),
79
                admin_url()
80
            )
81
        );
82
83
        $this->notice_css();
0 ignored issues
show
The call to the method PluginSponsor::notice_css() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
84
85
        $install_url = wp_nonce_url(
86
            admin_url( 'update.php?action=install-plugin&plugin=mailoptin' ),
87
            'install-plugin_mailoptin'
88
        );
89
90
        $activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php' ),
91
            'activate-plugin_mailoptin/mailoptin.php' );
92
        ?>
93
        <div class="mo-admin-notice notice notice-success">
94
            <div class="mo-notice-first-half">
95
                <p>
96
                    <?php
97
                    printf(
98
                        __( 'Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.' ),
99
                        '<span class="mo-stylize"><strong>', '</strong></span>' );
100
                    ?>
101
                </p>
102
                <p style="text-decoration: underline;font-size: 12px;">Recommended by Dynamic Featured Image plugin</p>
103
            </div>
104
            <div class="mo-notice-other-half">
105
                <?php if ( ! $this->is_plugin_installed( 'mailoptin' ) ) : ?>
106
                    <a class="button button-primary button-hero" id="mo-install-mailoptin-plugin"
107
                       href="<?php echo $install_url; ?>">
108
                        <?php _e( 'Install MailOptin Now for Free!' ); ?>
109
                    </a>
110
                <?php endif; ?>
111
                <?php if ( $this->is_plugin_installed( 'mailoptin' ) && ! $this->is_plugin_active( 'mailoptin' ) ) : ?>
112
                    <a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin"
113
                       href="<?php echo $activate_url; ?>">
114
                        <?php _e( 'Activate MailOptin Now!' ); ?>
115
                    </a>
116
                <?php endif; ?>
117
                <div class="mo-notice-learn-more">
118
                    <a target="_blank" href="https://mailoptin.io">Learn more</a>
119
                </div>
120
            </div>
121
            <a href="<?php echo $dismiss_url; ?>">
122
                <button type="button" class="notice-dismiss">
123
                    <span class="screen-reader-text"><?php _e( 'Dismiss this notice' ); ?>.</span>
124
                </button>
125
            </a>
126
        </div>
127
        <?php
128
    }
129
130
    /**
131
     * Check if plugin is installed.
132
     *
133
     * @param $key
134
     *
135
     * @return bool
136
     */
137
    protected function is_plugin_installed( $key ) {
138
        $installed_plugins = get_plugins();
139
140
        return isset( $installed_plugins[ self::$sponsors[ $key ] ] );
141
    }
142
143
    /**
144
     * Check if plugin is active.
145
     *
146
     * @param $key
147
     *
148
     * @return bool
149
     */
150
    protected function is_plugin_active( $key )  {
151
        return is_plugin_active( self::$sponsors[ $key ] );
152
    }
153
154
    /**
155
     * Styles for notice.
156
     *
157
     * @return void
158
     */
159
    protected function notice_css() {
160
        ?>
161
        <style type="text/css">
162
            .mo-admin-notice {
163
                background: #fff;
164
                color: #000;
165
                border-left-color: #46b450;
166
                position: relative;
167
            }
168
169
            .mo-admin-notice .notice-dismiss:before {
170
                color: #72777c;
171
            }
172
173
            .mo-admin-notice .mo-stylize {
174
                line-height: 2;
175
            }
176
177
            .mo-admin-notice .button-primary {
178
                background: #006799;
179
                text-shadow: none;
180
                border: 0;
181
                box-shadow: none;
182
            }
183
184
            .mo-notice-first-half {
185
                width: 66%;
186
                display: inline-block;
187
                margin: 10px 0;
188
            }
189
190
            .mo-notice-other-half {
191
                width: 33%;
192
                display: inline-block;
193
                padding: 20px 0;
194
                position: absolute;
195
                text-align: center;
196
            }
197
198
            .mo-notice-first-half p {
199
                font-size: 14px;
200
            }
201
202
            .mo-notice-learn-more a {
203
                margin: 10px;
204
            }
205
206
            .mo-notice-learn-more {
207
                margin-top: 10px;
208
            }
209
        </style>
210
        <?php
211
    }
212
}
213