Файловый менеджер - Редактировать - /home/avadvi5/public_html/wp-content/plugins/code4rest-pro/dist/dark-mode/hooks.php
Ðазад
<?php /** * Functions for dark mode. * * @package Code4rest */ namespace Code4rest_Pro; use function Code4rest\code4rest; use function Code4rest\render_custom_logo; use function is_customize_preview; /** * Output Dark mode Mobile Logo. */ function dark_mode_mobile_logo() { if ( code4rest()->option( 'dark_mode_enable' ) && code4rest()->option( 'dark_mode_custom_logo' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { if ( code4rest()->option( 'dark_mode_custom_mobile_logo' ) ) { render_custom_logo( 'dark_mode_mobile_logo', 'code4rest-dark-mode-logo' ); } else { render_custom_logo( 'dark_mode_logo', 'code4rest-dark-mode-logo' ); } } } add_action( 'before_code4rest_mobile_logo_output', 'Code4rest_Pro\dark_mode_mobile_logo' ); /** * Output Darkmode Logo. */ function dark_mode_logo() { if ( code4rest()->option( 'dark_mode_enable' ) && code4rest()->option( 'dark_mode_custom_logo' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { render_custom_logo( 'dark_mode_logo', 'code4rest-dark-mode-logo' ); } } add_action( 'before_code4rest_logo_output', 'Code4rest_Pro\dark_mode_logo' ); /** * Output Darkmode Learndash Logo. * @param string $header_element Focus mode header element markup. * @param array $header Array of header element details keyed logo_alt, logo_url, text, text_url. * @param int $course_id Course ID. * @param int $user_id User ID. */ function learndash_focus_dark_mode_logo( $header_element, $header, $course_id, $user_id ) { if ( code4rest()->option( 'dark_mode_enable' ) && code4rest()->option( 'dark_mode_learndash_enable' ) && code4rest()->option( 'dark_mode_learndash_lesson_logo' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { ob_start(); echo '<a class="brand code4rest-dark-mode-logo-link" href="' . esc_url( apply_filters( 'code4rest_logo_url', home_url( '/' ) ) ) . '" rel="home" aria-label="' . esc_attr( get_bloginfo( 'name' ) ) . '">'; render_custom_logo( 'dark_mode_learndash_lesson_logo', 'code4rest-dark-mode-logo' ); echo '</a>'; $darkmode_logo = ob_get_clean(); $header_element = $header_element . $darkmode_logo; } return $header_element; } add_filter( 'learndash_focus_header_element', 'Code4rest_Pro\learndash_focus_dark_mode_logo', 20, 4 ); /** * Output Header Switch. */ function header_color_switcher() { if ( code4rest()->option( 'dark_mode_enable' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { echo '<div class="code4rest-color-palette-header-switcher">'; echo output_color_switcher( code4rest()->option( 'header_dark_mode_switch_type' ), code4rest()->option( 'header_dark_mode_switch_style' ), code4rest()->option( 'header_dark_mode_light_icon' ), code4rest()->option( 'header_dark_mode_dark_icon' ), code4rest()->option( 'header_dark_mode_light_switch_title' ), code4rest()->option( 'header_dark_mode_dark_switch_title' ), code4rest()->option( 'header_dark_mode_switch_tooltip' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } } add_action( 'code4rest_header_dark_mode', 'Code4rest_Pro\header_color_switcher' ); /** * Output Mobile Switch. */ function mobile_color_switcher() { if ( code4rest()->option( 'dark_mode_enable' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { echo '<div class="code4rest-color-palette-mobile-switcher">'; echo output_color_switcher( code4rest()->option( 'mobile_dark_mode_switch_type' ), code4rest()->option( 'mobile_dark_mode_switch_style' ), code4rest()->option( 'mobile_dark_mode_light_icon' ), code4rest()->option( 'mobile_dark_mode_dark_icon' ), code4rest()->option( 'mobile_dark_mode_light_switch_title' ), code4rest()->option( 'mobile_dark_mode_dark_switch_title' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } } add_action( 'code4rest_mobile_dark_mode', 'Code4rest_Pro\mobile_color_switcher' ); /** * Output Footer Switch. */ function footer_color_switcher() { if ( code4rest()->option( 'dark_mode_enable' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { echo '<div class="code4rest-color-palette-footer-switcher">'; echo output_color_switcher( code4rest()->option( 'footer_dark_mode_switch_type' ), code4rest()->option( 'footer_dark_mode_switch_style' ), code4rest()->option( 'footer_dark_mode_light_icon' ), code4rest()->option( 'footer_dark_mode_dark_icon' ), code4rest()->option( 'footer_dark_mode_light_switch_title' ), code4rest()->option( 'footer_dark_mode_dark_switch_title' ), code4rest()->option( 'footer_dark_mode_switch_tooltip' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } } add_action( 'code4rest_footer_dark_mode', 'Code4rest_Pro\footer_color_switcher' ); /** * Output Fixed Switch. */ function fixed_color_switcher() { if ( code4rest()->option( 'dark_mode_enable' ) && code4rest()->option( 'dark_mode_switch_show' ) && apply_filters( 'code4rest_dark_mode_enable', true ) ) { echo '<div class="code4rest-color-palette-fixed-switcher kcpf-position-' . esc_attr( code4rest()->option( 'dark_mode_switch_position' ) ) . ' vs-lg-' . ( code4rest()->sub_option( 'dark_mode_switch_visibility', 'desktop' ) ? 'true' : 'false' ) . ' vs-md-' . ( code4rest()->sub_option( 'dark_mode_switch_visibility', 'tablet' ) ? 'true' : 'false' ) . ' vs-sm-' . ( code4rest()->sub_option( 'dark_mode_switch_visibility', 'mobile' ) ? 'true' : 'false' ) . '">'; echo output_color_switcher( code4rest()->option( 'dark_mode_switch_type' ), code4rest()->option( 'dark_mode_switch_style' ), code4rest()->option( 'dark_mode_light_icon' ), code4rest()->option( 'dark_mode_dark_icon' ), code4rest()->option( 'dark_mode_light_switch_title' ), code4rest()->option( 'dark_mode_dark_switch_title' ), code4rest()->option( 'dark_mode_switch_tooltip' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } } add_action( 'wp_footer', 'Code4rest_Pro\fixed_color_switcher' ); /** * Output Header Switch. */ function header_learndash_color_switcher() { if ( code4rest()->option( 'dark_mode_enable' ) && code4rest()->option( 'dark_mode_learndash_enable' ) ) { echo '<div class="code4rest-color-palette-header-switcher">'; echo output_color_switcher( code4rest()->option( 'header_dark_mode_switch_type' ), code4rest()->option( 'header_dark_mode_switch_style' ), code4rest()->option( 'header_dark_mode_light_icon' ), code4rest()->option( 'header_dark_mode_dark_icon' ), code4rest()->option( 'header_dark_mode_light_switch_title' ), code4rest()->option( 'header_dark_mode_dark_switch_title' ), code4rest()->option( 'header_dark_mode_switch_tooltip' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } } add_action( 'learndash-focus-header-usermenu-after', 'Code4rest_Pro\header_learndash_color_switcher' ); /** * Output Switch. */ function output_color_switcher( $type = 'icon', $style = 'button', $light_icon = 'sun', $dark_icon = 'moon', $light_text = 'Light', $dark_text = 'Dark', $tooltip = false ) { echo '<div class="code4rest-color-palette-switcher kcps-style-' . esc_attr( $style ) . ' kcps-type-' . esc_attr( $type ) . '">'; echo '<button class="code4rest-color-palette-toggle code4rest-color-toggle" aria-label="' . esc_attr__( 'Change site color palette', 'code4rest-pro' ) . '">'; switch ( $type ) { case 'text': echo '<span class="code4rest-color-palette-light">'; echo '<span class="code4rest-color-palette-label">'; echo esc_html( $light_text ); echo '</span>'; echo '</span>'; echo '<span class="code4rest-color-palette-dark">'; echo '<span class="code4rest-color-palette-label">'; echo esc_html( $dark_text ); echo '</span>'; echo '</span>'; break; case 'both': echo '<span class="code4rest-color-palette-light">'; echo '<span class="code4rest-color-palette-icon">'; code4rest()->print_icon( $light_icon, $light_text ); echo '</span>'; echo '<span class="code4rest-color-palette-label">'; echo esc_html( $light_text ); echo '</span>'; echo '</span>'; echo '<span class="code4rest-color-palette-dark">'; echo '<span class="code4rest-color-palette-icon">'; code4rest()->print_icon( $dark_icon, $dark_text ); echo '</span>'; echo '<span class="code4rest-color-palette-label">'; echo esc_html( $dark_text ); echo '</span>'; echo '</span>'; break; default: echo '<span class="code4rest-color-palette-light"' . ( $tooltip ? 'data-tooltip-drop="' . esc_attr( $light_text ) . '"' : '' ) . '>'; echo '<span class="code4rest-color-palette-icon">'; code4rest()->print_icon( $light_icon, $light_text ); echo '</span>'; echo '</span>'; echo '<span class="code4rest-color-palette-dark"' . ( $tooltip ? 'data-tooltip-drop="' . esc_attr( $dark_text ) . '"' : '' ) . '>'; echo '<span class="code4rest-color-palette-icon">'; code4rest()->print_icon( $dark_icon, $dark_text ); echo '</span>'; echo '</span>'; break; } echo '</button>'; echo '</div>'; }
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка