esc_html__( 'Activate', 'header-footer-elementor' ), 'addon_activated' => esc_html__( 'Activated', 'header-footer-elementor' ), 'addon_active' => esc_html__( 'Active', 'header-footer-elementor' ), 'addon_deactivate' => esc_html__( 'Deactivate', 'header-footer-elementor' ), 'addon_inactive' => esc_html__( 'Inactive', 'header-footer-elementor' ), 'addon_install' => esc_html__( 'Install', 'header-footer-elementor' ), 'theme_installed' => esc_html__( 'Theme Installed', 'header-footer-elementor' ), 'plugin_installed' => esc_html__( 'Plugin Installed', 'header-footer-elementor' ), 'addon_download' => esc_html__( 'Download', 'header-footer-elementor' ), 'addon_exists' => esc_html__( 'Already Exists.', 'header-footer-elementor' ), 'visit_site' => esc_html__( 'Visit Website', 'header-footer-elementor' ), 'plugin_error' => esc_html__( 'Could not install. Please download from WordPress.org and install manually.', 'header-footer-elementor' ), 'subscribe_success' => esc_html__( 'Your details are submitted successfully.', 'header-footer-elementor' ), 'subscribe_error' => esc_html__( 'Encountered an error while performing your request.', 'header-footer-elementor' ), 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'hfe-admin-nonce' ), 'popup_dismiss' => false, 'data_source' => 'HFE', ]; $strings = apply_filters( 'hfe_admin_strings', $strings ); wp_localize_script( 'hfe-admin-script', 'hfe_admin_data', $strings ); } /** * Adds a tab in plugin submenu page. * * @since 1.6.0 * @param string $views to add tab to current post type view. * * @return mixed */ public function hfe_settings( $views ) { $this->hfe_tabs(); $this->hfe_modal(); return $views; } /** * Function for registering the settings api. * * @since 1.6.0 * @return void */ public function hfe_admin_init() { register_setting( 'hfe-plugin-options', 'hfe_compatibility_option' ); add_settings_section( 'hfe-options', __( 'Add Theme Support', 'header-footer-elementor' ), [ $this, 'hfe_compatibility_callback' ], 'Settings' ); add_settings_field( 'hfe-way', 'Methods to Add Theme Support', [ $this, 'hfe_compatibility_option_callback' ], 'Settings', 'hfe-options' ); register_setting( 'hfe-plugin-guide', 'hfe_guide_email' ); register_setting( 'hfe-plugin-guide', 'hfe_guide_fname' ); } /** * Call back function for the ssettings api function add_settings_section * * This function can be used to add description of the settings sections * * @since 1.6.0 * @return void */ public function hfe_compatibility_callback() { _e( 'The Elementor Header & Footer Builder plugin need compatibility with your current theme to work smoothly.

Following are two methods that enable theme support for the plugin.

Method 1 is selected by default and that works fine almost will all themes. In case, you face any issue with the header or footer template, try choosing Method 2.', 'header-footer-elementor' ); } /** * Call back function for the ssettings api function add_settings_field * * This function will contain the markup for the input feilds that we can add. * * @since 1.6.0 * @return void */ public function hfe_compatibility_option_callback() { $hfe_radio_button = get_option( 'hfe_compatibility_option', '1' ); wp_enqueue_style( 'hfe-admin-style', HFE_URL . 'admin/assets/css/ehf-admin.css', [], HFE_VER ); ?>

plugin.', 'header-footer-elementor' ), '
' ); ?>

'; esc_attr_e( 'Elementor Header & Footer Builder ', 'header-footer-elementor' ); echo ''; $this->hfe_tabs(); ?> get_themes_support(); break; case 'hfe-about': $this->get_about_html(); break; case 'default': break; } } /** * Settings page - load modal content. * * Call back function for add submenu page function. * * @since 1.6.2 */ public function hfe_modal() { $is_dismissed = []; $is_dismissed = get_user_meta( get_current_user_id(), 'hfe-popup' ); $is_subscribed = get_user_meta( get_current_user_ID(), 'hfe-subscribed' ); $subscribe_valid = ( is_array( $is_subscribed ) && isset( $is_subscribed[0] ) && 'yes' === $is_subscribed[0] ) ? 'yes' : false; if ( ( ! empty( $is_dismissed ) && 'dismissed' === $is_dismissed[0] ) || 'yes' === $subscribe_valid ) { return false; } else { $this->get_guide_modal(); } } /** * Function for adding tabs * * @since 1.6.0 * @return void */ public function hfe_tabs() { ?> post_type || 'appearance_page_hfe-guide' === $current_screen->id || 'appearance_page_hfe-about' === $current_screen->id || 'appearance_page_hfe-settings' === $current_screen->id ) ); if ( $is_elementor_screen ) { $footer_text = sprintf( /* translators: 1: Elementor, 2: Link to plugin review */ __( 'Help us spread the word about the plugin by leaving %2$s %1$s %3$s ratings on %2$s WordPress.org %3$s. Thank you from the Brainstorm Force team!', 'header-footer-elementor' ), '★★★★★', '', '' ); } return $footer_text; } /** * Function for theme support tab * * @since 1.6.0 * @return void */ public function get_themes_support() { ?>

get_form_html(); ?>

', '', '', '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

get_form_row_1(); ?> get_form_row_2(); ?>

get_guide_html(); ?>
output_about_info(); $this->output_about_addons(); } /** * Display the General Info section of About tab. * * @since 1.6.0 */ protected function output_about_info() { ?>

<?php esc_attr_e( 'Team photo', 'header-footer-elementor' ); ?>

get_bsf_plugins(); $can_install_plugins = $this->hfe_can_install( 'plugin' ); $can_install_themes = $this->hfe_can_install( 'theme' ); ?>
$details ) : $plugin_data = $this->get_plugin_data( $plugin, $details, $all_plugins, $all_themes ); ?>
', '', esc_html( $plugin_data['details']['name'] ) ); ?>

' . wp_kses_post( $plugin_data['status_text'] ) . '' ); ?>
name || 'Astra' === $theme->parent_theme ) ) ) { // Status text/status. $plugin_data['status_class'] = 'status-active'; $plugin_data['status_text'] = esc_html__( 'Active', 'header-footer-elementor' ); // Button text/status. $plugin_data['action_class'] = $plugin_data['status_class'] . ' button button-secondary disabled'; $plugin_data['action_text'] = esc_html__( 'Activated', 'header-footer-elementor' ); $plugin_data['plugin_src'] = esc_attr( $addon ); } else { // Status text/status. $plugin_data['status_class'] = 'status-inactive'; $plugin_data['status_text'] = esc_html__( 'Inactive', 'header-footer-elementor' ); // Button text/status. $plugin_data['action_class'] = $plugin_data['status_class'] . ' button button-secondary'; $plugin_data['action_text'] = esc_html__( 'Activate', 'header-footer-elementor' ); $plugin_data['plugin_src'] = esc_attr( $addon ); } } else { // install if already doesn't exists. // Status text/status. $plugin_data['status_class'] = 'status-download'; if ( isset( $details['act'] ) && 'go-to-url' === $details['act'] ) { $plugin_data['status_class'] = 'status-go-to-url'; } $plugin_data['status_text'] = esc_html__( 'Not Installed', 'header-footer-elementor' ); // Button text/status. $plugin_data['action_class'] = $plugin_data['status_class'] . ' button button-primary'; $plugin_data['action_text'] = esc_html__( 'Install', 'header-footer-elementor' ); $plugin_data['plugin_src'] = esc_url( $details['url'] ); if ( $have_pro ) { $plugin_data['status_class'] = ''; $plugin_data['action_text'] = esc_html__( 'Visit Website', 'header-footer-elementor' ); } } $plugin_data['details'] = $details; return $plugin_data; } /** * List of plugins that we propose to install. * * @since 1.6.0 * * @return array */ protected function get_bsf_plugins() { $images_url = HFE_URL . 'assets/images/settings/'; return [ 'astra' => [ 'icon' => $images_url . 'plugin-astra.png', 'type' => 'theme', 'name' => esc_html__( 'Astra Theme', 'header-footer-elementor' ), 'desc' => esc_html__( 'Powering over 1+ Million websites, Astra is loved for the fast performance and ease of use it offers. It is suitable for all kinds of websites like blogs, portfolios, business, and WooCommerce stores.', 'header-footer-elementor' ), 'wporg' => 'https://wordpress.org/themes/astra/', 'url' => 'https://downloads.wordpress.org/theme/astra.zip', 'siteurl' => 'https://wpastra.com/', 'pro' => false, 'slug' => 'astra', ], 'astra-sites/astra-sites.php' => [ 'icon' => $images_url . 'plugin-st.png', 'type' => 'plugin', 'name' => esc_html__( 'Starter Templates', 'header-footer-elementor' ), 'desc' => esc_html__( 'A popular templates plugin that provides an extensive library of professional and fully customizable 600+ ready website and templates. More than 1+ Million websites have built with this plugin.', 'header-footer-elementor' ), 'wporg' => 'https://wordpress.org/plugins/astra-sites/', 'url' => 'https://downloads.wordpress.org/plugin/astra-sites.zip', 'siteurl' => 'https://startertemplates.com/', 'pro' => false, 'slug' => 'astra-sites', ], 'ultimate-elementor/ultimate-elementor.php' => [ 'icon' => $images_url . 'plugin-uae.png', 'type' => 'plugin', 'name' => esc_html__( 'Ultimate Addons for Elementor', 'header-footer-elementor' ), 'desc' => esc_html__( 'It’s a collection of 40+ unique, creative, and optimized Elementor widgets with 100+ readymade templates. Trusted by more than 600+ K web professionals. It’s a #1 toolkit for Elementor Page Builder.', 'header-footer-elementor' ), 'wporg' => '', 'url' => 'https://ultimateelementor.com/', 'siteurl' => 'https://ultimateelementor.com/', 'pro' => true, 'slug' => 'ultimate-elementor', ], ]; } /** * Determine if the plugin/addon installations are allowed. * * @since 1.6.0 * @param string $type defines addon type. * @return bool */ public function hfe_can_install( $type ) { if ( ! in_array( $type, [ 'plugin', 'theme' ], true ) ) { return false; } // Determine whether file modifications are allowed. if ( ! wp_is_file_mod_allowed( 'hfe_can_install' ) ) { return false; } if ( 'theme' === $type ) { if ( ! current_user_can( 'install_themes' ) ) { return false; } return true; } elseif ( 'plugin' === $type ) { if ( ! current_user_can( 'install_plugins' ) ) { return false; } return true; } return false; } /** * Add settings link to the Plugins page. * * @since 1.6.0 * * @param array $links Plugin row links. * * @return array $links */ public function settings_link( $links ) { $custom['settings'] = sprintf( '%s', esc_url( add_query_arg( [ 'post_type' => 'elementor-hf', ], admin_url( 'edit.php' ) ) ), esc_attr__( 'Go to HFE Settings page', 'header-footer-elementor' ), esc_html__( 'Settings', 'header-footer-elementor' ) ); return array_merge( $custom, (array) $links ); } } new HFE_Settings_Page();