get_template_directory_uri() . '/epanel/images/empty.png', 'epanel_nonce' => wp_create_nonce( 'epanel_nonce' ), 'help_label' => esc_html__( 'Help', $themename ), 'et_core_nonces' => et_core_get_nonces(), ) ); // Use WP 4.9 CodeMirror Editor for some fields if ( function_exists( 'wp_enqueue_code_editor' ) ) { wp_enqueue_code_editor( array( 'type' => 'text/css', ) ); // Required for Javascript mode wp_enqueue_script( 'jshint' ); wp_enqueue_script( 'htmlhint' ); } } } /* --------------------------------------------- */ /* Adds additional ePanel css */ if ( ! function_exists( 'et_epanel_css_admin' ) ) { function et_epanel_css_admin() { ?> id ); if ( ! wp_style_is( 'et-core-admin', 'enqueued' ) ) { wp_enqueue_style( 'et-core-admin-epanel', get_template_directory_uri() . '/core/admin/css/core.css', array(), et_get_theme_version() ); } wp_enqueue_style( 'epanel-style', get_template_directory_uri() . '/epanel/css/panel.css', array(), et_get_theme_version() ); if ( wp_style_is( 'activecampaign-subscription-forms', 'enqueued' ) ) { // activecampaign-subscription-forms style breaks the panel. wp_dequeue_style( 'activecampaign-subscription-forms' ); } // ePanel on theme others than Divi might want to add specific styling if ( ! apply_filters( 'et_epanel_is_divi', $is_divi ) ) { wp_enqueue_style( 'epanel-theme-style', apply_filters( 'et_epanel_style_url', get_template_directory_uri() . '/style-epanel.css'), array( 'epanel-style' ), et_get_theme_version() ); } } } if ( ! function_exists( 'et_epanel_hook_scripts' ) ) { function et_epanel_hook_scripts() { add_action( 'admin_enqueue_scripts', 'et_epanel_admin_scripts' ); } } /* --------------------------------------------- */ /* Save/Reset actions | Adds theme options to WP-Admin menu */ add_action( 'admin_menu', 'et_add_epanel' ); function et_add_epanel() { global $themename, $shortname, $options; $epanel = basename( __FILE__ ); if ( isset( $_GET['page'] ) && $_GET['page'] == $epanel && isset( $_POST['action'] ) ) { if ( ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'epanel_nonce' ) ) || ( 'reset' === $_POST['action'] && isset( $_POST['_wpnonce_reset'] ) && wp_verify_nonce( $_POST['_wpnonce_reset'], 'et-nojs-reset_epanel' ) ) ) { if ( ! isset( $GLOBALS['et_core_updates'] ) ) { et_register_updates_component(); } epanel_save_data( 'js_disabled' ); //saves data when javascript is disabled } } $core_page = add_theme_page( $themename . ' ' . esc_html__( 'Options', $themename ), $themename . ' ' . esc_html__( 'Theme Options', $themename ), 'switch_themes', basename( __FILE__ ), 'et_build_epanel' ); add_action( "admin_print_scripts-{$core_page}", 'et_epanel_admin_js' ); add_action( "admin_head-{$core_page}", 'et_epanel_css_admin' ); add_action( "load-{$core_page}", 'et_epanel_hook_scripts' ); } /* --------------------------------------------- */ /* Displays ePanel */ if ( ! function_exists( 'et_build_epanel' ) ) { function et_build_epanel() { global $themename, $shortname, $options, $et_disabled_jquery, $epanelMainTabs; // load theme settings array et_load_core_options(); $tabs = array(); $default_tab_names = array( 'ad' => _x( 'Ads', 'site ads placement areas', $themename ), 'colorization' => _x( 'Colorization', 'site color scheme', $themename ), 'general' => _x( 'General', 'general options', $themename ), 'integration' => _x( 'Integration', 'integrate third-party code', $themename ), 'layout' => _x( 'Layout', 'page/post', $themename ), 'navigation' => _x( 'Navigation', 'navigation menu', $themename ), 'seo' => _x( 'SEO', 'search engine optimization', $themename ), 'support' => _x( 'Support', 'documentation links', $themename ), 'updates' => _x( 'Updates', 'theme updates', $themename ), ); /** * Filters the data used to construct ePanel's layout. * * @since 3.2.1 * * @param array $options */ $options = apply_filters( 'et_epanel_layout_data', $options ); /** * Filters the slugs/ids for ePanel's tabs. * * @deprecated * * @since 1.0 * @since 3.2.1 Deprecated * * @param string[] $tab_slugs */ $epanelMainTabs = apply_filters( 'epanel_page_maintabs', $epanelMainTabs ); foreach( $epanelMainTabs as $tab_slug ) { if ( isset( $default_tab_names[ $tab_slug ] ) ) { $tabs[ $tab_slug ] = $default_tab_names[ $tab_slug ]; } } /** * Filters ePanel's localized tab names. * * @since 3.2.1 * * @param string[] $tabs { * * @type string $tab_slug Localized tab name. * ... * } */ $tabs = apply_filters( 'et_epanel_tab_names', $tabs ); if ( isset($_GET['saved']) ) { if ( $_GET['saved'] ) echo '
' . esc_html( $themename ) . ' ' . esc_html__( 'settings saved.', $themename ) . '
' . esc_html( $themename ) . ' ' . esc_html__( 'settings reset.', $themename ) . '