'.__('Plugin settings', 'two-factor-authentication').''; array_unshift($links, $link); } else { switch_to_blog(1); $link = ''.__('Plugin settings', 'two-factor-authentication').''; restore_current_blog(); array_unshift($links, $link); } $link2 = ''.__('User settings', 'two-factor-authentication').''; array_unshift($links, $link2); return $links; } /** * Runs upon the WP actions admin_menu and network_admin_menu */ public function menu_entry_for_user() { $this->get_totp_controller()->potentially_port_private_keys(); global $current_user; if ($this->is_activated_for_user($current_user->ID)) { add_menu_page(__('Two Factor Authentication', 'two-factor-authentication'), __('Two Factor Auth', 'two-factor-authentication'), 'read', 'two-factor-auth-user', array($this, 'show_dashboard_user_settings_page'), $this->includes_url().'/tfa_admin_icon_16x16.png', 72); } } /** * Runs upon the WP action admin_menu */ public function menu_entry_for_admin() { $this->get_totp_controller()->potentially_port_private_keys(); if (is_multisite() && (!is_super_admin() || !is_main_site())) return; add_options_page( __('Two Factor Authentication', 'two-factor-authentication'), __('Two Factor Authentication', 'two-factor-authentication'), $this->get_management_capability(), 'two-factor-auth', array($this, 'show_admin_settings_page') ); } /** * Include the admin settings page code */ public function show_admin_settings_page() { $totp_controller = $this->get_totp_controller(); $totp_controller->setUserHMACTypes(); if (!is_admin() || !current_user_can($this->get_management_capability())) return; $this->include_template('admin-settings.php', array('totp_controller' => $totp_controller)); } /** * Runs conditionally on the WP action all_admin_notices */ public function admin_notice_insufficient_php() { $this->show_admin_warning(''.__('Higher PHP version required', 'two-factor-authentication').'
'.sprintf(__('The Two Factor Authentication plugin requires PHP version %s or higher - your current version is only %s.', 'two-factor-authentication'), self::PHP_REQUIRED, PHP_VERSION), 'error'); } /** * Runs conditionally on the WP action all_admin_notices */ public function admin_notice_missing_mcrypt_and_openssl() { $this->show_admin_warning(''.__('PHP OpenSSL or mcrypt module required', 'two-factor-authentication').'
'.__('The Two Factor Authentication plugin requires either the PHP openssl (preferred) or mcrypt module to be installed. Please ask your web hosting company to install one of them.', 'two-factor-authentication'), 'error'); } /** * Run upon the WP plugins_loaded action. This method is called even if main loading aborts - so don't put anything else in it (use a separate method). */ public function plugins_loaded_load_textdomain() { load_plugin_textdomain( 'two-factor-authentication', false, dirname(plugin_basename(__FILE__)).'/languages/' ); } } $GLOBALS['simba_two_factor_authentication'] = new Simba_Two_Factor_Authentication_Plugin();