'desc', 'nested_depth' => 3, 'require_login' => false, 'allow_reply' => true, 'avatar_size' => 48, 'empty_text' => __('暂无评论,来做第一个评论的人吧~', 'aksrt'), ]; $require_login = !empty($comment_settings['require_login']); $default_comment_order = ($comment_settings['order'] ?? 'desc') === 'asc' ? 'oldest' : 'newest'; $comment_order = isset($_GET['aksrt_comment_order']) ? sanitize_key((string) wp_unslash($_GET['aksrt_comment_order'])) : $default_comment_order; $comment_order = in_array($comment_order, ['newest', 'oldest', 'hottest'], true) ? $comment_order : 'newest'; $reverse_comments = ($comment_order === 'newest'); $is_hottest = ($comment_order === 'hottest'); if ($is_hottest) { add_filter('comments_clauses', function ($clauses) { global $wpdb; $clauses['join'] .= " LEFT JOIN {$wpdb->commentmeta} AS aksrt_cm ON ({$wpdb->comments}.comment_ID = aksrt_cm.comment_id AND aksrt_cm.meta_key = 'aksrt_comment_likes')"; $clauses['orderby'] = 'CAST(aksrt_cm.meta_value AS UNSIGNED) DESC, ' . $clauses['orderby']; return $clauses; }); } $author_only = isset($_GET['aksrt_author_only']) && (int) $_GET['aksrt_author_only'] === 1; $post_author_id = (int) get_the_author_meta('ID'); $avatar_size = max(24, (int) ($comment_settings['avatar_size'] ?? 48)); $max_depth = max(1, (int) ($comment_settings['nested_depth'] ?? 3)); $allow_reply = !empty($comment_settings['allow_reply']); $empty_text = (string) ($comment_settings['empty_text'] ?? __('暂无评论,来做第一个评论的人吧~', 'aksrt')); $comment_toolbar = is_array($comment_settings['toolbar'] ?? null) ? $comment_settings['toolbar'] : ['smilie' => true, 'code' => true, 'image' => true]; $comment_upload_enabled = !empty($comment_settings['toolbar']['upload_img']); $comment_box_placeholder = (string) ($comment_settings['box_placeholder'] ?? __('说点什么吧...', 'aksrt')); $comment_submit_text = (string) ($comment_settings['submit_text'] ?? __('提交评论', 'aksrt')); $comment_title_text = (string) ($comment_settings['title'] ?? __('评论', 'aksrt')); set_query_var('aksrt_comment_order', $comment_order); set_query_var('aksrt_comment_settings', $comment_settings); ?> get_auth_providers_data(); } ?>