PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.6
JetFormBuilder — Dynamic Blocks Form Builder v3.1.6
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
199 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 Jet_Form_Builder\Classes\Tools;
16 use JFB_Components\Module\Base_Module_Handle_It;
17 use JFB_Components\Module\Base_Module_Handle_Trait;
18 use JFB_Components\Module\Base_Module_It;
19 use JFB_Components\Module\Base_Module_Url_It;
20 use JFB_Components\Module\Base_Module_Url_Trait;
21
22 class Module implements Base_Module_It, Base_Module_Url_It, Base_Module_Handle_It {
23
24 use Base_Module_Handle_Trait;
25 use Base_Module_Url_Trait;
26
27 public function rep_item_id() {
28 return 'admin';
29 }
30
31 public function condition(): bool {
32 return true;
33 }
34
35 public function init_hooks() {
36 add_action( 'admin_footer', array( $this, 'add_modal_on_deactivate' ) );
37 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
38
39 add_filter(
40 'plugin_action_links_' . JET_FORM_BUILDER_PLUGIN_BASE,
41 array( $this, 'modify_plugin_action_links' )
42 );
43 }
44
45 public function remove_hooks() {
46 remove_action( 'admin_footer', array( $this, 'add_modal_on_deactivate' ) );
47 remove_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
48
49 remove_filter(
50 'plugin_action_links_' . JET_FORM_BUILDER_PLUGIN_BASE,
51 array( $this, 'modify_plugin_action_links' )
52 );
53 }
54
55 public function admin_footer_text( $footer_text ): string {
56 try {
57 Pages_Manager::instance()->get_current();
58 } catch ( Not_Found_Page_Exception $exception ) {
59 $screen = get_current_screen();
60
61 return ( $screen && 'edit-jet-form-builder' === $screen->id )
62 ? $this->get_footer_text()
63 : Tools::to_string( $footer_text );
64 }
65
66 return $this->get_footer_text();
67 }
68
69 private function get_footer_text(): string {
70 return sprintf(
71 /* translators: %s - link to the JetFormBuilder reviews page */
72 __(
73 'Liked <strong>JetFormBuilder</strong>?
74 Please <a href="%1$s" target="_blank">rate it �
75
76
77
78
79 </a>.
80 For troubleshooting, contact <a href="%2$s" target="_blank">Crocoblock support</a>.',
81 'jet-form-builder'
82 ),
83 'https://wordpress.org/support/plugin/jetformbuilder/reviews/?filter=5',
84 'https://support.crocoblock.com/support/home/'
85 );
86 }
87
88 public function modify_plugin_action_links( array $links ): array {
89 if ( jet_form_builder()->addons_manager->is_active() ) {
90 return $links;
91 }
92
93 wp_enqueue_style(
94 $this->get_handle( 'go-pro' ),
95 $this->get_url( 'assets/build/css/go-pro.css' ),
96 array(),
97 jet_form_builder()->get_version()
98 );
99
100 $utm = new Utm_Url( 'wp-dashboard/jet-form-builder-plugins-page' );
101 $utm->set_campaign( 'go-pro-button' );
102
103 $url = $utm->add_query( JET_FORM_BUILDER_SITE . '/pricing/' );
104
105 $label = __( 'Go Pro', 'jet-form-builder' );
106
107 $links['go_pro'] = "<a href=\"{$url}\" target=\"_blank\" class=\"jet-fb-go-pro-link\">{$label}</a>";
108
109 return $links;
110 }
111
112 public function add_modal_on_deactivate() {
113
114 $screen = get_current_screen();
115
116 if ( 'plugins' !== $screen->id ) {
117 return;
118 }
119
120 $options = Tab_Handler_Manager::get_options( 'options-tab' );
121
122 if ( empty( $options['clear_on_uninstall'] ) ) {
123 return;
124 }
125
126 $handle = $this->get_handle( 'deactivate' );
127
128 wp_enqueue_style(
129 $handle,
130 $this->get_url( 'assets/build/css/deactivate.css' ),
131 array(),
132 jet_form_builder()->get_version()
133 );
134
135 wp_enqueue_script(
136 $handle,
137 $this->get_url( 'assets/build/js/plugins.js' ),
138 array(),
139 jet_form_builder()->get_version(),
140 true
141 );
142
143 $slug = basename( jet_form_builder()->plugin_dir() );
144
145 wp_localize_script(
146 $handle,
147 'JetFBPluginConfig',
148 array(
149 'slug' => $slug,
150 )
151 );
152
153 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
154 ob_start();
155 ?>
156 <div style="display:none;" class="jet-form-builder-modal" id="modal-<?php echo esc_attr( $slug ); ?>">
157 <div class="jet-form-builder-modal-bg jet-form-builder-modal-exit"></div>
158 <div class="jet-form-builder-modal-container">
159 <h2 class="mb-unset"><?php echo __( 'Deactivating JetFormBuilder', 'jet-form-builder' ); ?></h2>
160 <hr/>
161 <p class="mt-unset">
162 <?php
163 echo __(
164 'You have the "<b>Clear plugin data after the uninstall</b>" option enabled, which deletes the following when the plugin is removed:',
165 'jet-form-builder'
166 );
167 ?>
168 </p>
169 <ul>
170 <li><?php echo __( 'All forms', 'jet-form-builder' ); ?></li>
171 <li><?php echo __( 'All saved Form Records', 'jet-form-builder' ); ?></li>
172 <li><?php echo __( 'All saved files', 'jet-form-builder' ); ?></li>
173 <li><?php echo __( 'All custom SQL tables', 'jet-form-builder' ); ?></li>
174 <li><?php echo __( 'All global options', 'jet-form-builder' ); ?></li>
175 </ul>
176 <p class="mb-unset">
177 <?php
178 echo __(
179 'If you are sure that you want to delete all this data,
180 click "<b>Continue</b>". If not, click "<b>Cancel</b>".',
181 'jet-form-builder'
182 );
183 ?>
184 </p>
185 <hr/>
186 <div class="jet-form-builder-modal-container-footer">
187 <button type="button"
188 class="button continue"><?php echo __( 'Continue', 'jet-form-builder' ); ?></button>
189 <button type="button"
190 class="button close"><?php echo __( 'Cancel', 'jet-form-builder' ); ?></button>
191 </div>
192 </div>
193 </div>
194 <?php
195 echo ob_get_clean();
196 // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
197 }
198 }
199