| 1 | <?php |
||
| 2 | /** |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
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 ) { |
||
| 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 ); |
||
| 17 | |||
| 18 | if ( ! is_array( $blogids ) ) |
||
| 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" ) ) { |
||
| 38 | return true; |
||
| 39 | } |
||
| 40 | |||
| 41 | return false; |
||
| 42 | |||
| 43 | } |
||
| 44 |