Example #1
0
File: YALW.php Project: otacke/yalw
 /**
  * Output the content of the widget
  *
  * @global int|string $user_login user ID, slug, email address, or login name
  *
  * @param array $args display arguments
  * @param array $instance The settings for the particular instance of the widget
  */
 public function widget($args, $instance)
 {
     global $user_login;
     echo $args['before_widget'];
     // display the widget title
     echo $args['before_title'];
     Display::display_widget_title($user_login, $instance);
     echo $args['after_title'];
     /*
      * Depending on the state of the 'YALW_action' value stored in the
      * session cookie we present different options
      */
     if (!is_user_logged_in()) {
         $events = new \WP_Error();
         switch (Session::get_next_widget_task()) {
             case 'retrieve_code':
                 Display::display_code_retrieval_form();
                 break;
             case 'check_code':
                 Display::display_code_entry_form();
                 break;
             case 'enter_new_password':
                 Display::display_new_password_form();
                 break;
             default:
                 Display::display_login_form();
         }
         Session::clean_next_widget_task();
     } else {
         /*
          * The user is logged in and we give him/her the options to either
          * go to the Dashboard or to logout.
          * The wp_logout hook takes care of deleting the session cookie
          */
         Display::display_logged_in_options();
     }
     echo $args['after_widget'];
 }