everest-forms
Last commit date
addons
2 weeks ago
assets
1 week ago
bin
5 months ago
dist
1 week ago
docs
2 weeks ago
includes
1 week ago
languages
2 weeks ago
src
1 week ago
templates
3 months ago
traits
1 year ago
vendor
1 week ago
composer.json
5 months ago
everest-forms.php
1 week ago
license.txt
8 years ago
readme.txt
1 week ago
uninstall.php
3 years ago
wp
1 year ago
wpml-config.xml
5 years ago
everest-forms.php
115 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Everest Forms |
| 4 | * Plugin URI: https://everestforms.net/ |
| 5 | * Description: Easily create contact form, payment form, conversational form, calculator, multi-step form, registration form, quiz form, survey form etc. |
| 6 | * Version: 3.5.1 |
| 7 | * Author: Everest Forms |
| 8 | * Author URI: https://everestforms.net/ |
| 9 | * Text Domain: everest-forms |
| 10 | * Domain Path: /languages/ |
| 11 | * WordPress Available: yes |
| 12 | * Requires License: no |
| 13 | * |
| 14 | * @package EverestForms |
| 15 | */ |
| 16 | |
| 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | exit; // Exit if accessed directly. |
| 19 | } |
| 20 | |
| 21 | // Define EVF_PLUGIN_FILE. |
| 22 | if ( ! defined( 'EVF_PLUGIN_FILE' ) ) { |
| 23 | define( 'EVF_PLUGIN_FILE', __FILE__ ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Autoload the packages. |
| 28 | * |
| 29 | * We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader. |
| 30 | * If the autoloader is not present, let's log the failure and display a nice admin notice. |
| 31 | */ |
| 32 | $autoloader = __DIR__ . '/vendor/autoload.php'; |
| 33 | if ( is_readable( $autoloader ) && version_compare( PHP_VERSION, '7.1.3', '>=' ) ) { |
| 34 | require $autoloader; |
| 35 | } else { |
| 36 | if ( version_compare( PHP_VERSION, '7.1.3', '<=' ) ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
| 41 | error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log |
| 42 | sprintf( |
| 43 | /* translators: 1: composer command. 2: plugin directory */ |
| 44 | esc_html__( 'Your installation of the Everest Forms plugin is incomplete. Please run %1$s within the %2$s directory.', 'everest-forms' ), |
| 45 | '`composer install`', |
| 46 | '`' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '`' |
| 47 | ) |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Outputs an admin notice if composer install has not been ran. |
| 53 | */ |
| 54 | add_action( |
| 55 | 'admin_notices', |
| 56 | function () { |
| 57 | ?> |
| 58 | <div class="notice notice-error"> |
| 59 | <p> |
| 60 | <?php |
| 61 | printf( |
| 62 | /* translators: 1: composer command. 2: plugin directory */ |
| 63 | esc_html__( 'Your installation of the Everest Forms plugin is incomplete. Please run %1$s within the %2$s directory.', 'everest-forms' ), |
| 64 | '<code>composer install</code>', |
| 65 | '<code>' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '</code>' |
| 66 | ); |
| 67 | ?> |
| 68 | </p> |
| 69 | </div> |
| 70 | <?php |
| 71 | } |
| 72 | ); |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | // Include the main EverestForms class. |
| 77 | if ( ! class_exists( 'EverestForms' ) ) { |
| 78 | include_once dirname( __FILE__ ) . '/includes/class-everest-forms.php'; // phpcs:ignore |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Main instance of EverestForms. |
| 83 | * |
| 84 | * Returns the main instance of EVF to prevent the need to use globals. |
| 85 | * |
| 86 | * @since 1.0.0 |
| 87 | * @return EverestForms |
| 88 | */ |
| 89 | function evf() { |
| 90 | return EverestForms::instance(); |
| 91 | } |
| 92 | |
| 93 | // Global for backwards compatibility. |
| 94 | $GLOBALS['everest-forms'] = evf(); |
| 95 | |
| 96 | /** |
| 97 | * ThemeGrill SDK customizations |
| 98 | * Disable promotions and dashboard widgets |
| 99 | */ |
| 100 | add_filter( 'themegrill_sdk_ran_promos', '__return_true' ); |
| 101 | add_filter( 'themegrill_sdk_hide_dashboard_widget', '__return_true' ); |
| 102 | |
| 103 | /** |
| 104 | * Register Everest Forms with ThemeGrill SDK |
| 105 | */ |
| 106 | add_filter( |
| 107 | 'themegrill_sdk_products', |
| 108 | function ( $products ) { |
| 109 | $products[] = EVF_PLUGIN_FILE; |
| 110 | return $products; |
| 111 | }, |
| 112 | 10, |
| 113 | 1 |
| 114 | ); |
| 115 |