/** * Register actions for the wizard with WordPress * * @since 1.0.0 */ public function register_actions() { $this->wp_facade->add_action('wp_ajax_' . static::VERIFY_CONFIG_AJAX_ACTION, array($this, 'verify_configuration_callback')); $this->wp_facade->add_action('wp_ajax_' . static::DATA_SUBMIT_AJAX_ACTION, array($this, 'wizard_submit_ajax')); $this->wp_facade->add_filter('init', array($this, 'enqueue_verify_configuration_script')); $this->wp_facade->add_filter('init', array($this, 'enqueue_wizard_script')); }
/** * Register actions and callbacks with WP Engine * * @since 1.0.0 */ public function register_actions() { $this->wp_facade->add_action('admin_menu', array($this, 'add_launchkey_admin_menus')); $this->wp_facade->add_action('admin_notices', array($this, 'oauth_warning')); $this->wp_facade->add_action('admin_notices', array($this, 'activate_notice')); $this->wp_facade->add_filter(sprintf('plugin_action_links_%s', $this->wp_facade->plugin_basename($this->wp_facade->plugin_dir_path(__DIR__) . 'launchkey.php')), array($this, 'add_action_links')); }
/** * Register actions and callbacks with WP Engine */ public function register_actions() { $this->wp_facade->add_shortcode('launchkey_login', array($this, 'launchkey_shortcode')); $this->wp_facade->add_action('login_form', array(&$this, 'launchkey_form')); // Register the authentication controller as the first filter in the chain $this->wp_facade->add_filter('authenticate', array($this, 'authenticate'), 0, 3); // Register logout handler $this->wp_facade->add_filter('wp_logout', array($this, 'logout')); }
/** * Register actions and callbacks with WP Engine * * @since 1.0.0 */ public function register_actions() { if ($this->is_multi_site) { $this->wp_facade->add_action('network_admin_menu', array($this, 'add_launchkey_network_admin_menus')); } else { $this->wp_facade->add_action('admin_menu', array($this, 'add_launchkey_admin_menus')); } $notices_action = $this->is_multi_site ? 'network_admin_notices' : 'admin_notices'; $this->wp_facade->add_action($notices_action, array($this, 'oauth_warning')); $this->wp_facade->add_action($notices_action, array($this, 'activate_notice')); $this->wp_facade->add_filter(sprintf('%splugin_action_links_%s', $this->is_multi_site ? 'network_admin_' : '', $this->wp_facade->plugin_basename($this->wp_facade->plugin_dir_path(__DIR__) . 'launchkey.php')), array($this, 'add_action_links')); }
/** * Register actions for the wizard with WordPress * * @since 1.0.0 */ public function register_actions() { $this->wp_facade->add_action('wp_ajax_' . static::VERIFY_CONFIG_AJAX_ACTION, array($this, 'verify_configuration_callback')); $this->wp_facade->add_action('wp_ajax_' . static::DATA_SUBMIT_AJAX_ACTION, array($this, 'wizard_submit_ajax')); $this->wp_facade->add_action('wp_ajax_' . static::QR_CODE_ACTION, array($this, 'wizard_easy_setup_qr_code')); $this->wp_facade->add_action('wp_ajax_nopriv_' . LaunchKey_WP_Native_Client::CALLBACK_AJAX_ACTION, array($this, 'wizard_easy_setup_callback')); $this->wp_facade->add_filter('init', array($this, 'enqueue_verify_configuration_script')); $this->wp_facade->add_filter('init', array($this, 'enqueue_scripts')); }
/** * Register actions and callbacks with WP Engine */ public function register_actions() { $this->wp_facade->add_shortcode('launchkey_login', array($this, 'launchkey_shortcode')); $this->wp_facade->add_action('login_form', array(&$this, 'launchkey_form')); // Register the authentication controller as the first filter in the chain $this->wp_facade->add_filter('authenticate', array($this, 'authenticate'), 0, 3); // Register logout handler $this->wp_facade->add_filter('wp_logout', array($this, 'logout')); // Place this at the end of the init chain to only worry about users that are otherwise considered // authenticated $this->wp_facade->add_filter('init', array($this, 'launchkey_still_authenticated_page_load'), 999, 3); /** * Jack into the WordPress heartbeat process to log the user out based on server side de-orbit events * being processed. The authentication check is performed on "heartbeat_send" filter so we ensure we verify * before that by using the "heartbeat_received" filter. * * @see wp_ajax_heartbeat */ $this->wp_facade->add_filter('heartbeat_received', array($this, 'launchkey_still_authenticated_heartbeat')); }
/** * Front controller for LaunchKey Native/White Label authentication * * * @param WP_User $user Unused parameter always passed first by authenticate filter * @param string $username Username specified by the user in the login screen * @param string $password Password specifiedby the user in the login screen * * @since 1.0.0 */ public function authentication_controller($user, $username, $password) { if ($username && empty($password)) { // If username and no password, user is attempting passwordless login // Find the user by login $user = $this->wp_facade->get_user_by('login', $username); // If we have a user and thatg user is paired if ($user instanceof WP_User && $user->launchkey_username) { // Remove username and password authentication $this->wp_facade->remove_all_filters('authenticate'); // Work Around: Add a bogus filter to make sure that the launchkey_authentication filter will still run $this->wp_facade->add_filter('authenticate', array($this, 'null_method')); // Register LaunchKey authentication $this->wp_facade->add_filter('authenticate', array($this, 'launchkey_user_authentication'), 30, 2); } } elseif (!$username && !$password && ($user = $this->wp_facade->wp_get_current_user())) { // If no username or password and there is a current user, we are validating user is still logged in if ($user && $user->launchkey_username && 'false' === $user->launchkey_authorized) { $this->wp_facade->wp_logout(); } } }