Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| Likes_Options | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| likes_enabled_sitewide | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| reblogs_enabled_sitewide | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| comment_likes_enabled | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Reads the Likes options without depending on the Likes module being loaded. |
| 4 | * |
| 5 | * @package automattic/jetpack-sharing-likes |
| 6 | */ |
| 7 | |
| 8 | declare( strict_types = 1 ); |
| 9 | |
| 10 | namespace Automattic\Jetpack\Sharing_Likes\Settings; |
| 11 | |
| 12 | use Jetpack_Options; |
| 13 | |
| 14 | /** |
| 15 | * The Likes options, as the settings screen needs them. |
| 16 | * |
| 17 | * `Jetpack_Likes_Settings` carries equivalent accessors, but it only loads with |
| 18 | * the Likes module, and this screen renders whether that module is on or off. |
| 19 | */ |
| 20 | final class Likes_Options { |
| 21 | |
| 22 | /** |
| 23 | * Whether Likes are on for every post. |
| 24 | */ |
| 25 | public static function likes_enabled_sitewide(): bool { |
| 26 | /** This filter is documented in projects/plugins/jetpack/modules/likes/jetpack-likes-settings.php */ |
| 27 | return (bool) apply_filters( |
| 28 | 'wpl_is_enabled_sitewide', |
| 29 | ! Jetpack_Options::get_option_and_ensure_autoload( 'disabled_likes', 0 ) |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Whether the Reblog button shows on posts. WordPress.com Simple only. |
| 35 | */ |
| 36 | public static function reblogs_enabled_sitewide(): bool { |
| 37 | /** This filter is documented in projects/plugins/jetpack/modules/likes/jetpack-likes-settings.php */ |
| 38 | return (bool) apply_filters( 'wpl_reblogging_enabled_sitewide', ! get_option( 'disabled_reblogs' ) ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Whether the Comment Likes option is on. Only WordPress.com Simple reads it. |
| 43 | */ |
| 44 | public static function comment_likes_enabled(): bool { |
| 45 | /** This filter is documented in projects/plugins/jetpack/modules/likes/jetpack-likes-settings.php */ |
| 46 | return (bool) apply_filters( 'jetpack_comment_likes_enabled', get_option( 'jetpack_comment_likes_enabled', false ) ); |
| 47 | } |
| 48 | } |