本文整理汇总了PHP中GDSRHelper::calculate_deadline方法的典型用法代码示例。如果您正苦于以下问题:PHP GDSRHelper::calculate_deadline方法的具体用法?PHP GDSRHelper::calculate_deadline怎么用?PHP GDSRHelper::calculate_deadline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDSRHelper
的用法示例。
在下文中一共展示了GDSRHelper::calculate_deadline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_multi_rating
function render_multi_rating($post, $user, $settings)
{
if ($this->is_bot) {
return "";
}
if (is_feed()) {
return "";
}
$set = gd_get_multi_set($settings["id"]);
if ($set == null) {
return "";
}
$dbg_allow = "F";
$allow_vote = true;
if ($this->is_ban && $this->o["ip_filtering"] == 1) {
if ($this->o["ip_filtering_restrictive"] == 1) {
return "";
} else {
$allow_vote = false;
}
$dbg_allow = "B";
}
if ($settings["read_only"] == 1) {
$dbg_allow = "RO";
$allow_vote = false;
}
if (is_single() || is_page() && $this->o["display_comment_page"] == 1) {
$this->init_post();
}
$rd_post_id = intval($post->ID);
$rd_user_id = intval($user->ID);
$rd_is_page = $post->post_type == "page" ? "1" : "0";
$remaining = 0;
$deadline = "";
if ($this->p) {
$post_data = $this->p;
} else {
$post_data = GDSRDatabase::get_post_data($rd_post_id);
if (count($post_data) == 0) {
GDSRDatabase::add_default_vote($rd_post_id, $rd_is_page);
$post_data = GDSRDatabase::get_post_data($rd_post_id);
}
}
if ($post_data->rules_articles == "H") {
return "";
}
if ($allow_vote) {
if ($this->o["author_vote"] == 1 && $rd_user_id == $post->post_author) {
$allow_vote = false;
$dbg_allow = "A";
}
}
if ($allow_vote) {
if ($post_data->rules_articles == "" || $post_data->rules_articles == "A" || $post_data->rules_articles == "U" && $rd_user_id > 0 || $post_data->rules_articles == "V" && $rd_user_id == 0) {
$allow_vote = true;
} else {
$allow_vote = false;
$dbg_allow = "R_" . $post_data->rules_articles;
}
}
if ($allow_vote && ($post_data->expiry_type == 'D' || $post_data->expiry_type == 'T')) {
switch ($post_data->expiry_type) {
case "D":
$remaining = GDSRHelper::expiration_date($post_data->expiry_value);
$deadline = $post_data->expiry_value;
break;
case "T":
$remaining = GDSRHelper::expiration_countdown($post->post_date, $post_data->expiry_value);
$deadline = GDSRHelper::calculate_deadline($remaining);
break;
}
if ($remaining < 1) {
GDSRDatabase::lock_post($rd_post_id);
$allow_vote = false;
$dbg_allow = "T";
}
}
if ($allow_vote) {
$allow_vote = GDSRDBMulti::check_vote($rd_post_id, $rd_user_id, $set->multi_id, 'multis', $_SERVER["REMOTE_ADDR"], $this->o["logged"] != 1, $this->o["mur_allow_mixed_ip_votes"] == 1);
if (!$allow_vote) {
$dbg_allow = "D";
}
}
if ($allow_vote) {
$allow_vote = $this->check_cookie($rd_post_id . "#" . $set->multi_id, "multis");
if (!$allow_vote) {
$dbg_allow = "C";
}
}
$multi_record_id = GDSRDBMulti::get_vote($rd_post_id, $set->multi_id, count($set->object));
$multi_data = GDSRDBMulti::get_values($multi_record_id);
$votes = array();
foreach ($multi_data as $md) {
$single_vote = array();
$single_vote["votes"] = 0;
$single_vote["score"] = 0;
if ($post_data->rules_articles == "A" || $post_data->rules_articles == "N") {
$single_vote["votes"] = $md->user_voters + $md->visitor_voters;
$single_vote["score"] = $md->user_votes + $md->visitor_votes;
} else {
//.........这里部分代码省略.........