Ejemplo n.º 1
0
					<strong><?php 
_e("Add Catalog Item's To Gallery", 'catablog');
?>
</strong>
				</h3>
				
				<div class="catablog-modal-body">
					
					
					<select name="gallery_id" id="catablog_gallery_id">
						<option value="-1">- <?php 
_e("Select a Gallery", "catablog");
?>
</option>
						<?php 
foreach (CataBlogGallery::getGalleries('title') as $gallery) {
    ?>
							<?php 
    echo "<option value='{$gallery->getId()}'>{$gallery->getTitle()}</option>";
    ?>
						<?php 
}
?>
					</select>
					
					<?php 
wp_nonce_field('catablog_append_gallery', '_catablog_append_gallery_nonce', false, true);
?>
					
					<input type="submit" name="save" value="<?php 
_e("Add To Gallery", 'catablog');
Ejemplo n.º 2
0
 public function ajax_delete_library()
 {
     check_ajax_referer('catablog-delete-library', 'security');
     $gallery_counts = wp_count_posts($this->custom_post_gallery_name);
     $item_counts = wp_count_posts($this->custom_post_name);
     $limit = 20;
     if ($gallery_counts->publish > 0) {
         $galleries = CataBlogGallery::getGalleries('title', 'asc', 0, $limit);
         foreach ($galleries as $gallery) {
             $gallery->delete();
         }
         // NOTE that the limit value is changed here.
         $limit = $limit - count($galleries);
     }
     if ($limit > 0) {
         $items = CataBlogItem::getItems(false, 'IN', 'date', 'asc', 0, $limit);
         foreach ($items as $item) {
             $item->delete(false);
         }
     }
     $gallery_counts = wp_count_posts($this->custom_post_gallery_name);
     $item_counts = wp_count_posts($this->custom_post_name);
     $total_remaining = $gallery_counts->publish + $item_counts->publish;
     if ($total_remaining > 0) {
         $message = sprintf(__('%s library items deleted successfully.', 'catablog'), $limit);
     } else {
         $message = sprintf(__('CataBlog Library Cleared Successfully.', 'catablog'));
     }
     echo "{\"success\":true, \"remaining\":{$total_remaining}, \"message\":\"{$message}\"}";
     exit;
 }