fix(comments): align image upload with Zibll
Unify comment image upload settings, REST permissions, preview, progress, and response handling while removing obsolete compatibility paths.
This commit is contained in:
@@ -208,7 +208,6 @@ trait ScriptsPart1c {
|
||||
'post_action_nonce' => wp_create_nonce('post_action'),
|
||||
'is_split_upload' => false,
|
||||
'split_minimum_size' => 10,
|
||||
'comment_upload_img' => false,
|
||||
'translate_config' => [],
|
||||
'i18n' => [
|
||||
'load_more' => __('加载更多', 'aksrt'),
|
||||
@@ -489,9 +488,12 @@ trait ScriptsPart1c {
|
||||
'ajaxLoading' => __('正在加载...', 'aksrt'),
|
||||
'iasMax' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['ias_max'] : 3,
|
||||
'commentIasAuto' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_comment_display_settings()['paging_ajax_ias'] : true,
|
||||
'commentUploadEnabled' => class_exists('\AKSRT\Settings\Settings') ? !empty((\AKSRT\Settings\Settings::get_comment_display_settings()['toolbar']['upload_img'] ?? false)) : false,
|
||||
'commentUploadUrl' => esc_url_raw(rest_url('aksrt/v1/comment/upload-image')),
|
||||
'commentUploadMaxSize' => 2 * 1024 * 1024,
|
||||
'commentUploadMaxSize' => (function () {
|
||||
$settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settings\Settings::get_all() : [];
|
||||
$max_size_mb = max(1, min(10, (int) ($settings['comment_image_max_size'] ?? 2)));
|
||||
return $max_size_mb * MB_IN_BYTES;
|
||||
})(),
|
||||
'commentIasMax' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_comment_display_settings()['paging_ajax_ias_max'] : 3,
|
||||
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
|
||||
// Alias used by modal-auth / follow / report (same value as restUrl).
|
||||
|
||||
Reference in New Issue
Block a user