PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.0
JetFormBuilder — Dynamic Blocks Form Builder v3.1.0
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / admin / module.php
jetformbuilder / modules / admin Last commit date
.config 2 years ago assets 2 years ago .gitattributes 2 years ago module.php 2 years ago package.json 2 years ago
module.php
198 lines
1 <?php
2
3
4 namespace JFB_Modules\Admin;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 use Jet_Form_Builder\Admin\Exceptions\Not_Found_Page_Exception;
12 use Jet_Form_Builder\Admin\Pages\Pages_Manager;
13 use Jet_Form_Builder\Admin\Tabs_Handlers\Tab_Handler_Manager;
14 use Jet_Form_Builder\Classes\Http\Utm_Url;
15 use JFB_Components\Module\Base_Module_Handle_It;
16 use JFB_Components\Module\Base_Module_Handle_Trait;
17 use JFB_Components\Module\Base_Module_It;
18 use JFB_Components\Module\Base_Module_Url_It;
19 use JFB_Components\Module\Base_Module_Url_Trait;
20
21 class Module implements Base_Module_It, Base_Module_Url_It, Base_Module_Handle_It {
22
23 use Base_Module_Handle_Trait;
24 use Base_Module_Url_Trait;
25
26 public function rep_item_id() {
27 return 'admin';
28 }
29
30 public function condition(): bool {
31 return true;
32 }
33
34 public function init_hooks() {
35 add_action( 'admin_footer', array( $this, 'add_modal_on_deactivate' ) );
36 add_action( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
37
38 add_filter(
39 'plugin_action_links_' . JET_FORM_BUILDER_PLUGIN_BASE,
40 array( $this, 'modify_plugin_action_links' )
41 );
42 }
43
44 public function remove_hooks() {
45 remove_action( 'admin_init', array( $this, 'add_modal_on_deactivate' ) );
46 remove_action( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
47
48 remove_filter(
49 'plugin_action_links_' . JET_FORM_BUILDER_PLUGIN_BASE,
50 array( $this, 'modify_plugin_action_links' )
51 );
52 }
53
54 public function admin_footer_text( string $footer_text ): string {
55 try {
56 Pages_Manager::instance()->get_current();
57 } catch ( Not_Found_Page_Exception $exception ) {
58 $screen = get_current_screen();
59
60 return ( $screen && 'edit-jet-form-builder' === $screen->id )
61 ? $this->get_footer_text()
62 : $footer_text;
63 }
64
65 return $this->get_footer_text();
66 }
67
68 private function get_footer_text(): string {
69 return sprintf(
70 /* translators: %s - link to the JetFormBuilder reviews page */
71 __(
72 'Liked <strong>JetFormBuilder</strong>?
73 Please <a href="%1$s" target="_blank">rate it �
74
75
76
77
78 </a>.
79 For troubleshooting, contact <a href="%2$s" target="_blank">Crocoblock support</a>.',
80 'jet-form-builder'
81 ),
82 'https://wordpress.org/support/plugin/jetformbuilder/reviews/?filter=5',
83 'https://support.crocoblock.com/support/home/'
84 );
85 }
86
87 public function modify_plugin_action_links( array $links ): array {
88 if ( jet_form_builder()->addons_manager->is_active() ) {
89 return $links;
90 }
91
92 wp_enqueue_style(
93 $this->get_handle( 'go-pro' ),
94 $this->get_url( 'assets/build/css/go-pro.css' ),
95 array(),
96 jet_form_builder()->get_version()
97 );
98
99 $utm = new Utm_Url( 'wp-dashboard/jet-form-builder-plugins-page' );
100 $utm->set_campaign( 'go-pro-button' );
101
102 $url = $utm->add_query( JET_FORM_BUILDER_SITE . '/pricing/' );
103
104 $label = __( 'Go Pro', 'jet-form-builder' );
105
106 $links['go_pro'] = "<a href=\"{$url}\" target=\"_blank\" class=\"jet-fb-go-pro-link\">{$label}</a>";
107
108 return $links;
109 }
110
111 public function add_modal_on_deactivate() {
112
113 $screen = get_current_screen();
114
115 if ( 'plugins' !== $screen->id ) {
116 return;
117 }
118
119 $options = Tab_Handler_Manager::get_options( 'options-tab' );
120
121 if ( empty( $options['clear_on_uninstall'] ) ) {
122 return;
123 }
124
125 $handle = $this->get_handle( 'deactivate' );
126
127 wp_enqueue_style(
128 $handle,
129 $this->get_url( 'assets/build/css/deactivate.css' ),
130 array(),
131 jet_form_builder()->get_version()
132 );
133
134 wp_enqueue_script(
135 $handle,
136 $this->get_url( 'assets/build/js/plugins{min}.js' ),
137 array(),
138 jet_form_builder()->get_version(),
139 true
140 );
141
142 $slug = basename( jet_form_builder()->plugin_dir() );
143
144 wp_localize_script(
145 $handle,
146 'JetFBPluginConfig',
147 array(
148 'slug' => $slug,
149 )
150 );
151
152 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
153 ob_start();
154 ?>
155 <div style="display:none;" class="jet-form-builder-modal" id="modal-<?php echo esc_attr( $slug ); ?>">
156 <div class="jet-form-builder-modal-bg jet-form-builder-modal-exit"></div>
157 <div class="jet-form-builder-modal-container">
158 <h2 class="mb-unset"><?php echo __( 'Deactivating JetFormBuilder', 'jet-form-builder' ); ?></h2>
159 <hr/>
160 <p class="mt-unset">
161 <?php
162 echo __(
163 'You have the "<b>Clear plugin data after the uninstall</b>" option enabled, which deletes the following when the plugin is removed:',
164 'jet-form-builder'
165 );
166 ?>
167 </p>
168 <ul>
169 <li><?php echo __( 'All forms', 'jet-form-builder' ); ?></li>
170 <li><?php echo __( 'All saved Form Records', 'jet-form-builder' ); ?></li>
171 <li><?php echo __( 'All saved files', 'jet-form-builder' ); ?></li>
172 <li><?php echo __( 'All custom SQL tables', 'jet-form-builder' ); ?></li>
173 <li><?php echo __( 'All global options', 'jet-form-builder' ); ?></li>
174 </ul>
175 <p class="mb-unset">
176 <?php
177 echo __(
178 'If you are sure that you want to delete all this data,
179 click "<b>Continue</b>". If not, click "<b>Cancel</b>".',
180 'jet-form-builder'
181 );
182 ?>
183 </p>
184 <hr/>
185 <div class="jet-form-builder-modal-container-footer">
186 <button type="button"
187 class="button continue"><?php echo __( 'Continue', 'jet-form-builder' ); ?></button>
188 <button type="button"
189 class="button close"><?php echo __( 'Cancel', 'jet-form-builder' ); ?></button>
190 </div>
191 </div>
192 </div>
193 <?php
194 echo ob_get_clean();
195 // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
196 }
197 }
198