function ajax_nextgen_reset_album_import() { if (check_admin_referer('foogallery_nextgen_album_reset', 'foogallery_nextgen_album_reset')) { //$this->nextgen->reset_import(); $this->nextgen->render_album_import_form(); } die; }
function import() { //create an empty foogallery album $foogallery_album_args = array('post_title' => $this->foogallery_album_title, 'post_type' => FOOGALLERY_CPT_ALBUM, 'post_status' => 'publish'); $this->foogallery_album_id = wp_insert_post($foogallery_album_args); //set a default gallery template add_post_meta($this->foogallery_album_id, FOOGALLERY_ALBUM_META_TEMPLATE, foogallery_default_album_template(), true); $nextgen = new FooGallery_NextGen_Helper(); //link all galleries that can be linked $album = $nextgen->get_album($this->nextgen_album_id); $galleries = $nextgen->nextgen_unserialize($album->sortorder); $gallery_ids = array(); foreach ($galleries as $gallery_id) { $gallery_progress = $nextgen->get_import_progress($gallery_id); if ($gallery_progress->is_completed()) { $gallery_ids[] = $gallery_progress->foogallery_id; $this->galleries_count++; } } //link all galleries to the foogallery album add_post_meta($this->foogallery_album_id, FOOGALLERY_ALBUM_META_GALLERIES, $gallery_ids); $this->status = self::PROGRESS_COMPLETED; }
function import_next_picture() { $picture = array_pop($this->nextgen_pictures); $nextgen = new FooGallery_NextGen_Helper(); $attachment_id = $nextgen->import_picture($this->nextgen_gallery->path, $picture); $attachment_ids = get_post_meta($this->foogallery_id, FOOGALLERY_META_ATTACHMENTS, true); if (empty($attachment_ids)) { $attachment_ids = array(); } $attachment_ids[] = $attachment_id; //link all attachments to foogallery update_post_meta($this->foogallery_id, FOOGALLERY_META_ATTACHMENTS, $attachment_ids); //update our list of imported attachments $this->attachments[] = $attachment_id; //update our percentage complete $this->percentage_complete = count($this->attachments) / $this->import_count * 100; //update our status if 100% if (100 === $this->percentage_complete) { $this->status = self::PROGRESS_COMPLETED; } }
<?php $nextgen = new FooGallery_NextGen_Helper(); if (isset($_POST['foogallery_nextgen_reset'])) { if (check_admin_referer('foogallery_nextgen_import_reset', 'foogallery_nextgen_import_reset')) { $nextgen->reset_import(); } } else { if (isset($_POST['foogallery_nextgen_reset_album'])) { if (check_admin_referer('foogallery_nextgen_album_reset', 'foogallery_nextgen_album_reset')) { $nextgen->reset_album_import(); } } } ?> <style> .foo-nav-tabs a:focus { -webkit-box-shadow: none; box-shadow: none; } .spinner.shown { display: inline !important; margin: 0; } .nextgen-import-progress-error { color: #f00 !important; } .nextgen-import-progress-not_started {