HEX
Server: LiteSpeed
System: Linux sinope.sitehostingserver.com 5.14.0-611.49.2.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 30 09:05:08 EDT 2026 x86_64
User: aprilnet (1155)
PHP: 8.2.32
Disabled: popen,imap_mail,exec,passthru,system,shell_exec,proc_open,pcntl_exec,eval,allow_url_fopen,allow_url_include,mail,proc_get_status,get_cfg_var,disk_free_space,disk_total_space,diskfreespace,getmygid,getmyinode,getmypid,geymyuid,proc_nice,proc_terminate,proc_close,apache_child_terminate,chown,lchgrp,lchown,link,readlink,highlight_file,show_source,php_strip_whitespace,get_meta_tags,dl,leak,pfsockopen,event_new,pcntl_signal,pcntl_alarm,register_tick_function,apache_setenv,define_syslog_variables,escapeshellarg,escapeshellcmd,ini_alter,ini_restore,inject_code,openlog,syslog,xmlrpc_entity_decode,phpAds_remoteInfo,phpAds_XmlRpc,phpAds_xmlrpcDecode,phpAds_xmlrpcEncode,chgrp,php_eval,safe_dir,root,ftok,egy_perl,symlink,wscript
Upload Files
File: /home/aprilnet/public_html/sciohost.org/wp-content/plugins/mb-term-meta/src/MetaBox.php
<?php
namespace MBTM;

use RWMB_Loader;

class MetaBox extends \RW_Meta_Box {
	/**
	 * Create meta box based on given data.
	 *
	 * @param array $meta_box Meta box configuration.
	 */
	public function __construct( $meta_box ) {
		$meta_box['taxonomies'] = (array) $meta_box['taxonomies'];
		$this->object_type      = 'term';
		parent::__construct( $meta_box );
	}

	/**
	 * Specific hooks for meta box object. Default is 'post'.
	 * This should be extended in sub-classes to support meta fields for terms, user, settings pages, etc.
	 */
	protected function object_hooks() {
		// Add meta fields to edit term page.
		add_action( 'load-edit-tags.php', array( $this, 'add' ) );
		add_action( 'load-term.php', array( $this, 'add' ) );

		// Save term meta.
		foreach ( $this->meta_box['taxonomies'] as $taxonomy ) {
			add_action( "edited_$taxonomy", array( $this, 'save_post' ) );
			add_action( "created_$taxonomy", array( $this, 'save_post' ) );
		}

		add_action( "rwmb_before_{$this->meta_box['id']}", array( $this, 'show_heading' ) );
	}

	/**
	 * Show heading of the section.
	 */
	public function show_heading() {
		echo '<h2>', esc_html( $this->meta_box['title'] ), '</h2>';
	}

	/**
	 * Add meta box to term edit form, each meta box is a section.
	 */
	public function add() {
		if ( ! $this->is_edit_screen() ) {
			return;
		}

		// Add meta box.
		foreach ( $this->meta_box['taxonomies'] as $taxonomy ) {
			add_action( "{$taxonomy}_edit_form", array( $this, 'show' ), 10, 2 );
			add_action( "{$taxonomy}_add_form_fields", array( $this, 'show' ), 10, 2 );
		}
	}

	/**
	 * Enqueue styles for term meta.
	 */
	public function enqueue() {
		if ( ! $this->is_edit_screen() ) {
			return;
		}

		parent::enqueue();

		list( , $url ) = RWMB_Loader::get_path( dirname( __DIR__ ) );
		wp_enqueue_style( 'mb-term-meta', $url . 'assets/term-meta.css', '', '1.2.4' );

		// Only load these scripts on add term page.
		$screen = get_current_screen();
		if ( 'edit-tags' !== $screen->base ) {
			return;
		}

		wp_enqueue_script( 'mb-term-meta', $url . 'assets/term-meta.js', array( 'jquery' ), '1.0.6', true );
		wp_localize_script( 'mb-term-meta', 'MBTermMeta', array(
			'addedMessage' => __( 'Term added.', 'mb-term-meta' ),
		) );
	}

	/**
	 * Get current object id.
	 *
	 * @return int|string
	 */
	public function get_current_object_id() {
		return filter_input( INPUT_GET, 'tag_ID', FILTER_SANITIZE_NUMBER_INT );
	}

	/**
	 * Check if we're on the right edit screen.
	 *
	 * @param WP_Screen $screen Screen object. Optional. Use current screen object by default.
	 *
	 * @return bool
	 */
	public function is_edit_screen( $screen = null ) {
		$screen = get_current_screen();

		return
			( 'edit-tags' === $screen->base || 'term' === $screen->base )
			&& in_array( $screen->taxonomy, $this->meta_box['taxonomies'], true );
	}

	/**
	 * Add fields to field registry.
	 */
	public function register_fields() {
		$field_registry = rwmb_get_registry( 'field' );

		foreach ( $this->taxonomies as $taxonomy ) {
			foreach ( $this->fields as $field ) {
				$field_registry->add( $field, $taxonomy, 'term' );
			}
		}
	}

	/**
	 * Get storage object.
	 *
	 * @return RWMB_Storage_Interface
	 */
	public function get_storage() {
		return new Storage;
	}
}