| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | namespace PodloveSubscribeButton; |
||
| 4 | |||
| 5 | function for_every_podcast_blog( $callback ) { |
||
| 6 | |||
| 7 | global $wpdb; |
||
| 8 | |||
| 9 | $plugin = basename( \PodloveSubscribeButton\PLUGIN_DIR ) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME; |
||
| 10 | $blogids = $wpdb->get_col( "SELECT blog_id FROM " . $wpdb->blogs ); |
||
| 11 | |||
| 12 | if ( ! is_array( $blogids ) ) |
||
| 13 | return; |
||
| 14 | |||
| 15 | foreach ( $blogids as $blog_id ) { |
||
| 16 | switch_to_blog( $blog_id ); |
||
| 17 | if ( is_plugin_active( $plugin ) ) { |
||
| 18 | $callback(); |
||
| 19 | } |
||
| 20 | restore_current_blog(); |
||
| 21 | } |
||
| 22 | |||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Check if `Podlove Publisher` is installed + activated |
||
| 27 | * |
||
| 28 | * @return bool |
||
| 29 | */ |
||
| 30 | function is_podlove_publisher_active() { |
||
| 31 | if ( is_plugin_active( "podlove-podcasting-plugin-for-wordpress/podlove.php" ) ) { |
||
| 32 | return true; |
||
| 33 | } |
||
| 34 | |||
| 35 | return false; |
||
| 36 | |||
| 37 | } |
||
| 38 |