本文整理汇总了PHP中SwpmUtils::get_expiration_timestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP SwpmUtils::get_expiration_timestamp方法的具体用法?PHP SwpmUtils::get_expiration_timestamp怎么用?PHP SwpmUtils::get_expiration_timestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SwpmUtils
的用法示例。
在下文中一共展示了SwpmUtils::get_expiration_timestamp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_account_status
public function update_account_status()
{
global $wpdb;
for ($counter = 0;; $counter += 100) {
$query = $wpdb->prepare("SELECT member_id, membership_level, subscription_starts, account_state\n FROM {$wpdb->prefix}swpm_members_tbl LIMIT %d, 100", $counter);
$results = $wpdb->get_results($query);
if (empty($results)) {
break;
}
$expired = array();
foreach ($results as $result) {
$timestamp = SwpmUtils::get_expiration_timestamp($result);
if ($timestamp < time() && $result->account_state == 'active') {
$expired[] = $result->member_id;
}
}
if (count($expired) > 0) {
$query = "UPDATE {$wpdb->prefix}swpm_members_tbl \n SET account_state='expired' WHERE member_id IN (" . implode(',', $expired) . ")";
$wpdb->query($query);
}
}
}
示例2: is_subscription_expired
public static function is_subscription_expired($user)
{
$expiration_timestamp = SwpmUtils::get_expiration_timestamp($user);
return $expiration_timestamp < time();
}
示例3: set_cookie
private function set_cookie($remember = '', $secure = '')
{
if ($remember) {
$expiration = time() + 1209600;
// 14 days
$expire = $expiration + 43200;
// 12 hours grace period
} else {
$expiration = time() + 172800;
// 2 days.
$expire = $expiration;
//The minimum cookie expiration should be at least couple of days.
}
$expiration_timestamp = SwpmUtils::get_expiration_timestamp($this->userData);
$enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
// make sure cookie doesn't live beyond account expiration date.
// but if expired account login is enabled then ignore if account is expired
$expiration = empty($enable_expired_login) ? min($expiration, $expiration_timestamp) : $expiration;
$pass_frag = substr($this->userData->password, 8, 4);
$scheme = 'auth';
if (!$secure) {
$secure = is_ssl();
}
$key = SwpmAuth::b_hash($this->userData->user_name . $pass_frag . '|' . $expiration, $scheme);
$hash = hash_hmac('md5', $this->userData->user_name . '|' . $expiration, $key);
$auth_cookie = $this->userData->user_name . '|' . $expiration . '|' . $hash;
$auth_cookie_name = $secure ? SIMPLE_WP_MEMBERSHIP_SEC_AUTH : SIMPLE_WP_MEMBERSHIP_AUTH;
//setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
setcookie($auth_cookie_name, $auth_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure, true);
}