plugin_file = $plugin;
}
public function duo_add_link($links, $file) {
static $this_plugin;
if (!$this_plugin) $this_plugin = $this->plugin_file;
if ($file == $this_plugin) {
$settings_link = ''.__("Settings", "aca-settings").'';
array_unshift($links, $settings_link);
}
return $links;
}
/**
* Add options page
*/
public function add_plugin_page()
{
// This page will be under "Settings"
add_options_page(
'Settings Active Auth',
'Active Auth',
'manage_options',
'aca-settings',
array($this, 'create_admin_page')
);
}
/**
* Options page callback
*/
public function create_admin_page()
{
// Set class property
$this->options = get_option('aca-options');
?>
Active Auth Security
get_names();
//otherwise validate each role and then return the array
foreach ($options as $opt) {
if (!in_array($opt, $valid_roles)) {
unset($options[$opt]);
}
}
return $options;
}
/**
* Sanitize each setting field as needed
* @param $input
* @return array
*/
public function sanitize($input)
{
$new_input = array();
if(isset( $input['aca_iaccount']))
$new_input['aca_iaccount'] = sanitize_text_field( $input['aca_iaccount'] );
/*
if(isset( $input['aca_server']))
$new_input['aca_server'] = sanitize_text_field( $input['aca_server'] );
*/
if(isset( $input['aca_ikey']))
$new_input['aca_ikey'] = sanitize_text_field( $input['aca_ikey'] );
if(isset( $input['aca_skey']))
$new_input['aca_skey'] = sanitize_text_field( $input['aca_skey'] );
if(isset( $input['aca_enabled']))
$new_input['aca_enabled'] = sanitize_text_field( $input['aca_enabled'] );
return $new_input;
}
/**
* Print the Section text
*/
public function print_section_info()
{
print 'Enter your settings below:';
}
/**
* Get the settings option array and print one of its values
*/
public function aca_iaccount_callback()
{
printf(
'',
isset($this->options['aca_iaccount']) ? esc_attr($this->options['aca_iaccount']) : ''
);
}
/**
* Get the settings option array and print one of its values
*/
/*
public function aca_server_callback()
{
printf(
'',
isset($this->options['aca_server']) ? esc_attr($this->options['aca_server']) : ''
);
}
*/
/**
* Get the settings option array and print one of its values
*/
public function aca_ikey_callback()
{
printf(
'',
isset($this->options['aca_ikey']) ? esc_attr($this->options['aca_ikey']) : ''
);
}
/**
* Get the settings option array and print one of its values
*/
public function aca_skey_callback()
{
printf(
'',
isset($this->options['aca_skey']) ? esc_attr($this->options['aca_skey']) : ''
);
}
/**
* Get the settings option array and print one of its values
*/
public function aca_enabled_callback()
{
printf(
'options['aca_enabled'] == 1 ? 'checked' : '').' /> Enable/Disable'
);
}
/**
* Get the settings option array and print one of its values
*/
public function aca_roles_callback()
{
global $wp_roles;
$wp_roles = isset($wp_roles) ? $wp_roles : new WP_Roles();
$roles = $wp_roles->get_names();
$newroles = array();
foreach($roles as $key=>$role) {
$newroles[$key] = $role;
}
$selected = get_option('aca_roles', $newroles);
foreach ($wp_roles->get_names() as $key=>$role) {
?>
/>