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/admin/class-admin-notices.php (9 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
 * FooGallery Admin Notices class
4
 */
5
6
if ( ! class_exists( 'FooGallery_Admin_Notices' ) ) {
7
8
    class FooGallery_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...
9
10
        public function __construct() {
11
            add_action( 'admin_notices', array( $this, 'display_thumb_test_notice') );
12
			add_action( 'admin_notices', array( $this, 'display_rating_notice') );
13
            add_action( 'foogallery_thumbnail_generation_test', array( $this, 'save_test_results') );
14
15
			add_action( 'wp_ajax_foogallery_admin_rating_notice_dismiss', array( $this, 'admin_rating_notice_dismiss' ) );
16
        }
17
18
        function should_run_tests() {
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...
19
            $option = get_option( FOOGALLERY_OPTION_THUMB_TEST );
20
            $option_value = $this->generate_option_value();
21
22
            if ( !isset( $option ) ) {
23
                //we have never run tests before
24
                return true;
25
            } else {
26
                $option_key = $option['key'];
27
                if ( $option_value !== $option_key ) {
28
                    //either the PHP version or Host has changed. In either case, we should run tests again!
29
                    return true;
30
                }
31
            }
32
33
            return false;
34
        }
35
36
        function should_show_alert() {
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...
37
            $option = get_option( FOOGALLERY_OPTION_THUMB_TEST );
38
39
            if ( isset( $option ) && array_key_exists( 'results', $option ) ) {
40
                $results = $option['results'];
41
                //should show the alert if the tests were not a success
42
                return !$results['success'];
43
            }
44
45
            return false;
46
        }
47
48
        function generate_option_value() {
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...
49
            $php_version = phpversion();
50
            $host = home_url();
51
            return "php$($php_version}-{$host}";
52
        }
53
54
        function save_test_results($results) {
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...
55
            update_option( FOOGALLERY_OPTION_THUMB_TEST, array (
56
                'key' => $this->generate_option_value(),
57
                'results' => $results
58
            ));
59
        }
60
61
		/**
62
		 * Dismiss the admin rating notice forever
63
		 */
64
		function admin_rating_notice_dismiss() {
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...
65
			if ( check_admin_referer( 'foogallery_admin_rating_notice_dismiss' ) ) {
66
				update_option( 'foogallery_admin_rating_notice_dismiss', 'hide' );
67
			}
68
		}
69
70
        function should_show_rating_message() {
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...
71
			//first try to get the saved option
72
			$show_message = get_option( 'foogallery_admin_rating_notice_dismiss', 0 );
73
74
			if ( 'hide' === $show_message ) {
75
				return false; //never show - user has dismissed
76
			}
77
78
			if ( 'show' === $show_message ) {
79
				return true; //always show - user has created 5 or more galleries
80
			}
81
82
83
			//we must show the message - get out early
84
			if ( 0 === $show_message ) {
85
				$gallery_count = count( get_posts( array(
86
					'post_type'     => FOOGALLERY_CPT_GALLERY,
87
					'post_status'	=> array( 'publish', 'draft' ),
88
					'cache_results' => false,
89
					'nopaging'      => true,
90
				) ) );
91
92
				if ( $gallery_count >= 5 ) {
93
					update_option( 'foogallery_admin_rating_notice_dismiss', 'show' );
94
				}
95
			}
96
		}
97
98
		function display_rating_notice() {
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...
99
			if ( $this->should_show_rating_message() ) {
100
101
				$url = 'https://fooplugins.link/please-rate-foogallery';
102
				?>
103
				<script type="text/javascript">
104
					(function ($) {
105
						$(document).ready(function () {
106
							$('.foogallery-rating-notice.is-dismissible')
107
								.on('click', '.notice-dismiss', function (e) {
108
									e.preventDefault();
109
									$.post(ajaxurl, {
110
										action  : 'foogallery_admin_rating_notice_dismiss',
111
										url     : '<?php echo admin_url( 'admin-ajax.php' ); ?>',
112
										_wpnonce: '<?php echo wp_create_nonce( 'foogallery_admin_rating_notice_dismiss' ); ?>'
113
									});
114
								});
115
						});
116
					})(jQuery);
117
				</script>
118
				<style>
119
					.foogallery-rating-notice {
120
						border-left-color: #ff69b4;
121
					}
122
123
					.foogallery-rating-notice .dashicons-heart {
124
						color: #ff69b4;
125
					}
126
				</style>
127
				<div class="foogallery-rating-notice notice notice-success is-dismissible">
128
					<p>
129
						<strong><?php _e('Thanks for using FooGallery') ?> <span class="dashicons dashicons-heart"></span></strong><br />
130
						<?php _e('We noticed you have created 5 galleries in FooGallery. If you love FooGallery, please consider giving it a 5 star rating on WordPress.org. Your positive ratings help spread the word and help us grow.', 'foogallery'); ?><br />
131
						<br/>
132
						<a class="button button-primary button-large" target="_blank" href="<?php echo $url; ?>"><?php _e( 'Rate FooGallery on WordPress.org', 'foogallery' ); ?></a>
133
					</p>
134
				</div>
135
				<?php
136
			}
137
		}
138
139
        function display_thumb_test_notice() {
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...
140
            //check if we are on specific admin pages
141
            if ( FOOGALLERY_CPT_GALLERY === foo_current_screen_post_type() ) {
142
143
                if ($this->should_run_tests()) {
144
                    $thumbs = new FooGallery_Thumbnails();
145
                    $thumbs->run_thumbnail_generation_tests();
146
                }
147
148
                if ($this->should_show_alert()) {
149
                    ?>
150
                    <div class="notice error">
151
                        <p>
152
                            <strong><?php _e('Thumbnail Generation Alert!', 'foogallery'); ?></strong><br/>
153
                            <?php _e('There is a problem generating thumbnails for your gallery. Please check that your hosting provider has the GD Image Library extension installed and enabled.' , 'foogallery'); ?><br />
154
                            <?php _e('If thumbnails cannot be generated, then full-sized, uncropped images will be used instead. This will result in slow page load times, and thumbnails that do not look correct.', 'foogallery'); ?>
155
                            <br/>
156
                        </p>
157
                    </div>
158
                    <?php
159
                }
160
            }
161
        }
162
    }
163
164
}