示例#1
0
文件: Status.php 项目: blogfor/king
function dwqa_is_new($question_id = null, $status = false)
{
    global $dwqa_general_settings;
    $hours = isset($dwqa_general_settings['question-new-time-frame']) ? (int) $dwqa_general_settings['question-new-time-frame'] : 4;
    $created_date = get_post_time('U', false, $question_id);
    $hours = $hours * 60 * 60 * 1000;
    if ($created_date + $hours > current_time('U') && dwqa_is_open($question_id, $status)) {
        return true;
    }
    return false;
}
function dwqa_is_new($question_id = null)
{
    global $dwqa_general_settings;
    $hours = isset($dwqa_general_settings['question-new-time-frame']) ? (int) $dwqa_general_settings['question-new-time-frame'] : 4;
    $created_date = get_post_time('U', false, $question_id);
    $hours = -$hours;
    if ($created_date > strtotime($hours . ' hours') && dwqa_is_open()) {
        return true;
    }
    return false;
}