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.

includes/class-foogallery-widget.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
 * Widget to insert a FooGallery
4
 */
5
6
if ( ! class_exists( 'FooGallery_Widget_Init' ) ) {
7
    class FooGallery_Widget_Init
8
    {
9
        public function __construct()
10
        {
11
            add_action('widgets_init', array($this, 'register_widget'));
12
        }
13
14
        public function register_widget()
15
        {
16
            register_widget('FooGallery_Widget');
17
        }
18
    }
19
}
20
21
if ( ! class_exists( 'FooGallery_Widget' ) ) {
22
    class FooGallery_Widget extends WP_Widget
23
    {
24
25
        /**
26
         * Sets up the widgets name etc
27
         */
28
        public function __construct()
29
        {
30
            $widget_ops = array(
31
                'classname' => 'foogallery_widget',
32
                'description' => __('Insert a FooGallery', 'foogallery'),
33
            );
34
35
            parent::__construct('foogallery_widget', 'FooGallery', $widget_ops);
36
        }
37
38
39
        /**
40
         * Outputs the content of the widget
41
         *
42
         * @param array $args
43
         * @param array $instance
44
         */
45
        public function widget($args, $instance)
46
        {
47
            // outputs the content of the widget
48
            echo $args['before_widget'];
49
            if (!empty($instance['title'])) {
50
                echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
51
            }
52
            //output the gallery here
53
            $foogallery_id = isset( $instance['foogallery_id'] ) ? intval( $instance['foogallery_id'] ) : 0;
54
            if ( $foogallery_id > 0 ) {
55
                foogallery_render_gallery( $foogallery_id );
56
            }
57
58
            echo $args['after_widget'];
59
        }
60
61
62
        /**
63
         * Outputs the options form on admin
64
         *
65
         * @param array $instance The widget options
66
         * @return string|void
67
         */
68
        public function form($instance)
69
        {
70
            // outputs the options form on admin
71
            $title = !empty($instance['title']) ? $instance['title'] : __('New title', 'foogallery');
72
            $foogallery_id = !empty($instance['foogallery_id'])  ? intval($instance['foogallery_id']) : 0;
73
            $galleries = foogallery_get_all_galleries();
74
            ?>
75
            <p>
76
                <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
77
                <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
78
                       name="<?php echo $this->get_field_name('title'); ?>" type="text"
79
                       value="<?php echo esc_attr($title); ?>">
80
            </p>
81
            <p>
82
                <label for="<?php echo $this->get_field_id('foogallery_id'); ?>"><?php _e('Select Gallery:', 'foogallery'); ?></label>
83
                <select class="widefat" id="<?php echo $this->get_field_id('foogallery_id'); ?>"
84
                       name="<?php echo $this->get_field_name('foogallery_id'); ?>"
85
                       value="<?php echo esc_attr($title); ?>">
86
                    <?php foreach ( $galleries as $gallery ) {?>
87
                        <option <?php echo $gallery->ID == $foogallery_id ? 'selected="selected"' : ''; ?> value="<?php echo $gallery->ID; ?>"><?php echo $gallery->name . ' [' . $gallery->ID . ']'; ?></option>
88
                    <?php } ?>
89
                </select>
90
            </p>
91
            <?php
92
        }
93
94
95
        /**
96
         * Processing widget options on save
97
         *
98
         * @param array $new_instance The new options
99
         * @param array $old_instance The previous options
100
         * @return array|mixed
101
         */
102
        public function update($new_instance, $old_instance)
103
        {
104
            // processes widget options to be saved
105
            foreach ($new_instance as $key => $value) {
106
                $updated_instance[$key] = sanitize_text_field($value);
0 ignored issues
show
Coding Style Comprehensibility introduced by
$updated_instance was never initialized. Although not strictly required by PHP, it is generally a good practice to add $updated_instance = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
107
            }
108
109
            return $updated_instance;
110
        }
111
    }
112
}