HEX
Server: Apache
System: Linux digivps 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC 2025 x86_64
User: root (0)
PHP: 8.3.15
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/biographybirthday.com/wp-content/plugins/term-management-tools/classes/class-HTML.php
<?php

namespace CNMD\TMT;

/**
 * Class HTML
 *
 * Handles the creation and display of required HTML. The elements inserted ad re-positioned by javascript.
 *
 * @package CNMD\TMT
 */
class HTML extends Base {


	/**
	 * Create and insert the HTML required by each valid action. They are put into the footer of the page and
	 * moved to the correct spot via JS.
	 */
	public function insert() {
		global $taxonomy;
		foreach ( array_keys( $this->get_actions( $taxonomy ) ) as $key ) {
			if ( ! method_exists( $this, $key ) ) {
				// @codeCoverageIgnoreStart
				continue;
				// @codeCoverageIgnoreEnd
			}
			/*
			 * I realize this is less elegant than using something like
			 * $this->{$key}( $taxonomy )
			 * but it is also a lot clearer, and clearer > clever every time IMHO.
			 */
			echo '<div id="tmt-input-' . esc_attr( $key ) . '" style="display:none">';
			switch ( $key ) {
				case 'merge':
					$success = $this->merge( $taxonomy );
					break;
				case 'set_parent':
					$success = $this->set_parent( $taxonomy );
					break;
				case 'change_tax':
					$success = $this->change_tax( $taxonomy );
					break;
			}
			echo '</div>';
		}
	}


	/**
	 * Create and echo the HTML for the "Merge" required extra info.
	 *
	 * @param string $taxonomy
	 */
	private function merge( string $taxonomy ) {
		esc_html_e( 'into:', 'term-management-tools' );
		?>
		<input name="bulk_to_tag" type="text" size="20" />
		<?php
	}


	/**
	 * Create and echo the HTML for the "Set Parent" required extra info.
	 *
	 * @param string $taxonomy
	 *
	 * @codeCoverageIgnore  This contains only a WP core function, which we don't need to test.
	 */
	private function set_parent( string $taxonomy ) {
		wp_dropdown_categories(
			array(
				'echo'             => true,
				'hide_empty'       => 0,
				'hide_if_empty'    => false,
				'name'             => 'parent',
				'orderby'          => 'name',
				'taxonomy'         => $taxonomy,
				'hierarchical'     => true,
				'show_option_none' => __( 'None', 'term-management-tools' ),
			)
		);
	}


	/**
	 * Create and echo the HTML for the "Change Parent" required extra info. This is a list of valid taxonomies,
	 * excluding the current one.
	 *
	 * @param string $taxonomy
	 */
	private function change_tax( string $taxonomy ) {
		$tax_list = get_taxonomies(
			array(
				'show_ui' => true,
				'public'  => true,
			),
			'objects'
		);
		?>
		<select class="postform" name="new_tax">
			<?php
			foreach ( $tax_list as $new_tax => $tax_obj ) {
				if ( $new_tax === $taxonomy ) {
					continue;
				}
				echo '<option value="' . esc_attr( $new_tax ) . '">' . esc_html( $tax_obj->label ) . '</option>';
			}
			?>
		</select>
		<?php
	}

}