本文整理汇总了PHP中wpl_global::wpl_hasher方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_global::wpl_hasher方法的具体用法?PHP wpl_global::wpl_hasher怎么用?PHP wpl_global::wpl_hasher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_global
的用法示例。
在下文中一共展示了wpl_global::wpl_hasher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forget_password
private function forget_password()
{
$error_array = array();
$error_array['authentication'] = array('type' => 'forget_password', 'status' => 'false');
$db = wpl_db::get_DBO();
$user_login = wpl_db::sanitize($this->username);
if (trim($user_login) == '') {
return $error_array;
} elseif (strpos($user_login, '@')) {
$user_data = wpl_users::get_user_by('email', $user_login);
if (trim($user_data) == '') {
return $error_array;
}
} else {
$login = trim($user_login);
$user_data = wpl_users::get_user_by('login', $login);
}
do_action('lostpassword_post');
if (!$user_data) {
return $this->failed_array;
}
$user_login = $user_data->user_login;
$user_email = $user_data->user_email;
do_action('retreive_password', $user_login);
do_action('retrieve_password', $user_login);
$allow = apply_filters('allow_password_reset', true, $user_data->ID);
if (is_wp_error($allow)) {
return $error_array;
}
$key = wpl_global::generate_password(20, false);
do_action('retrieve_password_key', $user_login, $key);
$hashed = wpl_global::wpl_hasher(8, $key);
wpl_db::update('users', array('user_activation_key' => $hashed), 'user_login', $user_login);
$message = __('Someone requested that the password be reset for the following account:', WPL_TEXTDOMAIN) . "\r\n";
$message .= network_home_url('/') . "\r\n";
$message .= sprintf(__('Username: %s', WPL_TEXTDOMAIN), $user_login) . "\r\n";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.', WPL_TEXTDOMAIN) . "\r\n";
$message .= __('To reset your password, visit the following address:', WPL_TEXTDOMAIN) . "\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login') . ">\r\n";
if (is_multisite()) {
$blogname = $GLOBALS['current_site']->site_name;
} else {
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
}
$title = sprintf(__('[%s] Password Reset', WPL_TEXTDOMAIN), $blogname);
$title = apply_filters('retrieve_password_title', $title);
$message = apply_filters('retrieve_password_message', $message, $key);
if ($message && !wp_mail($user_email, $title, $message)) {
return $error_array;
}
$this->built['authentication'] = array('type' => 'forget_password', 'status' => 'true');
return $this->built;
}