HEX
Server: nginx/1.22.0
System: Linux iZuf6jdxbygmf6cco977lcZ 5.10.84-10.4.al8.x86_64 #1 SMP Tue Apr 12 12:31:07 CST 2022 x86_64
User: root (0)
PHP: 7.4.29
Disabled: passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen
Upload Files
File: /data/wwwroot/wordpress/wp-content/plugins/categories-images/assets/js/zci-scripts.js
jQuery(document).ready(function($) {
    var upload_button;
    
    $(".z_upload_image_button").on('click', function(event) {
        upload_button = $(this);
        var frame;
        if (zci_config.wordpress_ver >= "3.5") {
            event.preventDefault();
            if (frame) {
                frame.open();
                return;
            }
            frame = wp.media();
            frame.on( "select", function() {
                // Grab the selected attachment.
                var attachment = frame.state().get("selection").first();
                var attachmentUrl = attachment.attributes.url;
                var attachmentId = attachment.attributes.id;
                attachmentUrl = attachmentUrl.replace('-scaled.', '.');

                frame.close();
                $(".zci-taxonomy-image").attr("src", attachmentUrl);
                if (upload_button.parent().prev().children().hasClass("tax_list")) {
                    upload_button.parent().prev().children().val(attachmentUrl);
                    upload_button.parent().prev().prev().children().attr("src", attachmentUrl);
                    upload_button.parent().next().children().val(attachmentId);
                }
                else {
                    $("#zci_taxonomy_image").val(attachmentUrl);
                    $("#zci_taxonomy_image_id").val(attachmentId);
                }
            });
            frame.open();
        }
        else {
            tb_show("", "media-upload.php?type=image&TB_iframe=true");
            return false;
        }
    });
    
    $(".z_remove_image_button").on('click', function() {
        $(".zci-taxonomy-image").attr("src", zci_config.placeholder);
        $("#zci_taxonomy_image").val("");
        $(this).parent().siblings(".title").children("img").attr("src", zci_config.placeholder);
        $(".inline-edit-col :input[name='zci_taxonomy_image']").val("");
        return false;
    });
    
    if (zci_config.wordpress_ver < "3.5") {
        window.send_to_editor = function(html) {
            imgurl = $("img",html).attr("src");
            if (upload_button.parent().prev().children().hasClass("tax_list")) {
                upload_button.parent().prev().children().val(imgurl);
                upload_button.parent().prev().prev().children().attr("src", imgurl);
            }
            else
                $("#zci_taxonomy_image").val(imgurl);
            tb_remove();
        }
    }
    
    $(".editinline").on('click', function() {
        var tax_id = $(this).parents("tr").attr("id").substr(4);
        var thumb = $("#tag-"+tax_id+" .thumb img").attr("src");

        // To Do: fix image input url in quick mode
        /*if (thumb != zci_config.placeholder) {
            $(".inline-edit-col :input[name='zci_taxonomy_image']").val(thumb);
        } else {
            $(".inline-edit-col :input[name='zci_taxonomy_image']").val("");
        }*/
        
        $(".inline-edit-col .title img").attr("src",thumb);
    });
});