PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.26.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.26.1
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
formidable / classes / controllers / FrmDeactivationFeedbackController.php

FrmDeactivationFeedbackController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.26.1, at classes/controllers/FrmDeactivationFeedbackController.php

136 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Deactivation feedback controller
4 *
5 * @package Formidable
6 *
7 * @since 6.15
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 die( 'You are not allowed to call this page directly.' );
12 }
13
14 /**
15 * Class FrmDeactivationFeedbackController
16 */
17 class FrmDeactivationFeedbackController {
18
19 /**
20 * Checks if is plugins page.
21 *
22 * @return bool
23 */
24 private static function is_plugins_page() {
25 return 'plugins' === get_current_screen()->id;
26 }
27
28 /**
29 * Checks if feedback is expired.
30 *
31 * @return bool
32 */
33 private static function feedback_is_expired() {
34 $feedback_expired = get_option( 'frm_feedback_expired' );
35
36 if ( ! $feedback_expired ) {
37 return true;
38 }
39
40 $expired_date = strtotime( $feedback_expired );
41
42 if ( ! $expired_date ) {
43 return true;
44 }
45
46 return $expired_date < time();
47 }
48
49 /**
50 * Sets feedback expired date.
51 *
52 * @param string $plugin Path to the plugin file relative to the plugins directory.
53 *
54 * @return void
55 */
56 public static function set_feedback_expired_date( $plugin ) {
57 if ( empty( $_GET['frm_feedback_submitted'] ) ) {
58 return;
59 }
60
61 if ( ! strpos( $plugin, 'formidable.php' ) && ! strpos( $plugin, 'formidable-pro.php' ) ) {
62 return;
63 }
64 update_option( 'frm_feedback_expired', gmdate( 'Y-m-d', strtotime( '+ 1 day' ) ) );
65 }
66
67 /**
68 * Enqueues assets.
69 *
70 * @return void
71 */
72 public static function enqueue_assets() {
73 if ( ! self::is_plugins_page() || ! self::feedback_is_expired() ) {
74 return;
75 }
76
77 wp_enqueue_script(
78 'frm-deactivation-feedback',
79 FrmAppHelper::plugin_url() . '/js/admin/deactivation-feedback.js',
80 array( 'formidable', 'formidable_dom', 'jquery' ),
81 FrmAppHelper::plugin_version(),
82 true
83 );
84
85 wp_enqueue_style( 'formidable-admin' );
86
87 wp_enqueue_style(
88 'frm-deactivation-feedback',
89 FrmAppHelper::plugin_url() . '/css/admin/deactivation-feedback.css',
90 array( 'formidable-admin' ),
91 FrmAppHelper::plugin_version()
92 );
93
94 FrmAppHelper::localize_script( 'front' );
95
96 wp_localize_script(
97 'frm-deactivation-feedback',
98 'FrmDeactivationFeedbackI18n',
99 array(
100 'skip_text' => __( 'Skip & Deactivate', 'formidable' ),
101 )
102 );
103 }
104
105 /**
106 * Prints footer HTML.
107 *
108 * @return void
109 */
110 public static function footer_html() {
111 if ( ! self::is_plugins_page() || ! self::feedback_is_expired() ) {
112 return;
113 }
114 ?>
115 <div id="frm-deactivation-modal" style="display: none;">
116 <div class="metabox-holder">
117 <div class="postbox">
118 <a class="frm-modal-close dismiss" title="<?php esc_attr_e( 'Close', 'formidable' ); ?>">
119 <svg class="frmsvg" id="frm_close_icon" viewBox="0 0 20 20" width="18px" height="18px" aria-label="<?php esc_attr_e( 'Close', 'formidable' ); ?>">
120 <path d="M16.8 4.5l-1.3-1.3L10 8.6 4.5 3.2 3.2 4.5 8.6 10l-5.4 5.5 1.3 1.3 5.5-5.4 5.5 5.4 1.3-1.3-5.4-5.5 5.4-5.5z"/>
121 </svg>
122 </a>
123
124 <div class="inside">
125 <img id="frm-deactivation-modal-icon" class="frmsvg" src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/logo.svg' ); ?>" alt="" />
126 <div id="frm-deactivation-form-wrapper" class="frmapi-form">
127 <span class="frm-wait frm_visible_spinner"></span>
128 </div>
129 </div>
130 </div>
131 </div>
132 </div><!-- End #frm-deactivation-popup -->
133 <?php
134 }
135 }
136