Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
90.00% covered (success)
90.00%
27 / 30
100.00% covered (success)
100.00%
2 / 2
CRAP
n/a
0 / 0
Automattic\Jetpack\PremiumAnalytics\configure_parsely_promos
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
Automattic\Jetpack\PremiumAnalytics\register_parsely_promos
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * The Upgrade to Parse.ly prompts in the Stats dashboard.
4 *
5 * @package automattic/jetpack-premium-analytics
6 */
7
8namespace Automattic\Jetpack\PremiumAnalytics;
9
10require_once __DIR__ . '/promos.php';
11require_once __DIR__ . '/parsely-prompts.php';
12require_once __DIR__ . '/parsely-signup-url.php';
13
14/**
15 * Arranges for the Upgrade to Parse.ly prompts to be registered.
16 *
17 * Their copy is translated, and the package boots on `plugins_loaded`, before the textdomain
18 * can load. The script data filter that publishes the promos runs later than `init`, so waiting
19 * costs them nothing.
20 *
21 * @since $$next-version$$
22 *
23 * @return void
24 */
25function configure_parsely_promos() {
26    if ( did_action( 'init' ) ) {
27        register_parsely_promos();
28
29        return;
30    }
31
32    add_action( 'init', __NAMESPACE__ . '\\register_parsely_promos' );
33}
34
35/**
36 * Registers the Upgrade to Parse.ly prompts.
37 *
38 * @since $$next-version$$
39 *
40 * @return void
41 */
42function register_parsely_promos() {
43    register_promo(
44        'parsely/settings-upgrade',
45        array(
46            'placement'    => 'settings',
47            'title'        => __( 'Parse.ly', 'jetpack-premium-analytics-pkg' ),
48            'description'  => __( 'Grow with Parse.ly, the favorite analytics provider for professional brands and media companies. See which stories hold attention, where readers came from, and what they read next, in real time.', 'jetpack-premium-analytics-pkg' ),
49            'cta_label'    => __( 'Upgrade to Parse.ly', 'jetpack-premium-analytics-pkg' ),
50            'cta_url'      => parsely_signup_url(),
51            'cta_variant'  => 'secondary',
52            'dismissible'  => false,
53            'is_available' => __NAMESPACE__ . '\\offers_parsely_prompts',
54        )
55    );
56
57    register_promo(
58        'parsely/menu-upgrade',
59        array(
60            'placement'    => 'options-menu',
61            'cta_label'    => __( 'Upgrade to Parse.ly', 'jetpack-premium-analytics-pkg' ),
62            'cta_url'      => parsely_signup_url(),
63            'dismissible'  => false,
64            'is_available' => __NAMESPACE__ . '\\offers_parsely_prompts',
65        )
66    );
67}