PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.0.5
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.0.5
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / admin / class-evf-admin.php
everest-forms / includes / admin Last commit date
builder 1 year ago form-migrator 2 years ago plugin-updates 8 years ago settings 1 year ago views 1 year ago class-evf-admin-addons.php 2 years ago class-evf-admin-assets.php 1 year ago class-evf-admin-builder.php 8 years ago class-evf-admin-dashboard.php 2 years ago class-evf-admin-deactivation-feedback.php 3 years ago class-evf-admin-editor.php 4 years ago class-evf-admin-embed-wizard.php 2 years ago class-evf-admin-entries-table-list.php 2 years ago class-evf-admin-entries.php 2 years ago class-evf-admin-form-templates.php 1 year ago class-evf-admin-forms-table-list.php 2 years ago class-evf-admin-forms.php 2 years ago class-evf-admin-import-export.php 4 years ago class-evf-admin-menus.php 2 years ago class-evf-admin-notices.php 1 year ago class-evf-admin-preview-confirmation.php 1 year ago class-evf-admin-settings.php 1 year ago class-evf-admin-tools.php 2 years ago class-evf-admin-welcome.php 2 years ago class-evf-admin.php 2 years ago evf-admin-functions.php 1 year ago
class-evf-admin.php
246 lines
1 <?php
2 /**
3 * EverestForms Admin
4 *
5 * @package EverestForms\Admin
6 * @version 1.0.0
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * EVF_Admin class.
13 */
14 class EVF_Admin {
15
16 /**
17 * Constructor.
18 */
19 public function __construct() {
20 add_action( 'init', array( $this, 'includes' ) );
21 add_action( 'admin_init', array( $this, 'buffer' ), 1 );
22 add_action( 'admin_init', array( $this, 'addon_actions' ) );
23 add_action( 'admin_init', array( $this, 'template_actions' ) );
24 add_action( 'admin_init', array( $this, 'admin_redirects' ) );
25 add_action( 'admin_footer', 'evf_print_js', 25 );
26 add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
27 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
28 }
29
30 /**
31 * Output buffering allows admin screens to make redirects later on.
32 */
33 public function buffer() {
34 ob_start();
35 }
36
37 /**
38 * Include any classes we need within admin.
39 */
40 public function includes() {
41 include_once __DIR__ . '/evf-admin-functions.php';
42 include_once __DIR__ . '/class-evf-admin-menus.php';
43 include_once __DIR__ . '/class-evf-admin-notices.php';
44 include_once __DIR__ . '/class-evf-admin-assets.php';
45 include_once __DIR__ . '/class-evf-admin-editor.php';
46 include_once __DIR__ . '/class-evf-admin-forms.php';
47 include_once __DIR__ . '/class-evf-admin-entries.php';
48 include_once __DIR__ . '/class-evf-admin-import-export.php';
49 include_once __DIR__ . '/class-evf-admin-deactivation-feedback.php';
50
51 // Setup/welcome.
52 if ( ! empty( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
53 switch ( $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification
54 case 'evf-dashboard':
55 include_once __DIR__ . '/class-evf-admin-dashboard.php';
56 break;
57 }
58 }
59
60 include_once __DIR__ . '/form-migrator/abstract-evf-form-migrator.php';
61 include_once __DIR__ . '/form-migrator/class-evf-fm-contactform7.php';
62 include_once __DIR__ . '/form-migrator/class-evf-fm-wpforms.php';
63 }
64
65 /**
66 * Handle redirects after addon activate/deactivate.
67 */
68 public function addon_actions() {
69 if ( isset( $_GET['page'], $_REQUEST['action'] ) && 'evf-addons' === $_GET['page'] ) {
70 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
71 $plugin = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : false;
72
73 if ( 'evf-addons-refresh' === $action ) {
74 if ( empty( $_GET['evf-addons-nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['evf-addons-nonce'] ) ), 'refresh' ) ) {
75 wp_die( esc_html_e( 'Could not verify nonce', 'everest-forms' ) );
76 }
77 foreach ( array( 'evf_pro_license_plan', 'evf_addons_sections_list', 'evf_extensions_section_list' ) as $transient ) {
78 delete_transient( $transient );
79 }
80 }
81
82 if ( $plugin && in_array( $action, array( 'activate', 'deactivate' ), true ) ) {
83
84 if ( 'activate' === $action ) {
85 if ( ! current_user_can( 'activate_plugin', $plugin ) ) {
86 wp_die( esc_html__( 'Sorry, you are not allowed to activate this plugin.', 'everest-forms' ) );
87 }
88
89 check_admin_referer( 'activate-plugin_' . $plugin );
90
91 activate_plugin( $plugin );
92 } elseif ( 'deactivate' === $action ) {
93 if ( ! current_user_can( 'deactivate_plugins' ) ) {
94 wp_die( esc_html__( 'Sorry, you are not allowed to deactivate plugins for this site.', 'everest-forms' ) );
95 }
96
97 check_admin_referer( 'deactivate-plugin_' . $plugin );
98
99 deactivate_plugins( $plugin );
100 $evf_stats_report_cron = new EVF_Report_Cron();
101 $evf_stats_report_cron->deactivate();
102
103 }
104 }
105
106 // Redirect to the add-ons page.
107 wp_safe_redirect( admin_url( 'admin.php?page=evf-addons' ) );
108 exit;
109 }
110 }
111
112 /**
113 * Handle redirects after template refresh.
114 */
115 public function template_actions() {
116 if ( isset( $_GET['page'], $_REQUEST['action'] ) && 'evf-builder' === $_GET['page'] ) {
117 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
118 $templates = EVF_Admin_Form_Templates::get_template_data();
119 $templates = is_array( $templates ) ? $templates : array();
120 if ( 'evf-template-refresh' === $action ) {
121 if ( empty( $_GET['evf-template-nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['evf-template-nonce'] ) ), 'refresh' ) ) {
122 wp_die( esc_html_e( 'Could not verify nonce', 'everest-forms' ) );
123 }
124
125 foreach ( array( 'evf_pro_license_plan', 'evf_template_sections', 'evf_template_section', 'evf_template_section_list' ) as $transient ) {
126 delete_transient( $transient );
127 }
128
129 // Redirect to the builder page normally.
130 wp_safe_redirect( admin_url( 'admin.php?page=evf-builder&create-form=1' ) );
131 exit;
132 }
133 }
134 }
135
136 /**
137 * Handle redirects to setup/dashboard page after install and updates.
138 *
139 * For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
140 */
141 public function admin_redirects() {
142 // Nonced plugin install redirects (whitelisted).
143 if ( ! empty( $_GET['evf-install-plugin-redirect'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
144 $plugin_slug = evf_clean( esc_url_raw( wp_unslash( $_GET['evf-install-plugin-redirect'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.
145
146 $url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug );
147 wp_safe_redirect( $url );
148 exit;
149 }
150
151 // Setup wizard redirect.
152 if ( get_transient( '_evf_activation_redirect' ) && apply_filters( 'everest_forms_show_dashboard_page', true ) ) {
153 $do_redirect = true;
154 $current_page = isset( $_GET['page'] ) ? evf_clean( sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification
155
156 // On these pages, or during these events, postpone the redirect.
157 if ( wp_doing_ajax() || is_network_admin() || ! current_user_can( 'manage_everest_forms' ) ) {
158 $do_redirect = false;
159 }
160
161 // On these pages, or during these events, disable the redirect.
162 if ( 'evf-dashboard' === $current_page || EVF_Admin_Notices::has_notice( 'install' ) || apply_filters( 'everest_forms_prevent_automatic_wizard_redirect', false ) || isset( $_GET['activate-multi'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
163 delete_transient( '_evf_activation_redirect' );
164 $do_redirect = false;
165 }
166
167 if ( $do_redirect ) {
168 delete_transient( '_evf_activation_redirect' );
169 wp_safe_redirect( admin_url( 'admin.php?page=evf-dashboard' ) );
170 exit;
171 }
172 }
173 }
174
175 /**
176 * Change the admin footer text on EverestForms admin pages.
177 *
178 * @since 1.0.0
179 * @param string $footer_text Footer text.
180 * @return string
181 */
182 public function admin_footer_text( $footer_text ) {
183 if ( ! current_user_can( 'manage_everest_forms' ) || ! function_exists( 'evf_get_screen_ids' ) ) {
184 return $footer_text;
185 }
186 $current_screen = get_current_screen();
187
188 // Removing footer text from builder page.
189 if ( 'everest-forms_page_evf-builder' === $current_screen->id && isset( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
190 add_filter(
191 'update_footer',
192 function () {
193 return '';
194 }
195 );
196 return '';
197 }
198
199 $evf_pages = evf_get_screen_ids();
200 // Check to make sure we're on a EverestForms admin page.
201 if ( isset( $current_screen->id ) && apply_filters( 'everest_forms_display_admin_footer_text', in_array( $current_screen->id, $evf_pages, true ) ) ) {
202 // Change the footer text.
203 if ( ! get_option( 'everest_forms_admin_footer_text_rated' ) ) {
204 $footer_text = sprintf(
205 /* translators: 1: EverestForms 2:: five stars */
206 esc_html__( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'everest-forms' ),
207 sprintf( '<strong>%s</strong>', esc_html__( 'Everest Forms', 'everest-forms' ) ),
208 '<a href="https://wordpress.org/support/plugin/everest-forms/reviews?rate=5#new-post" target="_blank" class="evf-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'everest-forms' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
209 );
210 evf_enqueue_js(
211 "
212 jQuery( 'a.evf-rating-link' ).on( 'click', function() {
213 jQuery.post( '" . evf()->ajax_url() . "', { action: 'everest_forms_rated' } );
214 jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
215 });
216 "
217 );
218 } else {
219 $footer_text = esc_html__( 'Thank you for creating with Everest Forms.', 'everest-forms' );
220 }
221 }
222
223 return $footer_text;
224 }
225
226 /**
227 * Add body classes for Everest builder.
228 *
229 * @param array $classes Admin body classes.
230 * @return array
231 */
232 public function admin_body_class( $classes ) {
233 $screen = get_current_screen();
234 $screen_id = $screen ? $screen->id : '';
235
236 // Check to make sure we're on a EverestForms builder page.
237 if ( ( isset( $_GET['form_id'] ) || isset( $_GET['create-form'] ) ) && in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) ) { // phpcs:ignore WordPress.Security.NonceVerification
238 $classes = isset( $_GET['form_id'] ) ? 'everest-forms-builder' : 'everest-forms-builder-setup'; // phpcs:ignore WordPress.Security.NonceVerification
239 }
240
241 return $classes;
242 }
243 }
244
245 return new EVF_Admin();
246