[WordPress] 外掛分享: Extend Upload

首頁外掛目錄 › Extend Upload
全新外掛
安裝啟用
尚無評分
4751 天前
最後更新
問題解決
WordPress 3.0+ v0.0.4 上架:2012-03-30

內容簡介

我以前常常需要上傳檔案,而且必須使用 HTML 上傳,有時候會很麻煩。為此,我創建了一個使用 Thickbox 和 WordPress 上傳器的外掛。

要使用該外掛,您必須在使用該外掛的頁面上enqueue兩個內嵌CSS和JS檔案:

<?php
wp_enqueue_script( 'extend-upload' );
wp_enqueue_style( 'extend-upload' );

然後您可以通過調用jQuery Extends來使用外掛:

(function($) {
$(document).ready(function () {
$('.uc-call').callUpload();
});
})(jQuery.noConflict());

HTML / PHP輸出應如下所示:

<?php
$args = array(
'url' => admin_url( 'media-upload.php?post_id=0&button=' . rawurlencode('用作頭像') . '&TB_iframe=1&width=640&height=253' )
);
?>
<p class='uc-container'>
<label><?php echo _e( "Avatar:" ); ?></label><a target='_blank' class='uc-call' data='<?php echo json_encode( $args ); ?>'><small><?php _e( "上傳照片" ); ?></small></a>"; ?>
<input class="uc-answer" type="text" value="<?php echo ( is_numeric( absint( $avatar ) ) ? absint( $avatar ) : esc_url($avatar) ); ?>" />
</p>

其中,使用uc-call來設置連結、uc-answer來設置輸入欄位,以及uc-container來設置包含連結和輸入欄位的框。

通過將變數傳遞到$args陣列中,即可對所有東西進行自定義設置,有些東西必須在URL中傳遞,但稍後我會添加更簡單的方法。

待辦事項
0.0.4

允許使用舊版本的jQuery以及允許使用非圖像媒體

0.0.3

修復了一些錯誤並添加了國際化支援

0.0.2

添加了更改Thickbox中的插入到文章文本的javascript

0.0.1

使用Thickbox和上傳器iFrame,您可以從任何已經引入該js檔案的頁面調用此功能

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.0.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Extend Upload」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

I had a problem that most of the time I had to upload a file, and I had to use a HTML upload, and that’s kind of bad, so I created something to use the Thickbox and the WordPress Uploader.
To use you must enqueue in the page used both the style and the script of the plugin:
admin_url( 'media-upload.php?post_id=0&button=' . rawurlencode('Use as Avatar') . '&TB_iframe=1&width=640&height=253' )
);
?>

"; ?>

Having the uc-call for the link, uc-answer with the input field and uc-container for the box with both the link and the input field.
All the stuff is customizable by passing the variables in to the array $args, some stuff must be passed in the url, but later on I will add a easier way to do it.
Backlog
0.0.4

Older version of jQuery allowed and allowing non Image Media to be used

0.0.3

Fixed some bugs and added internationalization

0.0.2

Added the javascript to change the Insert to Post text on the thickbox

0.0.1

Using the the thickbox with the uploader iFrame inside you can call this from any page that has the script enqueued

延伸相關外掛

文章
Filter
Apply Filters
Mastodon