HEX
Server: Apache
System: Linux sxb1plmcpnl510113.prod.sxb1.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: acnbijigo78q (10488831)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/acnbijigo78q/public_html/wp-content/plugins/wpml-import/classes/Helper/Taxonomies.php
<?php

namespace WPML\Import\Helper;

use WPML\FP\Str;

class Taxonomies {

	/**
	 * @param bool $withWpmlPrefix
	 *
	 * @return array
	 */
	public static function getTranslatableOnly( $withWpmlPrefix = false ) {
		/** @var \SitePress $sitepress */
		global $sitepress;

		return wpml_collect( self::getTranslatable() )
			->diff( $sitepress->get_display_as_translated_taxonomies() )
			->map( self::addWpmlPrefix( $withWpmlPrefix ) )
			->toArray();
	}

	/**
	 * @param bool $withWpmlPrefix
	 *
	 * @return array
	 */
	public static function getTranslatable( $withWpmlPrefix = false ) {
		/** @var \SitePress $sitepress */
		global $sitepress;

		return wpml_collect( $sitepress->get_translatable_taxonomies() )
			->map( self::addWpmlPrefix( $withWpmlPrefix ) )
			->toArray();
	}

	/**
	 * @param bool $withWpmlPrefix
	 *
	 * @return callable(string):string
	 */
	private static function addWpmlPrefix( $withWpmlPrefix ) {
		return Str::concat( $withWpmlPrefix ? 'tax_' : '' );
	}

	/**
	 * @param  string $taxonomy
	 *
	 * @return bool
	 */
	public static function isTranslatable( $taxonomy ) {
		return in_array( $taxonomy, self::getTranslatable(), true );
	}
}