| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Integrations\Third_Party; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Conditionals\Front_End_Conditional; |
| 6 |
use Yoast\WP\SEO\Helpers\Options_Helper; |
| 7 |
use Yoast\WP\SEO\Integrations\Integration_Interface; |
| 8 |
|
| 9 |
/** |
| 10 |
* BbPress integration. |
| 11 |
*/ |
| 12 |
class BbPress implements Integration_Interface { |
| 13 |
|
| 14 |
/** |
| 15 |
* The options helper. |
| 16 |
* |
| 17 |
* @var Options_Helper |
| 18 |
*/ |
| 19 |
private $options; |
| 20 |
|
| 21 |
/** |
| 22 |
* Returns the conditionals based in which this loadable should be active. |
| 23 |
* |
| 24 |
* @return array |
| 25 |
*/ |
| 26 |
public static function get_conditionals() { |
| 27 |
return [ Front_End_Conditional::class ]; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* BbPress constructor. |
| 32 |
* |
| 33 |
* @codeCoverageIgnore It only sets dependencies. |
| 34 |
* |
| 35 |
* @param Options_Helper $options The options helper. |
| 36 |
*/ |
| 37 |
public function __construct( Options_Helper $options ) { |
| 38 |
$this->options = $options; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Initializes the integration. |
| 43 |
* |
| 44 |
* This is the place to register hooks and filters. |
| 45 |
* |
| 46 |
* @return void |
| 47 |
*/ |
| 48 |
public function register_hooks() { |
| 49 |
if ( $this->options->get( 'breadcrumbs-enable' ) !== true ) { |
| 50 |
return; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* If breadcrumbs are active (which they supposedly are if the users has enabled this settings, |
| 55 |
* there's no reason to have bbPress breadcrumbs as well. |
| 56 |
* |
| 57 |
* {@internal The class itself is only loaded when the template tag is encountered |
| 58 |
* via the template tag function in the wpseo-functions.php file.}} |
| 59 |
*/ |
| 60 |
\add_filter( 'bbp_get_breadcrumb', '__return_false' ); |
| 61 |
} |
| 62 |
} |
| 63 |
|