PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | extensions/plugins/ai-content-lens/ai-content-lens.php +18 -4 12.9.5 → 16.3 View file →
@@ -10,8 +10,17 @@
10 10 use Automattic\Jetpack\Connection\Manager as Connection_Manager;
11 11 use Automattic\Jetpack\Status;
12 12 use Automattic\Jetpack\Status\Host;
13 13
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit( 0 );
16 +}
17 +
18 +// Required directly rather than relying on the plugin bootstrap: on
19 +// WordPress.com Simple the extension files load through wpcom's own loader
20 +// and load-jetpack.php never runs.
21 +require_once __DIR__ . '/../../../_inc/lib/class-jetpack-ai-settings.php';
22 +
14 23 // Feature name.
15 24 const FEATURE_NAME = 'ai-content-lens';
16 25
17 26 /**
@@ -21,12 +30,17 @@
21 30 *
22 31 * @return void
23 32 */
24 33 function register_plugin() {
25 - // Connection check.
34 + // Connection check, plus the AI master switch and the writing toggle that
35 + // owns the excerpt generator on the AI settings page.
26 36 if (
27 - ( new Host() )->is_wpcom_simple()
28 - || ( ( new Connection_Manager( 'jetpack' ) )->has_connected_owner() && ! ( new Status() )->is_offline_mode() )
37 + (
38 + ( new Host() )->is_wpcom_simple()
39 + || ( ( new Connection_Manager( 'jetpack' ) )->has_connected_owner() && ! ( new Status() )->is_offline_mode() )
40 + )
41 + && \Jetpack_AI_Settings::is_ai_enabled()
42 + && \Jetpack_AI_Settings::is_feature_enabled( 'writing_assistant' )
29 43 ) {
30 44 // Register AI Content lens plugin.
31 45 \Jetpack_Gutenberg::set_extension_available( FEATURE_NAME );
32 46 }
@@ -37,9 +51,9 @@
37 51 add_filter(
38 52 'jetpack_set_available_extensions',
39 53 function ( $extensions ) {
40 54 return array_merge(
41 - $extensions,
55 + (array) $extensions,
42 56 array(
43 57 FEATURE_NAME,
44 58 )
45 59 );