PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 1.3.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v1.3.3
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 7 years ago plugin-updates 8 years ago settings 7 years ago views 7 years ago class-evf-admin-addons.php 8 years ago class-evf-admin-assets.php 7 years ago class-evf-admin-builder.php 8 years ago class-evf-admin-editor.php 8 years ago class-evf-admin-entries-table-list.php 7 years ago class-evf-admin-entries.php 7 years ago class-evf-admin-forms-table-list.php 7 years ago class-evf-admin-forms.php 8 years ago class-evf-admin-menus.php 7 years ago class-evf-admin-notices.php 7 years ago class-evf-admin-settings.php 7 years ago class-evf-admin-status.php 8 years ago class-evf-admin.php 8 years ago evf-admin-functions.php 7 years ago
class-evf-admin.php
183 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, 'admin_redirects' ) );
24 add_action( 'admin_footer', 'evf_print_js', 25 );
25 add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
26 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
27 }
28
29 /**
30 * Output buffering allows admin screens to make redirects later on.
31 */
32 public function buffer() {
33 ob_start();
34 }
35
36 /**
37 * Include any classes we need within admin.
38 */
39 public function includes() {
40 include_once dirname( __FILE__ ) . '/evf-admin-functions.php';
41 include_once dirname( __FILE__ ) . '/class-evf-admin-menus.php';
42 include_once dirname( __FILE__ ) . '/class-evf-admin-notices.php';
43 include_once dirname( __FILE__ ) . '/class-evf-admin-assets.php';
44 include_once dirname( __FILE__ ) . '/class-evf-admin-editor.php';
45 include_once dirname( __FILE__ ) . '/class-evf-admin-forms.php';
46 include_once dirname( __FILE__ ) . '/class-evf-admin-entries.php';
47 }
48
49 /**
50 * Handle redirects after addon activate/deactivate.
51 */
52 public function addon_actions() {
53 if ( isset( $_GET['page'], $_REQUEST['action'] ) && 'evf-addons' === $_GET['page'] ) { // WPCS: input var okay, CSRF ok.
54 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // WPCS: input var okay, CSRF ok.
55 $plugin = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : false; // WPCS: input var okay, CSRF ok.
56
57 if ( 'evf-addons-refresh' === $action ) {
58 if ( empty( $_GET['evf-addons-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['evf-addons-nonce'] ), 'refresh' ) ) { // WPCS: input var ok, sanitization ok.
59 wp_die( esc_html_e( 'Could not verify nonce', 'everest-forms' ) );
60 }
61
62 foreach ( array( 'evf_pro_license_plan', 'evf_addons_sections', 'evf_extensions_section' ) as $transient ) {
63 delete_transient( $transient );
64 }
65 }
66
67 if ( $plugin && in_array( $action, array( 'activate', 'deactivate' ), true ) ) {
68
69 if ( 'activate' === $action ) {
70 if ( ! current_user_can( 'activate_plugin', $plugin ) ) {
71 wp_die( esc_html__( 'Sorry, you are not allowed to activate this plugin.', 'everest-forms' ) );
72 }
73
74 check_admin_referer( 'activate-plugin_' . $plugin );
75
76 activate_plugin( $plugin );
77 } elseif ( 'deactivate' === $action ) {
78 if ( ! current_user_can( 'deactivate_plugins' ) ) {
79 wp_die( esc_html__( 'Sorry, you are not allowed to deactivate plugins for this site.', 'everest-forms' ) );
80 }
81
82 check_admin_referer( 'deactivate-plugin_' . $plugin );
83
84 deactivate_plugins( $plugin );
85 }
86 }
87
88 // Redirect to the add-ons page.
89 wp_safe_redirect( admin_url( 'admin.php?page=evf-addons' ) );
90 exit;
91 }
92 }
93
94 /**
95 * Handle redirects to setup/welcome page after install and updates.
96 *
97 * For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
98 */
99 public function admin_redirects() {
100 // Nonced plugin install redirects (whitelisted).
101 if ( ! empty( $_GET['evf-install-plugin-redirect'] ) ) {
102 $plugin_slug = evf_clean( $_GET['evf-install-plugin-redirect'] );
103
104 $url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug );
105 wp_safe_redirect( $url );
106 exit;
107 }
108
109 // Setup wizard redirect.
110 if ( get_transient( '_evf_activation_redirect' ) ) {
111 delete_transient( '_evf_activation_redirect' );
112
113 if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'evf-settings' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_everest_forms' ) || apply_filters( 'everest_forms_prevent_automatic_wizard_redirect', false ) ) {
114 return;
115 }
116
117 // If the user needs to install, send them to the setup wizard.
118 if ( EVF_Admin_Notices::has_notice( 'install' ) ) {
119 wp_safe_redirect( admin_url( 'admin.php?page=evf-settings' ) );
120 exit;
121 }
122 }
123 }
124
125 /**
126 * Change the admin footer text on EverestForms admin pages.
127 *
128 * @since 1.0.0
129 * @param string $footer_text Footer text.
130 * @return string
131 */
132 public function admin_footer_text( $footer_text ) {
133 if ( ! current_user_can( 'manage_everest_forms' ) || ! function_exists( 'evf_get_screen_ids' ) ) {
134 return $footer_text;
135 }
136 $current_screen = get_current_screen();
137 $evf_pages = evf_get_screen_ids();
138
139 // Check to make sure we're on a EverestForms admin page.
140 if ( isset( $current_screen->id ) && apply_filters( 'everest_forms_display_admin_footer_text', in_array( $current_screen->id, $evf_pages ) ) ) {
141 // Change the footer text.
142 if ( ! get_option( 'everest_forms_admin_footer_text_rated' ) ) {
143 $footer_text = sprintf(
144 /* translators: 1: EverestForms 2:: five stars */
145 __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'everest-forms' ),
146 sprintf( '<strong>%s</strong>', esc_html__( 'Everest Forms', 'everest-forms' ) ),
147 '<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>'
148 );
149 evf_enqueue_js( "
150 jQuery( 'a.evf-rating-link' ).click( function() {
151 jQuery.post( '" . EVF()->ajax_url() . "', { action: 'everest_forms_rated' } );
152 jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
153 });
154 " );
155 } else {
156 $footer_text = __( 'Thank you for creating with Everest Forms.', 'everest-forms' );
157 }
158 }
159
160 return $footer_text;
161 }
162
163 /**
164 * Add body classes for Everest builder.
165 *
166 * @param array $classes Admin body classes.
167 * @return array
168 */
169 public function admin_body_class( $classes ) {
170 $screen = get_current_screen();
171 $screen_id = $screen ? $screen->id : '';
172
173 // Check to make sure we're on a EverestForms builder page.
174 if ( ( isset( $_GET['form_id'] ) || isset( $_GET['create-form'] ) ) && in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) ) {
175 $classes = isset( $_GET['form_id'] ) ? 'everest-forms-builder' : 'everest-forms-builder-setup';
176 }
177
178 return $classes;
179 }
180 }
181
182 return new EVF_Admin();
183