| 1 |
<?php |
| 2 |
/** |
| 3 |
* Friends 3rd Parties |
| 4 |
* |
| 5 |
* This contains the functions for working with third party plugins. |
| 6 |
* |
| 7 |
* @package Friends |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Friends; |
| 11 |
|
| 12 |
/** |
| 13 |
* This is the class for the Friends Plugin 3rd Party handling. |
| 14 |
* |
| 15 |
* @since 0.6 |
| 16 |
* |
| 17 |
* @package Friends |
| 18 |
* @author Alex Kirk |
| 19 |
*/ |
| 20 |
class Third_Parties { |
| 21 |
/** |
| 22 |
* Contains a reference to the Friends class. |
| 23 |
* |
| 24 |
* @var Friends |
| 25 |
*/ |
| 26 |
private $friends = null; |
| 27 |
|
| 28 |
/** |
| 29 |
* Constructor |
| 30 |
* |
| 31 |
* @param Friends $friends A reference to the Friends object. |
| 32 |
*/ |
| 33 |
public function __construct( Friends $friends ) { |
| 34 |
$this->friends = $friends; |
| 35 |
$this->register_hooks(); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Register the WordPress hooks |
| 40 |
*/ |
| 41 |
private function register_hooks() { |
| 42 |
add_filter( 'option_fx-private-site', array( $this, 'fx_private_site' ) ); |
| 43 |
add_filter( 'wp_sweep_excluded_taxonomies', array( $this, 'wp_sweep_excluded_taxonomies' ) ); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Allow accessing the private feed when the FX Private Site plugin is installed. |
| 48 |
* |
| 49 |
* @param mixed $value Value of the option. |
| 50 |
*/ |
| 51 |
function fx_private_site( $value ) { |
| 52 |
if ( $this->friends->access_control->feed_is_authenticated() ) { |
| 53 |
$value['enable'] = false; |
| 54 |
} |
| 55 |
return $value; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* WP Sweep |
| 60 |
* Prevent WP Sweep from sweeping our taxonomies. |
| 61 |
* |
| 62 |
* @since 2.0 |
| 63 |
* |
| 64 |
* @param array $excluded_taxonomies list of taxonomies excluded from sweeping. |
| 65 |
* @return array |
| 66 |
*/ |
| 67 |
public function wp_sweep_excluded_taxonomies( $excluded_taxonomies ) { |
| 68 |
return array_merge( $excluded_taxonomies, array( User_Feed::TAXONOMY, Subscription::TAXONOMY ) ); |
| 69 |
} |
| 70 |
} |
| 71 |
|