本文整理匯總了PHP中wfUtils::localHumanDateShort方法的典型用法代碼示例。如果您正苦於以下問題:PHP wfUtils::localHumanDateShort方法的具體用法?PHP wfUtils::localHumanDateShort怎麽用?PHP wfUtils::localHumanDateShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wfUtils
的用法示例。
在下文中一共展示了wfUtils::localHumanDateShort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loginAction
public static function loginAction($username)
{
if (sizeof($_POST) < 1) {
return;
}
//only execute if login form is posted
if (!$username) {
return;
}
wfConfig::inc('totalLogins');
$user = get_user_by('login', $username);
$userID = $user ? $user->ID : 0;
self::getLog()->logLogin('loginOK', 0, $username);
if (wfUtils::isAdmin($user)) {
wfConfig::set_ser('lastAdminLogin', array('userID' => $userID, 'username' => $username, 'firstName' => $user->first_name, 'lastName' => $user->last_name, 'time' => wfUtils::localHumanDateShort(), 'IP' => wfUtils::getIP()));
}
if (user_can($userID, 'update_core')) {
if (wfConfig::get('alertOn_adminLogin')) {
wordfence::alert("Admin Login", "A user with username \"{$username}\" who has administrator access signed in to your WordPress site.", wfUtils::getIP());
}
} else {
if (wfConfig::get('alertOn_nonAdminLogin')) {
wordfence::alert("User login", "A non-admin user with username \"{$username}\" signed in to your WordPress site.", wfUtils::getIP());
}
}
}
示例2: loginAction
public static function loginAction($username)
{
if (sizeof($_POST) < 1) {
return;
}
//only execute if login form is posted
if (!$username) {
return;
}
wfConfig::inc('totalLogins');
$user = get_user_by('login', $username);
$userID = $user ? $user->ID : 0;
self::getLog()->logLogin('loginOK', 0, $username);
if (wfUtils::isAdmin($user)) {
wfConfig::set_ser('lastAdminLogin', array('userID' => $userID, 'username' => $username, 'firstName' => $user->first_name, 'lastName' => $user->last_name, 'time' => wfUtils::localHumanDateShort(), 'IP' => wfUtils::getIP()));
}
$salt = wp_salt('logged_in');
$cookiename = 'wf_loginalerted_' . hash_hmac('sha256', wfUtils::getIP() . '|' . $user->ID, $salt);
$cookievalue = hash_hmac('sha256', $user->user_login, $salt);
if (user_can($userID, 'update_core')) {
if (wfConfig::get('alertOn_adminLogin')) {
$shouldAlert = true;
if (wfConfig::get('alertOn_firstAdminLoginOnly') && isset($_COOKIE[$cookiename])) {
$shouldAlert = !hash_equals($cookievalue, $_COOKIE[$cookiename]);
}
if ($shouldAlert) {
wordfence::alert("Admin Login", "A user with username \"{$username}\" who has administrator access signed in to your WordPress site.", wfUtils::getIP());
}
}
} else {
if (wfConfig::get('alertOn_nonAdminLogin')) {
$shouldAlert = true;
if (wfConfig::get('alertOn_firstNonAdminLoginOnly') && isset($_COOKIE[$cookiename])) {
$shouldAlert = !hash_equals($cookievalue, $_COOKIE[$cookiename]);
}
if ($shouldAlert) {
wordfence::alert("User login", "A non-admin user with username \"{$username}\" signed in to your WordPress site.", wfUtils::getIP());
}
}
}
if (wfConfig::get('alertOn_firstAdminLoginOnly') || wfConfig::get('alertOn_firstNonAdminLoginOnly')) {
wfUtils::setcookie($cookiename, $cookievalue, time() + 86400 * 365, '/', null, null, true);
}
}