Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| Overview | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| get_key | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_state | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
6 | |||
| register_routes | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * The Overview section: what the site earns, and the ways it could earn more. |
| 4 | * |
| 5 | * @package automattic/jetpack-monetize |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Monetize\Sections; |
| 9 | |
| 10 | use Automattic\Jetpack\Current_Plan; |
| 11 | use Automattic\Jetpack\Modules; |
| 12 | use Automattic\Jetpack\Monetize\Dashboard_Section; |
| 13 | use Automattic\Jetpack\Status\Host; |
| 14 | |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit( 0 ); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Overview state. Its earnings come from the Payments section's routes. |
| 21 | * |
| 22 | * @since 0.2.0 |
| 23 | */ |
| 24 | class Overview implements Dashboard_Section { |
| 25 | |
| 26 | /** |
| 27 | * Section key. |
| 28 | * |
| 29 | * @return string |
| 30 | */ |
| 31 | public function get_key() { |
| 32 | return 'overview'; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Which paid features the plan includes, and whether ads are on. |
| 37 | * |
| 38 | * @return array |
| 39 | */ |
| 40 | public function get_state() { |
| 41 | return array( |
| 42 | 'hasWordAds' => Current_Plan::supports( 'wordads' ), |
| 43 | 'isWordAdsActive' => ( new Modules() )->is_active( 'wordads' ), |
| 44 | 'hasSimplePayments' => Current_Plan::supports( 'simple-payments' ), |
| 45 | // The payments fee the upgrade brings: Jetpack Creator's 2%, or 0% on WordPress.com's top plans. |
| 46 | 'upgradeCommission' => ( new Host() )->is_wpcom_platform() ? 0 : 0.02, |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * No routes of its own. |
| 52 | * |
| 53 | * @return void |
| 54 | */ |
| 55 | public function register_routes() {} |
| 56 | } |