function widget($args, $instance)
 {
     global $wpdb;
     require_once dirname(__FILE__) . '/wppa-links.php';
     require_once dirname(__FILE__) . '/wppa-styles.php';
     require_once dirname(__FILE__) . '/wppa-functions.php';
     require_once dirname(__FILE__) . '/wppa-thumbnails.php';
     require_once dirname(__FILE__) . '/wppa-boxes-html.php';
     require_once dirname(__FILE__) . '/wppa-slideshow.php';
     wppa_initialize_runtime();
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '0'));
     $title = apply_filters('widget_title', $instance['title']);
     $album = $instance['album'];
     if (!$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_ALBUMS . "` WHERE `id` = %d", $album))) {
         $album = '0';
         // Album vanished
     }
     wppa_user_upload();
     // Do the upload if required
     wppa('in_widget', 'upload');
     wppa_bump_mocc();
     $mocc = wppa('mocc');
     $is_responsive = wppa_opt('colwidth') == 'auto';
     if ($is_responsive) {
         // Responsive widgetwppaAutoColumnWidth[1] = true;
         $js = wppa_get_responsive_widget_js_html($mocc);
     } else {
         $js = '';
     }
     $create = wppa_get_user_create_html($album, wppa_opt('widget_width'), 'widget');
     $upload = wppa_get_user_upload_html($album, wppa_opt('widget_width'), 'widget', $is_responsive);
     if (!$create && !$upload) {
         return;
     }
     // Nothing to do
     $text = '<div id="wppa-container-' . $mocc . '" class="wppa-upload-widget" style="margin-top:2px; margin-left:2px;" >' . $js . $create . $upload . '</div>';
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo $text;
     echo '<div style="clear:both"></div>';
     echo $after_widget;
     wppa('in_widget', false);
 }
Пример #2
0
function wppa_user_upload_html($alb, $width, $where = '', $mcr = false)
{
    wppa_out(wppa_get_user_upload_html($alb, $width, $where, $mcr));
}