false, 'requires_acf' => true, 'basename' => '', 'plugin_dir' => '', 'plugin_url' => '', 'plugin' => '', ) ); if( defined( 'FEA_VERSION' ) ) { return; } define( 'FEA_NAME', $data['basename'] ); define( 'FEA_URL', $data['plugin_url'] ); define( 'FEA_DIR', $data['plugin_dir'] ); define( 'FEA_PLUGIN', $data['plugin'] ); define( 'FEA_VERSION', '3.25.3' ); do_action( 'front_end_admin_loaded' ); // Add tutorial videos to plugin item on plugins page add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); // Check for required PHP version if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) ); return; } add_action( 'init', array( $this, 'i18n' ) ); if ( ! $data['pro_version'] ) { add_action( 'admin_notices', array( $this, 'admin_notice_get_pro' ) ); add_action( 'wp_ajax_fea-upgrade-pro-dismiss', array( $this, 'ajax_upgrade_pro_dismiss' ) ); } // Prompt user to rate plugin after several submississions add_action( 'admin_notices', array( $this, 'admin_notice_review_plugin' ) ); add_action( 'wp_ajax_fea-rate-plugin', array( $this, 'ajax_rate_the_plugin' ) ); add_action( 'after_setup_theme', array( $this, 'plugin_includes' ), 12 ); } function include_custom_fields() { if ( class_exists( 'ACF' ) ) return; // Define path and URL to the ACF plugin. define( 'FEACF_PATH', FEA_DIR . '/main/custom-fields/' ); define( 'FEACF_URL', FEA_URL . '/main/custom-fields/' ); // Include the ACF plugin. include_once FEACF_PATH . 'custom-fields.php'; // Customize the url setting to fix incorrect asset URLs. add_filter( 'acf/settings/url', function( $url ) { return FEACF_URL; } ); } /** * Load Textdomain * * Load plugin localization files. * * Fired by `init` action hook. * * @since 1.0.0 * * @access public */ public function i18n() { load_plugin_textdomain( 'acf-frontend-form-element', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } /** * Plugin Includes * * Load plugin files and folders that makle this plugin so awesome * * Fired in the constructer. * * @since 1.0.0 * * @access public */ public function plugin_includes() { $this->include_custom_fields(); include_once __DIR__ . '/helpers.php'; if ( did_action( 'elementor/loaded' ) ) { include_once __DIR__ . '/elementor/module.php'; } include_once __DIR__ . '/frontend/module.php'; include_once __DIR__ . '/gutenberg/module.php'; include_once __DIR__ . '/admin/module.php'; } /** * is_license_active * * Legacy function to avoid breaking the plugin when used in * conjuction with previous versions * * @since 1.0.0 * * @access public */ public function is_license_active() { return true; } /** * set_basename * * Legacy function to avoid breaking the plugin when used in * conjuction with previous versions * * @since 1.0.0 * * @access public */ public function set_basename() { return null; } /** * Admin notice get pro version * * Notify the admin about pro version of Frontend Admin * * @since 1.0.0 * * @access public */ public function admin_notice_get_pro() { if ( ! is_admin() ) { return; } if ( get_option( 'fea_pro_trial_dismiss' ) ) { return; } if ( get_option( 'frontend_admin_submissions_all_time', 0 ) < 100 ) { return; } global $frontend_admin; $image_path = FEA_URL . 'assets/icon.png'; ?>
admin_url( 'admin-ajax.php' ) ) ); } /** * Admin notice rate the plugin * * Request from the admin to rate the plugin on WordPress.org * * @since 1.0.0 * * @access public */ public function admin_notice_review_plugin() { if ( ! is_admin() ) { return; } $min_submits = get_option( 'fea_min_submits_trigger', 10 ); $submits_count = get_option( 'frontend_admin_submissions_all_time', 0 ); if ( $min_submits == -1 || $submits_count < $min_submits ) { return; } $image_path = FEA_URL . 'assets/icon.png'; $review_url = 'https://wordpress.org/support/view/plugin-reviews/' . 'acf-frontend-form-element' . '?rate=5#postform'; ?> admin_url( 'admin-ajax.php' ) ) ); } /** * Ajax rate the plugin * * Ajax function to take action when admin responds to request to * rate the plugin. * * @since 1.0.0 * * @access public */ public function ajax_rate_the_plugin() { // Continue only if the nonce is correct check_admin_referer( 'fea_rate_action_nonce', '_n' ); $min_submits = get_option( 'fea_min_submits_trigger', 10 ); if ( -1 === $min_submits ) { exit; } if ( ! isset( $_POST['rate_action'] ) ) { exit; } $rate_action = sanitize_text_field( wp_unslash( $_POST['rate_action'] ) ); if ( 'do-rate' === $rate_action ) { $min_submits = -1; } else { if ( 10 === $min_submits ) { $min_submits = 100; } else { if ( 100 === $min_submits ) { $min_submits = 1000; } else { $min_submits = -1; } } } update_option( 'fea_min_submits_trigger', $min_submits ); echo 1; exit; } /** * Ajax upgrade pro dismiss * * Ajax function to dismiss the notice to upgrade to pro version * * @since 1.0.0 * * @access public */ public function ajax_upgrade_pro_dismiss() { // Continue only if the nonce is correct check_admin_referer( 'fea_dismiss_pro_nonce', '_n' ); update_option( 'fea_pro_trial_dismiss', true ); echo 1; exit; } /** * Admin notice * * Warning when the site doesn't have ACF installed or activated. * * @since 1.0.0 * * @access public */ public function admin_notice_missing_acf_plugin() { if ( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); } $message = sprintf( /* translators: 1: Plugin name 2: Advanced Custom Fields */ __( '"%1$s" requires "%2$s" to be installed and activated.', 'acf-frontend-form-element' ), 'Frontend Admin', 'Advanced Custom Fields' ); printf( '%1$s
%1$s