HEX
Server: LiteSpeed
System: Linux cde2.duelhost.dk 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: dtptviut (1121)
PHP: 8.0.30
Disabled: exec,system,passthru,shell_exec,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/dtptviut/domains/teleweb.dk/public_html/wp-content/plugins/wp-show-posts/admin/js/button.js
function wpsp_get_post_lists() {
    var response = jQuery.getJSON({
		type: 'POST',
		url: ajaxurl,
		data: {
			action: 'wpsp_get_post_lists',
			wpsp_nonce: wpsp_nonce
		},
		async: false,
		dataType: 'json'
	});
				
	return response.responseJSON;
}

console.log(wpsp_get_post_lists());

(function() {
    tinymce.PluginManager.add('wpsp_shortcode_button', function( editor, url ) {
        editor.addButton( 'wpsp_shortcode_button', {
			title: wpsp_add_posts,
            icon: 'wpsp-add-icon',
			onclick: function() {
				editor.windowManager.open( {
					width: 300,
					height: 75,
					title: wpsp_add_posts,
					body: [
					{
						type: 'listbox', 
						name: 'wpsp_add_posts', 
						label: false, 
						'values': wpsp_get_post_lists(),
					}],
					onsubmit: function( e ) {
						editor.insertContent( '[wp_show_posts id="' + e.data.wpsp_add_posts + '"]');
					}
				});
			}
        });
    });
})();