本文整理匯總了PHP中wfUtils::isAdmin方法的典型用法代碼示例。如果您正苦於以下問題:PHP wfUtils::isAdmin方法的具體用法?PHP wfUtils::isAdmin怎麽用?PHP wfUtils::isAdmin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wfUtils
的用法示例。
在下文中一共展示了wfUtils::isAdmin方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addDashboardWidget
public static function addDashboardWidget()
{
if (wfUtils::isAdmin() && (is_network_admin() || !is_multisite()) && wfConfig::get('email_summary_dashboard_widget_enabled')) {
wp_enqueue_style('wordfence-activity-report-widget', wfUtils::getBaseURL() . 'css/activity-report-widget.css', '', WORDFENCE_VERSION);
$report_date_range = 'week';
switch (wfConfig::get('email_summary_interval')) {
case 'biweekly':
$report_date_range = '2 weeks';
break;
case 'monthly':
$report_date_range = 'month';
break;
}
wp_add_dashboard_widget('wordfence_activity_report_widget', 'Wordfence activity in the past ' . $report_date_range, array('wfActivityReport', 'outputDashboardWidget'));
}
}
示例2:
<?php
if (!wfUtils::isAdmin()) {
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<title>Wordfence System Info</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel='stylesheet' id='wordfence-main-style-css' href='<?php
echo wfUtils::getBaseURL();
?>
/css/phpinfo.css?ver=<?php
echo WORDFENCE_VERSION;
?>
' type='text/css' media='all' />
<body>
<?php
ob_start();
phpinfo(INFO_ALL);
$out = ob_get_clean();
$out = str_replace('width="600"', 'width="900"', $out);
$out = preg_replace('/<hr.*?PHP Credits.*?<\\/h1>/s', '', $out);
$out = preg_replace('/<a [^>]+>/', '', $out);
$out = preg_replace('/<\\/a>/', '', $out);
$out = preg_replace('/<title>[^<]*<\\/title>/', '', $out);
echo $out;
?>
<div class="diffFooter">© 2011 Wordfence — Visit <a href="http://wordfence.com/">Wordfence.com</a> for help, security updates and more.</a>
示例3: admin_menus
public static function admin_menus()
{
if (!wfUtils::isAdmin()) {
return;
}
$warningAdded = false;
if (get_option('wf_plugin_act_error', false)) {
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::activation_warning');
} else {
add_action('admin_notices', 'wordfence::activation_warning');
}
$warningAdded = true;
}
if (!wfConfig::get('apiKey')) {
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::noKeyError');
} else {
add_action('admin_notices', 'wordfence::noKeyError');
}
$warningAdded = true;
}
if (!$warningAdded) {
if (wfConfig::get('tourClosed') == '1' && !wfConfig::get('alertEmails')) {
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::adminEmailWarning');
} else {
add_action('admin_notices', 'wordfence::adminEmailWarning');
}
}
}
/*
if(is_plugin_active('w3-total-cache/w3-total-cache.php') && wfConfig::get('liveTrafficEnabled')){
wfConfig::set('liveTrafficEnabled', 0);
if(wfUtils::isAdminPageMU()){
add_action('network_admin_notices', 'wordfence::liveTrafficW3TCWarning');
} else {
add_action('admin_notices', 'wordfence::liveTrafficW3TCWarning');
}
}
if(is_plugin_active('wp-super-cache/wp-cache.php') && wfConfig::get('liveTrafficEnabled')){
wfConfig::set('liveTrafficEnabled', 0);
if(wfUtils::isAdminPageMU()){
add_action('network_admin_notices', 'wordfence::liveTrafficSuperCacheWarning');
} else {
add_action('admin_notices', 'wordfence::liveTrafficSuperCacheWarning');
}
}
*/
add_submenu_page("Wordfence", "Scan", "Scan", "activate_plugins", "Wordfence", 'wordfence::menu_scan');
add_menu_page('Wordfence', 'Wordfence', 'activate_plugins', 'Wordfence', 'wordfence::menu_scan', wfUtils::getBaseURL() . 'images/wordfence-logo-16x16.png');
if (wfConfig::get('liveTrafficEnabled')) {
add_submenu_page("Wordfence", "Live Traffic", "Live Traffic", "activate_plugins", "WordfenceActivity", 'wordfence::menu_activity');
}
add_submenu_page('Wordfence', 'Blocked IPs', 'Blocked IPs', 'activate_plugins', 'WordfenceBlockedIPs', 'wordfence::menu_blockedIPs');
add_submenu_page("Wordfence", "Cellphone Sign-in", "Cellphone Sign-in", "activate_plugins", "WordfenceTwoFactor", 'wordfence::menu_twoFactor');
add_submenu_page("Wordfence", "Country Blocking", "Country Blocking", "activate_plugins", "WordfenceCountryBlocking", 'wordfence::menu_countryBlocking');
add_submenu_page("Wordfence", "Scan Schedule", "Scan Schedule", "activate_plugins", "WordfenceScanSchedule", 'wordfence::menu_scanSchedule');
add_submenu_page("Wordfence", "Whois Lookup", "Whois Lookup", "activate_plugins", "WordfenceWhois", 'wordfence::menu_whois');
add_submenu_page("Wordfence", "Advanced Blocking", "Advanced Blocking", "activate_plugins", "WordfenceRangeBlocking", 'wordfence::menu_rangeBlocking');
add_submenu_page("Wordfence", "Options", "Options", "activate_plugins", "WordfenceSecOpt", 'wordfence::menu_options');
}
示例4: admin_menus
public static function admin_menus()
{
if (!wfUtils::isAdmin()) {
return;
}
$warningAdded = false;
if (get_option('wf_plugin_act_error', false)) {
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::activation_warning');
} else {
add_action('admin_notices', 'wordfence::activation_warning');
}
$warningAdded = true;
}
if (!wfConfig::get('apiKey')) {
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::noKeyError');
} else {
add_action('admin_notices', 'wordfence::noKeyError');
}
$warningAdded = true;
}
if (!$warningAdded) {
if (wfConfig::get('tourClosed') == '1' && !wfConfig::get('autoUpdate') && !wfConfig::get('autoUpdateChoice')) {
$warningAdded = true;
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::autoUpdateNotice');
} else {
add_action('admin_notices', 'wordfence::autoUpdateNotice');
}
}
}
if (!$warningAdded) {
if (wfConfig::get('tourClosed') == '1' && !wfConfig::get('alertEmails')) {
$warningAdded = true;
if (wfUtils::isAdminPageMU()) {
add_action('network_admin_notices', 'wordfence::adminEmailWarning');
} else {
add_action('admin_notices', 'wordfence::adminEmailWarning');
}
}
}
add_submenu_page("Wordfence", "Scan", "Scan", "activate_plugins", "Wordfence", 'wordfence::menu_scan');
add_menu_page('Wordfence', 'Wordfence', 'activate_plugins', 'Wordfence', 'wordfence::menu_scan', wfUtils::getBaseURL() . 'images/wordfence-logo-16x16.png');
add_submenu_page("Wordfence", "Live Traffic", "Live Traffic", "activate_plugins", "WordfenceActivity", 'wordfence::menu_activity');
/* add_submenu_page('Wordfence', 'Site Performance', 'Site Performance', 'activate_plugins', 'WordfenceSitePerfStats', 'wordfence::menu_sitePerfStats'); */
add_submenu_page('Wordfence', 'Performance Setup', 'Performance Setup', 'activate_plugins', 'WordfenceSitePerf', 'wordfence::menu_sitePerf');
add_submenu_page('Wordfence', 'Blocked IPs', 'Blocked IPs', 'activate_plugins', 'WordfenceBlockedIPs', 'wordfence::menu_blockedIPs');
add_submenu_page("Wordfence", "Cellphone Sign-in", "Cellphone Sign-in", "activate_plugins", "WordfenceTwoFactor", 'wordfence::menu_twoFactor');
add_submenu_page("Wordfence", "Country Blocking", "Country Blocking", "activate_plugins", "WordfenceCountryBlocking", 'wordfence::menu_countryBlocking');
add_submenu_page("Wordfence", "Scan Schedule", "Scan Schedule", "activate_plugins", "WordfenceScanSchedule", 'wordfence::menu_scanSchedule');
add_submenu_page("Wordfence", "Whois Lookup", "Whois Lookup", "activate_plugins", "WordfenceWhois", 'wordfence::menu_whois');
add_submenu_page("Wordfence", "Advanced Blocking", "Advanced Blocking", "activate_plugins", "WordfenceRangeBlocking", 'wordfence::menu_rangeBlocking');
add_submenu_page("Wordfence", "Options", "Options", "activate_plugins", "WordfenceSecOpt", 'wordfence::menu_options');
}
示例5: if
<?php if(! wfUtils::isAdmin()){ exit(); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<title>Wordfence Connectivity Tester</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<h1>Wordfence connectivity tester</h1>
<br /><br />
DNS lookup for noc1.wordfence.com returns: <?php echo gethostbyname('noc1.wordfence.com'); ?><br /><br />
<?php
$curlContent = "";
function curlWrite($h, $d){
global $curlContent;
$curlContent .= $d;
return strlen($d);
}
function doWPostTest($protocol){
echo "<br /><b>Starting wp_remote_post() test</b><br />\n";
$cronURL = admin_url('admin-ajax.php');
$cronURL = preg_replace('/^(https?:\/\/)/i', '://noc1.wordfence.com/scanptest/', $cronURL);
$cronURL .= '?action=wordfence_doScan&isFork=0&cronKey=47e9d1fa6a675b5999999333';
$cronURL = $protocol . $cronURL;
$result = wp_remote_post($cronURL, array(
'timeout' => 10, //Must be less than max execution time or more than 2 HTTP children will be occupied by scan
'blocking' => true, //Non-blocking seems to block anyway, so we use blocking
'sslverify' => false,
'headers' => array()
));
if( (! is_wp_error($result)) && $result['response']['code'] == 200 && strpos($result['body'], "scanptestok") !== false){
echo "wp_remote_post() test to noc1.wordfence.com passed!<br />\n";