本文整理汇总了PHP中wordfence::getCurrentUserRole方法的典型用法代码示例。如果您正苦于以下问题:PHP wordfence::getCurrentUserRole方法的具体用法?PHP wordfence::getCurrentUserRole怎么用?PHP wordfence::getCurrentUserRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wordfence
的用法示例。
在下文中一共展示了wordfence::getCurrentUserRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initAction
public static function initAction()
{
if (wfConfig::liveTrafficEnabled() && !wfConfig::get('disableCookies', false)) {
self::setCookie();
}
// This is more of a hurdle, but might stop an automated process.
// if (current_user_can('administrator')) {
// $adminUsers = new wfAdminUserMonitor();
// if ($adminUsers->isEnabled() && !$adminUsers->isAdminUserLogged(get_current_user_id())) {
// define('DISALLOW_FILE_MODS', true);
// }
// }
$currentUserID = get_current_user_id();
$role = wordfence::getCurrentUserRole();
if (!WFWAF_SUBDIRECTORY_INSTALL) {
try {
$authCookie = wfWAF::getInstance()->parseAuthCookie();
if (is_user_logged_in() && (!$authCookie || (int) $currentUserID !== (int) $authCookie['userID'] || $role !== $authCookie['role'])) {
$secureLoggedInCookie = is_ssl() && parse_url(get_option('home'), PHP_URL_SCHEME) === 'https';
wfUtils::setcookie(wfWAF::getInstance()->getAuthCookieName(), $currentUserID . '|' . $role . '|' . wfWAF::getInstance()->getAuthCookieValue($currentUserID, $role), time() + 43200, COOKIEPATH, COOKIE_DOMAIN, $secureLoggedInCookie, true);
}
} catch (wfWAFStorageFileException $e) {
error_log($e->getMessage());
}
}
if (wfConfig::get('other_hideWPVersion')) {
global $wp_version;
global $wp_styles;
if (!$wp_styles instanceof WP_Styles) {
$wp_styles = new WP_Styles();
}
if ($wp_styles->default_version === $wp_version) {
$wp_styles->default_version = wp_hash($wp_styles->default_version);
}
foreach ($wp_styles->registered as $key => $val) {
if ($wp_styles->registered[$key]->ver === $wp_version) {
$wp_styles->registered[$key]->ver = wp_hash($wp_styles->registered[$key]->ver);
}
}
global $wp_scripts;
if (!$wp_scripts instanceof WP_Scripts) {
$wp_scripts = new WP_Scripts();
}
if ($wp_scripts->default_version === $wp_version) {
$wp_scripts->default_version = wp_hash($wp_scripts->default_version);
}
foreach ($wp_scripts->registered as $key => $val) {
if ($wp_scripts->registered[$key]->ver === $wp_version) {
$wp_scripts->registered[$key]->ver = wp_hash($wp_scripts->registered[$key]->ver);
}
}
}
}