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.
Passed
Pull Request — master (#42)
by Christian
02:49
created

helper.php (7 issues)

1
<?php
2
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
3
 * @author    Podlove <[email protected]>
4
 * @copyright Copyright (c) 2014-2018, Podlove
5
 * @license   https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT
6
 * @package   Podlove\PodloveSubscribeButton
7
 */
8
9
namespace PodloveSubscribeButton;
10
11
function for_every_podcast_blog( $callback ) {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function for_every_podcast_blog()
Loading history...
12
13
	global $wpdb;
14
15
	$plugin  = basename( \PodloveSubscribeButton\PLUGIN_DIR ) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME;
16
	$blogids = $wpdb->get_col( "SELECT blog_id FROM " . $wpdb->blogs );
0 ignored issues
show
Usage of a direct database call is discouraged.
Loading history...
Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().
Loading history...
Coding Style Comprehensibility introduced by
The string literal SELECT blog_id FROM does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
17
18
	if ( ! is_array( $blogids ) )
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
19
		return;
20
21
	foreach ( $blogids as $blog_id ) {
22
		switch_to_blog( $blog_id );
23
		if ( is_plugin_active( $plugin ) ) {
24
			$callback();
25
		}
26
		restore_current_blog();
27
	}
28
29
}
30
31
/**
32
 * Check if `Podlove Publisher` is installed + activated
33
 *
34
 * @return bool
35
 */
36
function is_podlove_publisher_active() {
37
	if ( is_plugin_active( "podlove-podcasting-plugin-for-wordpress/podlove.php" ) ) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal podlove-podcasting-plugi...r-wordpress/podlove.php does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
38
		return true;
39
	}
40
41
	return false;
42
43
}
44