<commit_before><?php

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

/**
 * Papi Admin Meta Box Tabs.
 *
 * @package Papi
 * @version 1.0.0
 */
class Papi_Admin_Meta_Box_Tabs {

	/**
	 * The tabs.
	 *
	 * @var array
	 * @since 1.0.0
	 */

	private $tabs = array();

	/**
	 * Constructor.
	 *
	 * @param array $tabs
	 *
	 * @since 1.0.0
	 */

	public function __construct( $tabs = array() ) {
		if ( empty( $tabs ) ) {
			return;
		}

		$this->setup_tabs( $tabs );

		$this->html();
	}

	/**
	 * Setup tabs array.
	 *
	 * @param array $tabs
	 *
	 * @since 1.0.0
	 * @access private
	 */

	private function setup_tabs( $tabs ) {
		// Check capabilities on tabs.
		$tabs = array_filter( $tabs, function ( $tab ) {
			return _papi_current_user_is_allowed( $tab->options->capabilities );
		} );

		// Sort tabs based on `sort_order` value.
		$tabs = _papi_sort_order( $tabs );

		// Generate unique names for all tabs.
		for ( $i = 0; $i < count( $tabs ); $i ++ ) {
			$tabs[ $i ]->name = _papi_name( $tabs[ $i ]->title ) . '_' . $i;

			foreach ($tabs[$i]->properties as $property) {
				if (!isset($tabs[$i]->sidebar)) {
					$tabs[$i]->sidebar = true;
				}
			}
		}

		$this->tabs = $tabs;
	}

	/**
	 * Generate html for tabs and properties.
	 *
	 * @since 1.0.0
	 * @access private
	 */

	private function html() {
		?>
		<div class="papi-tabs-wrapper">
			<div class="papi-tabs-table-back"></div>
			<div class="papi-tabs-back"></div>
			<ul class="papi-tabs">
				<?php

				foreach ( $this->tabs as $tab ):
					?>
					<li class="<?php echo $this->tabs[0] == $tab ? 'active' : ''; ?>">
						<a href="#" data-papi-tab="<?php echo $tab->name; ?>">
							<?php if ( isset( $tab->options->icon ) && ! empty( $tab->options->icon ) ): ?>
								<img src="<?php echo $tab->options->icon; ?>" alt="<?php echo $tab->title; ?>"/>
							<?php endif;
							echo $tab->title; ?>
						</a>
					</li>
				<?php
				endforeach;
				?>
			</ul>
			<div class="papi-tabs-content">
				<?php
				foreach ( $this->tabs as $tab ):
					?>
					<div class="<?php echo $this->tabs[0] == $tab ? 'active' : ''; ?>"
					     data-papi-tab="<?php echo $tab->name; ?>">
						<?php
							$properties = $tab->properties;

							$properties = array_map(function ($property) {
								// While in a tab the sidebar is required.
								$property->sidebar = true;

								return $property;
							}, $properties);

							_papi_render_properties( $properties );
						?>
					</div>
				<?php
				endforeach;
				?>
			</div>
		</div>
		<div class="papi-clear"></div>
	<?php
	}
}
<commit_msg>Removed unnecessary code<commit_after><?php

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

/**
 * Papi Admin Meta Box Tabs.
 *
 * @package Papi
 * @version 1.0.0
 */
class Papi_Admin_Meta_Box_Tabs {

	/**
	 * The tabs.
	 *
	 * @var array
	 * @since 1.0.0
	 */

	private $tabs = array();

	/**
	 * Constructor.
	 *
	 * @param array $tabs
	 *
	 * @since 1.0.0
	 */

	public function __construct( $tabs = array() ) {
		if ( empty( $tabs ) ) {
			return;
		}

		$this->setup_tabs( $tabs );

		$this->html();
	}

	/**
	 * Setup tabs array.
	 *
	 * @param array $tabs
	 *
	 * @since 1.0.0
	 * @access private
	 */

	private function setup_tabs( $tabs ) {
		// Check capabilities on tabs.
		$tabs = array_filter( $tabs, function ( $tab ) {
			return _papi_current_user_is_allowed( $tab->options->capabilities );
		} );

		// Sort tabs based on `sort_order` value.
		$tabs = _papi_sort_order( $tabs );

		// Generate unique names for all tabs.
		for ( $i = 0; $i < count( $tabs ); $i ++ ) {
			$tabs[ $i ]->name = _papi_name( $tabs[ $i ]->title ) . '_' . $i;
		}

		$this->tabs = $tabs;
	}

	/**
	 * Generate html for tabs and properties.
	 *
	 * @since 1.0.0
	 * @access private
	 */

	private function html() {
		?>
		<div class="papi-tabs-wrapper">
			<div class="papi-tabs-table-back"></div>
			<div class="papi-tabs-back"></div>
			<ul class="papi-tabs">
				<?php

				foreach ( $this->tabs as $tab ):
					?>
					<li class="<?php echo $this->tabs[0] == $tab ? 'active' : ''; ?>">
						<a href="#" data-papi-tab="<?php echo $tab->name; ?>">
							<?php if ( isset( $tab->options->icon ) && ! empty( $tab->options->icon ) ): ?>
								<img src="<?php echo $tab->options->icon; ?>" alt="<?php echo $tab->title; ?>"/>
							<?php endif;
							echo $tab->title; ?>
						</a>
					</li>
				<?php
				endforeach;
				?>
			</ul>
			<div class="papi-tabs-content">
				<?php
				foreach ( $this->tabs as $tab ):
					?>
					<div class="<?php echo $this->tabs[0] == $tab ? 'active' : ''; ?>"
					     data-papi-tab="<?php echo $tab->name; ?>">
						<?php
							$properties = $tab->properties;

							$properties = array_map(function ($property) {
								// While in a tab the sidebar is required.
								$property->sidebar = true;

								return $property;
							}, $properties);

							_papi_render_properties( $properties );
						?>
					</div>
				<?php
				endforeach;
				?>
			</div>
		</div>
		<div class="papi-clear"></div>
	<?php
	}
}

{'fraction_non_alphanumeric': 0.20248178057908214, 'fraction_numerical': 0.007090801654520386, 'mean_word_length': 2.299545159194282, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 118, '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': '5994031', 'n_tokens_mistral': 2295, 'n_tokens_neox': 1823, 'n_words': 428}