Issues (1386)

helper.php (1 issue)

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