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.
Completed
Push — hotfix/unyson-support ( a83d09 )
by Brad
02:40
created

view-system-info.php ➔ foogallery_gdversion()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 4
eloc 16
nc 4
nop 0
dl 0
loc 26
rs 8.5806
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
	$debug_info = array(
63
		__( 'FooGallery version', 'foogallery' )      => $info['version'],
64
		__( 'WordPress version', 'foogallery' )   => $wp_version,
65
		__( 'Activated Theme', 'foogallery' )     => $current_theme['Name'],
66
		__( 'WordPress URL', 'foogallery' )       => get_site_url(),
67
		__( 'PHP version', 'foogallery' )         => phpversion(),
68
		__( 'PHP GD Loaded', 'foogallery' )       => extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? foogallery_gdversion() : __( 'Not found!', 'foogallery' ),
69
		__( 'Extensions Endpoint', 'foogallery' ) => $api->get_extensions_endpoint(),
70
		__( 'Extensions Errors', 'foogallery' )   => $api->has_extension_loading_errors() == true ? $api->get_extension_loading_errors_response() : __( 'Nope, all good', 'foogallery' ),
71
		__( 'Extensions', 'foogallery' )          => $extension_slugs,
72
		__( 'Extensions Active', 'foogallery' )   => array_keys( $api->get_active_extensions() ),
73
		__( 'Gallery Templates', 'foogallery' )   => $template_slugs,
74
		__( 'Lightboxes', 'foogallery' )          => apply_filters( 'foogallery_gallery_template_field_lightboxes', array() ),
75
		__( 'Settings', 'foogallery' )            => $settings,
76
		__( 'Active Plugins', 'foogallery' )      => $plugins,
77
	);
78
79
	$debug_info = apply_filters( 'foogallery_admin_debug_info', $debug_info );
80
	?>
81
	<style>
82
		.foogallery-debug {
83
			width: 100%;
84
			font-family: "courier new";
85
			height: 500px;
86
		}
87
	</style>
88
	<div class="wrap about-wrap">
89
		<h1><?php echo $title; ?></h1>
90
91
		<div class="about-text">
92
			<?php echo $support_text; ?>
93
		</div>
94
    <textarea class="foogallery-debug">
95
<?php foreach ( $debug_info as $key => $value ) {
96
	echo $key . ' : ';
97
	print_r( $value );
98
	echo "\n";
99
} ?>
100
    </textarea>
101
	</div>
102
<?php }