HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux acmehomecare 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: www-data (33)
PHP: 8.0.30
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wp-content/plugins/exertio-framework/js/attachment-upload - Copy.js
var meta_gallery_frame_brand;
	jQuery('#attachment_btn').on('click', function(e){
                // sonu code here.
                if ( meta_gallery_frame_brand ) {
                        meta_gallery_frame_brand.open();
                        return;
                }
                // Sets up the media library frame
                meta_gallery_frame_brand = wp.media.frames.meta_gallery_frame_brand = wp.media({
                        title: 'Selct Images',
                        button: { text:  'button' },
                        library: { type: ['image','pdf', 'doc', 'docx.', 'xls ', 'xlsx'] },
						multiple: true
                });
				// Create Featured Gallery state. This is essentially the Gallery state, but selection behavior is altered.
				meta_gallery_frame_brand.states.add([
					new wp.media.controller.Library({
						priority:   20,
						toolbar:    'main-gallery',
						filterable: 'uploaded',
						library:    wp.media.query( meta_gallery_frame_brand.options.library ),
						multiple:   meta_gallery_frame_brand.options.multiple ? 'reset' : false,
						editable:   true,
						allowLocalEdits: true,
						displaySettings: true,
						displayUserSettings: true
					}),
				]);
				var idsArray;
				var attachmentz;
				meta_gallery_frame_brand.on('open', function() {
					var selection = meta_gallery_frame_brand.state().get('selection');
					var library = meta_gallery_frame_brand.state('gallery-edit').get('library');
					var idsArray = jQuery('#attachments_ids').val();
					if (idsArray) {
						idsArray_selection = idsArray.split(',');
						idsArray_selection.forEach(function(id) {
							attachmentz = wp.media.attachment(id);
							attachmentz.fetch();
							selection.add( attachmentz ? [ attachmentz ] : [] );
						});
					}
				});
				meta_gallery_frame_brand.on('ready', function() {
					jQuery( '.media-modal' ).addClass( 'no-sidebar' );
				});
		 var imagesz;
		// When an image is selected, run a callback.
		//meta_gallery_frame.on('update', function() {
		meta_gallery_frame_brand.on('select', function() {
			var imageIDArrayz = [];
			var imageHTMLz = '';
			var metadataStringz = '';
			imagesz = meta_gallery_frame_brand.state().get('selection');
			//imageHTMLz += '<ul class="freelance_gallery">';
			imagesz.each(function(attachmentz) {
				//get image object
				imageHTMLz = '';
                //console.debug(attachmentz.attributes);
				imageIDArrayz.push(attachmentz.attributes.id);
				if(attachmentz.attributes.subtype == 'pdf' || attachmentz.attributes.subtype == 'doc' || attachmentz.attributes.subtype == 'docx' || attachmentz.attributes.subtype == 'xls' || attachmentz.attributes.subtype == 'xlsx')
				{
				imageHTMLz += '<li><span class="freelance_icon_brand"><img id="'+attachmentz.attributes.id+'" src="'+attachmentz.attributes.icon+'"></span></li>';
				}
				else
				{
				imageHTMLz += '<li><span class="freelance_icon_brand"><img id="'+attachmentz.attributes.id+'" src="'+attachmentz.attributes.url+'"></span></li>';
				}
				//alert(attachmentz.attributes.subtype);
			});
			//imageHTMLz += '</ul>';
			metadataStringz = imageIDArrayz.join(",");
			if (metadataStringz) {
				jQuery("#attachments_ids").val(metadataStringz);
				jQuery("#freelance_gall_render_html .freelance_gallery").append(imageHTMLz);
			}
		});
			// Finally, open the modal
			meta_gallery_frame_brand.open();
        });