PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.6.1
Defender Security – Malware Scanner, Login Security & Firewall v5.6.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / component / class-cross-sell.php

class-cross-sell.php in Defender Security – Malware Scanner, Login Security & Firewall 5.6.1, at src/component/class-cross-sell.php

59 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Cross_Sell class.
4 *
5 * @package WP_Defender\Component
6 */
7
8 namespace WP_Defender\Component;
9
10 use Calotes\Base\Component;
11 use WP_Defender\Behavior\WPMUDEV;
12
13 /**
14 * Handles the functionality related to the Cross-Sell module.
15 *
16 * @since 5.2.1
17 */
18 class Cross_Sell extends Component {
19
20 /**
21 * Checks if the Cross-Sell should render its UI.
22 *
23 * Should load only for a free version and non-hosted sites.
24 *
25 * @return bool
26 */
27 protected function should_render(): bool {
28 return defender_is_wp_org_version() && ! wd_di()->get( WPMUDEV::class )->is_wpmu_hosting();
29 }
30
31 /**
32 * Initialize the Cross-Sell module and set its options.
33 *
34 * @return void
35 */
36 public function init() {
37 $cross_sell_path = defender_path( 'extra/plugins-cross-sell-page/plugin-cross-sell.php' );
38 if ( ! $this->should_render() || ! file_exists( $cross_sell_path ) ) {
39 return;
40 }
41
42 static $cross_sell = null;
43 if ( is_null( $cross_sell ) ) {
44 if ( ! class_exists( '\WPMUDEV\Modules\Plugin_Cross_Sell' ) ) {
45 require_once $cross_sell_path;
46 }
47
48 $submenu_params = array(
49 'slug' => 'defender-security', // Required.
50 'parent_slug' => 'wp-defender', // Required.
51 'menu_slug' => 'defender_cross_sell', // Optional - Strongly recommended to set in order to avoid admin page conflicts with other WPMU DEV plugins.
52 'position' => 17, // Optional – Usually a specific position will be required.
53 'translation_dir' => defender_path( 'languages' ), // Optional – The directory where the translation files are located.
54 );
55 $cross_sell = new \WPMUDEV\Modules\Plugin_Cross_Sell( $submenu_params );
56 }
57 }
58 }
59