HEX
Server: Apache/2
System: Linux server-80-13-140-150.da.direct 5.14.0-362.24.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 4 22:31:43 UTC 2024 x86_64
User: cpt (1004)
PHP: 8.1.24
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/cpt/public_html/wp-content/plugins/events-manager/includes/js/taxonomies-admin.js
jQuery(document).ready(function($) {
	//other color picker
	$('.term-color').wpColorPicker();

	//Event Taxonomy Image Picker
	var frame;	
	// ADD IMAGE LINK
	$('.term-image-wrap .upload-img-button').on( 'click', function( event ){
		event.preventDefault();
		// If the media frame already exists, reopen it.
		if ( frame ) {
		frame.open();
		return;
		}
		// Create a new media frame
		frame = wp.media({
			library: {
				type: 'image'
			},
			title: wp.media.view.l10n.chooseImage,
			multiple: false  // Set to true to allow multiple files to be selected
		});
		// When an image is selected in the media frame...
		frame.on( 'select', function() {
			// Get media attachment details from the frame state
			var attachment = frame.state().get('selection').first().toJSON();
			// Send the attachment URL to our custom image input field.
			$( '.term-image-wrap .img-container').empty().append( '<img src="'+attachment.url+'" alt="" style="max-width:100%;"/>' );
			// Send the attachment id to our hidden input
			$( '.term-image-wrap .img-id' ).val( attachment.id );
			$( '.term-image-wrap .img-url' ).val( attachment.url );
			// Unhide the remove image link
			$( '.term-image-wrap .delete-img-button').show();
		});
		// Finally, open the modal on click
		frame.open();
	});
	// DELETE IMAGE LINK
	$( '.term-image-wrap .delete-img-button').on( 'click', function( event ){
		event.preventDefault();
		// Clear out the preview image
		$( '.term-image-wrap .img-container').html( '' );
		// Un-hide the add image link
		$(this).hide();
		// Delete the image id from the hidden input
		$( '.term-image-wrap .img-id' ).val( '' );
		$( '.term-image-wrap .img-url' ).val( '' );
	});

});