芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/ebpt.pulsehost.co.uk/wp-content/themes/maxcoach/framework/class-top-bar.php
'01', '02' => '02', ); } /** * @param bool $default_option Show or hide default select option. * @param string $default_text Custom text for default option. * * @return array A list of options for select field. */ public function get_list( $default_option = false, $default_text = '' ) { $top_bars = array( 'none' => esc_html__( 'Hide', 'maxcoach' ), ); $top_bars += $this->get_type(); if ( $default_option === true ) { if ( $default_text === '' ) { $default_text = esc_html__( 'Default', 'maxcoach' ); } $top_bars = array( '' => $default_text ) + $top_bars; } return $top_bars; } public function get_support_components() { $list = [ 'widget' => esc_html__( 'Widget', 'maxcoach' ), 'text' => esc_html__( 'Text', 'maxcoach' ), 'language_switcher' => esc_html__( 'Language Switcher', 'maxcoach' ), 'info_list' => esc_html__( 'Info List', 'maxcoach' ), 'user_link' => esc_html__( 'User Link', 'maxcoach' ), ]; return $list; } /** * Add classes to the top barr. * * @var string $class Custom class. */ public function get_wrapper_class( $class = '' ) { $classes = array( 'page-top-bar' ); $type = Maxcoach_Global::instance()->get_top_bar_type(); $classes[] = "top-bar-{$type}"; if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } $classes = apply_filters( 'maxcoach_top_bar_class', $classes, $class ); echo 'class="' . esc_attr( join( ' ', $classes ) ) . '"'; } public function render() { $type = Maxcoach_Global::instance()->get_top_bar_type(); if ( 'none' !== $type ) { get_template_part( 'template-parts/top-bar/top-bar', $type ); } } public function print_components( $position = false ) { $type = Maxcoach_Global::instance()->get_top_bar_type(); if ( false === $position ) { $components = Maxcoach::setting( "top_bar_style_{$type}_components" ); } else { $components = Maxcoach::setting( "top_bar_style_{$type}_{$position}_components" ); } if ( empty( $components ) ) { return; } foreach ( $components as $component ) { $this->print_component( $component ); } } /** * @param string $component Component type */ public function print_component( $component ) { switch ( $component ) { case 'text' : $this->print_text(); break; case 'widget' : $this->print_widgets(); break; case 'language_switcher' : $this->print_language_switcher(); break; case 'info_list' : $this->print_info_list(); break; case 'user_link' : $this->print_user_link(); break; } } public function print_text() { $type = Maxcoach_Global::instance()->get_top_bar_type(); $text = Maxcoach::setting( "top_bar_style_{$type}_text" ); echo '
' . $text . '
'; } /** * Print WPML switcher html template. * * @var string $class Custom class. */ public function print_language_switcher() { do_action( 'maxcoach_before_add_language_selector_top_bar' ); if ( ! defined( 'ICL_SITEPRESS_VERSION' ) ) { return; } ?>
target="_blank" >
is_activated() ) { $login_url = wc_get_page_permalink( 'myaccount' ); } ?>
is_activated() ) : ?>
get_top_bar_type(); $enable = Maxcoach::setting( "top_bar_style_{$type}_social_networks_enable" ); if ( $enable !== '1' ) { return; } ?>
'icon', 'tooltip_enable' => false, ) ); ?>
get_top_bar_type(); $info_list = Maxcoach::setting( "top_bar_style_{$type}_info_list" ); if ( empty( $info_list ) ) { return; } ?>
' . $text . ''; ?>
initialize(); }