芝麻web文件管理V1.00
编辑当前文件:/home/felaukpo/public_html/wp-content/themes/pixelpiernyc/vamtam/classes/overrides.php
user_id ); if ( $user && ! empty( $user->display_name ) ) { $author = $user->display_name; } return $author; } public static function excerpt_length( $words ) { if ( ! vamtam_extra_features() ) { return 20; } return $words; } public static function the_password_form( $html ) { return preg_replace( '/(
)(.*?)(?=
$2', $html ); } /** * Custom wp_kses contexts * * @param array $allowedtags * @param string $context * @return array */ public static function wp_kses_allowed_html( $allowedtags, $context ) { if ( $context === 'vamtam-a-span' ) { return [ 'a' => [ 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'id' => true, 'style' => true, 'title' => true, 'role' => true, 'data-*' => true, 'href' => true, 'target' => true, ], 'span' => [ 'class' => true, 'id' => true, 'style' => true, 'data-*' => true, ], ]; } if ( $context === 'vamtam-admin' ) { return [ 'a' => [ 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'id' => true, 'style' => true, 'title' => true, 'role' => true, 'data-*' => true, 'href' => true, 'target' => true, ], 'span' => [ 'class' => true, 'id' => true, 'style' => true, 'data-*' => true, ], 'code' => [], 'br' => [], 'p' => [ 'class' => true, 'id' => true, ], ]; } return $allowedtags; } public static function sgf_options( $opt ) { $opt['font_display'] = 'swap'; return $opt; } /** * Extra templates */ public static function footer_additions() { get_template_part( 'templates/overlay-search' ); get_template_part( 'templates/side-buttons' ); } /** * @param string * @param array * @return string */ public static function render_block( $block_content, $block ) { if ( $block['blockName'] === 'core/cover' ) { if ( isset( $block['attrs']['align'] ) && in_array( $block['attrs']['align'], array( 'left', 'right' ), true ) ) { $block_content = str_replace( "align{$block['attrs']['align']}", '', $block_content ); $block_content = "
" . $block_content . '
'; } } return $block_content; } /** * @return bool true if the pages needs the outer .limit-wrapper */ public static function limit_wrapper() { global $vamtam_theme, $post; if ( VamtamElementorBridge::is_elementor_pro_active() && VamtamElementorBridge::is_build_with_elementor() ) { // If Elementor pro is used and is active dont apply limit-wrapper. $GLOBALS['vamtam_had_limit_wrapper'] = false; } else if ( is_404() ) { // 404 should be full width. $GLOBALS['vamtam_had_limit_wrapper'] = false; } else if ( vamtam_has_woocommerce() && is_product() && VamtamElementorBridge::is_elementor_pro_active() ) { // Product pages are full width when Elementor Pro is active. $GLOBALS['vamtam_had_limit_wrapper'] = false; } else { $GLOBALS['vamtam_had_limit_wrapper'] = ! is_singular() || ( vamtam_has_woocommerce() && is_product() ) || ( class_exists( 'VamtamTemplates' ) && VamtamTemplates::get_layout() !== 'full' ) || ! ( ( class_exists( '\Elementor\Plugin' ) ) || ( class_exists( 'Vamtam_Elements_B' ) && Vamtam_Elements_B::is_beaver_used() ) || ( is_callable( 'has_blocks' ) && has_blocks() ) ); } } /** * Wrap the current page number in a span * @param string $link * @param int $i * @return string */ public static function wp_link_pages_link( $link, $i ) { if ( strpos( $link, '
' . $link . ''; } return $link; } public static function widget_title( $title = '', $instance = null, $id_base = null ) { if ( ! is_null( $instance ) && $id_base === 'recent-posts' && empty( $instance['title'] ) ) { return ''; } return $title; } public static function wp_title( $title ) { if ( empty( $title ) && ( is_home() || is_front_page() ) ) { $description = get_bloginfo( 'description' ); return get_bloginfo( 'name' ) . ( ! empty( $description ) ? ' | ' . $description : '' ); } return $title; } /** * Remove unnecessary menu item classes * * @param array $classes current menu item classes * @param object $item menu item * @param object $args menu item args * @return array filtered classes */ public static function nav_menu_css_class( $classes, $item ) { if ( isset( $item->url ) && strpos( $item->url, '#' ) !== false && ( $key = array_search( 'mega-current-menu-item', $classes ) ) !== false ) { unset( $classes[ $key ] ); $classes[] = 'maybe-current-menu-item'; $GLOBALS['vamtam_menu_had_hash'] = true; } if ( isset( $GLOBALS['vamtam_menu_had_hash'] ) && $GLOBALS['vamtam_menu_had_hash'] ) { $classes = array_diff( $classes, array( 'mega-current-menu-item', 'mega-current-menu-ancestor', 'mega-current-menu-parent' ) ); } return $classes; } /** * Wrap oEmbeds in .vamtam-video-frame * * @param string $output original oembed output * @param object $data data from the oEmbed provider * @param string $url original embed url * @return string $output wrapped in additional html */ public static function oembed_dataparse( $output, $data, $url ) { if ( $data->type == 'video' && ! ( has_blocks() && doing_filter( 'the_content' ) ) ) return '
' . $output . '
'; return $output; } /** * Sets the excerpt ending * * @param string $more original ending * @return string excerpt ending */ public static function excerpt_more( $more ) { return '...'; } }