<commit_before><?php
/**
 * Plugin Name: Alphasss Top Navigation
 * Plugin URI:  http://alphasss.com/
 * Description: Alphasss Top Navigation
 * Author:      AlphaSSS
 * Author URI:  http://alphasss.com
 * Version:     0.0.1
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

//Loads the plugin's translated strings
load_plugin_textdomain('alphasss-top-navigation', false, basename(dirname( __FILE__ )) . '/languages');

__('Blog', 'alphasss-top-navigation');
__('Register', 'alphasss-top-navigation');
__('Home', 'alphasss-top-navigation');
__('Browse', 'alphasss-top-navigation');
__('Forum', 'alphasss-top-navigation');

add_action( 'plugins_loaded', function(){
	// Top navigation localization
	add_filter('wp_get_nav_menu_items', function($items, $menu){
		foreach ( $items as $key => $item ) {
	        $items[$key]->title = __($items[$key]->title, 'alphasss-top-navigation');
	    }

	    return $items;
	}, 10, 2);
	//--
});<commit_msg>set active class in top navigation menu for Register<commit_after><?php
/**
 * Plugin Name: Alphasss Top Navigation
 * Plugin URI:  http://alphasss.com/
 * Description: Alphasss Top Navigation
 * Author:      AlphaSSS
 * Author URI:  http://alphasss.com
 * Version:     0.0.1
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

//Loads the plugin's translated strings
load_plugin_textdomain('alphasss-top-navigation', false, basename(dirname( __FILE__ )) . '/languages');

__('Blog', 'alphasss-top-navigation');
__('Register', 'alphasss-top-navigation');
__('Home', 'alphasss-top-navigation');
__('Browse', 'alphasss-top-navigation');
__('Forum', 'alphasss-top-navigation');

add_action( 'plugins_loaded', function(){
	// Top navigation localization
	add_filter('wp_get_nav_menu_items', function($items, $menu){

		foreach ( $items as $key => $item ) {
			$items[$key]->title = __($items[$key]->title, 'alphasss-top-navigation');

			if ($items[$key]->title == 'Register') {
				if (is_user_logged_in()) {
					// Remove register for member
					if (current_user_can('generate_invitation_code')) {
						unset($items[$key]);
					} else {
						$items[$key]->url       = str_replace('register', 'activate', $items[$key]->url);

						// Set active class in menu
						$items[$key]->classes[] = 'current-menu-item page_item';
					}
				}
			}
	    }

	    return $items;
	}, 10, 2);
	//--
});
{'fraction_non_alphanumeric': 0.18063157894736842, 'fraction_numerical': 0.0050526315789473685, 'mean_word_length': 3.9707112970711296, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6202945', 'n_tokens_mistral': 863, 'n_tokens_neox': 783, 'n_words': 171}