Example #1
0
 function widget($args, $instance)
 {
     if (!WPFB_Core::$settings->frontend_upload) {
         return;
     }
     wpfb_loadclass('File', 'Category', 'Output');
     $instance['category'] = empty($instance['category']) ? 0 : (int) $instance['category'];
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     echo $before_title . (empty($title) ? __('Upload File', WPFB) : $title) . $after_title;
     $prefix = "wpfb-upload-widget-" . $this->id_base;
     $form_url = add_query_arg('wpfb_upload_file', 1);
     $form_args = array('cat' => $instance['category'], 'overwrite' => (int) $instance['overwrite']);
     $form_args['file_post_id'] = $instance['attach'] ? WPFB_Core::GetPostId() : 0;
     // attach file to current post
     WPFB_Output::FileForm($prefix, $form_url, $form_args);
     echo $after_widget;
 }