PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 3.06.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v3.06.06
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmAppController.php +254 -690 6.33.06.06 View file →
@@ -1,29 +1,20 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - die( 'You are not allowed to call this page directly.' );
4 -}
5 2
6 3 class FrmAppController {
7 4
8 - /**
9 - * @return void
10 - */
11 5 public static function menu() {
12 - FrmAppHelper::maybe_add_permissions();
13 - if ( ! current_user_can( 'frm_view_forms' ) ) {
14 - return;
15 - }
6 + FrmAppHelper::maybe_add_permissions();
7 + if ( ! current_user_can( 'frm_view_forms' ) ) {
8 + return;
9 + }
16 10
17 11 $menu_name = FrmAppHelper::get_menu_name();
18 12 add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() );
19 - }
13 + }
20 14
21 - /**
22 - * @return int
23 - */
24 15 private static function get_menu_position() {
25 - return (int) apply_filters( 'frm_menu_position', 29 );
16 + return apply_filters( 'frm_menu_position', '29.3' );
26 17 }
27 18
28 19 /**
29 20 * @since 3.05
@@ -35,9 +26,8 @@
35 26 'orange' => '#a0a5aa',
36 27 )
37 28 );
38 29 $icon = 'data:image/svg+xml;base64,' . base64_encode( $icon );
39 -
40 30 return apply_filters( 'frm_icon', $icon );
41 31 }
42 32
43 33 /**
@@ -45,138 +35,34 @@
45 35 */
46 36 public static function add_admin_class( $classes ) {
47 37 if ( self::is_white_page() ) {
48 38 $classes .= ' frm-white-body ';
49 - $classes .= self::get_os();
50 -
51 - $page = str_replace( 'formidable-', '', FrmAppHelper::simple_get( 'page', 'sanitize_title' ) );
52 - if ( empty( $page ) || $page === 'formidable' ) {
53 - $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
54 - if ( in_array( $action, array( 'settings', 'edit', 'list' ) ) ) {
55 - $page .= $action;
56 - } else {
57 - $page = $action;
58 - }
59 - }
60 - if ( ! empty( $page ) ) {
61 - $classes .= ' frm-admin-page-' . $page;
62 - }
63 39 }
64 -
65 - if ( FrmAppHelper::is_full_screen() ) {
66 - $full_screen_on = self::get_full_screen_setting();
67 - $add_class = '';
68 - if ( $full_screen_on ) {
69 - $add_class = ' frm-full-screen is-fullscreen-mode';
70 - wp_enqueue_style( 'wp-edit-post' ); // Load the CSS for .is-fullscreen-mode.
71 - }
72 - $classes .= apply_filters( 'frm_admin_full_screen_class', $add_class );
73 - }
74 -
75 - if ( ! FrmAppHelper::pro_is_installed() ) {
76 - $classes .= ' frm-lite ';
77 - }
78 -
79 40 return $classes;
80 41 }
81 42
82 43 /**
83 - * Get the full screen mode setting from the block editor.
84 - *
85 - * @since 6.1
86 - *
87 - * @return bool
88 - */
89 - private static function get_full_screen_setting() {
90 - global $wpdb;
91 - $meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences';
92 -
93 - $prefs = get_user_meta( get_current_user_id(), $meta_key, true );
94 - if ( $prefs && isset( $prefs['core/edit-post']['fullscreenMode'] ) ) {
95 - return $prefs['core/edit-post']['fullscreenMode'];
96 - }
97 -
98 - return true;
99 - }
100 -
101 - /**
102 - * @since 4.0
103 - *
104 - * @return string
105 - */
106 - private static function get_os() {
107 - $agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) );
108 - $os = '';
109 - if ( strpos( $agent, 'mac' ) !== false ) {
110 - $os = ' osx';
111 - } elseif ( strpos( $agent, 'linux' ) !== false ) {
112 - $os = ' linux';
113 - } elseif ( strpos( $agent, 'windows' ) !== false ) {
114 - $os = ' windows';
115 - }
116 - return $os;
117 - }
118 -
119 - /**
120 44 * @since 3.0
121 45 */
122 46 private static function is_white_page() {
123 - $white_pages = array(
124 - 'formidable',
125 - 'formidable-entries',
126 - 'formidable-views',
127 - 'formidable-views-editor',
128 - 'formidable-pro-upgrade',
129 - 'formidable-addons',
130 - 'formidable-import',
131 - 'formidable-settings',
132 - 'formidable-styles',
133 - 'formidable-styles2',
134 - 'formidable-inbox',
135 - 'formidable-welcome',
136 - 'formidable-applications',
137 - );
138 -
139 - $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
140 - $is_white_page = in_array( $get_page, $white_pages, true );
141 -
47 + $is_white_page = ( FrmAppHelper::is_admin_page( 'formidable' ) || FrmAppHelper::is_admin_page( 'formidable-entries' ) || FrmAppHelper::is_admin_page( 'formidable-pro-upgrade' ) || FrmAppHelper::is_admin_page( 'formidable-addons' ) || FrmAppHelper::is_admin_page( 'formidable-import' ) );
142 48 if ( ! $is_white_page ) {
143 - $screen = get_current_screen();
144 - $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
49 + $screen = get_current_screen();
50 + $is_white_page = ( $screen && $screen->id === 'edit-frm_display' );
145 51 }
146 52
147 - /**
148 - * Allow another add on to style a page as a Formidable "white page", which adds a white background color.
149 - *
150 - * @since 5.3
151 - *
152 - * @param bool $is_white_page
153 - */
154 - $is_white_page = apply_filters( 'frm_is_white_page', $is_white_page );
155 -
156 53 return $is_white_page;
157 54 }
158 55
159 - /**
160 - * @return void
161 - */
162 - public static function load_wp_admin_style() {
163 - FrmAppHelper::load_font_style();
164 - }
56 + public static function load_wp_admin_style() {
57 + FrmAppHelper::load_font_style();
58 + }
165 59
166 - /**
167 - * @param bool $show_nav
168 - * @param string $title
169 - *
170 - * @psalm-param 'hide'|'show' $title
171 - *
172 - * @return void
173 - */
174 60 public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
175 61 $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
176 - if ( empty( $show_nav ) || ! $form ) {
177 - return;
178 - }
62 + if ( empty( $show_nav ) || ! $form ) {
63 + return;
64 + }
179 65
180 66 FrmForm::maybe_get_form( $form );
181 67 if ( ! is_object( $form ) ) {
182 68 return;
@@ -181,24 +67,22 @@
181 67 if ( ! is_object( $form ) ) {
182 68 return;
183 69 }
184 70
185 - $id = $form->id;
71 + $id = $form->id;
186 72 $current_page = self::get_current_page();
187 - $nav_items = self::get_form_nav_items( $form );
73 + $nav_items = self::get_form_nav_items( $form );
188 74
189 75 include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
190 76 }
191 77
192 - /**
193 - * @return string
194 - */
195 78 private static function get_current_page() {
196 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
197 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
79 + global $pagenow;
80 +
81 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
82 + $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
198 83 $current_page = isset( $_GET['page'] ) ? $page : $post_type;
199 -
200 - if ( FrmAppHelper::is_view_builder_page() ) {
84 + if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) {
201 85 $current_page = 'frm_display';
202 86 }
203 87
204 88 return $current_page;
@@ -203,73 +87,62 @@
203 87
204 88 return $current_page;
205 89 }
206 90
207 - /**
208 - * @param object $form
209 - * @return array
210 - */
211 91 private static function get_form_nav_items( $form ) {
212 92 $id = $form->parent_form_id ? $form->parent_form_id : $form->id;
213 93
214 94 $nav_items = array(
215 95 array(
216 - 'link' => FrmForm::get_edit_link( $id ),
217 - 'label' => __( 'Build', 'formidable' ),
218 - 'current' => array( 'edit', 'new', 'duplicate' ),
219 - 'page' => 'formidable',
96 + 'link' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $id ) ),
97 + 'label' => __( 'Build', 'formidable' ),
98 + 'current' => array( 'edit', 'new', 'duplicate' ),
99 + 'page' => 'formidable',
220 100 'permission' => 'frm_edit_forms',
221 101 ),
222 102 array(
223 - 'link' => FrmStylesHelper::get_list_url( $id ),
224 - 'label' => __( 'Style', 'formidable' ),
225 - 'current' => array(),
226 - 'page' => 'formidable-styles',
103 + 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
104 + 'label' => __( 'Settings', 'formidable' ),
105 + 'current' => array( 'settings' ),
106 + 'page' => 'formidable',
227 107 'permission' => 'frm_edit_forms',
228 108 ),
229 109 array(
230 - 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
231 - 'label' => __( 'Settings', 'formidable' ),
232 - 'current' => array( 'settings' ),
233 - 'page' => 'formidable',
234 - 'permission' => 'frm_edit_forms',
235 - ),
236 - array(
237 - 'link' => admin_url( 'admin.php?page=formidable-entries&frm_action=list&form=' . absint( $id ) ),
238 - 'label' => __( 'Entries', 'formidable' ),
239 - 'current' => array(),
240 - 'page' => 'formidable-entries',
110 + 'link' => admin_url( 'admin.php?page=formidable-entries&frm_action=list&form=' . absint( $id ) ),
111 + 'label' => __( 'Entries', 'formidable' ),
112 + 'current' => array(),
113 + 'page' => 'formidable-entries',
241 114 'permission' => 'frm_view_entries',
242 115 ),
243 116 );
244 117
245 - $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
246 -
247 - if ( ! $views_installed ) {
118 + // Let people know reports and views exist.
119 + if ( ! FrmAppHelper::pro_is_installed() ) {
248 120 $nav_items[] = array(
249 - 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
121 + 'link' => '',
250 122 'label' => __( 'Views', 'formidable' ),
251 123 'current' => array(),
252 - 'page' => 'formidable-views',
124 + 'page' => '',
253 125 'permission' => 'frm_view_entries',
254 126 'atts' => array(
255 - 'class' => 'frm_noallow',
127 + 'class' => 'frm_show_upgrade frm_noallow',
128 + 'data-upgrade' => __( 'Views', 'formidable' ),
129 + 'data-medium' => 'views-nav',
256 130 ),
257 131 );
258 - }
259 -
260 - // Let people know reports and views exist.
261 - if ( ! FrmAppHelper::pro_is_installed() ) {
262 132 $nav_items[] = array(
263 - 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
133 + 'link' => '',
264 134 'label' => __( 'Reports', 'formidable' ),
265 - 'current' => array( 'reports' ),
266 - 'page' => 'formidable',
135 + 'current' => array(),
136 + 'page' => '',
267 137 'permission' => 'frm_view_entries',
268 138 'atts' => array(
269 - 'class' => 'frm_noallow',
139 + 'class' => 'frm_show_upgrade frm_noallow',
140 + 'data-upgrade' => __( 'Reports', 'formidable' ),
141 + 'data-medium' => 'reports-nav',
270 142 ),
271 143 );
144 + self::include_upgrade_overlay();
272 145 }
273 146
274 147 $nav_args = array(
275 148 'form_id' => $id,
@@ -274,34 +147,86 @@
274 147 $nav_args = array(
275 148 'form_id' => $id,
276 149 'form' => $form,
277 150 );
151 + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
152 + }
278 153
279 - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
280 - }
154 + // Adds a settings link to the plugins page
155 + public static function settings_link( $links ) {
156 + $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
157 + array_unshift( $links, $settings );
281 158
282 - // Adds a settings link to the plugins page
283 - /**
284 - * @return array
285 - */
286 - public static function settings_link( $links ) {
287 - $settings = array();
159 + return $links;
160 + }
288 161
289 - if ( ! FrmAppHelper::pro_is_installed() ) {
290 - $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b>' . esc_html__( 'Upgrade to Pro', 'formidable' ) . '</b></a>';
162 + public static function pro_get_started_headline() {
163 + self::maybe_show_upgrade_bar();
164 + self::review_request();
165 +
166 + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
167 + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
168 + return;
169 + }
170 +
171 + $pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' );
172 + $authorized = get_site_option( 'frmpro-authorized' ) && ! is_callable( 'load_formidable_pro' );
173 + if ( ! $authorized ) {
174 + return;
291 175 }
292 176
293 - $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
177 + FrmAppHelper::load_admin_wide_js();
294 178
295 - return array_merge( $settings, $links );
296 - }
179 + // user is authorized, but running free version
180 + $download_url = '';
181 + if ( $pro_installed ) {
182 + // if pro version is installed, include link to activate it
183 + $inst_install_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=formidable-pro/formidable-pro.php' ), 'activate-plugin_formidable-pro/formidable-pro.php' );
184 + } else {
185 + $inst_install_url = '#';
186 + $download_url = FrmAddonsController::get_pro_download_url();
297 187
298 - /**
299 - * @return void
300 - */
301 - public static function pro_get_started_headline() {
302 - self::review_request();
303 - FrmAppHelper::min_pro_version_notice( '4.0' );
188 + if ( empty( $download_url ) ) {
189 + $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/?utm_source=WordPress&utm_medium=get-started&utm_campaign=liteplugin';
190 + }
191 + }
192 + ?>
193 +<div class="error frm_previous_install">
194 + <?php
195 + echo apply_filters( // WPCS: XSS ok.
196 + 'frm_pro_update_msg',
197 + sprintf(
198 + esc_html__( 'This site has been previously authorized to run Formidable Forms. %1$sInstall Formidable Pro%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable' ),
199 + '<br/><a href="' . esc_url( $inst_install_url ) . '" id="frm_install_link" target="_blank" data-prourl="' . esc_url( $download_url ) . '">',
200 + '</a>',
201 + '<a href="#" class="frm_deauthorize_link">',
202 + '</a>'
203 + ),
204 + esc_url( $inst_install_url )
205 + );
206 + ?>
207 + <div id="frm_install_message" class="hidden frm_hidden"></div>
208 +</div>
209 +<?php
210 + }
211 +
212 + private static function maybe_show_upgrade_bar() {
213 + if ( ! FrmAppHelper::is_formidable_admin() || FrmAppHelper::pro_is_installed() ) {
214 + return;
215 + }
216 +
217 + $affiliate = FrmAppHelper::get_affiliate();
218 + if ( ! empty( $affiliate ) ) {
219 + $tip = FrmTipsHelper::get_banner_tip();
220 + $link = FrmAppHelper::admin_upgrade_link( 'banner' );
221 +?>
222 +<div class="update-nag frm-update-to-pro">
223 + <?php echo FrmAppHelper::kses( $tip['tip'] ); // WPCS: XSS ok. ?>
224 + <span><?php echo FrmAppHelper::kses( $tip['call'] ); // WPCS: XSS ok. ?></span>
225 + <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( $link ) ); ?>" class="button">Upgrade to Pro</a>
226 +</div>
227 +<?php
228 + }
304 229 }
305 230
306 231 /**
307 232 * Add admin notices as needed for reviews
@@ -306,10 +231,8 @@
306 231 /**
307 232 * Add admin notices as needed for reviews
308 233 *
309 234 * @since 3.04.03
310 - *
311 - * @return void
312 235 */
313 236 private static function review_request() {
314 237 $reviews = new FrmReviews();
315 238 $reviews->review_request();
@@ -318,10 +241,8 @@
318 241 /**
319 242 * Save the request to hide the review
320 243 *
321 244 * @since 3.04.03
322 - *
323 - * @return void
324 245 */
325 246 public static function dismiss_review() {
326 247 FrmAppHelper::permission_check( 'frm_change_settings' );
327 248 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -331,32 +252,18 @@
331 252 }
332 253
333 254 /**
334 255 * @since 3.04.02
335 - *
336 - * @return void
337 256 */
338 257 public static function include_upgrade_overlay() {
339 - self::enqueue_dialog_assets();
340 - add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
341 - }
342 -
343 - /**
344 - * Enqueue scripts and styles required for modals.
345 - *
346 - * @since 5.3
347 - *
348 - * @return void
349 - */
350 - public static function enqueue_dialog_assets() {
351 258 wp_enqueue_script( 'jquery-ui-dialog' );
352 259 wp_enqueue_style( 'jquery-ui-dialog' );
260 +
261 + add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
353 262 }
354 263
355 264 /**
356 265 * @since 3.06.03
357 - *
358 - * @return void
359 266 */
360 267 public static function upgrade_overlay_html() {
361 268 $is_pro = FrmAppHelper::pro_is_installed();
362 269 $upgrade_link = array(
@@ -362,96 +269,33 @@
362 269 $upgrade_link = array(
363 270 'medium' => 'builder',
364 271 'content' => 'upgrade',
365 272 );
366 - $default_link = FrmAppHelper::admin_upgrade_link( $upgrade_link );
367 - $plugin_path = FrmAppHelper::plugin_path();
368 - $shared_path = $plugin_path . '/classes/views/shared/';
369 -
370 - include $shared_path . 'upgrade_overlay.php';
371 - include $shared_path . 'confirm-overlay.php';
372 -
373 - if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
374 - self::new_form_overlay_html();
375 - }
273 + include( FrmAppHelper::plugin_path() . '/classes/views/shared/upgrade_overlay.php' );
376 274 }
377 275
378 276 /**
379 - * @return void
277 + * @since 3.04.02
380 278 */
381 - private static function new_form_overlay_html() {
382 - FrmFormsController::before_list_templates();
383 -
384 - $plugin_path = FrmAppHelper::plugin_path();
385 - $path = $plugin_path . '/classes/views/frm-forms/';
386 - $expired = FrmFormsController::expired();
387 - $expiring = FrmAddonsController::is_license_expiring();
388 - $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
389 - $view_path = $path . 'new-form-overlay/';
390 - $modal_class = '';
391 - $upgrade_link = FrmAppHelper::admin_upgrade_link(
392 - array(
393 - 'medium' => 'new-template',
394 - 'content' => 'upgrade',
395 - )
396 - );
397 - $renew_link = FrmAppHelper::admin_upgrade_link(
398 - array(
399 - 'medium' => 'new-template',
400 - 'content' => 'renew',
401 - )
402 - );
403 - $blocks_to_render = array();
404 -
405 - if ( ! FrmAppHelper::pro_is_installed() ) {
406 - // avoid rendering the email and code blocks for users who have upgraded or have a free license already
407 - $api = new FrmFormTemplateApi();
408 - if ( ! $api->has_free_access() ) {
409 - array_push( $blocks_to_render, 'email', 'code' );
410 - }
411 - }
412 -
413 - // avoid rendering the upgrade block for users with elite
414 - if ( 'elite' !== FrmAddonsController::license_type() ) {
415 - $blocks_to_render[] = 'upgrade';
416 - }
417 -
418 - // avoid rendering the renew block for users who are not currently expired
419 - if ( $expired ) {
420 - $blocks_to_render[] = 'renew';
421 - $modal_class = 'frm-expired';
422 - } elseif ( $expiring ) {
423 - $modal_class = 'frm-expiring';
424 - }
425 -
426 - include $path . 'new-form-overlay.php';
279 + public static function remove_upsells() {
280 + remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
281 + remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
427 282 }
428 283
429 284 /**
430 - * @return void
431 - */
432 - public static function include_info_overlay() {
433 - self::enqueue_dialog_assets();
434 - add_action( 'admin_footer', 'FrmAppController::info_overlay_html' );
435 - }
436 -
437 - /**
438 - * @return void
439 - */
440 - public static function info_overlay_html() {
441 - include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php';
442 - }
443 -
444 - /**
445 - * @since 3.04.02
285 + * Don't nag people to install WPForms
446 286 *
447 - * @return void
287 + * @since 3.05
448 288 */
449 - public static function remove_upsells() {
450 - remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
451 - remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
452 - remove_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' );
453 - remove_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
289 + public static function remove_wpforms_nag( $upsell ) {
290 + if ( is_array( $upsell ) ) {
291 + foreach ( $upsell as $k => $plugin ) {
292 + if ( strpos( $plugin['slug'], 'wpforms' ) !== false ) {
293 + unset( $upsell[ $k ] );
294 + }
295 + }
296 + }
297 + return $upsell;
454 298 }
455 299
456 300 /**
457 301 * If there are CURL problems on this server, wp_remote_post won't work for installing
@@ -457,17 +301,12 @@
457 301 * If there are CURL problems on this server, wp_remote_post won't work for installing
458 302 * Use a javascript fallback instead.
459 303 *
460 304 * @since 2.0.3
461 - *
462 - * @return void
463 305 */
464 306 public static function install_js_fallback() {
465 307 FrmAppHelper::load_admin_wide_js();
466 - ?>
467 - <div id="frm_install_message"></div>
468 - <script>jQuery(document).ready( frm_install_now );</script>
469 - <?php
308 + echo '<div id="hidden frm_install_message"></div><script type="text/javascript">jQuery(document).ready(function(){frm_install_now();});</script>';
470 309 }
471 310
472 311 /**
473 312 * Check if the database is outdated
@@ -486,9 +325,8 @@
486 325
487 326 if ( ! $needs_upgrade ) {
488 327 $needs_upgrade = apply_filters( 'frm_db_needs_upgrade', $needs_upgrade );
489 328 }
490 -
491 329 return $needs_upgrade;
492 330 }
493 331
494 332 /**
@@ -494,11 +332,8 @@
494 332 /**
495 333 * Check both version number and DB number for changes
496 334 *
497 335 * @since 3.0.04
498 - *
499 - * @param array $atts
500 - * @return bool
501 336 */
502 337 public static function compare_for_update( $atts ) {
503 338 $db_version = get_option( $atts['option'] );
504 339
@@ -504,12 +339,12 @@
504 339
505 340 if ( strpos( $db_version, '-' ) === false ) {
506 341 $needs_upgrade = true;
507 342 } else {
508 - $last_upgrade = explode( '-', $db_version );
343 + $last_upgrade = explode( '-', $db_version );
509 344 $needs_db_upgrade = (int) $last_upgrade[1] < (int) $atts['new_db_version'];
510 - $new_version = version_compare( $last_upgrade[0], $atts['new_plugin_version'], '<' );
511 - $needs_upgrade = $needs_db_upgrade || $new_version;
345 + $new_version = version_compare( $last_upgrade[0], $atts['new_plugin_version'], '<' );
346 + $needs_upgrade = $needs_db_upgrade || $new_version;
512 347 }
513 348
514 349 return $needs_upgrade;
515 350 }
@@ -517,21 +352,10 @@
517 352 /**
518 353 * Check for database update and trigger js loading
519 354 *
520 355 * @since 2.0.1
521 - *
522 - * @return void
523 356 */
524 357 public static function admin_init() {
525 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
526 - FrmFormsController::duplicate();
527 - }
528 -
529 - if ( FrmAppHelper::is_style_editor_page() && 'save' === FrmAppHelper::get_param( 'frm_action' ) ) {
530 - // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
531 - FrmStylesController::save_style();
532 - }
533 -
534 358 new FrmPersonalData(); // register personal data hooks
535 359
536 360 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
537 361 self::network_upgrade_site();
@@ -536,116 +360,22 @@
536 360 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
537 361 self::network_upgrade_site();
538 362 }
539 363
540 - if ( ! FrmAppHelper::doing_ajax() ) {
364 + $action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
365 + if ( ! FrmAppHelper::doing_ajax() || $action == 'frm_import_choices' ) {
541 366 // don't continue during ajax calls
542 367 self::admin_js();
543 368 }
544 -
545 - if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
546 - $action = FrmAppHelper::get_param( 'frm_action' );
547 -
548 - if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
549 - wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
550 - exit;
551 - }
552 -
553 - FrmInbox::maybe_disable_screen_options();
554 - }
555 -
556 - self::maybe_add_ip_warning();
557 369 }
558 370
559 - /**
560 - * Show a warning for the IP address setting if it hasn't been set.
561 - *
562 - * @since 6.1
563 - *
564 - * @return void
565 - */
566 - private static function maybe_add_ip_warning() {
567 - $settings = FrmAppHelper::get_settings();
568 - if ( false !== $settings->custom_header_ip ) {
569 - // The setting has been changed from the false default (to either 1 or 0), so stop showing the message.
570 - return;
571 - }
371 + public static function admin_js() {
372 + $version = FrmAppHelper::plugin_version();
373 + FrmAppHelper::load_admin_wide_js( false );
572 374
573 - if ( ! self::is_behind_proxy() ) {
574 - // This message is only applicable when using a reverse proxy.
575 - return;
576 - }
577 -
578 - if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) {
579 - // Avoid the message on a POST action. We don't want to show the message if we're saving global settings.
580 - return;
581 - }
582 -
583 - $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
584 - $message = sprintf(
585 - // Translators: 1: Global Settings Link
586 - __( 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to %1$s and enabling the "Use custom headers when retrieving IPs with form submissions." setting.', 'formidable' ),
587 - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>'
588 - );
589 - $option_name = 'frm_dismiss_ip_address_notice';
590 - FrmAppHelper::add_dismissable_warning_message( $message, $option_name );
591 - }
592 -
593 - /**
594 - * Check if any reverse proxy headers are set.
595 - *
596 - * @since 6.1
597 - *
598 - * @return bool
599 - */
600 - private static function is_behind_proxy() {
601 - $custom_headers = FrmAppHelper::get_custom_header_keys_for_ip();
602 - foreach ( $custom_headers as $header ) {
603 - if ( 'REMOTE_ADDR' === $header ) {
604 - // We want to check every key but REMOTE_ADDR. REMOTE_ATTR is not unique to reverse proxy servers.
605 - continue;
606 - }
607 -
608 - $ip = trim( FrmAppHelper::get_server_value( $header ) );
609 - // Return true for anything that isn't empty but ignoring values like ::1.
610 - if ( $ip && 0 !== strpos( $ip, '::' ) ) {
611 - return true;
612 - }
613 - }
614 -
615 - return false;
616 - }
617 -
618 - /**
619 - * @return void
620 - */
621 - public static function admin_js() {
622 - $plugin_url = FrmAppHelper::plugin_url();
623 - $version = FrmAppHelper::plugin_version();
624 -
625 - FrmAppHelper::load_admin_wide_js();
626 -
627 - wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
628 - wp_enqueue_style( 'formidable_admin_global' );
629 -
630 - wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
631 - wp_register_style( 'formidable-grids', $plugin_url . '/css/frm_grids.css', array(), $version );
632 -
633 - wp_register_script( 'formidable_dom', $plugin_url . '/js/admin/dom.js', array( 'jquery', 'jquery-ui-dialog', 'wp-i18n' ), $version, true );
634 - wp_register_script( 'formidable_embed', $plugin_url . '/js/admin/embed.js', array( 'formidable_dom', 'jquery-ui-autocomplete' ), $version, true );
635 - self::register_popper1();
636 - wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
637 - wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
638 -
639 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
640 -
641 - if ( 'formidable-applications' === $page ) {
642 - FrmApplicationsController::load_assets();
643 - return;
644 - }
645 -
646 - $dependencies = array(
375 + $dependecies = array(
647 376 'formidable_admin_global',
377 + 'formidable',
648 378 'jquery',
649 379 'jquery-ui-core',
650 380 'jquery-ui-draggable',
651 381 'jquery-ui-sortable',
@@ -650,195 +380,81 @@
650 380 'jquery-ui-draggable',
651 381 'jquery-ui-sortable',
652 382 'bootstrap_tooltip',
653 383 'bootstrap-multiselect',
654 - 'wp-i18n',
655 - 'wp-hooks', // Required in WP versions older than 5.7
656 - 'formidable_dom',
657 - 'formidable_embed',
658 384 );
659 385
660 - if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
661 - // We only need to load the color picker when editing styles.
662 - $dependencies[] = 'wp-color-picker';
386 + if ( FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
387 + $dependecies[] = 'wp-color-picker';
663 388 }
664 389
665 - wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', $dependencies, $version, true );
390 + wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true );
391 + wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
392 + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
393 + wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
666 394
667 - if ( FrmAppHelper::on_form_listing_page() ) {
668 - // For the existing page dropdown in the Form embed modal.
669 - wp_enqueue_script( 'jquery-ui-autocomplete' );
670 - }
395 + // load multselect js
396 + wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
671 397
672 - wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true );
673 -
398 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
674 399 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
675 400
676 401 global $pagenow;
677 - if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
402 + if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
678 403
679 - wp_enqueue_script( 'admin-widgets' );
680 - wp_enqueue_style( 'widgets' );
681 - self::maybe_deregister_popper2();
682 - wp_enqueue_script( 'formidable_admin' );
683 - wp_enqueue_script( 'formidable_embed' );
404 + wp_enqueue_script( 'admin-widgets' );
405 + wp_enqueue_style( 'widgets' );
406 + wp_enqueue_script( 'formidable' );
407 + wp_enqueue_script( 'formidable_admin' );
684 408 FrmAppHelper::localize_script( 'admin' );
685 409
686 410 wp_enqueue_style( 'formidable-admin' );
687 - if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
411 + if ( 'formidable-styles' !== $page ) {
688 412 wp_enqueue_style( 'formidable-grids' );
689 413 wp_enqueue_style( 'formidable-dropzone' );
414 + add_thickbox();
690 415 } else {
691 - wp_enqueue_style( 'formidable-grids' );
416 + $settings = FrmAppHelper::get_settings();
417 + if ( empty( $settings->old_css ) ) {
418 + wp_enqueue_style( 'formidable-grids' );
419 + }
692 420 }
693 421
694 - if ( 'formidable-entries' === $page ) {
695 - // Load front end js for entries.
696 - wp_enqueue_script( 'formidable' );
697 - }
422 + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
698 423
699 424 do_action( 'frm_enqueue_builder_scripts' );
700 - self::include_upgrade_overlay();
701 - self::include_info_overlay();
702 - } elseif ( FrmAppHelper::is_view_builder_page() ) {
703 - if ( isset( $_REQUEST['post_type'] ) ) {
704 - $post_type = sanitize_title( wp_unslash( $_REQUEST['post_type'] ) );
705 - } elseif ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
706 - $post = get_post( absint( wp_unslash( $_REQUEST['post'] ) ) );
707 - if ( ! $post ) {
708 - return;
709 - }
710 - $post_type = $post->post_type;
711 - } else {
712 - return;
713 - }
425 + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
426 + if ( isset( $_REQUEST['post_type'] ) ) {
427 + $post_type = sanitize_title( $_REQUEST['post_type'] );
428 + } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
429 + $post = get_post( absint( $_REQUEST['post'] ) );
430 + if ( ! $post ) {
431 + return;
432 + }
433 + $post_type = $post->post_type;
434 + } else {
435 + return;
436 + }
714 437
715 - if ( $post_type === 'frm_display' ) {
716 - self::enqueue_legacy_views_assets();
717 - }
718 - }
438 + if ( $post_type == 'frm_display' ) {
439 + wp_enqueue_script( 'jquery-ui-draggable' );
440 + wp_enqueue_script( 'formidable_admin' );
441 + wp_enqueue_style( 'formidable-admin' );
442 + FrmAppHelper::localize_script( 'admin' );
443 + }
444 + } else if ( $pagenow == 'widgets.php' ) {
445 + FrmAppHelper::load_admin_wide_js();
446 + }
447 + }
719 448
720 - self::maybe_force_formidable_block_on_gutenberg_page();
721 - }
449 + public static function load_lang() {
450 + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
451 + }
722 452
723 453 /**
724 - * Enqueue required assets for the Legacy Views editor (Views v4.x).
725 - *
726 - * @since 6.1.2
727 - *
728 - * @return void
729 - */
730 - private static function enqueue_legacy_views_assets() {
731 - wp_enqueue_style( 'formidable-grids' );
732 - wp_enqueue_script( 'jquery-ui-draggable' );
733 - self::maybe_deregister_popper2();
734 - wp_enqueue_script( 'formidable_admin' );
735 - wp_add_inline_style(
736 - 'formidable-admin',
737 - '
738 - .frm-white-body.post-type-frm_display .columns-2 {
739 - display: block;
740 - overflow: visible;
741 - }
742 -
743 - .frm-white-body.post-type-frm_display .columns-2 > div {
744 - overflow-y: hidden;
745 - }
746 -
747 - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text {
748 - padding: 3px 0 0 10px;
749 - }
750 -
751 - .post-type-frm_display #field-search-input,
752 - .post-type-frm_display #advanced-search-input {
753 - flex: 1;
754 - }
755 - '
756 - );
757 - wp_enqueue_style( 'formidable-admin' );
758 - FrmAppHelper::localize_script( 'admin' );
759 - self::include_info_overlay();
760 - }
761 -
762 - /**
763 - * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459.
764 - *
765 - * @since 5.2.02.01
766 - *
767 - * @return void
768 - */
769 - private static function maybe_deregister_popper2() {
770 - global $wp_scripts;
771 -
772 - if ( ! array_key_exists( 'popper', $wp_scripts->registered ) ) {
773 - return;
774 - }
775 -
776 - $popper = $wp_scripts->registered['popper'];
777 - if ( version_compare( $popper->ver, '2.0', '>=' ) ) {
778 - wp_deregister_script( 'popper' );
779 - self::register_popper1();
780 - }
781 - }
782 -
783 - /**
784 - * Register Popper required for Bootstrap 4.
785 - *
786 - * @since 5.2.02.01
787 - *
788 - * @return void
789 - */
790 - private static function register_popper1() {
791 - wp_register_script( 'popper', FrmAppHelper::plugin_url() . '/js/popper.min.js', array( 'jquery' ), '1.16.0', true );
792 - }
793 -
794 - /**
795 - * Automatically insert a Formidable block when loading Gutenberg when $_GET['frmForm' is set.
796 - *
797 - * @since 5.2
798 - *
799 - * @return void
800 - */
801 - private static function maybe_force_formidable_block_on_gutenberg_page() {
802 - global $pagenow;
803 - if ( 'post.php' !== $pagenow ) {
804 - return;
805 - }
806 -
807 - $form_id = FrmAppHelper::simple_get( 'frmForm', 'absint' );
808 - if ( ! $form_id ) {
809 - return;
810 - }
811 -
812 - self::add_js_to_inject_gutenberg_block( 'formidable/simple-form', 'formId', $form_id );
813 - }
814 -
815 - /**
816 - * @since 5.3
817 - *
818 - * @param string $block_name
819 - * @param string $object_key
820 - * @param array|string $object_id
821 - *
822 - * @return void
823 - */
824 - public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
825 - require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
826 - }
827 -
828 - /**
829 - * @return void
830 - */
831 - public static function load_lang() {
832 - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
833 - }
834 -
835 - /**
836 454 * Check if the styles are updated when a form is loaded on the front-end
837 455 *
838 456 * @since 3.0.1
839 - *
840 - * @return void
841 457 */
842 458 public static function maybe_update_styles() {
843 459 if ( self::needs_update() ) {
844 460 self::network_upgrade_site();
@@ -846,40 +462,18 @@
846 462 }
847 463
848 464 /**
849 465 * @since 3.0
850 - *
851 - * @return void
852 466 */
853 467 public static function create_rest_routes() {
854 468 $args = array(
855 469 'methods' => 'GET',
856 470 'callback' => 'FrmAppController::api_install',
857 - 'permission_callback' => __CLASS__ . '::can_update_db',
858 471 );
859 -
860 472 register_rest_route( 'frm-admin/v1', '/install', $args );
861 -
862 - $args = array(
863 - 'methods' => 'GET',
864 - 'callback' => 'FrmAddonsController::install_addon_api',
865 - 'permission_callback' => 'FrmAddonsController::can_install_addon_api',
866 - );
867 -
868 - register_rest_route( 'frm-admin/v1', '/install-addon', $args );
869 473 }
870 474
871 475 /**
872 - * Make sure the install is only being run when we tell it to.
873 - * We don't want to run manually by people calling the API.
874 - *
875 - * @since 4.06.02
876 - */
877 - public static function can_update_db() {
878 - return get_transient( 'frm_updating_api' );
879 - }
880 -
881 - /**
882 476 * Run silent upgrade on each site in the network during a network upgrade.
883 477 * Update database settings for all sites in a network during network upgrade process.
884 478 *
885 479 * @since 2.0.1
@@ -884,18 +478,13 @@
884 478 *
885 479 * @since 2.0.1
886 480 *
887 481 * @param int $blog_id Blog ID.
888 - *
889 - * @return void
890 482 */
891 483 public static function network_upgrade_site( $blog_id = 0 ) {
892 - // Flag to check if install is happening as intended.
893 - set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS );
484 +
894 485 $request = new WP_REST_Request( 'GET', '/frm-admin/v1/install' );
895 486
896 - self::maybe_add_wp_site_health();
897 -
898 487 if ( $blog_id ) {
899 488 switch_to_blog( $blog_id );
900 489 $response = rest_do_request( $request );
901 490 restore_current_blog();
@@ -909,29 +498,11 @@
909 498 }
910 499 }
911 500
912 501 /**
913 - * Make sure WP_Site_Health has been included because it is required when calling rest_do_request.
914 - * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2.
915 - *
916 - * @return void
917 - */
918 - private static function maybe_add_wp_site_health() {
919 - if ( ! class_exists( 'WP_Site_Health' ) ) {
920 - $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
921 - if ( file_exists( $wp_site_health_path ) ) {
922 - require_once $wp_site_health_path;
923 - }
924 - }
925 - }
926 -
927 - /**
928 502 * @since 3.0
929 - *
930 - * @return true
931 503 */
932 504 public static function api_install() {
933 - delete_transient( 'frm_updating_api' );
934 505 if ( self::needs_update() ) {
935 506 $running = get_option( 'frm_install_running' );
936 507 if ( false === $running || $running < strtotime( '-5 minutes' ) ) {
937 508 update_option( 'frm_install_running', time(), 'no' );
@@ -938,9 +509,8 @@
938 509 self::install();
939 510 delete_option( 'frm_install_running' );
940 511 }
941 512 }
942 -
943 513 return true;
944 514 }
945 515
946 516 /**
@@ -947,114 +517,108 @@
947 517 * Silent database upgrade (no redirect).
948 518 * Called via ajax request during network upgrade process.
949 519 *
950 520 * @since 2.0.1
951 - *
952 - * @return void
953 521 */
954 522 public static function ajax_install() {
955 - FrmAppHelper::permission_check( 'frm_change_settings' );
956 - check_ajax_referer( 'frm_ajax', 'nonce' );
957 523 self::api_install();
958 524 wp_die();
959 525 }
960 526
961 - /**
962 - * @return void
963 - */
964 - public static function install() {
965 - $frmdb = new FrmMigrate();
966 - $frmdb->upgrade();
967 - }
527 + public static function install() {
528 + $frmdb = new FrmMigrate();
529 + $frmdb->upgrade();
530 + }
968 531
969 - /**
970 - * @return void
971 - */
972 - public static function uninstall() {
532 + public static function uninstall() {
973 533 FrmAppHelper::permission_check( 'administrator' );
974 - check_ajax_referer( 'frm_ajax', 'nonce' );
534 + check_ajax_referer( 'frm_ajax', 'nonce' );
975 535
976 536 $frmdb = new FrmMigrate();
977 537 $frmdb->uninstall();
978 538
979 539 //disable the plugin and redirect after uninstall so the tables don't get added right back
980 - $plugins = array( FrmAppHelper::plugin_folder() . '/formidable.php', 'formidable-pro/formidable-pro.php' );
981 - deactivate_plugins( $plugins, false, false );
540 + deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
982 541 echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
983 542
984 - wp_die();
985 - }
543 + wp_die();
544 + }
986 545
987 - public static function drop_tables( $tables ) {
988 - global $wpdb;
989 - $tables[] = $wpdb->prefix . 'frm_fields';
990 - $tables[] = $wpdb->prefix . 'frm_forms';
991 - $tables[] = $wpdb->prefix . 'frm_items';
992 - $tables[] = $wpdb->prefix . 'frm_item_metas';
546 + public static function drop_tables( $tables ) {
547 + global $wpdb;
548 + $tables[] = $wpdb->prefix . 'frm_fields';
549 + $tables[] = $wpdb->prefix . 'frm_forms';
550 + $tables[] = $wpdb->prefix . 'frm_items';
551 + $tables[] = $wpdb->prefix . 'frm_item_metas';
552 + return $tables;
553 + }
993 554
994 - return $tables;
995 - }
996 -
997 - /**
998 - * @return void
999 - */
1000 - public static function deauthorize() {
555 + public static function deauthorize() {
1001 556 FrmAppHelper::permission_check( 'frm_change_settings' );
1002 - check_ajax_referer( 'frm_ajax', 'nonce' );
557 + check_ajax_referer( 'frm_ajax', 'nonce' );
1003 558
1004 - delete_option( 'frmpro-credentials' );
1005 - delete_option( 'frmpro-authorized' );
1006 - delete_site_option( 'frmpro-credentials' );
1007 - delete_site_option( 'frmpro-authorized' );
1008 - wp_die();
1009 - }
559 + delete_option( 'frmpro-credentials' );
560 + delete_option( 'frmpro-authorized' );
561 + delete_site_option( 'frmpro-credentials' );
562 + delete_site_option( 'frmpro-authorized' );
563 + wp_die();
564 + }
1010 565
1011 566 public static function set_footer_text( $text ) {
1012 567 if ( FrmAppHelper::is_formidable_admin() ) {
1013 - $text = '';
568 + $link = FrmAppHelper::admin_upgrade_link( 'footer' );
569 + $text = sprintf(
570 + __( 'Help us spread the %1$sFormidable Forms%2$s love with %3$s %5$s on WordPress.org%4$s. Thank you heaps!', 'formidable' ),
571 + '<a href="' . esc_url( FrmAppHelper::make_affiliate_url( $link ) ) . '" target="_blank">',
572 + '</a>',
573 + '<a href="https://wordpress.org/support/plugin/formidable/reviews/?filter=5#new-post" target="_blank">',
574 + '</a>',
575 + '&#9733;&#9733;&#9733;&#9733;&#9733;'
576 + );
577 + $text = '<span id="footer-thankyou">' . $text . '</span>';
1014 578 }
1015 -
1016 579 return $text;
1017 580 }
1018 581
1019 582 /**
1020 - * @deprecated 3.0.04
1021 - *
583 + * @deprecated 1.07.05
1022 584 * @codeCoverageIgnore
1023 - *
1024 - * @return void
1025 585 */
1026 - public static function activation_install() {
1027 - FrmDeprecated::activation_install();
586 + public static function get_form_shortcode( $atts ) {
587 + return FrmDeprecated::get_form_shortcode( $atts );
588 + }
589 +
590 + /**
591 + * @deprecated 2.5.4
592 + * @codeCoverageIgnore
593 + */
594 + public static function widget_text_filter( $content ) {
595 + return FrmDeprecated::widget_text_filter( $content );
1028 596 }
1029 597
1030 598 /**
1031 - * @deprecated 3.0
599 + * Deprecated in favor of wpmu_upgrade_site
600 + *
601 + * @deprecated 2.3
1032 602 * @codeCoverageIgnore
1033 603 */
1034 - public static function page_route( $content ) {
1035 - return FrmDeprecated::page_route( $content );
604 + public static function front_head() {
605 + FrmDeprecated::front_head();
1036 606 }
1037 607
608 +
1038 609 /**
1039 - * Include icons on page for Embed Form modal.
1040 - *
1041 - * @since 5.2
1042 - *
1043 - * @return void
610 + * @deprecated 3.0.04
611 + * @codeCoverageIgnore
1044 612 */
1045 - public static function include_embed_form_icons() {
1046 - _deprecated_function( __METHOD__, '5.3' );
613 + public static function activation_install() {
614 + FrmDeprecated::activation_install();
1047 615 }
1048 616
1049 617 /**
1050 - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
618 + * @deprecated 3.0
1051 619 * @codeCoverageIgnore
1052 - *
1053 - * @param array $atts
1054 - * @return string
1055 620 */
1056 - public static function get_form_shortcode( $atts ) {
1057 - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1058 - return FrmFormsController::get_form_shortcode( $atts );
621 + public static function page_route( $content ) {
622 + return FrmDeprecated::page_route( $content );
1059 623 }
1060 624 }