Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| AI_SEO_Enhancer | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
| is_available | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * The AI SEO Enhancer's availability gate. This package owns the |
| 4 | * `ai_seo_enhancer_enabled` option, so the shared predicate lives here. |
| 5 | * |
| 6 | * @package automattic/jetpack-seo-package |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\Jetpack\SEO; |
| 10 | |
| 11 | use Automattic\Jetpack\Current_Plan; |
| 12 | use Automattic\Jetpack\Modules; |
| 13 | |
| 14 | /** |
| 15 | * Whether the AI SEO Enhancer is offered on this site. |
| 16 | */ |
| 17 | class AI_SEO_Enhancer { |
| 18 | |
| 19 | /** |
| 20 | * Whether the site can offer the enhancer, independent of the admin's |
| 21 | * toggle. Callers own the outer AI master and host gates. The AI sidebar's |
| 22 | * SEO suggestions intentionally use a different plan slug — do not unify. |
| 23 | * |
| 24 | * @since $$next-version$$ |
| 25 | * |
| 26 | * @return bool |
| 27 | */ |
| 28 | public static function is_available() { |
| 29 | /** This filter is documented in projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php */ |
| 30 | return (bool) apply_filters( 'ai_seo_enhancer_enabled', true ) |
| 31 | /** This filter is documented in projects/plugins/jetpack/modules/seo-tools/class-jetpack-seo-utils.php */ |
| 32 | && ! apply_filters( 'jetpack_disable_seo_tools', false ) |
| 33 | && ( new Modules() )->is_active( 'seo-tools' ) |
| 34 | && Current_Plan::supports( 'ai-seo-enhancer' ); |
| 35 | } |
| 36 | } |