Passed
Push — analysis-ordexg ( 403c8a )
by Sudar
72:28 queued 38s
created

UpsellModule::get_success_message()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 0
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 1
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
namespace BulkWP\BulkDelete\Core\Addon;
4
5
use BulkWP\BulkDelete\Core\Base\BaseModule;
6
7
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
8
9
/**
10
 * A Module that upsells an add-on.
11
 *
12
 * Upseller Module is displayed for add-ons with a description and a link to buy them.
13
 * If an add-on is installed, then the Upseller Module is automatically deactivated.
14
 *
15
 * Methods that are not needed are left empty.
16
 *
17
 * @since 6.0.0
18
 */
19
class UpsellModule extends BaseModule {
20
	/**
21
	 * Details about the add-on.
22
	 *
23
	 * @var \BulkWP\BulkDelete\Core\Addon\AddonUpsellInfo
24
	 */
25
	protected $addon_upsell_info;
26
27
	/**
28
	 * Create the UpsellModule using add-on info.
29
	 *
30
	 * @param \BulkWP\BulkDelete\Core\Addon\AddonUpsellInfo $addon_upsell_info Addon Upsell Info.
31
	 */
32
	public function __construct( $addon_upsell_info ) {
33
		$this->addon_upsell_info = $addon_upsell_info;
34
35
		$this->meta_box_slug = $this->addon_upsell_info->get_slug();
36
		$this->messages      = array(
37
			'box_label' => $addon_upsell_info->get_upsell_title(),
38
		);
39
	}
40
41
	/**
42
	 * Upsell modules will use the name of the Add-on as their name.
43
	 *
44
	 * @return string Upsell Module name.
45
	 */
46
	public function get_name() {
47
		return str_replace( ' ', '', $this->addon_upsell_info->get_name() );
48
	}
49
50
	public function render() {
51
		?>
52
53
		<p>
54
			<?php echo $this->addon_upsell_info->get_upsell_message(); ?>
55
			<a href="<?php echo esc_url( $this->addon_upsell_info->get_buy_url() ); ?>" target="_blank"><?php _e( 'Buy Now', 'bulk-delete' ); ?></a>
56
		</p>
57
58
		<?php
59
	}
60
61
	protected function initialize() {
62
		// Empty by design.
63
	}
64
65
	protected function parse_common_filters( $request ) {
66
		// Empty by design.
67
	}
68
69
	protected function convert_user_input_to_options( $request, $options ) {
70
		// Empty by design.
71
	}
72
73
	protected function do_delete( $options ) {
74
		// Empty by design.
75
	}
76
}
77