1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | |||
3 | namespace PodloveSubscribeButton; |
||
4 | |||
5 | function for_every_podcast_blog($callback) { |
||
0 ignored issues
–
show
|
|||
6 | global $wpdb; |
||
7 | |||
8 | $plugin = basename(\PodloveSubscribeButton\PLUGIN_DIR) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME; |
||
0 ignored issues
–
show
|
|||
9 | $blogids = $wpdb->get_col("SELECT blog_id FROM " . $wpdb->blogs); |
||
0 ignored issues
–
show
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 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 ( 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: 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. ![]() |
|||
10 | |||
11 | if (!is_array($blogids)) |
||
0 ignored issues
–
show
|
|||
12 | return; |
||
13 | |||
14 | foreach ($blogids as $blog_id) { |
||
0 ignored issues
–
show
|
|||
15 | switch_to_blog($blog_id); |
||
0 ignored issues
–
show
|
|||
16 | if (is_plugin_active($plugin)) { |
||
0 ignored issues
–
show
|
|||
17 | $callback(); |
||
18 | } |
||
19 | restore_current_blog(); |
||
20 | } |
||
21 | } |
||
0 ignored issues
–
show
|