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.

view-system-info.php ➔ foogallery_gdversion()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 0
dl 0
loc 26
rs 9.504
c 0
b 0
f 0
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 8 and the first side effect is on line 2.

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
global $wp_version;
3
/**
4
 * Get which version of GD is installed, if any.
5
 *
6
 * Returns the version (1 or 2) of the GD extension.
7
 */
8
function foogallery_gdversion() {
9
	if ( ! extension_loaded( 'gd' ) ) {
10
		return '0';
11
	}
12
13
	// Use the gd_info() function if possible.
14
	if ( function_exists( 'gd_info' ) ) {
15
		$ver_info = gd_info();
16
		preg_match( '/\d/', $ver_info['GD Version'], $match );
17
18
		return $match[0];
19
	}
20
	// If phpinfo() is disabled use a specified / fail-safe choice...
21
	if ( preg_match( '/phpinfo/', ini_get( 'disable_functions' ) ) ) {
22
		return '?';
23
	}
24
	// ...otherwise use phpinfo().
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
25
	ob_start();
26
	phpinfo( 8 );
27
	$info = ob_get_contents();
28
	ob_end_clean();
29
	$info = stristr( $info, 'gd version' );
30
	preg_match( '/\d/', $info, $match );
31
32
	return $match[0];
33
}
34
35
if ( current_user_can( 'activate_plugins' ) ) {
36
	$instance     = FooGallery_Plugin::get_instance();
37
	$info         = $instance->get_plugin_info();
38
	$title        = apply_filters( 'foogallery_admin_systeminfo_title', sprintf( __( '%s System Information', 'foogallery' ), foogallery_plugin_name() ) );
39
	$support_text = apply_filters( 'foogallery_admin_systeminfo_supporttext', sprintf( __( 'Below is some information about your server configuration. You can use this info to help debug issues you may have with %s.' ), foogallery_plugin_name() ) );
40
	$api          = new FooGallery_Extensions_API();
41
	//clear any extenasion cache
42
	$api->clear_cached_extensions();
43
	$extension_slugs = $api->get_all_slugs();
44
45
	//get all gallery templates
46
	$template_slugs = array();
47
	foreach ( foogallery_gallery_templates() as $template ) {
48
		$template_slugs[] = $template['slug'];
49
	}
50
51
	//get all activated plugins
52
	$plugins = array();
53
	foreach ( get_option('active_plugins') as $plugin_slug => $plugin ) {
54
		$plugins[] = $plugin;
55
	}
56
57
	$current_theme = wp_get_theme();
58
59
	$foogallery = FooGallery_Plugin::get_instance();
60
	$settings = $foogallery->options()->get_all();
61
62
	$stream_wrappers = stream_get_wrappers();
63
64
	$test_image_url = foogallery_test_thumb_url();
65
66
	$test_image_url_scheme = parse_url( $test_image_url ,PHP_URL_SCHEME );
67
	$home_url_scheme = parse_url( home_url() ,PHP_URL_SCHEME );
68
69
	$debug_info = array(
70
		__( 'FooGallery version', 'foogallery' )  			=> $info['version'],
71
		__( 'WordPress version', 'foogallery' )   			=> $wp_version,
72
		__( 'Activated Theme', 'foogallery' )     			=> $current_theme['Name'],
73
		__( 'WordPress URL', 'foogallery' )       			=> get_site_url(),
74
		__( 'PHP version', 'foogallery' )         			=> phpversion(),
75
		__( 'PHP GD', 'foogallery' )              			=> extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? __( 'Loaded', 'foogallery' ) . ' (V' . foogallery_gdversion() . ')' : __( 'Not found!', 'foogallery' ),
76
		__( 'PHP Open SSL', 'foogallery' )        			=> extension_loaded( 'openssl' ) ? __( 'Loaded', 'foogallery' ) : __( 'Not found!', 'foogallery' ),
77
		__( 'PHP HTTP Wrapper', 'foogallery' )    			=> in_array( 'http', $stream_wrappers ) ? __( 'Found', 'foogallery' ) : __( 'Not found!', 'foogallery' ),
78
		__( 'PHP HTTPS Wrapper', 'foogallery' )   			=> in_array( 'https', $stream_wrappers ) ? __( 'Found', 'foogallery' ) : __( 'Not found!', 'foogallery' ),
79
		__( 'HTTPS Mismatch', 'foogallery' )      			=> $test_image_url_scheme === $home_url_scheme ? __( 'None', 'foogallery' ) : __( 'There is a protocol mismatch between your site URL and the actual URL!', 'foogallery' ),
80
		__( 'PHP Config[allow_url_fopen]', 'foogallery' ) 	=> ini_get( 'allow_url_fopen' ),
81
		__( 'PHP Config[allow_url_include]', 'foogallery' ) => ini_get( 'allow_url_fopen' ),
82
		__( 'Thumbnail Generation Test', 'foogallery') 		=> $test_image_url,
83
		__( 'Extensions Endpoint', 'foogallery' ) 			=> $api->get_extensions_endpoint(),
84
		__( 'Extensions Errors', 'foogallery' )   			=> $api->has_extension_loading_errors() == true ? $api->get_extension_loading_errors_response() : __( 'Nope, all good', 'foogallery' ),
85
		__( 'Extensions', 'foogallery' )          			=> $extension_slugs,
86
		__( 'Extensions Active', 'foogallery' )   			=> array_keys( $api->get_active_extensions() ),
87
		__( 'Gallery Templates', 'foogallery' )   			=> $template_slugs,
88
		__( 'Lightboxes', 'foogallery' )          			=> apply_filters( 'foogallery_gallery_template_field_lightboxes', array() ),
89
		__( 'Settings', 'foogallery' )            			=> $settings,
90
		__( 'Active Plugins', 'foogallery' )      			=> $plugins
91
	);
92
93
	$debug_info = apply_filters( 'foogallery_admin_debug_info', $debug_info );
94
	?>
95
	<style>
96
		.foogallery-debug {
97
			width: 100%;
98
			font-family: "courier new";
99
			height: 500px;
100
		}
101
	</style>
102
	<div class="wrap about-wrap">
103
		<h1><?php echo $title; ?></h1>
104
105
		<div class="about-text">
106
			<?php echo $support_text; ?>
107
		</div>
108
    <textarea class="foogallery-debug">
109
<?php foreach ( $debug_info as $key => $value ) {
110
	echo $key . ' : ';
111
	print_r( $value );
112
	echo "\n";
113
} ?>
114
    </textarea>
115
	</div>
116
<?php }