开发者

swfupload wordpress

I am using the SWFUpload from http://www.anedix.com/data/file/news/realname/swfupload-php-example-v1_4.zip and want to integrate this into my wordpress plugin.

In the example file there are JS files that need to be referenced.

I have enqueued these files in my plugin and they seems to be picked up in the header.

function add_admin_js() {

switch ($_GET['page']) {
    case "videos" :
        //wp_enqueue_script('swfobject', MYPLUGIN_URLPATH.'scripts/swfobject.js');
        wp_enqueue_script('uploadify', MYPLUGIN_URLPATH.'scripts/jquery.uploa开发者_高级运维dify.v2.1.0.min.js');
        wp_enqueue_script('swfupload', MYPLUGIN_URLPATH.'swfupload/swfupload.js');
        wp_enqueue_script('swfupload.queue', MYPLUGIN_URLPATH.'swfupload/js/swfupload.queue.js');
        wp_enqueue_script('fileprogress', MYPLUGIN_URLPATH.'swfupload/js/fileprogress.js');
        wp_enqueue_script('swfupload.speed', MYPLUGIN_URLPATH.'swfupload/plugins/swfupload.speed.js');
        wp_enqueue_script('handlers', MYPLUGIN_URLPATH.'swfupload/js/handlers.js');
    break;      
}

}

one little thing which I cannot work out is how to get the plugin to instantiate the function.

by default the example page uses the JS code as follows:

var swfu;

window.onload = function () {

swfu = new SWFUpload({

});

};


solved it.

After realizing SWFUpload is already used is Wordpress it made it a lot easier.

jQuery(document).ready(function() {
    var settings = {
        ...
        ...
        ...
    };
    swfu = new SWFUploader(settings);
});

And it seems to work fine now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜