PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 1.6.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v1.6.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 / class-evf-install.php
everest-forms / includes Last commit date
abstracts 6 years ago admin 6 years ago export 6 years ago fields 6 years ago interfaces 8 years ago libraries 7 years ago log-handlers 6 years ago shortcodes 6 years ago templates 6 years ago class-everest-forms.php 6 years ago class-evf-ajax.php 6 years ago class-evf-autoloader.php 7 years ago class-evf-background-updater.php 7 years ago class-evf-cache-helper.php 6 years ago class-evf-deprecated-action-hooks.php 6 years ago class-evf-deprecated-filter-hooks.php 7 years ago class-evf-emails.php 6 years ago class-evf-fields.php 6 years ago class-evf-form-block.php 6 years ago class-evf-form-handler.php 6 years ago class-evf-form-task.php 6 years ago class-evf-forms-features.php 6 years ago class-evf-frontend-scripts.php 6 years ago class-evf-install.php 6 years ago class-evf-integrations.php 7 years ago class-evf-log-levels.php 8 years ago class-evf-logger.php 6 years ago class-evf-post-types.php 6 years ago class-evf-privacy.php 6 years ago class-evf-session-handler.php 7 years ago class-evf-shortcodes.php 7 years ago class-evf-smart-tags.php 6 years ago class-evf-template-loader.php 6 years ago class-evf-validation.php 6 years ago evf-conditional-functions.php 6 years ago evf-core-functions.php 6 years ago evf-deprecated-functions.php 6 years ago evf-entry-functions.php 6 years ago evf-formatting-functions.php 6 years ago evf-notice-functions.php 6 years ago evf-template-functions.php 6 years ago evf-template-hooks.php 7 years ago evf-update-functions.php 6 years ago
class-evf-install.php
665 lines
1 <?php
2 /**
3 * Installation related functions and actions.
4 *
5 * @package EverestForms\Classes
6 * @version 1.0.0
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * EVF_Install Class.
13 */
14 class EVF_Install {
15
16 /**
17 * DB updates and callbacks that need to be run per version.
18 *
19 * @var array
20 */
21 private static $db_updates = array(
22 '1.0.0' => array(
23 'evf_update_100_db_version',
24 ),
25 '1.0.1' => array(
26 'evf_update_101_db_version',
27 ),
28 '1.0.2' => array(
29 'evf_update_102_db_version',
30 ),
31 '1.0.3' => array(
32 'evf_update_103_db_version',
33 ),
34 '1.1.0' => array(
35 'evf_update_110_update_forms',
36 'evf_update_110_db_version',
37 ),
38 '1.1.6' => array(
39 'evf_update_116_delete_options',
40 'evf_update_116_db_version',
41 ),
42 '1.2.0' => array(
43 'evf_update_120_db_rename_options',
44 'evf_update_120_db_version',
45 ),
46 '1.3.0' => array(
47 'evf_update_130_db_version',
48 ),
49 '1.4.0' => array(
50 'evf_update_140_db_multiple_email',
51 'evf_update_140_db_version',
52 ),
53 '1.4.4' => array(
54 'evf_update_144_delete_options',
55 'evf_update_144_db_version',
56 ),
57 '1.4.9' => array(
58 'evf_update_149_db_rename_options',
59 'evf_update_149_no_payment_options',
60 'evf_update_149_db_version',
61 ),
62 '1.5.0' => array(
63 'evf_update_150_field_datetime_type',
64 'evf_update_150_db_version',
65 ),
66 '1.6.0' => array(
67 'evf_update_160_db_version',
68 ),
69 );
70
71 /**
72 * Background update class.
73 *
74 * @var object
75 */
76 private static $background_updater;
77
78 /**
79 * Hook in tabs.
80 */
81 public static function init() {
82 add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
83 add_action( 'init', array( __CLASS__, 'init_background_updater' ), 5 );
84 add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
85 add_filter( 'plugin_action_links_' . EVF_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
86 add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
87 add_filter( 'wpmu_drop_tables', array( __CLASS__, 'wpmu_drop_tables' ) );
88 add_filter( 'cron_schedules', array( __CLASS__, 'cron_schedules' ) );
89 }
90
91 /**
92 * Init background updates
93 */
94 public static function init_background_updater() {
95 include_once dirname( __FILE__ ) . '/class-evf-background-updater.php';
96 self::$background_updater = new EVF_Background_Updater();
97 }
98
99 /**
100 * Check EverestForms version and run the updater is required.
101 *
102 * This check is done on all requests and runs if the versions do not match.
103 */
104 public static function check_version() {
105 if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( get_option( 'everest_forms_version' ), evf()->version, '<' ) ) {
106 self::install();
107 do_action( 'everest_forms_updated' );
108 }
109 }
110
111 /**
112 * Install actions when a update button is clicked within the admin area.
113 *
114 * This function is hooked into admin_init to affect admin only.
115 */
116 public static function install_actions() {
117 if ( ! empty( $_GET['do_update_everest_forms'] ) ) {
118 check_admin_referer( 'evf_db_update', 'evf_db_update_nonce' );
119 self::update();
120 EVF_Admin_Notices::add_notice( 'update' );
121 }
122 if ( ! empty( $_GET['force_update_everest_forms'] ) ) {
123 do_action( 'wp_' . get_current_blog_id() . '_evf_updater_cron' );
124 wp_safe_redirect( admin_url( 'admin.php?page=evf-settings' ) );
125 exit;
126 }
127 }
128
129 /**
130 * Install EVF.
131 */
132 public static function install() {
133 if ( ! is_blog_installed() ) {
134 return;
135 }
136
137 // Check if we are not already running this routine.
138 if ( 'yes' === get_transient( 'evf_installing' ) ) {
139 return;
140 }
141
142 // If we made it till here nothing is running yet, lets set the transient now.
143 set_transient( 'evf_installing', 'yes', MINUTE_IN_SECONDS * 10 );
144 evf_maybe_define_constant( 'EVF_INSTALLING', true );
145
146 self::remove_admin_notices();
147 self::create_options();
148 self::create_tables();
149 self::create_roles();
150 self::setup_environment();
151 self::create_cron_jobs();
152 self::create_files();
153 self::create_forms();
154 self::maybe_enable_setup_wizard();
155 self::update_evf_version();
156 self::maybe_update_db_version();
157 self::maybe_add_activated_date();
158
159 delete_transient( 'evf_installing' );
160
161 do_action( 'everest_forms_flush_rewrite_rules' );
162 do_action( 'everest_forms_installed' );
163 }
164
165 /**
166 * Reset any notices added to admin.
167 */
168 private static function remove_admin_notices() {
169 include_once dirname( __FILE__ ) . '/admin/class-evf-admin-notices.php';
170 EVF_Admin_Notices::remove_all_notices();
171 }
172
173 /**
174 * Setup EVF environment - post types, taxonomies, endpoints.
175 */
176 private static function setup_environment() {
177 EVF_Post_Types::register_post_types();
178 }
179
180 /**
181 * Is this a brand new EVF install?
182 *
183 * @return boolean
184 */
185 private static function is_new_install() {
186 return is_null( get_option( 'everest_forms_version', null ) ) && is_null( get_option( 'everest_forms_db_version', null ) );
187 }
188
189 /**
190 * Is a DB update needed?
191 *
192 * @return boolean
193 */
194 public static function needs_db_update() {
195 $current_db_version = get_option( 'everest_forms_db_version', null );
196 $updates = self::get_db_update_callbacks();
197 $update_versions = array_keys( $updates );
198 usort( $update_versions, 'version_compare' );
199
200 return ! is_null( $current_db_version ) && version_compare( $current_db_version, end( $update_versions ), '<' );
201 }
202
203 /**
204 * See if we need the wizard or not.
205 */
206 private static function maybe_enable_setup_wizard() {
207 if ( apply_filters( 'everest_forms_enable_setup_wizard', true ) ) {
208 set_transient( '_evf_activation_redirect', 1, 30 );
209 }
210 }
211
212 /**
213 * See if we need to show or run database updates during install.
214 */
215 private static function maybe_update_db_version() {
216 if ( self::needs_db_update() ) {
217 if ( apply_filters( 'everest_forms_enable_auto_update_db', false ) ) {
218 self::init_background_updater();
219 self::update();
220 } else {
221 EVF_Admin_Notices::add_notice( 'update' );
222 }
223 } else {
224 self::update_db_version();
225 }
226 }
227
228 /**
229 * Store the initial plugin activation date during install.
230 */
231 private static function maybe_add_activated_date() {
232 $activated_date = get_option( 'everest_forms_activated', '' );
233
234 if ( empty( $activated_date ) ) {
235 update_option( 'everest_forms_activated', time() );
236 }
237 }
238
239 /**
240 * Update EVF version to current.
241 */
242 private static function update_evf_version() {
243 delete_option( 'everest_forms_version' );
244 add_option( 'everest_forms_version', evf()->version );
245 }
246
247 /**
248 * Get list of DB update callbacks.
249 *
250 * @return array
251 */
252 public static function get_db_update_callbacks() {
253 return self::$db_updates;
254 }
255
256 /**
257 * Push all needed DB updates to the queue for processing.
258 */
259 private static function update() {
260 $current_db_version = get_option( 'everest_forms_db_version' );
261 $logger = evf_get_logger();
262 $update_queued = false;
263
264 foreach ( self::get_db_update_callbacks() as $version => $update_callbacks ) {
265 if ( version_compare( $current_db_version, $version, '<' ) ) {
266 foreach ( $update_callbacks as $update_callback ) {
267 $logger->info(
268 sprintf( 'Queuing %s - %s', $version, $update_callback ),
269 array( 'source' => 'evf_db_updates' )
270 );
271 self::$background_updater->push_to_queue( $update_callback );
272 $update_queued = true;
273 }
274 }
275 }
276
277 if ( $update_queued ) {
278 self::$background_updater->save()->dispatch();
279 }
280 }
281
282 /**
283 * Update DB version to current.
284 *
285 * @param string|null $version New EverestForms DB version or null.
286 */
287 public static function update_db_version( $version = null ) {
288 delete_option( 'everest_forms_db_version' );
289 add_option( 'everest_forms_db_version', is_null( $version ) ? evf()->version : $version );
290 }
291
292 /**
293 * Add more cron schedules.
294 *
295 * @param array $schedules List of WP scheduled cron jobs.
296 * @return array
297 */
298 public static function cron_schedules( $schedules ) {
299 $schedules['monthly'] = array(
300 'interval' => 2635200,
301 'display' => __( 'Monthly', 'everest-forms' ),
302 );
303 return $schedules;
304 }
305
306 /**
307 * Create cron jobs (clear them first).
308 */
309 private static function create_cron_jobs() {
310 wp_clear_scheduled_hook( 'everest_forms_cleanup_logs' );
311 wp_clear_scheduled_hook( 'everest_forms_cleanup_sessions' );
312 wp_schedule_event( time() + ( 3 * HOUR_IN_SECONDS ), 'daily', 'everest_forms_cleanup_logs' );
313 wp_schedule_event( time() + ( 6 * HOUR_IN_SECONDS ), 'twicedaily', 'everest_forms_cleanup_sessions' );
314 }
315
316 /**
317 * Default options.
318 *
319 * Sets up the default options used on the settings page.
320 */
321 private static function create_options() {
322 // Include settings so that we can run through defaults.
323 include_once dirname( __FILE__ ) . '/admin/class-evf-admin-settings.php';
324
325 $settings = EVF_Admin_Settings::get_settings_pages();
326
327 foreach ( $settings as $section ) {
328 if ( ! method_exists( $section, 'get_settings' ) ) {
329 continue;
330 }
331 $subsections = array_unique( array_merge( array( '' ), array_keys( $section->get_sections() ) ) );
332
333 foreach ( $subsections as $subsection ) {
334 foreach ( $section->get_settings( $subsection ) as $value ) {
335 if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
336 $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
337 add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
338 }
339 }
340 }
341 }
342 }
343
344 /**
345 * Set up the database tables which the plugin needs to function.
346 */
347 private static function create_tables() {
348 global $wpdb;
349
350 $wpdb->hide_errors();
351
352 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
353
354 /**
355 * Before updating with DBDELTA, add fields column to entries table schema.
356 */
357 if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}evf_entries';" ) ) {
358 if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}evf_entries` LIKE 'fields';" ) ) {
359 $wpdb->query( "ALTER TABLE {$wpdb->prefix}evf_entries ADD `fields` longtext NULL AFTER `referer`;" );
360 }
361 }
362
363 /**
364 * Change wp_evf_sessions schema to use a bigint auto increment field
365 * instead of char(32) field as the primary key. Doing this change primarily
366 * as it should reduce the occurrence of deadlocks, but also because it is
367 * not a good practice to use a char(32) field as the primary key of a table.
368 */
369 if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}evf_sessions'" ) ) {
370 if ( ! $wpdb->get_var( "SHOW KEYS FROM {$wpdb->prefix}evf_sessions WHERE Key_name = 'PRIMARY' AND Column_name = 'session_id'" ) ) {
371 $wpdb->query(
372 "ALTER TABLE `{$wpdb->prefix}evf_sessions` DROP PRIMARY KEY, DROP KEY `session_id`, ADD PRIMARY KEY(`session_id`), ADD UNIQUE KEY(`session_key`)"
373 );
374 }
375 }
376
377 dbDelta( self::get_schema() );
378 }
379
380 /**
381 * Get Table schema.
382 *
383 * When adding or removing a table, make sure to update the list of tables in EVF_Install::get_tables().
384 *
385 * @return string
386 */
387 private static function get_schema() {
388 global $wpdb;
389
390 $charset_collate = '';
391
392 if ( $wpdb->has_cap( 'collation' ) ) {
393 $charset_collate = $wpdb->get_charset_collate();
394 }
395
396 $tables = "
397 CREATE TABLE {$wpdb->prefix}evf_entries (
398 entry_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
399 form_id BIGINT UNSIGNED NOT NULL,
400 user_id BIGINT UNSIGNED NOT NULL,
401 user_device varchar(100) NOT NULL,
402 user_ip_address VARCHAR(100) NULL DEFAULT '',
403 referer text NOT NULL,
404 fields longtext NULL,
405 status varchar(20) NOT NULL,
406 viewed tinyint(1) NOT NULL DEFAULT '0',
407 starred tinyint(1) NOT NULL DEFAULT '0',
408 date_created datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
409 PRIMARY KEY (entry_id),
410 KEY form_id (form_id)
411 ) $charset_collate;
412 CREATE TABLE {$wpdb->prefix}evf_entrymeta (
413 meta_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
414 entry_id BIGINT UNSIGNED NOT NULL,
415 meta_key varchar(255) default NULL,
416 meta_value longtext NULL,
417 PRIMARY KEY (meta_id),
418 KEY entry_id (entry_id),
419 KEY meta_key (meta_key(32))
420 ) $charset_collate;
421 CREATE TABLE {$wpdb->prefix}evf_sessions (
422 session_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
423 session_key char(32) NOT NULL,
424 session_value longtext NOT NULL,
425 session_expiry BIGINT UNSIGNED NOT NULL,
426 PRIMARY KEY (session_id),
427 UNIQUE KEY session_key (session_key)
428 ) $charset_collate;
429 ";
430
431 return $tables;
432 }
433
434 /**
435 * Return a list of EverestForms tables. Used to make sure all UM tables are dropped when uninstalling the plugin
436 * in a single site or multi site environment.
437 *
438 * @return array UM tables.
439 */
440 public static function get_tables() {
441 global $wpdb;
442
443 $tables = array(
444 "{$wpdb->prefix}evf_entries",
445 "{$wpdb->prefix}evf_entrymeta",
446 "{$wpdb->prefix}evf_sessions",
447 );
448
449 return $tables;
450 }
451
452 /**
453 * Drop EverestForms tables.
454 */
455 public static function drop_tables() {
456 global $wpdb;
457
458 $tables = self::get_tables();
459
460 foreach ( $tables as $table ) {
461 $wpdb->query( "DROP TABLE IF EXISTS {$table}" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
462 }
463 }
464
465 /**
466 * Uninstall tables when MU blog is deleted.
467 *
468 * @param array $tables List of tables that will be deleted by WP.
469 * @return string[]
470 */
471 public static function wpmu_drop_tables( $tables ) {
472 return array_merge( $tables, self::get_tables() );
473 }
474
475 /**
476 * Create roles and capabilities.
477 */
478 public static function create_roles() {
479 global $wp_roles;
480
481 if ( ! class_exists( 'WP_Roles' ) ) {
482 return;
483 }
484
485 if ( ! isset( $wp_roles ) ) {
486 $wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
487 }
488
489 $capabilities = self::get_core_capabilities();
490
491 foreach ( $capabilities as $cap_group ) {
492 foreach ( $cap_group as $cap ) {
493 $wp_roles->add_cap( 'administrator', $cap );
494 }
495 }
496 }
497
498 /**
499 * Get capabilities for EverestForms - these are assigned to admin during installation or reset.
500 *
501 * @return array
502 */
503 private static function get_core_capabilities() {
504 $capabilities = array();
505
506 $capabilities['core'] = array(
507 'manage_everest_forms',
508 );
509
510 $capability_types = array( 'everest_form' );
511
512 foreach ( $capability_types as $capability_type ) {
513 $capabilities[ $capability_type ] = array(
514 // Post type.
515 "edit_{$capability_type}",
516 "read_{$capability_type}",
517 "delete_{$capability_type}",
518 "edit_{$capability_type}s",
519 "edit_others_{$capability_type}s",
520 "publish_{$capability_type}s",
521 "read_private_{$capability_type}s",
522 "delete_{$capability_type}s",
523 "delete_private_{$capability_type}s",
524 "delete_published_{$capability_type}s",
525 "delete_others_{$capability_type}s",
526 "edit_private_{$capability_type}s",
527 "edit_published_{$capability_type}s",
528
529 // Terms.
530 "manage_{$capability_type}_terms",
531 "edit_{$capability_type}_terms",
532 "delete_{$capability_type}_terms",
533 "assign_{$capability_type}_terms",
534 );
535 }
536
537 return $capabilities;
538 }
539
540 /**
541 * Remove EverestForms roles.
542 */
543 public static function remove_roles() {
544 global $wp_roles;
545
546 if ( ! class_exists( 'WP_Roles' ) ) {
547 return;
548 }
549
550 if ( ! isset( $wp_roles ) ) {
551 $wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
552 }
553
554 $capabilities = self::get_core_capabilities();
555
556 foreach ( $capabilities as $cap_group ) {
557 foreach ( $cap_group as $cap ) {
558 $wp_roles->remove_cap( 'administrator', $cap );
559 }
560 }
561 }
562
563 /**
564 * Create default contact form.
565 */
566 public static function create_forms() {
567 $form_count = wp_count_posts( 'everest_form' );
568
569 if ( empty( $form_count->publish ) ) {
570 include_once dirname( __FILE__ ) . '/templates/contact.php';
571
572 // Create a form.
573 $form_id = wp_insert_post(
574 array(
575 'post_title' => esc_html__( 'Contact Form', 'everest-forms' ),
576 'post_status' => 'publish',
577 'post_type' => 'everest_form',
578 'post_content' => '{}',
579 )
580 );
581
582 if ( $form_id ) {
583 wp_update_post(
584 array(
585 'ID' => $form_id,
586 'post_content' => evf_encode( array_merge( array( 'id' => $form_id ), $form_template['contact'] ) ),
587 )
588 );
589 }
590
591 update_option( 'everest_forms_default_form_page_id', $form_id );
592 }
593 }
594
595 /**
596 * Create files/directories.
597 */
598 private static function create_files() {
599 // Bypass if filesystem is read-only and/or non-standard upload system is used.
600 if ( apply_filters( 'everest_forms_install_skip_create_files', false ) ) {
601 return;
602 }
603
604 // Install files and folders for uploading files and prevent hotlinking.
605 $files = array(
606 array(
607 'base' => EVF_LOG_DIR,
608 'file' => '.htaccess',
609 'content' => 'deny from all',
610 ),
611 array(
612 'base' => EVF_LOG_DIR,
613 'file' => 'index.html',
614 'content' => '',
615 ),
616 );
617
618 foreach ( $files as $file ) {
619 if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) {
620 $file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
621 if ( $file_handle ) {
622 fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
623 fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
624 }
625 }
626 }
627 }
628
629 /**
630 * Display action links in the Plugins list table.
631 *
632 * @param array $actions Plugin Action links.
633 * @return array
634 */
635 public static function plugin_action_links( $actions ) {
636 $new_actions = array(
637 'settings' => '<a href="' . admin_url( 'admin.php?page=evf-settings' ) . '" aria-label="' . esc_attr__( 'View Everest Forms Settings', 'everest-forms' ) . '">' . esc_html__( 'Settings', 'everest-forms' ) . '</a>',
638 );
639
640 return array_merge( $new_actions, $actions );
641 }
642
643 /**
644 * Display row meta in the Plugins list table.
645 *
646 * @param array $plugin_meta Plugin Row Meta.
647 * @param string $plugin_file Plugin Row Meta.
648 * @return array
649 */
650 public static function plugin_row_meta( $plugin_meta, $plugin_file ) {
651 if ( EVF_PLUGIN_BASENAME === $plugin_file ) {
652 $new_plugin_meta = array(
653 'docs' => '<a href="' . esc_url( apply_filters( 'everest_forms_docs_url', 'https://docs.wpeverest.com/documentation/plugins/everest-forms/' ) ) . '" aria-label="' . esc_attr__( 'View Everest Forms documentation', 'everest-forms' ) . '">' . esc_html__( 'Docs', 'everest-forms' ) . '</a>',
654 'support' => '<a href="' . esc_url( apply_filters( 'everest_forms_support_url', 'https://wordpress.org/support/plugin/everest-forms/' ) ) . '" aria-label="' . esc_attr__( 'Visit free customer support', 'everest-forms' ) . '">' . esc_html__( 'Free support', 'everest-forms' ) . '</a>',
655 );
656
657 return array_merge( $plugin_meta, $new_plugin_meta );
658 }
659
660 return (array) $plugin_meta;
661 }
662 }
663
664 EVF_Install::init();
665