Ejemplo n.º 1
0
 /**
  * Outputs the HTML of the post list or the form (depending on $_GET variables).
  **/
 public function display()
 {
     if (!$this->valid) {
         _e("No form with the specified ID was found", 'wpfepp-plugin');
         return;
     }
     if (!is_user_logged_in()) {
         printf(__('You need to %s first.', 'wpfepp-plugin'), sprintf('<a href="%s">%s</a>', wp_login_url(), __('log in', 'wpfepp-plugin')));
         return;
     }
     if (isset($_GET['wpfepp_post']) && isset($_GET['wpfepp_action']) && is_numeric($_GET['wpfepp_post']) && $_GET['wpfepp_action'] == 'edit') {
         $this->form->display($_GET['wpfepp_post']);
     } else {
         $this->print_list();
     }
 }
 /**
  * Callback function for the [wpfepp_submission_form] shortcode registered in add_actions()
  **/
 public function submission_form_shortcode($_args)
 {
     wp_enqueue_style('wpfepp-style');
     wp_enqueue_script('wpfepp-script');
     wp_enqueue_media();
     $args = shortcode_atts(array('form' => -1), $_args);
     ob_start();
     $form_obj = new WPFEPP_Form($this->version, $args['form']);
     $form_obj->display();
     return ob_get_clean();
 }