/** * Adds a new entry in the menu, to manage WP Power Stats options */ public static function wp_power_stats_add_config_menu($s) { if (current_user_can('wp_power_stats_admin') || current_user_can('manage_options')) { $new_entry = add_submenu_page('wp-power-stats-view-1', __('Settings', 'wp-power-stats'), __('Settings', 'wp-power-stats'), PowerStatsAdmin::current_role_capability(), 'wp-power-stats-settings', array(__CLASS__, 'wp_power_stats_include_config')); // Load styles and Javascript needed to make the reports look nice and interactive add_action('load-' . $new_entry, array(__CLASS__, 'wp_power_stats_stylesheet')); if (version_compare($GLOBALS['wp_version'], '3.8', '<')) { wp_enqueue_style('wp-power-stats-layout-fix', plugins_url('/admin/css/styles-before-3.8.css', dirname(__FILE__))); } } return $s; }
$obj_role = get_role($role); // add the custom capability to this role object $obj_role->add_cap('wp_power_stats_admin'); } } else { PowerStatsAdmin::$faulty_fields[] = __('some roles in "Statistics Admin Roles" were not found', 'wp-power-stats'); } } else { // Remove the capability from all roles foreach ($wp_roles->roles as $role) { $role = get_role(strtolower($role['name'])); $role->remove_cap('wp_power_stats_admin'); } PowerStats::$options['admin_roles'] = ''; } } break; case __('Advanced', 'wp-power-stats'): $options_on_this_page = array('session_duration' => array('description' => __('Visit Duration', 'wp-power-stats'), 'type' => 'integer', 'long_description' => __('Period of time, during which requests from the same uniquely identified client are considered a unique visit.', 'wp-power-stats'), 'after_input_field' => __('seconds', 'wp-power-stats')), 'extend_session' => array('description' => __('Extend Visit', 'wp-power-stats'), 'type' => 'yesno', 'long_description' => __('Extend the duration of a visit each time the user visits a new page.', 'wp-power-stats'))); break; default: break; } if (has_filter('power_stats_options_on_page') && $config_tabs[$current_tab - 1] == __('Add-ons', 'wp-power-stats')) { $options_on_this_page = apply_filters('power_stats_options_on_page', $options_on_this_page); } if (isset($options_on_this_page)) { PowerStatsAdmin::update_options($options_on_this_page); PowerStatsAdmin::display_options($options_on_this_page, $current_tab); } echo '</div>';