HEX
Server: Apache/2
System: Linux server1c 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64
User: swtinter (1023)
PHP: 8.2.23
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/swtinter/public_html/wp-content/plugins/polylang/admin/admin-default-term.php
<?php
/**
 * @package Polylang
 */

/**
 * Manages filters and actions related to default terms.
 *
 * @since 3.1
 * @since 3.7 Extends `PLL_Default_Term`, most of the code is moved to it.
 */
class PLL_Admin_Default_Term extends PLL_Default_Term {

	/**
	 * Setups filters and actions needed.
	 *
	 * @since 3.1
	 *
	 * @return void
	 */
	public function add_hooks() {
		parent::add_hooks();

		foreach ( $this->taxonomies as $taxonomy ) {
			if ( 'category' === $taxonomy ) {
				// Adds the language column in the 'Terms' table.
				add_filter( 'pll_first_language_term_column', array( $this, 'first_language_column' ), 10, 2 );
			}
		}
	}

	/**
	 * Identifies the default term in the terms list table to disable the language dropdown in JS.
	 *
	 * @since 3.7
	 *
	 * @param  string $out     The output.
	 * @param  int    $term_id The term id.
	 * @return string          The HTML string.
	 */
	public function first_language_column( $out, $term_id ) {
		if ( $this->is_default_term( $term_id ) ) {
			$out .= sprintf( '<div class="hidden" id="default_cat_%1$d">%1$d</div>', intval( $term_id ) );
		}

		return $out;
	}
}