Passed
Push — master ( 6f0a6d...90a9ca )
by
unknown
09:41
created

MonsterInsights_Notification_Upgrade_To_Pro   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 30
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A prepare_notification_data() 0 12 1
1
<?php
2
3
/**
4
 * Add notification after 1 week of lite version installation
5
 * Recurrence: 40 Days
6
 *
7
 * @since 7.12.3
8
 */
9
final class MonsterInsights_Notification_Upgrade_To_Pro extends MonsterInsights_Notification_Event {
10
11
	public $notification_id             = 'monsterinsights_notification_upgrade_to_pro';
12
	public $notification_interval       = 40; // in days
13
	public $notification_first_run_time = '+7 day';
14
	public $notification_type           = array( 'lite' );
15
	public $notification_icon           = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
16
<circle cx="16" cy="16" r="16" fill="#D4E7F7"/>
17
<path d="M15.0867 9.48214C15.2474 9.16071 15.5063 9 15.8634 9C16.2206 9 16.4795 9.16071 16.6402 9.48214L18.3813 13.0179L22.292 13.6071C22.6492 13.6429 22.8813 13.8304 22.9884 14.1696C23.0956 14.5089 23.0242 14.8036 22.7742 15.0536L19.9349 17.8125L20.6045 21.7232C20.6581 22.0625 20.542 22.3304 20.2563 22.5268C19.9706 22.7411 19.6759 22.7679 19.3724 22.6071L15.8634 20.7857L12.3545 22.6071C12.0509 22.7857 11.7563 22.7679 11.4706 22.5536C11.1849 22.3393 11.0688 22.0625 11.1224 21.7232L11.792 17.8125L8.95274 15.0536C8.70274 14.8036 8.63131 14.5089 8.73845 14.1696C8.84559 13.8304 9.07774 13.6429 9.43488 13.6071L13.3456 13.0179L15.0867 9.48214Z" fill="#2679C1"/>
18
</svg>';
19
20
	/**
21
	 * Build Notification
22
	 *
23
	 * @return array $notification notification is ready to add
24
	 *
25
	 * @since 7.12.3
26
	 */
27
	public function prepare_notification_data( $notification ) {
28
		$notification['title']   = __( 'Upgrade to MonsterInsights Pro and unlock advanced tracking and reports', 'google-analytics-for-wordpress' );
29
		// Translators: upgrade to pro notification content
30
		$notification['content'] = __( 'By upgrading to MonsterInsights Pro you get access to additional reports right in your WordPress dashboard and advanced tracking features like eCommerce, Custom Dimensions, Forms tracking and more!', 'google-analytics-for-wordpress' );
31
		$notification['btns'] = array(
32
			"upgrade_to_pro" => array(
33
				'url'   => $this->get_upgrade_url(),
34
				'text'  => __( 'Upgrade to Pro', 'google-analytics-for-wordpress' )
35
			),
36
		);
37
38
		return $notification;
39
	}
40
41
}
42
43
// initialize the class
44
new MonsterInsights_Notification_Upgrade_To_Pro();
45