| 1 |
<?php |
| 2 |
/** |
| 3 |
* Module Name: Comments |
| 4 |
* Module Description: Replace the default comment form with a modern, feature‑rich alternative. |
| 5 |
* First Introduced: 1.4 |
| 6 |
* Sort Order: 20 |
| 7 |
* Requires Connection: Yes |
| 8 |
* Auto Activate: No |
| 9 |
* Module Tags: Social |
| 10 |
* Feature: Engagement |
| 11 |
* Additional Search Queries: comments, comment, facebook, social |
| 12 |
* |
| 13 |
* @package automattic/jetpack |
| 14 |
*/ |
| 15 |
|
| 16 |
use Automattic\Jetpack\Assets; |
| 17 |
use Automattic\Jetpack\Comments\Comments; |
| 18 |
|
| 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 |
} |
| 37 |
|
| 38 |
/* |
| 39 |
* Add the main commenting system. |
| 40 |
*/ |
| 41 |
require __DIR__ . '/comments/comments.php'; |
| 42 |
require __DIR__ . '/comments/subscription-modal-on-comment/class-jetpack-subscription-modal-on-comment.php'; |
| 43 |
|
| 44 |
if ( is_admin() ) { |
| 45 |
/** |
| 46 |
* Add the admin functionality. |
| 47 |
*/ |
| 48 |
require __DIR__ . '/comments/admin.php'; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Module loader. |
| 53 |
*/ |
| 54 |
function jetpack_comments_load() { |
| 55 |
Jetpack::enable_module_configurable( __FILE__ ); |
| 56 |
} |
| 57 |
|
| 58 |
add_action( 'jetpack_modules_loaded', 'jetpack_comments_load' ); |
| 59 |
|