Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Seo_Tools
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 get_conflicting_plugin
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
3
 is_disabled
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * SEO output availability and plugin ownership.
4 *
5 * @package automattic/jetpack-seo
6 */
7
8namespace Automattic\Jetpack\SEO;
9
10/**
11 * Separates plugin conflicts from other reasons to disable SEO output.
12 */
13class Seo_Tools {
14    /**
15     * Return the conflicting plugin's display name, or null when there is no conflict.
16     *
17     * @since $$next-version$$
18     * @return string|null
19     */
20    public static function get_conflicting_plugin() {
21        /**
22         * Filters the name of the plugin managing SEO output instead of Jetpack.
23         *
24         * @since $$next-version$$
25         * @param string|null $plugin The plugin's display name, or null for no conflict.
26         */
27        $plugin = apply_filters( 'jetpack_seo_conflicting_plugin', null );
28        return is_string( $plugin ) && '' !== trim( $plugin ) ? trim( $plugin ) : null;
29    }
30
31    /**
32     * Whether SEO output is disabled, defaulting to the plugin conflict state.
33     *
34     * @since $$next-version$$
35     * @return bool
36     */
37    public static function is_disabled() {
38        /** This filter is documented in projects/plugins/jetpack/modules/seo-tools/class-jetpack-seo-utils.php */
39        return (bool) apply_filters( 'jetpack_disable_seo_tools', null !== self::get_conflicting_plugin() );
40    }
41}