<commit_before><?php

/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Twitter Bootstrap 2.3.2 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.2
* Author: <NAME> - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/

class wp_bootstrap_navwalker extends Walker_Nav_Menu {

    
	/**
	* @see Walker::start_el()
	* @since 3.0.0
	*
	* @param string $output Passed by reference. Used to append additional content.
	* @param object $item Menu item data object.
	* @param int $depth Depth of menu item. Used for padding.
	* @param int $current_page Menu item ID.
	* @param object $args
	*/
	
    function start_el( &$output, $item, $depth, $args ) {
        $class_names = $value = '';     
        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
        $classes[] = 'menu-item-' . $item->ID;
        
        $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );

        $active = false;
        if(in_array('current-menu-item', $classes)) { $active = ' current'; }
        
        $class_names = ' class="' . esc_attr( $class_names ) . '"';
        
        $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
        $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
        
        //$output .= $indent . '<li' . $id . $value . $class_names .'>';
        $output .= $indent . '<li' . $id . $value .'>';
        
        
        // CREATION DES ATTRIBUTS
       //var_dump($item);
        $atts = array();
        $atts['title'] = ! empty( $item->title ) ? $item->title : '';
        $atts['target'] = ! empty( $item->target ) ? $item->target : '';
        $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
        //$atts['class'] = 'list-group-item '.$active;
        $atts['class'] = $active;
        $atts['href'] = ! empty( $item->url ) ? $item->url : '';
        
        // APPLICATION DES ATTRIBUTS
        $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
        
        $attributes = '';
        foreach ( $atts as $attr => $value ) {
            if ( ! empty( $value ) ) {
                $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
                $attributes .= ' ' . $attr . '="' . $value . '"';
            }
        }
        //var_dump($item);
        //$item_output = $args->before;
            $item_output .= '<a'. $attributes .'>';
              $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
            $item_output .= ($args->has_children && $depth === 0) ? ' <span class="caret"></span></a>' : ' <span class="pull-right glyphicon glyphicon-chevron-right"></span></a>';
        //$item_output .= $args->after;
        <commit_msg>Suppression du glyphicon par défaut<commit_after><?php

/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Twitter Bootstrap 2.3.2 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.2
* Author: <NAME> - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/

class wp_bootstrap_navwalker extends Walker_Nav_Menu {

    
	/**
	* @see Walker::start_el()
	* @since 3.0.0
	*
	* @param string $output Passed by reference. Used to append additional content.
	* @param object $item Menu item data object.
	* @param int $depth Depth of menu item. Used for padding.
	* @param int $current_page Menu item ID.
	* @param object $args
	*/
	
    function start_el( &$output, $item, $depth, $args ) {
        $class_names = $value = '';     
        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
        $classes[] = 'menu-item-' . $item->ID;
        
        $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );

        $active = false;
        if(in_array('current-menu-item', $classes)) { $active = ' current'; }
        
        $class_names = ' class="' . esc_attr( $class_names ) . '"';
        
        $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
        $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
        
        //$output .= $indent . '<li' . $id . $value . $class_names .'>';
        $output .= $indent . '<li' . $id . $value .'>';
        
        
        // CREATION DES ATTRIBUTS
       //var_dump($item);
        $atts = array();
        $atts['title'] = ! empty( $item->title ) ? $item->title : '';
        $atts['target'] = ! empty( $item->target ) ? $item->target : '';
        $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
        //$atts['class'] = 'list-group-item '.$active;
        $atts['class'] = $active;
        $atts['href'] = ! empty( $item->url ) ? $item->url : '';
        
        // APPLICATION DES ATTRIBUTS
        $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
        
        $attributes = '';
        foreach ( $atts as $attr => $value ) {
            if ( ! empty( $value ) ) {
                $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
                $attributes .= ' ' . $attr . '="' . $value . '"';
            }
        }
        //var_dump($item);
        //$item_output = $args->before;
            $item_output .= '<a'. $attributes .'>';
              $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
            $item_output .= ($args->has_children && $depth === 0) ? ' <span class="caret"></span></a>' : '</a>';
        //$item_output .= $args->after;
        
{'fraction_non_alphanumeric': 0.19016338217955195, 'fraction_numerical': 0.00471618662624221, 'mean_word_length': 2.243036592026215, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 61, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5208418', 'n_tokens_mistral': 1965, 'n_tokens_neox': 1916, 'n_words': 453}