本文整理汇总了PHP中ITSEC_Modules::is_active方法的典型用法代码示例。如果您正苦于以下问题:PHP ITSEC_Modules::is_active方法的具体用法?PHP ITSEC_Modules::is_active怎么用?PHP ITSEC_Modules::is_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITSEC_Modules
的用法示例。
在下文中一共展示了ITSEC_Modules::is_active方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_settings_page
private function show_settings_page()
{
$form = new ITSEC_Form();
$module_filters = array('all' => array(_x('All', 'List all modules', 'better-wp-security'), 0), 'recommended' => array(_x('Recommended', 'List recommended modules', 'better-wp-security'), 0), 'advanced' => array(_x('Advanced', 'List advanced modules', 'better-wp-security'), 0));
$current_type = isset($_REQUEST['module_type']) ? $_REQUEST['module_type'] : 'recommended';
$visible_modules = array();
foreach ($this->modules as $id => $module) {
$module_filters['all'][1]++;
if ('all' === $current_type) {
$visible_modules[] = $id;
}
if (isset($module_filters[$module->type])) {
$module_filters[$module->type][1]++;
if ($module->type === $current_type) {
$visible_modules[] = $id;
}
}
$module->enabled = ITSEC_Modules::is_active($id);
$module->always_active = ITSEC_Modules::is_always_active($id);
}
$feature_tabs = array();
foreach ($module_filters as $type => $data) {
if ($current_type === $type) {
$class = 'current';
} else {
$class = '';
}
$feature_tabs[] = "<li class='itsec-module-filter' id='itsec-module-filter-{$type}'><a href='" . esc_url(add_query_arg('module_type', $type, $this->self_url)) . "' class='{$class}'>{$data[0]} <span class='count'>({$data[1]})</span></a>";
}
$whitelisted_ips = ITSEC_Lib::get_whitelisted_ips();
$blacklisted_ips = ITSEC_Lib::get_blacklisted_ips();
// Get user's view preference
$view = get_user_meta(get_current_user_id(), 'itsec-settings-view', true);
// Default to grid view for users that have an invalid or unspecified view
if (!in_array($view, array('grid', 'list'))) {
$view = 'grid';
}
?>
<div class="wrap">
<h1>
<?php
_e('iThemes Security', 'better-wp-security');
?>
<a href="<?php
echo esc_url(ITSEC_Core::get_logs_page_url());
?>
" class="page-title-action"><?php
_e('View Logs', 'better-wp-security');
?>
</a>
<a href="<?php
echo esc_url(apply_filters('itsec_support_url', 'https://wordpress.org/support/plugin/better-wp-security'));
?>
" target="_blank" class="page-title-action"><?php
_e('Support', 'better-wp-security');
?>
</a>
</h1>
<div id="itsec-settings-messages-container">
<?php
foreach (ITSEC_Response::get_errors() as $error) {
ITSEC_Lib::show_error_message($error);
}
foreach (ITSEC_Response::get_messages() as $message) {
ITSEC_Lib::show_status_message($message);
}
?>
</div>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2 hide-if-no-js">
<div id="postbox-container-2" class="postbox-container">
<div class="itsec-module-section-heading">
<div class="itsec-settings-view-toggle hide-if-no-js" data-nonce="<?php
echo esc_attr(wp_create_nonce('set-user-setting-itsec-settings-view'));
?>
">
<a class="itsec-grid<?php
if ('grid' === $view) {
echo ' itsec-selected';
}
?>
"><span class="dashicons dashicons-grid-view"></span></a>
<a class="itsec-list<?php
if ('list' === $view) {
echo ' itsec-selected';
}
?>
"><span class="dashicons dashicons-list-view"></span></a>
</div>
<ul class="subsubsub itsec-feature-tabs hide-if-no-js">
<?php
echo implode($feature_tabs, " |</li>\n") . "</li>\n";
?>
</ul>
</div>
<div class="itsec-module-cards-container <?php
echo $view;
?>
//.........这里部分代码省略.........
示例2: enforce_activation
private static function enforce_activation($module, $name)
{
if (!in_array($module, self::$available_modules)) {
return;
}
if (ITSEC_Modules::is_active($module)) {
/* Translators: 1: feature name */
$text = __('%1$s is enabled as recommended.', 'better-wp-security');
$took_action = false;
} else {
ITSEC_Modules::activate($module);
ITSEC_Response::add_js_function_call('setModuleToActive', $module);
/* Translators: 1: feature name */
$text = __('Enabled %1$s.', 'better-wp-security');
$took_action = true;
}
ob_start();
self::open_container();
echo '<p>' . sprintf($text, $name) . '</p>';
echo '</div>';
if ($took_action) {
self::$actions_taken[] = ob_get_clean();
} else {
self::$confirmations[] = ob_get_clean();
}
}