PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 1.0.11
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v1.0.11
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
firebox / Inc / Framework / Inc / Admin / Includes / UpgradeProModal.php

UpgradeProModal.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 1.0.11, at Inc/Framework/Inc/Admin/Includes/UpgradeProModal.php

122 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FirePlugins Framework
4 * @version 1.0.22
5 *
6 * @author FirePlugins <[email protected]>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2022 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FPFramework\Admin\Includes;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class UpgradeProModal
20 {
21 /**
22 * The Modal ID.
23 *
24 * @var String
25 */
26 const modal_id = 'fpfUpgradeToPro';
27
28 /**
29 * Plugin slug
30 *
31 * @var string
32 */
33 private $plugin_slug;
34
35 /**
36 * Plugin name
37 *
38 * @var string
39 */
40 private $plugin_name;
41
42 public function __construct($plugin_slug = null, $plugin_name = null)
43 {
44 $this->plugin_slug = $plugin_slug;
45 $this->plugin_name = $plugin_name;
46
47 add_action( 'current_screen', [$this, 'validate'] );
48 }
49
50 /**
51 * Runs only on given plugin
52 *
53 * @return void
54 */
55 public function validate()
56 {
57 if (!is_admin())
58 {
59 return;
60 }
61
62 $current_screen = get_current_screen();
63 if (strpos($current_screen->id, $this->plugin_slug) === false)
64 {
65 return;
66 }
67
68 $this->run();
69 }
70
71 /**
72 * Run module
73 *
74 * @return void
75 */
76 private function run()
77 {
78 add_action('admin_footer', [$this, 'addModal'], 13);
79 }
80
81 /**
82 * Adds Upgrade to Pro Modal to the page
83 *
84 * @return void
85 */
86 public function addModal()
87 {
88 // get smart tags table layout
89 $content = fpframework()->renderer->admin->render('upgrade_pro', ['plugin_name' => $this->plugin_name], true);
90
91 $payload = [
92 'id' => self::modal_id,
93 'class' => ['upgrade-pro'],
94 'content' => $content,
95 'width' => '480px',
96 'overlay_click' => false
97 ];
98
99 // CSS
100 wp_register_style(
101 'fpframework-pro-modal',
102 FPF_MEDIA_URL . 'admin/css/fpf_pro_modal.css',
103 [],
104 FPF_VERSION,
105 false
106 );
107 wp_enqueue_style( 'fpframework-pro-modal' );
108
109 // JS
110 wp_register_script(
111 'fpframework-pro-modal',
112 FPF_MEDIA_URL . 'admin/js/fpf_pro_modal.js',
113 [],
114 FPF_VERSION,
115 false
116 );
117 wp_enqueue_script( 'fpframework-pro-modal' );
118
119 // render a pro modal
120 \FPFramework\Helpers\HTML::renderModal($payload);
121 }
122 }