| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Module Name: Comments |
| 4 | - * Module Description: Let visitors use a WordPress.com or Facebook account to comment | |
| 4 | + * Module Description: Replace the default comment form with a modern, feature‑rich alternative. | |
| 5 | 5 | * First Introduced: 1.4 |
| 6 | 6 | * Sort Order: 20 |
| 7 | 7 | * Requires Connection: Yes |
| 8 | 8 | * Auto Activate: No |
| @@ -13,20 +13,28 @@ | ||
| 13 | 13 | * @package automattic/jetpack |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | use Automattic\Jetpack\Assets; |
| 17 | +use Automattic\Jetpack\Comments\Comments; | |
| 17 | 18 | |
| 18 | -Assets::add_resource_hint( | |
| 19 | - array( | |
| 20 | - '//jetpack.wordpress.com', | |
| 21 | - '//s0.wp.com', | |
| 22 | - '//public-api.wordpress.com', | |
| 23 | - '//0.gravatar.com', | |
| 24 | - '//1.gravatar.com', | |
| 25 | - '//2.gravatar.com', | |
| 26 | - ), | |
| 27 | - 'dns-prefetch' | |
| 28 | -); | |
| 19 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 20 | + exit( 0 ); | |
| 21 | +} | |
| 22 | + | |
| 23 | +// Guarded because the module file and the package can land in either order on a staged deploy. | |
| 24 | +if ( class_exists( Comments::class ) && Comments::is_enabled() ) { | |
| 25 | + Comments::init(); | |
| 26 | +} else { | |
| 27 | + Assets::add_resource_hint( | |
| 28 | + array( | |
| 29 | + '//jetpack.wordpress.com', | |
| 30 | + '//s0.wp.com', | |
| 31 | + '//public-api.wordpress.com', | |
| 32 | + '//secure.gravatar.com', | |
| 33 | + ), | |
| 34 | + 'dns-prefetch' | |
| 35 | + ); | |
| 36 | +} | |
| 29 | 37 | |
| 30 | 38 | /* |
| 31 | 39 | * Add the main commenting system. |
| 32 | 40 | */ |