Passed
Push — 212-fix/add-upsell-notice ( 532246...0be06f )
by
unknown
03:08
created

Upseller::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
ccs 0
cts 2
cp 0
crap 2
1
<?php namespace EmailLog\Addon;
2
3
use EmailLog\Core\Loadie;
4
5
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
6
7
/**
8
 * Handles upsell messages.
9
 */
10
11
 class Upseller implements Loadie {
12
13
	/**
14
	 * Load all hooks.
15
	 *
16
	 * @inheritdoc
17
	 */
18
	public function load() {
19
		add_action( 'el_before_logs_list_table', array( $this, 'render_auto_delete_logs_addon_upsell_message' ) );
20
	}
21
22
   	/**
23
	 * Renders Upsell message for Auto delete logs add-on.
24
	 *
25
	 * @since 2.4.0
26
	 */
27
	public function render_auto_delete_logs_addon_upsell_message() {
28
		if ( ! \PAnD::is_admin_notice_active( 'disable-upsell-notice-forever' ) ) {
29
			return;
30
		}
31
		$email_log  = email_log();
32
		$logs_count = $email_log->table_manager->get_logs_count();
0 ignored issues
show
Unused Code introduced by
The assignment to $logs_count is dead and can be removed.
Loading history...
33
		//if ( $logs_count > 5 ) {
34
		?>
35
		<div data-dismissible="disable-upsell-notice-forever" class="updated notice notice-success is-dismissible">
36
			<p><?php _e( 'The Auto Delete Logs add-on allows you to automatically delete logs based on a schedule. <a href="https://wpemaillog.com/addons/auto-delete-logs/?utm_campaign=Upsell&utm_medium=wpadmin&utm_source=log-list&utm_content=dl" target="_blank">Buy now</a>', 'email-log' ); ?></p>
37
		</div>
38
		<?php
39
		//}
40
	}
41
42
 }
43